debian-forge-composer/internal/cloudapi/v2/openapi.v2.gen.go
Brian C. Lane a1a3e5ba2d cloudapi: Add azure-sap-rhui support to cloudapi
and Update openapi.v2.gen.go
by running `./tools/prepare-source.sh` which runs `go generate ./...`
among other things.
2022-11-18 16:53:22 +01:00

994 lines
38 KiB
Go

// Package v2 provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
package v2
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"github.com/deepmap/oapi-codegen/pkg/runtime"
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
)
const (
BearerScopes = "Bearer.Scopes"
)
// Defines values for ComposeStatusValue.
const (
ComposeStatusValueFailure ComposeStatusValue = "failure"
ComposeStatusValuePending ComposeStatusValue = "pending"
ComposeStatusValueSuccess ComposeStatusValue = "success"
)
// Defines values for ImageStatusValue.
const (
ImageStatusValueBuilding ImageStatusValue = "building"
ImageStatusValueFailure ImageStatusValue = "failure"
ImageStatusValuePending ImageStatusValue = "pending"
ImageStatusValueRegistering ImageStatusValue = "registering"
ImageStatusValueSuccess ImageStatusValue = "success"
ImageStatusValueUploading ImageStatusValue = "uploading"
)
// Defines values for ImageTypes.
const (
ImageTypesAws ImageTypes = "aws"
ImageTypesAwsHaRhui ImageTypes = "aws-ha-rhui"
ImageTypesAwsRhui ImageTypes = "aws-rhui"
ImageTypesAwsSapRhui ImageTypes = "aws-sap-rhui"
ImageTypesAzure ImageTypes = "azure"
ImageTypesAzureRhui ImageTypes = "azure-rhui"
ImageTypesAzureSapRhui ImageTypes = "azure-sap-rhui"
ImageTypesEdgeCommit ImageTypes = "edge-commit"
ImageTypesEdgeContainer ImageTypes = "edge-container"
ImageTypesEdgeInstaller ImageTypes = "edge-installer"
ImageTypesGcp ImageTypes = "gcp"
ImageTypesGcpRhui ImageTypes = "gcp-rhui"
ImageTypesGuestImage ImageTypes = "guest-image"
ImageTypesImageInstaller ImageTypes = "image-installer"
ImageTypesIotCommit ImageTypes = "iot-commit"
ImageTypesIotContainer ImageTypes = "iot-container"
ImageTypesIotInstaller ImageTypes = "iot-installer"
ImageTypesIotRawImage ImageTypes = "iot-raw-image"
ImageTypesVsphere ImageTypes = "vsphere"
)
// Defines values for UploadStatusValue.
const (
UploadStatusValueFailure UploadStatusValue = "failure"
UploadStatusValuePending UploadStatusValue = "pending"
UploadStatusValueRunning UploadStatusValue = "running"
UploadStatusValueSuccess UploadStatusValue = "success"
)
// Defines values for UploadTypes.
const (
UploadTypesAws UploadTypes = "aws"
UploadTypesAwsS3 UploadTypes = "aws.s3"
UploadTypesAzure UploadTypes = "azure"
UploadTypesContainer UploadTypes = "container"
UploadTypesGcp UploadTypes = "gcp"
)
// AWSEC2CloneCompose defines model for AWSEC2CloneCompose.
type AWSEC2CloneCompose struct {
Region string `json:"region"`
ShareWithAccounts *[]string `json:"share_with_accounts,omitempty"`
}
// AWSEC2UploadOptions defines model for AWSEC2UploadOptions.
type AWSEC2UploadOptions struct {
Region string `json:"region"`
ShareWithAccounts []string `json:"share_with_accounts"`
SnapshotName *string `json:"snapshot_name,omitempty"`
}
// AWSEC2UploadStatus defines model for AWSEC2UploadStatus.
type AWSEC2UploadStatus struct {
Ami string `json:"ami"`
Region string `json:"region"`
}
// AWSS3UploadOptions defines model for AWSS3UploadOptions.
type AWSS3UploadOptions struct {
// If set to false (the default value), a long, obfuscated URL
// is returned. Its expiration might be sooner than for other upload
// targets.
//
// If set to true, a shorter URL is returned and
// its expiration is the same as for the other upload targets.
Public *bool `json:"public,omitempty"`
Region string `json:"region"`
}
// AWSS3UploadStatus defines model for AWSS3UploadStatus.
type AWSS3UploadStatus struct {
Url string `json:"url"`
}
// AzureUploadOptions defines model for AzureUploadOptions.
type AzureUploadOptions struct {
// Name of the uploaded image. It must be unique in the given resource group.
// If name is omitted from the request, a random one based on a UUID is
// generated.
ImageName *string `json:"image_name,omitempty"`
// Location of the provided resource_group, where the image should be uploaded and registered.
// How to list all locations:
// https://docs.microsoft.com/en-us/cli/azure/account?view=azure-cli-latest#az_account_list_locations'
// If the location is not specified, it is deducted from the provided resource_group.
Location *string `json:"location,omitempty"`
// Name of the resource group where the image should be uploaded.
ResourceGroup string `json:"resource_group"`
// ID of subscription where the image should be uploaded.
SubscriptionId string `json:"subscription_id"`
// ID of the tenant where the image should be uploaded.
// How to find it in the Azure Portal:
// https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-how-to-find-tenant
TenantId string `json:"tenant_id"`
}
// AzureUploadStatus defines model for AzureUploadStatus.
type AzureUploadStatus struct {
ImageName string `json:"image_name"`
}
// CloneComposeBody defines model for CloneComposeBody.
type CloneComposeBody interface{}
// CloneComposeResponse defines model for CloneComposeResponse.
type CloneComposeResponse struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Id string `json:"id"`
}
// CloneStatus defines model for CloneStatus.
type CloneStatus struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded struct due to allOf(#/components/schemas/UploadStatus)
UploadStatus `yaml:",inline"`
}
// ComposeId defines model for ComposeId.
type ComposeId struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Id string `json:"id"`
}
// ComposeLogs defines model for ComposeLogs.
type ComposeLogs struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
ImageBuilds []interface{} `json:"image_builds"`
Koji *KojiLogs `json:"koji,omitempty"`
}
// ComposeManifests defines model for ComposeManifests.
type ComposeManifests struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Manifests []interface{} `json:"manifests"`
}
// ComposeMetadata defines model for ComposeMetadata.
type ComposeMetadata struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
// ID (hash) of the built commit
OstreeCommit *string `json:"ostree_commit,omitempty"`
// Package list including NEVRA
Packages *[]PackageMetadata `json:"packages,omitempty"`
}
// ComposeRequest defines model for ComposeRequest.
type ComposeRequest struct {
Customizations *Customizations `json:"customizations,omitempty"`
Distribution string `json:"distribution"`
ImageRequest *ImageRequest `json:"image_request,omitempty"`
ImageRequests *[]ImageRequest `json:"image_requests,omitempty"`
Koji *Koji `json:"koji,omitempty"`
}
// ComposeStatus defines model for ComposeStatus.
type ComposeStatus struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
ImageStatus ImageStatus `json:"image_status"`
ImageStatuses *[]ImageStatus `json:"image_statuses,omitempty"`
KojiStatus *KojiStatus `json:"koji_status,omitempty"`
Status ComposeStatusValue `json:"status"`
}
// ComposeStatusError defines model for ComposeStatusError.
type ComposeStatusError struct {
Details *interface{} `json:"details,omitempty"`
Id int `json:"id"`
Reason string `json:"reason"`
}
// ComposeStatusValue defines model for ComposeStatusValue.
type ComposeStatusValue string
// Container defines model for Container.
type Container struct {
// Name to use for the container from the image
Name *string `json:"name,omitempty"`
Source string `json:"source"`
// Control TLS verifification
TlsVerify *bool `json:"tls_verify,omitempty"`
}
// ContainerUploadOptions defines model for ContainerUploadOptions.
type ContainerUploadOptions struct {
// Name for the created container image
Name *string `json:"name,omitempty"`
// Tag for the created container image
Tag *string `json:"tag,omitempty"`
}
// ContainerUploadStatus defines model for ContainerUploadStatus.
type ContainerUploadStatus struct {
// Digest of the manifest of the uploaded container on the registry
Digest string `json:"digest"`
// FQDN of the uploaded image
Url string `json:"url"`
}
// Customizations defines model for Customizations.
type Customizations struct {
Containers *[]Container `json:"containers,omitempty"`
Filesystem *[]Filesystem `json:"filesystem,omitempty"`
Packages *[]string `json:"packages,omitempty"`
// Extra repositories for packages specified in customizations. These
// repositories will only be used to depsolve and retrieve packages
// for the OS itself (they will not be available for the build root or
// any other part of the build process). The package_sets field for these
// repositories is ignored.
PayloadRepositories *[]Repository `json:"payload_repositories,omitempty"`
Services *struct {
// List of services to disable by default
Disabled *[]string `json:"disabled,omitempty"`
// List of services to enable by default
Enabled *[]string `json:"enabled,omitempty"`
} `json:"services,omitempty"`
Subscription *Subscription `json:"subscription,omitempty"`
Users *[]User `json:"users,omitempty"`
}
// Error defines model for Error.
type Error struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Code string `json:"code"`
Details *interface{} `json:"details,omitempty"`
OperationId string `json:"operation_id"`
Reason string `json:"reason"`
}
// ErrorList defines model for ErrorList.
type ErrorList struct {
// Embedded struct due to allOf(#/components/schemas/List)
List `yaml:",inline"`
// Embedded fields due to inline allOf schema
Items []Error `json:"items"`
}
// Filesystem defines model for Filesystem.
type Filesystem struct {
MinSize uint64 `json:"min_size"`
Mountpoint string `json:"mountpoint"`
}
// GCPUploadOptions defines model for GCPUploadOptions.
type GCPUploadOptions struct {
// Name of an existing STANDARD Storage class Bucket.
Bucket *string `json:"bucket,omitempty"`
// The name to use for the imported and shared Compute Engine image.
// The image name must be unique within the GCP project, which is used
// for the OS image upload and import. If not specified a random
// 'composer-api-<uuid>' string is used as the image name.
ImageName *string `json:"image_name,omitempty"`
// The GCP region where the OS image will be imported to and shared from.
// The value must be a valid GCP location. See https://cloud.google.com/storage/docs/locations.
// If not specified, the multi-region location closest to the source
// (source Storage Bucket location) is chosen automatically.
Region string `json:"region"`
// List of valid Google accounts to share the imported Compute Engine image with.
// Each string must contain a specifier of the account type. Valid formats are:
// - 'user:{emailid}': An email address that represents a specific
// Google account. For example, 'alice@example.com'.
// - 'serviceAccount:{emailid}': An email address that represents a
// service account. For example, 'my-other-app@appspot.gserviceaccount.com'.
// - 'group:{emailid}': An email address that represents a Google group.
// For example, 'admins@example.com'.
// - 'domain:{domain}': The G Suite domain (primary) that represents all
// the users of that domain. For example, 'google.com' or 'example.com'.
// If not specified, the imported Compute Engine image is not shared with any
// account.
ShareWithAccounts *[]string `json:"share_with_accounts,omitempty"`
}
// GCPUploadStatus defines model for GCPUploadStatus.
type GCPUploadStatus struct {
ImageName string `json:"image_name"`
ProjectId string `json:"project_id"`
}
// ImageRequest defines model for ImageRequest.
type ImageRequest struct {
Architecture string `json:"architecture"`
ImageType ImageTypes `json:"image_type"`
Ostree *OSTree `json:"ostree,omitempty"`
Repositories []Repository `json:"repositories"`
// This should really be oneOf but AWSS3UploadOptions is a subset of
// AWSEC2UploadOptions. This means that all AWSEC2UploadOptions objects
// are also valid AWSS3UploadOptionas objects which violates the oneOf
// rules. Therefore, we have to use anyOf here but be aware that it isn't
// possible to mix and match more schemas together.
UploadOptions *UploadOptions `json:"upload_options,omitempty"`
}
// ImageStatus defines model for ImageStatus.
type ImageStatus struct {
Error *ComposeStatusError `json:"error,omitempty"`
Status ImageStatusValue `json:"status"`
UploadStatus *UploadStatus `json:"upload_status,omitempty"`
}
// ImageStatusValue defines model for ImageStatusValue.
type ImageStatusValue string
// ImageTypes defines model for ImageTypes.
type ImageTypes string
// Koji defines model for Koji.
type Koji struct {
Name string `json:"name"`
Release string `json:"release"`
Server string `json:"server"`
TaskId int `json:"task_id"`
Version string `json:"version"`
}
// KojiLogs defines model for KojiLogs.
type KojiLogs struct {
Import interface{} `json:"import"`
Init interface{} `json:"init"`
}
// KojiStatus defines model for KojiStatus.
type KojiStatus struct {
BuildId *int `json:"build_id,omitempty"`
}
// List defines model for List.
type List struct {
Kind string `json:"kind"`
Page int `json:"page"`
Size int `json:"size"`
Total int `json:"total"`
}
// OSTree defines model for OSTree.
type OSTree struct {
// A URL which, if set, is used for fetching content. Implies that `url` is set as well,
// which will be used for metadata only.
Contenturl *string `json:"contenturl,omitempty"`
// Can be either a commit (example: 02604b2da6e954bd34b8b82a835e5a77d2b60ffa), or a branch-like reference (example: rhel/8/x86_64/edge)
Parent *string `json:"parent,omitempty"`
Ref *string `json:"ref,omitempty"`
// Determines whether a valid subscription manager (candlepin) identity is required to
// access this repository. Consumer certificates will be used as client certificates when
// fetching metadata and content.
Rhsm *bool `json:"rhsm,omitempty"`
Url *string `json:"url,omitempty"`
}
// ObjectReference defines model for ObjectReference.
type ObjectReference struct {
Href string `json:"href"`
Id string `json:"id"`
Kind string `json:"kind"`
}
// PackageMetadata defines model for PackageMetadata.
type PackageMetadata struct {
Arch string `json:"arch"`
Epoch *string `json:"epoch,omitempty"`
Name string `json:"name"`
Release string `json:"release"`
Sigmd5 string `json:"sigmd5"`
Signature *string `json:"signature,omitempty"`
Type string `json:"type"`
Version string `json:"version"`
}
// Repository defines model for Repository.
type Repository struct {
Baseurl *string `json:"baseurl,omitempty"`
CheckGpg *bool `json:"check_gpg,omitempty"`
// GPG key used to sign packages in this repository.
Gpgkey *string `json:"gpgkey,omitempty"`
IgnoreSsl *bool `json:"ignore_ssl,omitempty"`
Metalink *string `json:"metalink,omitempty"`
Mirrorlist *string `json:"mirrorlist,omitempty"`
// Naming package sets for a repository assigns it to a specific part
// (pipeline) of the build process.
PackageSets *[]string `json:"package_sets,omitempty"`
// Determines whether a valid subscription is required to access this repository.
Rhsm *bool `json:"rhsm,omitempty"`
}
// Subscription defines model for Subscription.
type Subscription struct {
ActivationKey string `json:"activation_key"`
BaseUrl string `json:"base_url"`
Insights bool `json:"insights"`
Organization string `json:"organization"`
ServerUrl string `json:"server_url"`
}
// This should really be oneOf but AWSS3UploadOptions is a subset of
// AWSEC2UploadOptions. This means that all AWSEC2UploadOptions objects
// are also valid AWSS3UploadOptionas objects which violates the oneOf
// rules. Therefore, we have to use anyOf here but be aware that it isn't
// possible to mix and match more schemas together.
type UploadOptions interface{}
// UploadStatus defines model for UploadStatus.
type UploadStatus struct {
Options interface{} `json:"options"`
Status UploadStatusValue `json:"status"`
Type UploadTypes `json:"type"`
}
// UploadStatusValue defines model for UploadStatusValue.
type UploadStatusValue string
// UploadTypes defines model for UploadTypes.
type UploadTypes string
// User defines model for User.
type User struct {
Groups *[]string `json:"groups,omitempty"`
Key *string `json:"key,omitempty"`
Name string `json:"name"`
}
// Page defines model for page.
type Page string
// Size defines model for size.
type Size string
// PostComposeJSONBody defines parameters for PostCompose.
type PostComposeJSONBody ComposeRequest
// PostCloneComposeJSONBody defines parameters for PostCloneCompose.
type PostCloneComposeJSONBody CloneComposeBody
// GetErrorListParams defines parameters for GetErrorList.
type GetErrorListParams struct {
// Page index
Page *Page `json:"page,omitempty"`
// Number of items in each page
Size *Size `json:"size,omitempty"`
}
// PostComposeJSONRequestBody defines body for PostCompose for application/json ContentType.
type PostComposeJSONRequestBody PostComposeJSONBody
// PostCloneComposeJSONRequestBody defines body for PostCloneCompose for application/json ContentType.
type PostCloneComposeJSONRequestBody PostCloneComposeJSONBody
// ServerInterface represents all server handlers.
type ServerInterface interface {
// The status of a cloned compose
// (GET /clones/{id})
GetCloneStatus(ctx echo.Context, id string) error
// Create compose
// (POST /compose)
PostCompose(ctx echo.Context) error
// The status of a compose
// (GET /composes/{id})
GetComposeStatus(ctx echo.Context, id string) error
// Clone an existing compose
// (POST /composes/{id}/clone)
PostCloneCompose(ctx echo.Context, id string) error
// Get logs for a compose.
// (GET /composes/{id}/logs)
GetComposeLogs(ctx echo.Context, id string) error
// Get the manifests for a compose.
// (GET /composes/{id}/manifests)
GetComposeManifests(ctx echo.Context, id string) error
// Get the metadata for a compose.
// (GET /composes/{id}/metadata)
GetComposeMetadata(ctx echo.Context, id string) error
// Get a list of all possible errors
// (GET /errors)
GetErrorList(ctx echo.Context, params GetErrorListParams) error
// Get error description
// (GET /errors/{id})
GetError(ctx echo.Context, id string) error
// Get the openapi spec in json format
// (GET /openapi)
GetOpenapi(ctx echo.Context) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// GetCloneStatus converts echo context to params.
func (w *ServerInterfaceWrapper) GetCloneStatus(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetCloneStatus(ctx, id)
return err
}
// PostCompose converts echo context to params.
func (w *ServerInterfaceWrapper) PostCompose(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.PostCompose(ctx)
return err
}
// GetComposeStatus converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeStatus(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeStatus(ctx, id)
return err
}
// PostCloneCompose converts echo context to params.
func (w *ServerInterfaceWrapper) PostCloneCompose(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.PostCloneCompose(ctx, id)
return err
}
// GetComposeLogs converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeLogs(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeLogs(ctx, id)
return err
}
// GetComposeManifests converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeManifests(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeManifests(ctx, id)
return err
}
// GetComposeMetadata converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeMetadata(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeMetadata(ctx, id)
return err
}
// GetErrorList converts echo context to params.
func (w *ServerInterfaceWrapper) GetErrorList(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Parameter object where we will unmarshal all parameters from the context
var params GetErrorListParams
// ------------- Optional query parameter "page" -------------
err = runtime.BindQueryParameter("form", true, false, "page", ctx.QueryParams(), &params.Page)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter page: %s", err))
}
// ------------- Optional query parameter "size" -------------
err = runtime.BindQueryParameter("form", true, false, "size", ctx.QueryParams(), &params.Size)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter size: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetErrorList(ctx, params)
return err
}
// GetError converts echo context to params.
func (w *ServerInterfaceWrapper) GetError(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetError(ctx, id)
return err
}
// GetOpenapi converts echo context to params.
func (w *ServerInterfaceWrapper) GetOpenapi(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetOpenapi(ctx)
return err
}
// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
RegisterHandlersWithBaseURL(router, si, "")
}
// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
wrapper := ServerInterfaceWrapper{
Handler: si,
}
router.GET(baseURL+"/clones/:id", wrapper.GetCloneStatus)
router.POST(baseURL+"/compose", wrapper.PostCompose)
router.GET(baseURL+"/composes/:id", wrapper.GetComposeStatus)
router.POST(baseURL+"/composes/:id/clone", wrapper.PostCloneCompose)
router.GET(baseURL+"/composes/:id/logs", wrapper.GetComposeLogs)
router.GET(baseURL+"/composes/:id/manifests", wrapper.GetComposeManifests)
router.GET(baseURL+"/composes/:id/metadata", wrapper.GetComposeMetadata)
router.GET(baseURL+"/errors", wrapper.GetErrorList)
router.GET(baseURL+"/errors/:id", wrapper.GetError)
router.GET(baseURL+"/openapi", wrapper.GetOpenapi)
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+x9eXPiurL4V1HxflUzU2FfAknVqfuAkIQAWYCsh6k8Ycu2wJYcSWbJqfnuv5K8YMAE",
"cs+c8+69b+4fZ4Jtdbda3a3epPtHSqOOSwkigqdO/0i5kEEHCcSCXyaS/+qIawy7AlOSOk3dQhMBTHS0",
"SKVTaAEd10Zrn8+g7aHUaaqQ+vEjncJyzJuH2DKVThHoyDfqy3SKaxZyoBwilq58zgXDxFTDOH5PwH3t",
"OWPEADUAFsjhABOAoGaBAGCcmhBARE0+v5Me9e1H9PwIXyrQ9cdBq1ls2pSgpmQfV4hcRl3EBPbRM2Qq",
"krdgpVPcggy9zrGwXqGmUS/gfUB86vT3VKFYKleOq7WTfKGY+p5OqckmwgoeQMbgUk2PoTcPM6RLMAEN",
"36PP6HiCNCHH+VO4d20K9RvFXf7RHCLaUsjLzBEXmUIq/XfOLJ3iBLrcouLVX7M4Tc4yE77dpiqZJ8m0",
"7uPUQEDhJTAKOnidIujgTF6rlfLVk1K1WqmcVPTyOIljn2TxxmQk3vSeZR6U9qyy641trPm6ZkDPFqlT",
"A9ocpTd0r20AjgQQFKjX4KuwEAiGAKVl39IAApsSMw3o2PC4BgXSwX2/OyKYA4aExwjSs6AtOEALFzMo",
"QQMHm5YAYwQ4pQQxICxIgEEZoMJCDHiK/BERkJlI8OyIjMiKFsE8JNFyizKBmMQGYsgAJPqI4HWEmANJ",
"O4c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4HaOpMV9fD8EQo+/1O7fulv3sN3LqV6AeLPfmnxLy3+",
"jBajbQmSmhs1+ezeIW+CT5Llfp3YAJzSZxlZSx4EMfO/o2/x4XR+RH3QSZaoF1xsQ3VP829jig7Mr7dx",
"QRdnJR5u4eD/kgK62L/YNqOyB4hlwlu1crOi8jg2mssENDExP0LABTTRn0SjmEjCi3ciNPvgfP/x/wMA",
"AP//ZmNbs5ZtAAA=",
}
// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
if err != nil {
return nil, fmt.Errorf("error base64 decoding spec: %s", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
return buf.Bytes(), nil
}
var rawSpec = decodeSpecCached()
// a naive cached of a decoded swagger spec
func decodeSpecCached() func() ([]byte, error) {
data, err := decodeSpec()
return func() ([]byte, error) {
return data, err
}
}
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
var res = make(map[string]func() ([]byte, error))
if len(pathToFile) > 0 {
res[pathToFile] = rawSpec
}
return res
}
// GetSwagger returns the Swagger specification corresponding to the generated code
// in this file. The external references of Swagger specification are resolved.
// The logic of resolving external references is tightly connected to "import-mapping" feature.
// Externally referenced files must be embedded in the corresponding golang packages.
// Urls can be supported but this task was out of the scope.
func GetSwagger() (swagger *openapi3.T, err error) {
var resolvePath = PathToRawSpec("")
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
var pathToFile = url.String()
pathToFile = path.Clean(pathToFile)
getSpec, ok := resolvePath[pathToFile]
if !ok {
err1 := fmt.Errorf("path not found: %s", pathToFile)
return nil, err1
}
return getSpec()
}
var specData []byte
specData, err = rawSpec()
if err != nil {
return
}
swagger, err = loader.LoadFromData(specData)
if err != nil {
return
}
return
}