drone/registry/app/pkg/maven/response.go
Pragyesh Mishra 9290cf559e [feat]: [AH-147]: Get Maven Artifact Detail API and proxy changes (#3302)
* [feat]: [AH-147]: pr check
* [fix]: [AH-147]: fix pr check
* Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into maven-remote-changes
* [feat]: [AH-147]: Get Maven Artifact Detail API
* [feat]: [AH-147]: Get Maven Artifact Detail API
2025-01-21 15:24:14 +00:00

74 lines
1.8 KiB
Go

// Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package maven
import (
"io"
"github.com/harness/gitness/registry/app/pkg/commons"
"github.com/harness/gitness/registry/app/storage"
)
type Response interface {
GetErrors() []error
SetError(error)
}
var _ Response = (*HeadArtifactResponse)(nil)
var _ Response = (*GetArtifactResponse)(nil)
var _ Response = (*PutArtifactResponse)(nil)
type HeadArtifactResponse struct {
Errors []error
ResponseHeaders *commons.ResponseHeaders
}
func (r *HeadArtifactResponse) GetErrors() []error {
return r.Errors
}
func (r *HeadArtifactResponse) SetError(err error) {
r.Errors = make([]error, 1)
r.Errors[0] = err
}
type GetArtifactResponse struct {
Errors []error
ResponseHeaders *commons.ResponseHeaders
RedirectURL string
Body *storage.FileReader
ReadCloser io.ReadCloser
}
func (r *GetArtifactResponse) GetErrors() []error {
return r.Errors
}
func (r *GetArtifactResponse) SetError(err error) {
r.Errors = make([]error, 1)
r.Errors[0] = err
}
type PutArtifactResponse struct {
Errors []error
ResponseHeaders *commons.ResponseHeaders
}
func (r *PutArtifactResponse) GetErrors() []error {
return r.Errors
}
func (r *PutArtifactResponse) SetError(err error) {
r.Errors = make([]error, 1)
r.Errors[0] = err
}