diff --git a/client/client.gen.go b/client/client.gen.go index 94cc63b..7219504 100644 --- a/client/client.gen.go +++ b/client/client.gen.go @@ -2988,6 +2988,9 @@ type ListPipelineCriteriaInAppParams struct { // CreatePipelineRunByTriggerCriteriaParams defines parameters for CreatePipelineRunByTriggerCriteria. type CreatePipelineRunByTriggerCriteriaParams struct { + // DryRun Optionally validate the request but do not persist the actual Pipeline Run. + DryRun *bool `form:"dry_run,omitempty" json:"dry_run,omitempty"` + // IdempotencyKey The HTTP Idempotency-Key IdempotencyKey *IdempotencyKey `json:"Idempotency-Key,omitempty"` } @@ -3007,6 +3010,12 @@ type ListPipelinesParams struct { Metadata *ByMetadata `json:"metadata,omitempty"` } +// CreatePipelineParams defines parameters for CreatePipeline. +type CreatePipelineParams struct { + // DryRun Optionally validate the request but do not persist the actual Pipeline. + DryRun *bool `form:"dry_run,omitempty" json:"dry_run,omitempty"` +} + // DeletePipelineParams defines parameters for DeletePipeline. type DeletePipelineParams struct { // IfMatch Indicate that the request should only succeed if there is an etag match @@ -3021,6 +3030,9 @@ type GetPipelineParams struct { // UpdatePipelineParams defines parameters for UpdatePipeline. type UpdatePipelineParams struct { + // DryRun Optionally validate the request but do not persist the update. + DryRun *bool `form:"dry_run,omitempty" json:"dry_run,omitempty"` + // IfMatch Indicate that the request should only succeed if there is an etag match IfMatch *IfMatchHeaderParam `json:"If-Match,omitempty"` } @@ -3048,6 +3060,9 @@ type ListPipelineRunsParams struct { // CreatePipelineRunParams defines parameters for CreatePipelineRun. type CreatePipelineRunParams struct { + // DryRun Optionally validate the request but do not persist the actual Pipeline Run. + DryRun *bool `form:"dry_run,omitempty" json:"dry_run,omitempty"` + // IdempotencyKey The HTTP Idempotency-Key IdempotencyKey *IdempotencyKey `json:"Idempotency-Key,omitempty"` } @@ -3289,6 +3304,9 @@ type DeleteOrgsOrgIdResourcesDefsDefIdParams struct { Force *bool `form:"force,omitempty" json:"force,omitempty"` } +// PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONBody defines parameters for PutOrgsOrgIdResourcesDefsDefIdCriteria. +type PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONBody = []MatchingCriteriaRuleRequest + // DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams defines parameters for DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId. type DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams struct { // Force If set to `true`, the Matching Criteria is deleted immediately, even if this action affects existing Active Resources. @@ -3490,6 +3508,9 @@ type PutOrgsOrgIdResourcesDefsDefIdJSONRequestBody = UpdateResourceDefinitionReq // PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody defines body for PostOrgsOrgIdResourcesDefsDefIdCriteria for application/json ContentType. type PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody = MatchingCriteriaRuleRequest +// PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody defines body for PutOrgsOrgIdResourcesDefsDefIdCriteria for application/json ContentType. +type PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody = PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONBody + // PostOrgsOrgIdResourcesDriversJSONRequestBody defines body for PostOrgsOrgIdResourcesDrivers for application/json ContentType. type PostOrgsOrgIdResourcesDriversJSONRequestBody = CreateDriverRequestRequest @@ -4550,7 +4571,7 @@ type ClientInterface interface { ListPipelines(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *ListPipelinesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreatePipelineWithBody request with any body - CreatePipelineWithBody(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + CreatePipelineWithBody(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *CreatePipelineParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // DeletePipeline request DeletePipeline(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, pipelineId PipelineIdPathParam, params *DeletePipelineParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -4901,6 +4922,11 @@ type ClientInterface interface { PostOrgsOrgIdResourcesDefsDefIdCriteria(ctx context.Context, orgId string, defId string, body PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBody request with any body + PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBody(ctx context.Context, orgId string, defId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PutOrgsOrgIdResourcesDefsDefIdCriteria(ctx context.Context, orgId string, defId string, body PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId request DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId(ctx context.Context, orgId string, defId string, criteriaId string, params *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -5007,9 +5033,6 @@ type ClientInterface interface { // DeleteTokensTokenId request DeleteTokensTokenId(ctx context.Context, tokenId string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetUsersMe request - GetUsersMe(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetUsersUserIdTokens request GetUsersUserIdTokens(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -5925,8 +5948,8 @@ func (c *Client) ListPipelines(ctx context.Context, orgId OrgIdPathParam, appId return c.Client.Do(req) } -func (c *Client) CreatePipelineWithBody(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreatePipelineRequestWithBody(c.Server, orgId, appId, contentType, body) +func (c *Client) CreatePipelineWithBody(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *CreatePipelineParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreatePipelineRequestWithBody(c.Server, orgId, appId, params, contentType, body) if err != nil { return nil, err } @@ -7449,6 +7472,30 @@ func (c *Client) PostOrgsOrgIdResourcesDefsDefIdCriteria(ctx context.Context, or return c.Client.Do(req) } +func (c *Client) PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBody(ctx context.Context, orgId string, defId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequestWithBody(c.Server, orgId, defId, 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) PutOrgsOrgIdResourcesDefsDefIdCriteria(ctx context.Context, orgId string, defId string, body PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequest(c.Server, orgId, defId, 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) DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId(ctx context.Context, orgId string, defId string, criteriaId string, params *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdRequest(c.Server, orgId, defId, criteriaId, params) if err != nil { @@ -7905,18 +7952,6 @@ func (c *Client) DeleteTokensTokenId(ctx context.Context, tokenId string, reqEdi return c.Client.Do(req) } -func (c *Client) GetUsersMe(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetUsersMeRequest(c.Server) - 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) GetUsersUserIdTokens(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetUsersUserIdTokensRequest(c.Server, userId) if err != nil { @@ -10889,6 +10924,28 @@ func NewCreatePipelineRunByTriggerCriteriaRequestWithBody(server string, orgId O return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.DryRun != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "dry_run", runtime.ParamLocationQuery, *params.DryRun); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err @@ -11026,7 +11083,7 @@ func NewListPipelinesRequest(server string, orgId OrgIdPathParam, appId AppIdPat } // NewCreatePipelineRequestWithBody generates requests for CreatePipeline with any type of body -func NewCreatePipelineRequestWithBody(server string, orgId OrgIdPathParam, appId AppIdPathParam, contentType string, body io.Reader) (*http.Request, error) { +func NewCreatePipelineRequestWithBody(server string, orgId OrgIdPathParam, appId AppIdPathParam, params *CreatePipelineParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -11058,6 +11115,28 @@ func NewCreatePipelineRequestWithBody(server string, orgId OrgIdPathParam, appId return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.DryRun != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "dry_run", runtime.ParamLocationQuery, *params.DryRun); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err @@ -11241,6 +11320,28 @@ func NewUpdatePipelineRequestWithBody(server string, orgId OrgIdPathParam, appId return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.DryRun != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "dry_run", runtime.ParamLocationQuery, *params.DryRun); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("PATCH", queryURL.String(), body) if err != nil { return nil, err @@ -11583,6 +11684,28 @@ func NewCreatePipelineRunRequestWithBody(server string, orgId OrgIdPathParam, ap return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.DryRun != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "dry_run", runtime.ParamLocationQuery, *params.DryRun); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err @@ -16816,6 +16939,60 @@ func NewPostOrgsOrgIdResourcesDefsDefIdCriteriaRequestWithBody(server string, or return req, nil } +// NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequest calls the generic PutOrgsOrgIdResourcesDefsDefIdCriteria builder with application/json body +func NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequest(server string, orgId string, defId string, body PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequestWithBody(server, orgId, defId, "application/json", bodyReader) +} + +// NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequestWithBody generates requests for PutOrgsOrgIdResourcesDefsDefIdCriteria with any type of body +func NewPutOrgsOrgIdResourcesDefsDefIdCriteriaRequestWithBody(server string, orgId string, defId 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 + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "defId", runtime.ParamLocationPath, defId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/orgs/%s/resources/defs/%s/criteria", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewDeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdRequest generates requests for DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId func NewDeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdRequest(server string, orgId string, defId string, criteriaId string, params *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams) (*http.Request, error) { var err error @@ -18206,33 +18383,6 @@ func NewDeleteTokensTokenIdRequest(server string, tokenId string) (*http.Request return req, nil } -// NewGetUsersMeRequest generates requests for GetUsersMe -func NewGetUsersMeRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/users/me") - 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 -} - // NewGetUsersUserIdTokensRequest generates requests for GetUsersUserIdTokens func NewGetUsersUserIdTokensRequest(server string, userId string) (*http.Request, error) { var err error @@ -18642,7 +18792,7 @@ type ClientWithResponsesInterface interface { ListPipelinesWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *ListPipelinesParams, reqEditors ...RequestEditorFn) (*ListPipelinesResponse, error) // CreatePipelineWithBodyWithResponse request with any body - CreatePipelineWithBodyWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePipelineResponse, error) + CreatePipelineWithBodyWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *CreatePipelineParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePipelineResponse, error) // DeletePipelineWithResponse request DeletePipelineWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, pipelineId PipelineIdPathParam, params *DeletePipelineParams, reqEditors ...RequestEditorFn) (*DeletePipelineResponse, error) @@ -18993,6 +19143,11 @@ type ClientWithResponsesInterface interface { PostOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse(ctx context.Context, orgId string, defId string, body PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*PostOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) + // PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBodyWithResponse request with any body + PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBodyWithResponse(ctx context.Context, orgId string, defId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) + + PutOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse(ctx context.Context, orgId string, defId string, body PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) + // DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse request DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse(ctx context.Context, orgId string, defId string, criteriaId string, params *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams, reqEditors ...RequestEditorFn) (*DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdResponse, error) @@ -19099,9 +19254,6 @@ type ClientWithResponsesInterface interface { // DeleteTokensTokenIdWithResponse request DeleteTokensTokenIdWithResponse(ctx context.Context, tokenId string, reqEditors ...RequestEditorFn) (*DeleteTokensTokenIdResponse, error) - // GetUsersMeWithResponse request - GetUsersMeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetUsersMeResponse, error) - // GetUsersUserIdTokensWithResponse request GetUsersUserIdTokensWithResponse(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*GetUsersUserIdTokensResponse, error) @@ -22621,6 +22773,7 @@ type PostOrgsOrgIdResourcesDefsDefIdCriteriaResponse struct { HTTPResponse *http.Response JSON200 *MatchingCriteriaResponse JSON400 *HumanitecErrorResponse + JSON404 *HumanitecErrorResponse JSON409 *HumanitecErrorResponse JSON500 *HumanitecErrorResponse } @@ -22641,6 +22794,32 @@ func (r PostOrgsOrgIdResourcesDefsDefIdCriteriaResponse) StatusCode() int { return 0 } +type PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *[]MatchingCriteriaResponse + JSON400 *HumanitecErrorResponse + JSON404 *HumanitecErrorResponse + JSON409 *HumanitecErrorResponse + JSON500 *HumanitecErrorResponse +} + +// Status returns HTTPResponse.Status +func (r PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdResponse struct { Body []byte HTTPResponse *http.Response @@ -23334,28 +23513,6 @@ func (r DeleteTokensTokenIdResponse) StatusCode() int { return 0 } -type GetUsersMeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *map[string]interface{} -} - -// Status returns HTTPResponse.Status -func (r GetUsersMeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetUsersMeResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - type GetUsersUserIdTokensResponse struct { Body []byte HTTPResponse *http.Response @@ -24097,8 +24254,8 @@ func (c *ClientWithResponses) ListPipelinesWithResponse(ctx context.Context, org } // CreatePipelineWithBodyWithResponse request with arbitrary body returning *CreatePipelineResponse -func (c *ClientWithResponses) CreatePipelineWithBodyWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePipelineResponse, error) { - rsp, err := c.CreatePipelineWithBody(ctx, orgId, appId, contentType, body, reqEditors...) +func (c *ClientWithResponses) CreatePipelineWithBodyWithResponse(ctx context.Context, orgId OrgIdPathParam, appId AppIdPathParam, params *CreatePipelineParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePipelineResponse, error) { + rsp, err := c.CreatePipelineWithBody(ctx, orgId, appId, params, contentType, body, reqEditors...) if err != nil { return nil, err } @@ -25210,6 +25367,23 @@ func (c *ClientWithResponses) PostOrgsOrgIdResourcesDefsDefIdCriteriaWithRespons return ParsePostOrgsOrgIdResourcesDefsDefIdCriteriaResponse(rsp) } +// PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBodyWithResponse request with arbitrary body returning *PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse +func (c *ClientWithResponses) PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBodyWithResponse(ctx context.Context, orgId string, defId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) { + rsp, err := c.PutOrgsOrgIdResourcesDefsDefIdCriteriaWithBody(ctx, orgId, defId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutOrgsOrgIdResourcesDefsDefIdCriteriaResponse(rsp) +} + +func (c *ClientWithResponses) PutOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse(ctx context.Context, orgId string, defId string, body PutOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody, reqEditors ...RequestEditorFn) (*PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) { + rsp, err := c.PutOrgsOrgIdResourcesDefsDefIdCriteria(ctx, orgId, defId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutOrgsOrgIdResourcesDefsDefIdCriteriaResponse(rsp) +} + // DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse request returning *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdResponse func (c *ClientWithResponses) DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse(ctx context.Context, orgId string, defId string, criteriaId string, params *DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams, reqEditors ...RequestEditorFn) (*DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdResponse, error) { rsp, err := c.DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaId(ctx, orgId, defId, criteriaId, params, reqEditors...) @@ -25544,15 +25718,6 @@ func (c *ClientWithResponses) DeleteTokensTokenIdWithResponse(ctx context.Contex return ParseDeleteTokensTokenIdResponse(rsp) } -// GetUsersMeWithResponse request returning *GetUsersMeResponse -func (c *ClientWithResponses) GetUsersMeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetUsersMeResponse, error) { - rsp, err := c.GetUsersMe(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetUsersMeResponse(rsp) -} - // GetUsersUserIdTokensWithResponse request returning *GetUsersUserIdTokensResponse func (c *ClientWithResponses) GetUsersUserIdTokensWithResponse(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*GetUsersUserIdTokensResponse, error) { rsp, err := c.GetUsersUserIdTokens(ctx, userId, reqEditors...) @@ -31010,6 +31175,67 @@ func ParsePostOrgsOrgIdResourcesDefsDefIdCriteriaResponse(rsp *http.Response) (* } response.JSON400 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest HumanitecErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest HumanitecErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest HumanitecErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePutOrgsOrgIdResourcesDefsDefIdCriteriaResponse parses an HTTP response from a PutOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse call +func ParsePutOrgsOrgIdResourcesDefsDefIdCriteriaResponse(rsp *http.Response) (*PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PutOrgsOrgIdResourcesDefsDefIdCriteriaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []MatchingCriteriaResponse + 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 HumanitecErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest HumanitecErrorResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -32037,32 +32263,6 @@ func ParseDeleteTokensTokenIdResponse(rsp *http.Response) (*DeleteTokensTokenIdR return response, nil } -// ParseGetUsersMeResponse parses an HTTP response from a GetUsersMeWithResponse call -func ParseGetUsersMeResponse(rsp *http.Response) (*GetUsersMeResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetUsersMeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest map[string]interface{} - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - // ParseGetUsersUserIdTokensResponse parses an HTTP response from a GetUsersUserIdTokensWithResponse call func ParseGetUsersUserIdTokensResponse(rsp *http.Response) (*GetUsersUserIdTokensResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/docs/openapi.json b/docs/openapi.json index 8667c96..152aaeb 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Humanitec API", - "version": "0.24.6", + "version": "0.24.7", "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\nAlmost all requests made to the Humanitec API require Authentication. Humanitec provides 2 ways of authenticating with the API: `Bearer` and `JWT`.\n\n### Bearer Authentication\nThis form of authentication makes use of a **static token**. It is intended to be used when machines interact with the Humanitec API. Bearer tokens should be used for very narrow purposes. This allows for the token to be revoked if it is compromised and so limit the scope of exposure.\nNew Bearer tokens can be obtained via the UI:\n\n1. Log into Humanitec at https://app.humanitec.io\n1. Go to **Organization Settings**\n1. Select **API tokens**\n1. Enter a *name* for the new token and click on **Generate new token**\n\nThe token is passed to the API via the `Authorization` header. Assuming the issued token is `HUMANITEC_TOKEN`, the request could be made as follows:\n\n```\n curl -H 'Authorization: Bearer HUMANITEC_TOKEN' https://api.humanitec.io/orgs/my-org/apps\n```\n\n### JWT Authentication\nThis form of authentication makes use of a **JSON Web Token (JWT)**. It is intended to be used when humans interact with the Humanitec API. JWTs expire after a period of time. This means that a new JWT will need to be generated regularly. This makes them well suited to working in short sessions, but not for automation. (See Bearer Authentication.)\nThe token is passed to the API via the `Authorization` header. Assuming the issued token is `HUMANITEC_JWT`, the request could be made as follows:\n\n```\n curl -H 'Authorization: JWT HUMANITEC_JWT' https://api.humanitec.io/orgs/my-org/apps\n```\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", @@ -4477,6 +4477,15 @@ }, { "$ref": "#/components/parameters/appIdPathParam" + }, + { + "name": "dry_run", + "in": "query", + "description": "Optionally validate the request but do not persist the actual Pipeline.", + "example": false, + "schema": { + "type": "boolean" + } } ], "requestBody": { @@ -4505,6 +4514,9 @@ } } }, + "204": { + "description": "The request was valid, but no Pipeline was created." + }, "400": { "$ref": "#/components/responses/400BadRequest" }, @@ -4582,6 +4594,15 @@ }, { "$ref": "#/components/parameters/ifMatchHeaderParam" + }, + { + "name": "dry_run", + "in": "query", + "description": "Optionally validate the request but do not persist the update.", + "example": false, + "schema": { + "type": "boolean" + } } ], "requestBody": { @@ -4610,6 +4631,9 @@ } } }, + "204": { + "description": "The request was valid, but no Pipeline was updated." + }, "400": { "$ref": "#/components/responses/400BadRequest" }, @@ -5066,6 +5090,15 @@ }, { "$ref": "#/components/parameters/idempotencyKey" + }, + { + "name": "dry_run", + "in": "query", + "description": "Optionally validate the request but do not persist the actual Pipeline Run.", + "example": false, + "schema": { + "type": "boolean" + } } ], "requestBody": { @@ -5094,6 +5127,9 @@ } } }, + "204": { + "description": "The request was valid and matched a Pipeline, but not Pipeline Run was persisted." + }, "400": { "$ref": "#/components/responses/400BadRequest" }, @@ -5195,6 +5231,15 @@ }, { "$ref": "#/components/parameters/idempotencyKey" + }, + { + "name": "dry_run", + "in": "query", + "description": "Optionally validate the request but do not persist the actual Pipeline Run.", + "example": false, + "schema": { + "type": "boolean" + } } ], "requestBody": { @@ -5223,6 +5268,9 @@ } } }, + "204": { + "description": "The request was valid, but no Pipeline Run was created." + }, "400": { "$ref": "#/components/responses/400BadRequest" }, @@ -7281,6 +7329,109 @@ } }, "/orgs/{orgId}/resources/defs/{defId}/criteria": { + "put": { + "tags": [ + "public", + "ResourceDefinition", + "MatchingCriteria" + ], + "summary": "Update all Matching Criteria of a Resource Definition.", + "description": "Matching Criteria are combined with Resource Type to select a specific definition. Matching Criteria can be set for any combination of Application ID, Environment ID, Environment Type, and Resource ID. In the event of multiple matches, the most specific match is chosen.\n\nFor example, given 3 sets of matching criteria for the same type:\n\n```\n 1. {\"env_type\":\"test\"}\n 2. {\"env_type\":\"development\"}\n 3. {\"env_type\":\"test\", \"app_id\":\"my-app\"}\n```\n\nIf, a resource of that type was needed in an Application `my-app`, Environment `qa-team` with Type `test` and Resource ID `modules.my-module-externals.my-resource`, there would be two resource definitions matching the criteria: #1 & #3. Definition #3 will be chosen because its matching criteria is the most specific.", + "parameters": [ + { + "name": "orgId", + "in": "path", + "description": "The Organization ID.\n\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "defId", + "in": "path", + "description": "The Resource Definition ID.\n\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Matching Criteria rules.\n\n", + "required": true, + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/MatchingCriteriaRuleRequest" + }, + "type": "array" + }, + "example": [ + { + "env_id": "production" + } + ] + } + } + }, + "responses": { + "200": { + "description": "The newly added Matching Criteria details.\n\n", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/MatchingCriteriaResponse" + }, + "type": "array" + } + } + } + }, + "400": { + "description": "One or more request parameters is missing or invalid.\n\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + }, + "404": { + "description": "The Resource Definition is not found.\n\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + }, + "409": { + "description": "A Matching Criteria already exists.\n\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + }, + "500": { + "description": "Internal application error.\n\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + } + } + }, "post": { "tags": [ "public", @@ -7288,7 +7439,7 @@ "MatchingCriteria" ], "summary": "Add a new Matching Criteria to a Resource Definition.", - "description": "Matching Criteria are combined with Resource Type to select a specific definition. Matching Criteria can be set for any combination of Application ID, Environment ID, Environment Type, and Resource ID. In the event of multiple matches, the most specific match is chosen.\n\nFor example, given 3 sets of matching criteria for the same type:\n\n```\n 1. {\"env_type\":\"test\"}\n 2. {\"env_type\":\"development\"}\n 3. {\"env_type\":\"test\", \"app_id\":\"my-app\"}\n```\n\nIf, a resource of that time was needed in an Application `my-app`, Environment `qa-team` with Type `test` and Resource ID `modules.my-module-externals.my-resource`, there would be two resource definitions matching the criteria: #1 & #3. Definition #3 will be chosen because its matching criteria is the most specific.", + "description": "Matching Criteria are combined with Resource Type to select a specific definition. Matching Criteria can be set for any combination of Application ID, Environment ID, Environment Type, and Resource ID. In the event of multiple matches, the most specific match is chosen.\n\nFor example, given 3 sets of matching criteria for the same type:\n\n```\n 1. {\"env_type\":\"test\"}\n 2. {\"env_type\":\"development\"}\n 3. {\"env_type\":\"test\", \"app_id\":\"my-app\"}\n```\n\nIf, a resource of that type was needed in an Application `my-app`, Environment `qa-team` with Type `test` and Resource ID `modules.my-module-externals.my-resource`, there would be two resource definitions matching the criteria: #1 & #3. Definition #3 will be chosen because its matching criteria is the most specific.", "parameters": [ { "name": "orgId", @@ -7344,6 +7495,16 @@ } } }, + "404": { + "description": "The Resource Definition is not found.\n\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HumanitecErrorResponse" + } + } + } + }, "409": { "description": "A Matching Criteria already exists.\n\n", "content": { @@ -8982,34 +9143,6 @@ } } }, - "/users/me": { - "get": { - "tags": [ - "public", - "UserProfile" - ], - "summary": "DEPRECATED", - "responses": { - "200": { - "description": "The extended user profile of the user.\n\n", - "content": { - "application/json": { - "schema": { - "additionalProperties": true, - "type": "object" - } - } - } - }, - "401": { - "description": "No token supplied.\n\n" - }, - "403": { - "description": "Token is not valid for a user.\n\n" - } - } - } - }, "/users/{userId}/tokens": { "get": { "tags": [ @@ -11793,9 +11926,7 @@ ], "type": "object", "example": { - "object": "/orgs/my-org", - "role": "manager", - "error": "Could not validate token.", + "error": "API-000", "message": "Could not validate token." } },