diff --git a/client/client.gen.go b/client/client.gen.go index 14fef4b..10d333d 100644 --- a/client/client.gen.go +++ b/client/client.gen.go @@ -1434,6 +1434,9 @@ type Key struct { // Fingerprint The Key fingerprint (sha256 hash of the DER representation of the key). Fingerprint string `json:"fingerprint"` + // IsAuthorized If this key has been authorized to be used to validate requests coming from an Agent. + IsAuthorized bool `json:"is_authorized"` + // PublicKey A pcks8 RSA ublic key PEM encoded. PublicKey string `json:"public_key"` } @@ -2356,6 +2359,21 @@ type ResourceDefinitionVersion struct { Type string `json:"type"` } +// ResourceInputsResponse A payload needed to generate a resource graph. +type ResourceInputsResponse struct { + // Class The Resource class. + Class *string `json:"class,omitempty"` + + // Id The Resource ID in the Deployment Set. + Id string `json:"id"` + + // Resource The Resource input parameters specified in the deployment set. + Resource *map[string]interface{} `json:"resource,omitempty"` + + // Type The Resource type. + Type string `json:"type"` +} + // ResourceProvisionRequestRequest ResourceProvisionRequest is the payload passed to the resource provisioner, specifying the resources to be provisioned. type ResourceProvisionRequestRequest struct { // Class (Optional) A resource class @@ -5347,6 +5365,9 @@ type ClientInterface interface { // GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetId request GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetId(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, sourceSetId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetSetResourceInputs request + GetSetResourceInputs(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListUserRolesInApp request ListUserRolesInApp(ctx context.Context, orgId OrgIdPathParam, appId string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -7256,6 +7277,18 @@ func (c *Client) GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetId(ctx context.Conte return c.Client.Do(req) } +func (c *Client) GetSetResourceInputs(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSetResourceInputsRequest(c.Server, orgId, appId, setId) + 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) ListUserRolesInApp(ctx context.Context, orgId OrgIdPathParam, appId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListUserRolesInAppRequest(c.Server, orgId, appId) if err != nil { @@ -14855,6 +14888,54 @@ func NewGetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdRequest(server string, orgI return req, nil } +// NewGetSetResourceInputsRequest generates requests for GetSetResourceInputs +func NewGetSetResourceInputsRequest(server string, orgId OrgIdPathParam, appId AppIdPathParam, setId string) (*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 + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "appId", runtime.ParamLocationPath, appId) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "setId", runtime.ParamLocationPath, setId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/orgs/%s/apps/%s/sets/%s/resources", pathParam0, pathParam1, pathParam2) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewListUserRolesInAppRequest generates requests for ListUserRolesInApp func NewListUserRolesInAppRequest(server string, orgId OrgIdPathParam, appId string) (*http.Request, error) { var err error @@ -21695,6 +21776,9 @@ type ClientWithResponsesInterface interface { // GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdWithResponse request GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, sourceSetId string, reqEditors ...RequestEditorFn) (*GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdResponse, error) + // GetSetResourceInputsWithResponse request + GetSetResourceInputsWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, reqEditors ...RequestEditorFn) (*GetSetResourceInputsResponse, error) + // ListUserRolesInAppWithResponse request ListUserRolesInAppWithResponse(ctx context.Context, orgId OrgIdPathParam, appId string, reqEditors ...RequestEditorFn) (*ListUserRolesInAppResponse, error) @@ -24259,6 +24343,30 @@ func (r GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdResponse) StatusCode() int return 0 } +type GetSetResourceInputsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *[]ResourceInputsResponse + JSON400 *HumanitecErrorResponse + JSON404 *string +} + +// Status returns HTTPResponse.Status +func (r GetSetResourceInputsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetSetResourceInputsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type ListUserRolesInAppResponse struct { Body []byte HTTPResponse *http.Response @@ -28131,6 +28239,15 @@ func (c *ClientWithResponses) GetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdWithR return ParseGetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdResponse(rsp) } +// GetSetResourceInputsWithResponse request returning *GetSetResourceInputsResponse +func (c *ClientWithResponses) GetSetResourceInputsWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, setId string, reqEditors ...RequestEditorFn) (*GetSetResourceInputsResponse, error) { + rsp, err := c.GetSetResourceInputs(ctx, orgId, appId, setId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetSetResourceInputsResponse(rsp) +} + // ListUserRolesInAppWithResponse request returning *ListUserRolesInAppResponse func (c *ClientWithResponses) ListUserRolesInAppWithResponse(ctx context.Context, orgId OrgIdPathParam, appId string, reqEditors ...RequestEditorFn) (*ListUserRolesInAppResponse, error) { rsp, err := c.ListUserRolesInApp(ctx, orgId, appId, reqEditors...) @@ -32826,6 +32943,46 @@ func ParseGetOrgsOrgIdAppsAppIdSetsSetIdDiffSourceSetIdResponse(rsp *http.Respon return response, nil } +// ParseGetSetResourceInputsResponse parses an HTTP response from a GetSetResourceInputsWithResponse call +func ParseGetSetResourceInputsResponse(rsp *http.Response) (*GetSetResourceInputsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetSetResourceInputsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []ResourceInputsResponse + 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 + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest string + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + } + + return response, nil +} + // ParseListUserRolesInAppResponse parses an HTTP response from a ListUserRolesInAppWithResponse call func ParseListUserRolesInAppResponse(rsp *http.Response) (*ListUserRolesInAppResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/docs/openapi.json b/docs/openapi.json index 34efad3..008d8b7 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Humanitec API", - "version": "0.26.23", + "version": "0.26.26", "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\nThe Humanitec API, unless explicitly specified, 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, a new resource was created |\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` range should be regarded as an error that 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": "Humanitec Support", @@ -3577,6 +3577,68 @@ } } }, + "/orgs/{orgId}/apps/{appId}/sets/{setId}/resources": { + "get": { + "tags": [ + "public", + "Set" + ], + "summary": "Get Resource Inputs for the given Deployment Set", + "operationId": "getSetResourceInputs", + "parameters": [ + { + "$ref": "#/components/parameters/orgIdPathParam" + }, + { + "$ref": "#/components/parameters/appIdPathParam" + }, + { + "name": "setId", + "in": "path", + "description": "ID of the Deployment Set.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Resource Inputs of the requested Deployment Set.", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/ResourceInputsResponse" + }, + "type": "array" + } + } + } + }, + "404": { + "description": "No Deployment Set with ID `setId` found in Application.", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid resources in the Deployment Set", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + } + } + } + }, "/orgs/{orgId}/apps/{appId}/sets/{setId}/diff/{sourceSetId}": { "get": { "tags": [ @@ -13183,6 +13245,11 @@ "example": "2022-06-22T09:37:23.523Z", "format": "date-time", "description": "Time when the Key should be replaced (2 years after its creation)." + }, + "is_authorized": { + "type": "boolean", + "description": "If this key has been authorized to be used to validate requests coming from an Agent.", + "example": true } }, "required": [ @@ -13190,7 +13257,8 @@ "public_key", "created_at", "created_by", - "expired_at" + "expired_at", + "is_authorized" ] }, "KeyCreateBody": { @@ -15294,6 +15362,43 @@ ], "type": "object" }, + "ResourceInputsResponse": { + "description": "A payload needed to generate a resource graph.", + "example": { + "class": "cloudsql", + "id": "shared.postgres", + "resource": { + "host": "127.0.0.1", + "name": "my-database" + }, + "type": "postgres" + }, + "properties": { + "id": { + "description": "The Resource ID in the Deployment Set.", + "type": "string" + }, + "type": { + "description": "The Resource type.", + "type": "string" + }, + "class": { + "description": "The Resource class.", + "type": "string" + }, + "resource": { + "description": "The Resource input parameters specified in the deployment set.", + "additionalProperties": true, + "type": "object" + } + }, + "required": [ + "id", + "type" + ], + "type": "object", + "additionalProperties": false + }, "EventBaseRequest": { "description": "Properties which identify an event .", "properties": {