// 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 // ContainerUploadOptions defines model for ContainerUploadOptions. type ContainerUploadOptions struct { // Name for the created container image Name string `json:"name"` // Tag for the created container image Tag string `json:"tag"` } // 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 { 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/jOLboXyF8H1DdiBd5dwI05tqOk3jLYjtruxDQEi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8iGMVEEt7VjsB8ts73n/83AAD//6lVbrsfXgAA", } // 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 }