diff --git a/client/client.gen.go b/client/client.gen.go index 5187a35..c075bfe 100644 --- a/client/client.gen.go +++ b/client/client.gen.go @@ -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. @@ -1494,9 +1516,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 +2003,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 +2101,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. @@ -25000,7 +25019,7 @@ func (r CreateResourceAccountResponse) StatusCode() int { type DeleteResourceAccountResponse struct { Body []byte HTTPResponse *http.Response - JSON400 *HumanitecErrorResponse + JSON400 *ConflictingResourcesErrorResponse JSON404 *HumanitecErrorResponse JSON500 *HumanitecErrorResponse } @@ -34151,7 +34170,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..663bd4d 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.10", "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", @@ -6880,11 +6880,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 +7423,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": { @@ -16250,10 +16250,7 @@ } }, "required": [ - "registry", - "username", - "password", - "secrets" + "registry" ], "type": "object" }, @@ -16911,6 +16908,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 +17182,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 +17217,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 +17291,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 +19957,7 @@ "ResourceDefinition", "ResourceDefinitionVersion", "ResourceProvision", + "AccountType", "ResourceAccount", "ResourceType", "ResourceClass" @@ -19999,7 +20045,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" }, {