diff --git a/client/client.gen.go b/client/client.gen.go index 5187a35..68f2fcb 100644 --- a/client/client.gen.go +++ b/client/client.gen.go @@ -21,20 +21,6 @@ import ( openapi_types "github.com/oapi-codegen/runtime/types" ) -// Defines values for CreateWorkloadArtefactVersionExtensionsDeploySuccess. -const ( - CreateWorkloadArtefactVersionExtensionsDeploySuccessAvailable CreateWorkloadArtefactVersionExtensionsDeploySuccess = "available" - CreateWorkloadArtefactVersionExtensionsDeploySuccessComplete CreateWorkloadArtefactVersionExtensionsDeploySuccess = "complete" - CreateWorkloadArtefactVersionExtensionsDeploySuccessDeploy CreateWorkloadArtefactVersionExtensionsDeploySuccess = "deploy" -) - -// Defines values for CreateWorkloadArtefactVersionExtensionsDeployWhen. -const ( - CreateWorkloadArtefactVersionExtensionsDeployWhenAfter CreateWorkloadArtefactVersionExtensionsDeployWhen = "after" - CreateWorkloadArtefactVersionExtensionsDeployWhenBefore CreateWorkloadArtefactVersionExtensionsDeployWhen = "before" - CreateWorkloadArtefactVersionExtensionsDeployWhenDeploy CreateWorkloadArtefactVersionExtensionsDeployWhen = "deploy" -) - // Defines values for PipelineApprovalRequestStatus. const ( Approved PipelineApprovalRequestStatus = "approved" @@ -88,6 +74,20 @@ const ( Warning RuntimeInfoStatusClass = "Warning" ) +// Defines values for ScoreHumanitecExtensionsDeploySuccess. +const ( + ScoreHumanitecExtensionsDeploySuccessAvailable ScoreHumanitecExtensionsDeploySuccess = "available" + ScoreHumanitecExtensionsDeploySuccessComplete ScoreHumanitecExtensionsDeploySuccess = "complete" + ScoreHumanitecExtensionsDeploySuccessDeploy ScoreHumanitecExtensionsDeploySuccess = "deploy" +) + +// Defines values for ScoreHumanitecExtensionsDeployWhen. +const ( + ScoreHumanitecExtensionsDeployWhenAfter ScoreHumanitecExtensionsDeployWhen = "after" + ScoreHumanitecExtensionsDeployWhenBefore ScoreHumanitecExtensionsDeployWhen = "before" + ScoreHumanitecExtensionsDeployWhenDeploy ScoreHumanitecExtensionsDeployWhen = "deploy" +) + // Defines values for ValueSetVersionResultOf. const ( AppValueCreate ValueSetVersionResultOf = "app_value_create" @@ -523,6 +523,28 @@ type ClusterSecretsMapRequest map[string]ClusterSecretRequest // ClusterSecretsMapResponse ClusterSecretsMap stores a list of Kuberenetes secret references for the target deployment clusters. type ClusterSecretsMapResponse map[string]ClusterSecretResponse +// ConflictingResourcesErrorResponse Represents a standard Humanitec Error with additional details which describe why an action on a specific resource cannot be performed due to some other entities linked to it. +type ConflictingResourcesErrorResponse struct { + // Details Object composed by the list of resources which prevent the deletion of the specified entity. The resources are indexed by their kind. + Details ConflictingResourcesErrorResponseDetails `json:"details"` + Error string `json:"error"` + Message string `json:"message"` +} + +// ConflictingResourcesErrorResponseDetails Object composed by the list of resources which prevent the deletion of the specified entity. The resources are indexed by their kind. +type ConflictingResourcesErrorResponseDetails struct { + ReferencingResources ConflictingResourcesErrorResponseDetailsResources `json:"referencing_resources"` +} + +// ConflictingResourcesErrorResponseDetailsResources defines model for ConflictingResourcesErrorResponseDetailsResources. +type ConflictingResourcesErrorResponseDetailsResources struct { + // ActiveResources List of Active Resources referencing the specified Resource Account. + ActiveResources *[]ActiveResourceResponse `json:"active_resources,omitempty"` + + // ResourceDefinitions List of non-deleted Resource Definitions referencing the specified Resource Account. + ResourceDefinitions *[]ResourceDefinitionResponse `json:"resource_definitions,omitempty"` +} + // ContainerArtefactVersion defines model for ContainerArtefactVersion. type ContainerArtefactVersion struct { // Archived If the Artefact Version is archived. @@ -572,6 +594,24 @@ type ControllerResponse struct { Status string `json:"status"` } +// ConvertScoreToSetBody Request body for converting a Score manifest to Humanitec deployment set. +type ConvertScoreToSetBody struct { + // Extensions Humanitec workload extensions for the Workload Artefact Version. These can be used to override the profile, or workload module spec and resource attributes. + Extensions *ScoreHumanitecExtensions `json:"extensions,omitempty"` + + // Image An optional default image to assign to any containers in the workload that do not have an image set or whose image is '.' + Image *string `json:"image,omitempty"` + + // Overrides An optional Json object containing the workload overrides. Score v1b1 is expected. + Overrides *map[string]interface{} `json:"overrides,omitempty"` + + // PropertyOverrides An optional set of path overrides that will be applied to the workload. + PropertyOverrides *map[string]interface{} `json:"property_overrides,omitempty"` + + // Spec A Json object containing the workload specification. Score v1b1 is expected. + Spec map[string]interface{} `json:"spec"` +} + // CreateArtefactVersion The details of a new Artefact Version to register. The type field is required and dictates the type of Artefact to register. type CreateArtefactVersion struct { // Type The Artefact Version type. @@ -710,7 +750,7 @@ type CreateWorkloadArtefactVersion struct { Commit *string `json:"commit,omitempty"` // Extensions Humanitec workload extensions for the Workload Artefact Version. These can be used to override the profile, or workload module spec and resource attributes. - Extensions *CreateWorkloadArtefactVersionExtensions `json:"extensions,omitempty"` + Extensions *ScoreHumanitecExtensions `json:"extensions,omitempty"` // Image An optional default image to assign to any containers in the workload that do not have an image set or whose image is '.' Image *string `json:"image,omitempty"` @@ -737,36 +777,6 @@ type CreateWorkloadArtefactVersion struct { Version *string `json:"version,omitempty"` } -// CreateWorkloadArtefactVersionExtensions Humanitec workload extensions for the Workload Artefact Version. These can be used to override the profile, or workload module spec and resource attributes. -type CreateWorkloadArtefactVersionExtensions struct { - // ApiVersion The api version describing the format of the extensions. - ApiVersion string `json:"apiVersion"` - - // Deploy An optional deploy condition for the workload. - Deploy *struct { - // Success The success criteria for the deployment. "deploy", workload deployed. "available", workload available. "complete", workload complete (often used with jobs). - Success *CreateWorkloadArtefactVersionExtensionsDeploySuccess `json:"success,omitempty"` - - // Timeout The timeout in seconds for the deployment to reach it's success condition. - Timeout *int `json:"timeout,omitempty"` - - // When The stage the deployment should occur. "deploy", deployed in-parallel with other workloads (the default). "before", deployed before other workloads. "after", deployed after other workloads. - When *CreateWorkloadArtefactVersionExtensionsDeployWhen `json:"when,omitempty"` - } `json:"deploy,omitempty"` - - // Profile An optional override for the workload profile - Profile *string `json:"profile,omitempty"` - - // Spec A map of additional workload spec fields that will be merged. - Spec *map[string]interface{} `json:"spec,omitempty"` -} - -// CreateWorkloadArtefactVersionExtensionsDeploySuccess The success criteria for the deployment. "deploy", workload deployed. "available", workload available. "complete", workload complete (often used with jobs). -type CreateWorkloadArtefactVersionExtensionsDeploySuccess string - -// CreateWorkloadArtefactVersionExtensionsDeployWhen The stage the deployment should occur. "deploy", deployed in-parallel with other workloads (the default). "before", deployed before other workloads. "after", deployed after other workloads. -type CreateWorkloadArtefactVersionExtensionsDeployWhen string - // DeltaMetadataRequest defines model for DeltaMetadataRequest. type DeltaMetadataRequest struct { Archived *bool `json:"archived,omitempty"` @@ -1494,9 +1504,6 @@ type PatchResourceDefinitionRequestRequest struct { // DriverInputs ValuesSecretsRefs stores data that should be passed around split by sensitivity. DriverInputs *ValuesSecretsRefsRequest `json:"driver_inputs,omitempty"` - // DriverType (Optional) The driver to be used to create the resource. - DriverType *string `json:"driver_type,omitempty"` - // Name (Optional) Resource display name Name *string `json:"name"` @@ -1984,16 +1991,16 @@ type RegistryCredsResponse struct { Expires *string `json:"expires"` // Password Account password or token secret. - Password string `json:"password"` + Password *string `json:"password,omitempty"` // Registry Registry name, usually in a "{domain}" or "{domain}/{project}" format. Registry string `json:"registry"` // Secrets ClusterSecretsMap stores a list of Kuberenetes secret references for the target deployment clusters. - Secrets ClusterSecretsMapResponse `json:"secrets"` + Secrets *ClusterSecretsMapResponse `json:"secrets,omitempty"` // Username Security account login or token. - Username string `json:"username"` + Username *string `json:"username,omitempty"` } // RegistryRequest Humanitec can be used to manage registry credentials. The Registry object represents how to match credentials to a particular registry. @@ -2082,7 +2089,7 @@ type ResourceAccountResponse struct { // Id Unique identifier for the account (in scope of the organization it belongs to). Id string `json:"id"` - // IsUsed Indicates if this account is being used (referenced) by any resource definition. + // IsUsed Indicates if this account is being used (referenced) by any resource definition or active resource. IsUsed bool `json:"is_used"` // Name Display name. @@ -2423,6 +2430,36 @@ type RuntimeInfoStatus string // RuntimeInfoStatusClass Status class, statuses are aggregated into classes type RuntimeInfoStatusClass string +// ScoreHumanitecExtensions Humanitec workload extensions for the Workload Artefact Version. These can be used to override the profile, or workload module spec and resource attributes. +type ScoreHumanitecExtensions struct { + // ApiVersion The api version describing the format of the extensions. + ApiVersion string `json:"apiVersion"` + + // Deploy An optional deploy condition for the workload. + Deploy *struct { + // Success The success criteria for the deployment. "deploy", workload deployed. "available", workload available. "complete", workload complete (often used with jobs). + Success *ScoreHumanitecExtensionsDeploySuccess `json:"success,omitempty"` + + // Timeout The timeout in seconds for the deployment to reach it's success condition. + Timeout *int `json:"timeout,omitempty"` + + // When The stage the deployment should occur. "deploy", deployed in-parallel with other workloads (the default). "before", deployed before other workloads. "after", deployed after other workloads. + When *ScoreHumanitecExtensionsDeployWhen `json:"when,omitempty"` + } `json:"deploy,omitempty"` + + // Profile An optional override for the workload profile + Profile *string `json:"profile,omitempty"` + + // Spec A map of additional workload spec fields that will be merged. + Spec *map[string]interface{} `json:"spec,omitempty"` +} + +// ScoreHumanitecExtensionsDeploySuccess The success criteria for the deployment. "deploy", workload deployed. "available", workload available. "complete", workload complete (often used with jobs). +type ScoreHumanitecExtensionsDeploySuccess string + +// ScoreHumanitecExtensionsDeployWhen The stage the deployment should occur. "deploy", deployed in-parallel with other workloads (the default). "before", deployed before other workloads. "after", deployed after other workloads. +type ScoreHumanitecExtensionsDeployWhen string + // SecretReference It stores sensitive value in the organization primary store or a reference to a sensitive value stored in a store registered under the organization. type SecretReference struct { // Ref Secret reference in the format of the target store. It can't be defined if `value` is defined. @@ -3984,6 +4021,9 @@ type CreateArtefactVersionJSONRequestBody = CreateArtefactVersion // CreateArtefactVersionMultipartRequestBody defines body for CreateArtefactVersion for multipart/form-data ContentType. type CreateArtefactVersionMultipartRequestBody = CreateArtefactVersion +// ConvertScoreToSetJSONRequestBody defines body for ConvertScoreToSet for application/json ContentType. +type ConvertScoreToSetJSONRequestBody = ConvertScoreToSetBody + // PatchArtefactVersionJSONRequestBody defines body for PatchArtefactVersion for application/json ContentType. type PatchArtefactVersionJSONRequestBody = UpdateArtefactVersionPayloadRequest @@ -5241,6 +5281,11 @@ type ClientInterface interface { CreateArtefactVersion(ctx context.Context, orgId string, params *CreateArtefactVersionParams, body CreateArtefactVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // ConvertScoreToSetWithBody request with any body + ConvertScoreToSetWithBody(ctx context.Context, orgId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + ConvertScoreToSet(ctx context.Context, orgId string, body ConvertScoreToSetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetArtefactVersion request GetArtefactVersion(ctx context.Context, orgId string, artefactVersionId string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -7422,6 +7467,30 @@ func (c *Client) CreateArtefactVersion(ctx context.Context, orgId string, params return c.Client.Do(req) } +func (c *Client) ConvertScoreToSetWithBody(ctx context.Context, orgId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewConvertScoreToSetRequestWithBody(c.Server, orgId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ConvertScoreToSet(ctx context.Context, orgId string, body ConvertScoreToSetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewConvertScoreToSetRequest(c.Server, orgId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) GetArtefactVersion(ctx context.Context, orgId string, artefactVersionId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetArtefactVersionRequest(c.Server, orgId, artefactVersionId) if err != nil { @@ -15764,6 +15833,53 @@ func NewCreateArtefactVersionRequestWithBody(server string, orgId string, params return req, nil } +// NewConvertScoreToSetRequest calls the generic ConvertScoreToSet builder with application/json body +func NewConvertScoreToSetRequest(server string, orgId string, body ConvertScoreToSetJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewConvertScoreToSetRequestWithBody(server, orgId, "application/json", bodyReader) +} + +// NewConvertScoreToSetRequestWithBody generates requests for ConvertScoreToSet with any type of body +func NewConvertScoreToSetRequestWithBody(server string, orgId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgId", runtime.ParamLocationPath, orgId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/orgs/%s/artefact-versions/convert-score", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewGetArtefactVersionRequest generates requests for GetArtefactVersion func NewGetArtefactVersionRequest(server string, orgId string, artefactVersionId string) (*http.Request, error) { var err error @@ -21048,6 +21164,11 @@ type ClientWithResponsesInterface interface { CreateArtefactVersionWithResponse(ctx context.Context, orgId string, params *CreateArtefactVersionParams, body CreateArtefactVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateArtefactVersionResponse, error) + // ConvertScoreToSetWithBodyWithResponse request with any body + ConvertScoreToSetWithBodyWithResponse(ctx context.Context, orgId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConvertScoreToSetResponse, error) + + ConvertScoreToSetWithResponse(ctx context.Context, orgId string, body ConvertScoreToSetJSONRequestBody, reqEditors ...RequestEditorFn) (*ConvertScoreToSetResponse, error) + // GetArtefactVersionWithResponse request GetArtefactVersionWithResponse(ctx context.Context, orgId string, artefactVersionId string, reqEditors ...RequestEditorFn) (*GetArtefactVersionResponse, error) @@ -24004,6 +24125,29 @@ func (r CreateArtefactVersionResponse) StatusCode() int { return 0 } +type ConvertScoreToSetResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *WorkloadArtefactVersionDeploymentSet + JSON400 *HumanitecErrorResponse +} + +// Status returns HTTPResponse.Status +func (r ConvertScoreToSetResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ConvertScoreToSetResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type GetArtefactVersionResponse struct { Body []byte HTTPResponse *http.Response @@ -25000,7 +25144,7 @@ func (r CreateResourceAccountResponse) StatusCode() int { type DeleteResourceAccountResponse struct { Body []byte HTTPResponse *http.Response - JSON400 *HumanitecErrorResponse + JSON400 *ConflictingResourcesErrorResponse JSON404 *HumanitecErrorResponse JSON500 *HumanitecErrorResponse } @@ -27511,6 +27655,23 @@ func (c *ClientWithResponses) CreateArtefactVersionWithResponse(ctx context.Cont return ParseCreateArtefactVersionResponse(rsp) } +// ConvertScoreToSetWithBodyWithResponse request with arbitrary body returning *ConvertScoreToSetResponse +func (c *ClientWithResponses) ConvertScoreToSetWithBodyWithResponse(ctx context.Context, orgId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConvertScoreToSetResponse, error) { + rsp, err := c.ConvertScoreToSetWithBody(ctx, orgId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseConvertScoreToSetResponse(rsp) +} + +func (c *ClientWithResponses) ConvertScoreToSetWithResponse(ctx context.Context, orgId string, body ConvertScoreToSetJSONRequestBody, reqEditors ...RequestEditorFn) (*ConvertScoreToSetResponse, error) { + rsp, err := c.ConvertScoreToSet(ctx, orgId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseConvertScoreToSetResponse(rsp) +} + // GetArtefactVersionWithResponse request returning *GetArtefactVersionResponse func (c *ClientWithResponses) GetArtefactVersionWithResponse(ctx context.Context, orgId string, artefactVersionId string, reqEditors ...RequestEditorFn) (*GetArtefactVersionResponse, error) { rsp, err := c.GetArtefactVersion(ctx, orgId, artefactVersionId, reqEditors...) @@ -32561,6 +32722,39 @@ func ParseCreateArtefactVersionResponse(rsp *http.Response) (*CreateArtefactVers return response, nil } +// ParseConvertScoreToSetResponse parses an HTTP response from a ConvertScoreToSetWithResponse call +func ParseConvertScoreToSetResponse(rsp *http.Response) (*ConvertScoreToSetResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ConvertScoreToSetResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest WorkloadArtefactVersionDeploymentSet + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest HumanitecErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + } + + return response, nil +} + // ParseGetArtefactVersionResponse parses an HTTP response from a GetArtefactVersionWithResponse call func ParseGetArtefactVersionResponse(rsp *http.Response) (*GetArtefactVersionResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -34151,7 +34345,7 @@ func ParseDeleteResourceAccountResponse(rsp *http.Response) (*DeleteResourceAcco switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest HumanitecErrorResponse + var dest ConflictingResourcesErrorResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } diff --git a/docs/openapi.json b/docs/openapi.json index b5e8c7b..0a3b197 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Humanitec API", - "version": "0.26.5", + "version": "0.26.11", "description": "# Introduction\nThe *Humanitec API* allows you to automate and integrate Humanitec into your developer and operational workflows.\nThe API is a REST based API. It is based around a set of concepts:\n\n* Core\n* External Resources\n* Sets and Deltas\n\n## Authentication\n\nAlmost all requests made to the Humanitec API require Authentication. See our [Developer Docs on API Authentication](https://developer.humanitec.com/platform-orchestrator/reference/api-references/#authentication) for instructions.\n\n## Content Types\nAll of the Humanitec API unless explicitly only accepts content types of `application/json` and will always return valid `application/json` or an empty response.\n\n## Response Codes\n### Success\nAny response code in the `2xx` range should be regarded as success.\n\n| **Code** | **Meaning** |\n| --- | --- |\n| `200` | Success |\n| `201` | Success (In future, `201` will be replaced by `200`) |\n| `204` | Success, but no content in response |\n\n_Note: We plan to simplify the interface by replacing 201 with 200 status codes._\n\n### Failure\nAny response code in the `4xx` should be regarded as an error which can be rectified by the client. `5xx` error codes indicate errors that cannot be corrected by the client.\n\n| **Code** | **Meaning** |\n| --- | --- |\n| `400` | General error. (Body will contain details) |\n| `401` | Attempt to access protected resource without `Authorization` Header. |\n| `403` | The `Bearer` or `JWT` does not grant access to the requested resource. |\n| `404` | Resource not found. |\n| `405` | Method not allowed |\n| `409` | Conflict. Usually indicated a resource with that ID already exists. |\n| `422` | Unprocessable Entity. The body was not valid JSON, was empty or contained an object different from what was expected. |\n| `429` | Too many requests - request rate limit has been reached. |\n| `500` | Internal Error. If it occurs repeatedly, contact support. |\n", "contact": { "name": "API Support", @@ -2530,6 +2530,61 @@ } } }, + "/orgs/{orgId}/artefact-versions/convert-score": { + "post": { + "tags": [ + "public", + "ArtefactVersion" + ], + "summary": "Convert a Score specification, optional overrides, and extensions into the contents for a deployment set.", + "operationId": "convertScoreToSet", + "parameters": [ + { + "name": "orgId", + "in": "path", + "description": "The organization ID.", + "required": true, + "example": "sample-org", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The Score specification, optional overrides, and extensions.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConvertScoreToSetBody" + } + } + } + }, + "responses": { + "200": { + "description": "The deployment set contents.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkloadArtefactVersionDeploymentSet" + } + } + } + }, + "400": { + "description": "Either one or more request body parameters are missing or invalid, or the requested payload is not provided or malformed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + } + } + } + }, "/orgs/{orgId}/audit-logs": { "get": { "tags": [ @@ -6880,11 +6935,11 @@ "description": "The account was successfully deleted.\n\n" }, "400": { - "description": "One or more request parameters is missing or invalid.\n\n", + "description": "The Resource Account cannot be deleted as at least one non-deleted Resource Definition or one Active Resource still referencing it.\nIn the error the coordinates of the referencing resources are provided.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HumanitecErrorResponse" + "$ref": "#/components/schemas/ConflictingResourcesErrorResponse" } } } @@ -7423,7 +7478,7 @@ } ], "requestBody": { - "description": "The Resource Definition record details.\n\nThe PATCH operation would change the value of the property if it is included in the request payload JSON, and not `null`. Missing and `null` properties are ignored.\n\nFor the map properties, such as PatchResourceDefinitionRequest.DriverInputs, the merge operation is applied.\n\nMerge rules are as follows:\n\n- If a map property has a value, it is replaced (or added).\n\n- If a map property is set to `null`, it is removed.\n\n- If a map property is not included (missing in JSON), it remains unchanged.\n\nIf driver_type changes and an Active Resource which uses this Resource Definition exists, the resource provisioned with the previous used driver_type will be deleted.", + "description": "The Resource Definition record details.\n\nThe PATCH operation would change the value of the property if it is included in the request payload JSON, and not `null`. Missing and `null` properties are ignored.\n\nFor the map properties, such as PatchResourceDefinitionRequest.DriverInputs, the merge operation is applied.\n\nMerge rules are as follows:\n\n- If a map property has a value, it is replaced (or added).\n\n- If a map property is set to `null`, it is removed.\n\n- If a map property is not included (missing in JSON), it remains unchanged.", "required": true, "content": { "application/json": { @@ -13531,13 +13586,13 @@ } }, "extensions": { - "$ref": "#/components/schemas/CreateWorkloadArtefactVersionExtensions" + "$ref": "#/components/schemas/ScoreHumanitecExtensions" } } } ] }, - "CreateWorkloadArtefactVersionExtensions": { + "ScoreHumanitecExtensions": { "description": "Humanitec workload extensions for the Workload Artefact Version. These can be used to override the profile, or workload module spec and resource attributes.", "required": [ "apiVersion" @@ -13987,6 +14042,52 @@ ], "type": "object" }, + "ConvertScoreToSetBody": { + "description": "Request body for converting a Score manifest to Humanitec deployment set.", + "additionalProperties": false, + "required": [ + "spec" + ], + "properties": { + "spec": { + "type": "object", + "additionalProperties": true, + "description": "A Json object containing the workload specification. Score v1b1 is expected.", + "example": { + "apiVersion": "score.dev/v1b1", + "metadata": { + "name": "hello-world" + } + } + }, + "image": { + "type": "string", + "description": "An optional default image to assign to any containers in the workload that do not have an image set or whose image is '.'", + "example": "busybox:latest" + }, + "overrides": { + "type": "object", + "additionalProperties": true, + "description": "An optional Json object containing the workload overrides. Score v1b1 is expected.", + "example": { + "apiVersion": "score.dev/v1b1", + "profile": "humanitec/default-module" + } + }, + "property_overrides": { + "type": "object", + "additionalProperties": true, + "description": "An optional set of path overrides that will be applied to the workload.", + "example": { + "containers.my-container.image": "busybox:latest", + "containers.my-container.variables.DEBUG": null + } + }, + "extensions": { + "$ref": "#/components/schemas/ScoreHumanitecExtensions" + } + } + }, "AuditLogEntry": { "description": "An entry in the audit log", "required": [ @@ -16250,10 +16351,7 @@ } }, "required": [ - "registry", - "username", - "password", - "secrets" + "registry" ], "type": "object" }, @@ -16911,6 +17009,59 @@ ], "type": "object" }, + "ConflictingResourcesErrorResponse": { + "description": "Represents a standard Humanitec Error with additional details which describe why an action on a specific resource cannot be performed due to some other entities linked to it.\n", + "properties": { + "details": { + "$ref": "#/components/schemas/ConflictingResourcesErrorResponseDetails" + }, + "error": { + "type": "string" + }, + "message": { + "type": "string" + } + }, + "required": [ + "error", + "message", + "details" + ], + "type": "object" + }, + "ConflictingResourcesErrorResponseDetails": { + "description": "Object composed by the list of resources which prevent the deletion of the specified entity. The resources are indexed by their kind.", + "type": "object", + "properties": { + "referencing_resources": { + "$ref": "#/components/schemas/ConflictingResourcesErrorResponseDetailsResources" + } + }, + "required": [ + "referencing_resources" + ], + "additionalProperties": false + }, + "ConflictingResourcesErrorResponseDetailsResources": { + "type": "object", + "properties": { + "resource_definitions": { + "description": "List of non-deleted Resource Definitions referencing the specified Resource Account.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceDefinitionResponse" + } + }, + "active_resources": { + "description": "List of Active Resources referencing the specified Resource Account.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ActiveResourceResponse" + } + } + }, + "additionalProperties": false + }, "ManifestResponse": { "description": "Manifest represents a complete or a partial Kubernetes manifest, and a location for its injection.", "properties": { @@ -17132,7 +17283,6 @@ "description": "PatchResourceDefinitionRequest describes a ResourceDefinition change request.", "example": { "driver_account": "gcp-dev-cloudsql", - "driver_type": "humanitec/terraform", "driver_inputs": { "secret_refs": { "dbcredentials": { @@ -17168,10 +17318,6 @@ "$ref": "#/components/schemas/ValuesSecretsRefsRequest", "description": "(Optional) Additional input data to be passed to the driver." }, - "driver_type": { - "description": "(Optional) The driver to be used to create the resource.", - "type": "string" - }, "name": { "description": "(Optional) Resource display name", "nullable": true, @@ -17246,7 +17392,7 @@ "type": "string" }, "is_used": { - "description": "Indicates if this account is being used (referenced) by any resource definition.", + "description": "Indicates if this account is being used (referenced) by any resource definition or active resource.", "type": "boolean" }, "name": { @@ -19912,6 +20058,7 @@ "ResourceDefinition", "ResourceDefinitionVersion", "ResourceProvision", + "AccountType", "ResourceAccount", "ResourceType", "ResourceClass" @@ -19999,7 +20146,7 @@ }, { "name": "AccountType", - "x-displayName": "Account Types", + "x-displayName": "Resource Account Types", "description": "Resource Account Types define cloud providers or protocols to which a resource account can belong.\n\n" }, {