// 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" 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 { 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 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' Location string `json:"location"` // 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"` // 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+XPiuPL4v6Lifatmp8J9J1Vb7wEhCVcOIOcylRK2sAW25EgyR7bmf/+WZBsMNoHs", "zu47PvN+2Am21Je6W63ult/vCY3aDiWICJ44+z3hQAZtJBDzfxlI/qsjrjHsCExJ4ixxCw0EMNHRMpFM", "oCW0HQttDZ9Dy0WJs0Qu8f17MoHlnDcXsVUimSDQlm/UyGSCayayoZwiVo58zgXDxFDTOH6PwX3t2mPE", "AJ0ALJDNASYAQc0EPsAwNQGANTXZ7F561NiP6PkevFSga4+DZiPfsChBDSk+rhA5jDqICeyhZ8hQJEdg", "JRPchAy9LrAwX6GmUdeXvU984uy3RC5fKJbKleppNpdPfEsmFLOxsPwHkDG4Uuwx9OZihnQJxqfh23oY", "HU+RJuQ8j4V7x6JQv1HS5R/xsKYtgdzUAnGRyiWSfydnyQQn0OEmFa/emoVpslep4G2UqniZxNN6SFID", "AYUbIyho422KoI1TWa1ayFZOC5VKqXRa0ovjOIl9UsQ7zEi8yQPLPCj82FX+lI4FyPcJzmVWvPmHUchB", "sfDfXYYOMIdtaKC1yuw4E2gj6UqEiYCrwCAdqAlp0BLAdrkAYwRcgt9c6fHUQAPPEQEMceoyDQGDUddJ", "j0hrAiQSgDmgNhYC6WDCqK2mSF4QF0kAAYNEpzagBIEx5EgHlAAI7u9b5wDzETEQQQwKpKdHZOPOPA1X", "hMWpkEU1KPwV3Gaw678BCxMxpGhRUAA3qWvpirmAb0h0INeSC8QU/iu6AIICC3MBoGWBAA0/GxFTCIef", "ZTI61XjaxhqjnE5EWqN2BpGUyzOahTNQLk/Gt61/zjFa/KoepTQLpywoEBf/gO+B8b1KRK9rJF92BCC1", "EblyaeOtyFu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4M9r6itSHtrQeeYQ59ZFwGeHq", "O5jrT0FIYtQZ3HdnJPzxzDRQ99DWgzWqDIsHF/D85dPRBBOkAyhAOB3rf9bBaz+AJPjMQyoAly59YIqb", "r3P9tMeD9rgR1h6j3FruiGH+b9ratnkcYXShLuOPbc4f6JlcxM68C7NoCTWxtRExZX5IBzpyENH55lsr", "ytbWqX91jfMjywjo/GkYhw1j/QG4PXYRLOVn7OLnIfXnIfU/7ZAa8U1x/k4BD8cUERez+UpHxLnEcbYZ", "klEXePa1OITGqRs+f6npb3iI03bvs5J0Anxh/DSzf4+ZeYr+32dkcK1A0LLAuv8p0KaNmR3OaEPiNT0Q", "bf2ZdI+yzQdFxiugts54Qz0+f4T84X9q1y/8zXv43qVUL0D42U8r/mnFn7FiFNUgabnrJp/9O+SNPyRe", "77eJ9cEpe5YnaykD/8z83xhbfMjO93UfdJwn6vlfN6G6q3mf5Flfvd5u44IOTks83MT+/0UBdLD3ddOU", "yh4glgo+rZSZ51XEsdNcJqCBifERAi6ggf4kGiVEEnx9ZY3mEJxv3/9/AAAA//94/6Zd/WkAAA==", } // 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 }