// 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" ) // 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"` } // 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 // 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 // ServerInterface represents all server handlers. type ServerInterface interface { // Create compose // (POST /compose) PostCompose(ctx echo.Context) error // The status of a compose // (GET /composes/{id}) GetComposeStatus(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 } // 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 } // 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.POST(baseURL+"/compose", wrapper.PostCompose) router.GET(baseURL+"/composes/:id", wrapper.GetComposeStatus) 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/+x8aW/juLLoXyF8H9AziPc9AQbn2o6TeMtiO+u4EdASJdGWSIWkvKTR//2B1OJFcuKc", "0+fcdx96PkzHElkbq4rFqqJ+pDTquJQgInjq7EfKhQw6SCAW/DKR/FdHXGPYFZiS1FnqFpoIYKKjVSqd", "QivouDbaGb6AtodSZ6lC6ufPdArLOW8eYutUOkWgI9+okekU1yzkQDlFrF35nAuGiammcfyegPvac6aI", "AWoALJDDASYAQc0CAcBtakIAETX5/EF61NiP6PkZvlSgG4+jdqt479oU6jeKNJ9/Rl3EBPbxM2Qqmn+E", "VKXOUsjLLBEXmUIqvY8ineIWZOh1iYX1CjWNesGSRLP/ThWKpXKlWquf5gvF1Pd0SskggdwIOGQMrhVs", "Al1uUfHqM7xNk7POhG/jVP1Mpxh68zBDuiQg4CmZ1u/RbDqdIU1IvNuSGgkovARBQQfvUgQdnMlr9VK+", "dlqq1SqV04peniZJ7Isi3mNG4o1gHCB+VPq1q5wsz0+QHxKcx+xk29lGIQclwn/3GPqEOexAE0Uqs2eJ", "0EHSDoWFgKfAIB2oCVnQEcDxuABTBDyC3zzpLtRAEy8QAQxx6jENAZNRz81OSMcAEgnAHFAHC4F0YDDq", "qCmSF8RFGkDAINGpAyhBYAo50gElAIL7+845wHxCTEQQgwLp2QnZ+AJfwxVhSSpkUw2KYAV3GewHb8DS", "QgwpWhQUwC3q2bpiLuQbEh3IteQCMYX/ii6BoMDGXABo2yBEw88mxBLC5We5nE41nnWwxiinhshq1Mkh", "kvF4TrNxDsrlyQW29Y8FRsu/1KOMZuOMDQXi4r/ge2h8rxLRa4Tk254ApDYiTy5tshX5y/GqluPjld5d", "uiNEs78WY+ppkAwDMJcKY5Iv9KYRCa9YjxPVOZckbQ/7J4gpo4penxa1DJwWy5lyuVDKnOa1SqZaKJby", "VVTPn6JiEnUCEUjEB3RJIvxBx1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+kaqK0z2VCPiwAiuP/qrl/6D+/hB5dSvQDbz35b8W8r/ooV", "o7gGScuNSoKHd8ibYEiy3u8SG4BT9ixP1lIGwZn5f2Ns8SE7P6OuqSRPNAjuQlPd0/wL/NFFrd2iL3Rx", "VuLhFg6+lAtd7H8LLaOyB4hlwg8x5BZFFXHslaIFNDExP0LABTTRv4hGCZGEd7UjNJ/B+f7z/wYAAP//", "R6B2l8FfAAA=", } // 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 }