// 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" 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-' 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 { // 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"` 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(), ¶ms.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(), ¶ms.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/+x9+XPiuPL4v6Lifatmp8J9BJKqrfeAkIQAOYCcy1RK2LItsCVHkjmyNf/7tyQfGDCB", "7M7uOz6zP0ywLXW3Wt2tVndL+3tKo45LCSKCp05/T7mQQQcJxIInE8m/OuIaw67AlKROU7fQRAATHS1S", "6RRaQMe10VrzGbQ9lDpNFVLfv6dTWPZ58xBbptIpAh35RbVMp7hmIQfKLmLpyvdcMExM1Y3j9wTc154z", "RgxQA2CBHA4wAQhqFggAxqkJAUTU5PM76VFtP6Lne/hRga4/DlrNYtOmBDUl+7hC5DLqIiawj54hU5G8", "BSud4hZk6HWOhfUKNY16Ae8D4lOnv6UKxVK5clytneQLxdS3dEoNNhFW8AIyBpdqeAy9eZghXYIJaPgW", "NaPjCdKE7OcP4d61KdRvFHf5R2OIaEshLzNHXGQKqfTfObJ0ihPocouKV3/O4jQ5y0z4dZuqZJ4k07qP", "UwMBhZfAKOjgdYqggzN5rVbKV09K1WqlclLRy+Mkjn2SxRuDkXjTe6Z5UNozy643trHm65oBPVukTg1o", "c5Te0L22ATgSQFCgPoNfhIVA0AUoLfuaBhDYlJhpQMeGxzUokA7u+90RwRwwJDxGkJ4FbcEBWriYQQka", "ONi0BBgj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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 }