Documentation ¶
Index ¶
- Variables
- func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
- func MakeHandler(svc Service, auth endpoint.Middleware, metrics *o11y.MirrorMetrics, ...) http.Handler
- type Archive
- type Copier
- type EmptyObject
- type ListProviderInstallationResponse
- type ListProviderVersionsResponse
- type Middleware
- type Service
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUpstreamNotFound = errors.New("not found upstream")
)
Functions ¶
func ErrorEncoder ¶
func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
ErrorEncoder translates domain specific errors to HTTP status codes
func MakeHandler ¶
func MakeHandler(svc Service, auth endpoint.Middleware, metrics *o11y.MirrorMetrics, instrumentation o11y.Middleware, options ...httptransport.ServerOption) http.Handler
MakeHandler returns a fully initialized http.Handler.
Types ¶
type EmptyObject ¶
type EmptyObject struct{}
EmptyObject exists to return an `{}` JSON object to match the protocol spec
type ListProviderVersionsResponse ¶
type ListProviderVersionsResponse struct { Versions map[string]EmptyObject `json:"versions"` // contains filtered or unexported fields }
ListProviderVersionsResponse holds the response that is passed to the endpoint
type Middleware ¶
Middleware is a Service middleware.
func LoggingMiddleware ¶
func LoggingMiddleware() Middleware
LoggingMiddleware is a logging Service middleware.
type Service ¶
type Service interface { // ListProviderVersions determines which versions are currently available for a particular provider // https://www.terraform.io/docs/internals/provider-network-mirror-protocol.html#list-available-versions ListProviderVersions(ctx context.Context, provider *core.Provider) (*ListProviderVersionsResponse, error) // ListProviderInstallation returns download URLs and associated metadata for the distribution packages for a particular version of a provider // https://www.terraform.io/docs/internals/provider-network-mirror-protocol.html#list-available-installation-packages ListProviderInstallation(ctx context.Context, provider *core.Provider) (*ListProviderInstallationResponse, error) // RetrieveProviderArchive returns an io.Reader of a zip archive containing the provider binary for a given provider RetrieveProviderArchive(ctx context.Context, provider *core.Provider) (*retrieveProviderArchiveResponse, error) }
Service implements the Provider Network Mirror Protocol. For more information see: https://www.terraform.io/docs/internals/provider-network-mirror-protocol.html
func NewPullThroughMirror ¶
type Storage ¶
type Storage interface { // ListMirroredProviderVersions returns all matching provider versions for a given hostname, namespace, and name // The provider version can be set to narrow-down the search and return only a single provider ListMirroredProviders(ctx context.Context, provider *core.Provider) ([]*core.Provider, error) // GetMirroredProvider returns the mirrored provider or a core.ProviderError in case it cannot be located GetMirroredProvider(ctx context.Context, provider *core.Provider) (*core.Provider, error) // UploadMirroredFile uploads a file that belongs to a provider release UploadMirroredFile(ctx context.Context, provider *core.Provider, fileName string, reader io.Reader) error // MirroredSigningKeys retrieves the signing keys for mirrored providers MirroredSigningKeys(ctx context.Context, hostname, namespace string) (*core.SigningKeys, error) // UploadMirroredSigningKeys uploads signing keys for mirrored providers // Existing signing keys are overwritten UploadMirroredSigningKeys(ctx context.Context, hostname, namespace string, signingKeys *core.SigningKeys) error // Retrieve the SHA256SUM from storage MirroredSha256Sum(ctx context.Context, provider *core.Provider) (*core.Sha256Sums, error) }
Click to show internal directories.
Click to hide internal directories.