From 6ef5277c6eda364394b31ac1a1d2758dd057e43a Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee <97532027+rajarshee-harness@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:40:16 +0530 Subject: [PATCH] feat: [CCM-19504]: Onboard Governance Rule APIs (#575) * feat: [CCM-19504]: Onboard Governance Rule APIs * feat: [CCM-19504]: Onboard Governance Rule APIs * feat: [CCM-19504]: Onboard Governance Rule APIs --- harness/nextgen/api_rule.go | 1510 +++++++++++++++++ harness/nextgen/client.go | 3 + harness/nextgen/model_ccm_rule.go | 56 + harness/nextgen/model_clone_rule_dto.go | 14 + harness/nextgen/model_create_rule_dto.go | 14 + .../model_governance_adhoc_enqueue_dtov2.go | 21 + harness/nextgen/model_list_dto.go | 14 + .../model_response_dto_map_string_string.go | 17 + harness/nextgen/model_response_dto_rule.go | 17 + .../nextgen/model_response_dto_rule_list.go | 17 + harness/nextgen/model_rule_clone.go | 15 + harness/nextgen/model_rule_list.go | 18 + harness/nextgen/model_rule_request.go | 42 + .../nextgen/model_sub_rule_policy_details.go | 17 + 14 files changed, 1775 insertions(+) create mode 100644 harness/nextgen/api_rule.go create mode 100644 harness/nextgen/model_ccm_rule.go create mode 100644 harness/nextgen/model_clone_rule_dto.go create mode 100644 harness/nextgen/model_create_rule_dto.go create mode 100644 harness/nextgen/model_governance_adhoc_enqueue_dtov2.go create mode 100644 harness/nextgen/model_list_dto.go create mode 100644 harness/nextgen/model_response_dto_map_string_string.go create mode 100644 harness/nextgen/model_response_dto_rule.go create mode 100644 harness/nextgen/model_response_dto_rule_list.go create mode 100644 harness/nextgen/model_rule_clone.go create mode 100644 harness/nextgen/model_rule_list.go create mode 100644 harness/nextgen/model_rule_request.go create mode 100644 harness/nextgen/model_sub_rule_policy_details.go diff --git a/harness/nextgen/api_rule.go b/harness/nextgen/api_rule.go new file mode 100644 index 00000000..abd51ae0 --- /dev/null +++ b/harness/nextgen/api_rule.go @@ -0,0 +1,1510 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type RuleApiService service + +/* +RuleApiService Clone a rule +Clone a Rule with the given ID. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param body Request body containing Rule uuid + - @param accountIdentifier Account Identifier for the Entity. + +@return ResponseDtoRule +*/ +func (a *RuleApiService) CloneRule(ctx context.Context, body CloneRuleDto, accountIdentifier string) (ResponseDtoRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/ruleClone" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService List resources for which cost co-relation is supported. +List resources for which cost co-relation is supported. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param accountIdentifier Account Identifier for the Entity. + +@return ResponseDtoSetString +*/ +func (a *RuleApiService) CostCoRelationSupportedResources(ctx context.Context, accountIdentifier string) (ResponseDtoSetString, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoSetString + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule/costCoRelationSupportedResources" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoSetString + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService Add a rule +Create a new governance rule. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param body Request body containing Rule object + - @param accountIdentifier Account Identifier for the Entity. + +@return ResponseDtoRule +*/ +func (a *RuleApiService) CreateNewRule(ctx context.Context, body CreateRuleDto, accountIdentifier string) (ResponseDtoRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService Delete a rule +Delete a Rule with the given ID. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param accountIdentifier Account Identifier for the Entity. + - @param ruleID Unique identifier for the rule + +@return ResponseDtoBoolean +*/ +func (a *RuleApiService) DeleteRule(ctx context.Context, accountIdentifier string, ruleID string) (ResponseDtoBoolean, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoBoolean + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule/{ruleID}" + localVarPath = strings.Replace(localVarPath, "{"+"ruleID"+"}", fmt.Sprintf("%v", ruleID), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoBoolean + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* + RuleApiService Fetch rules for account + Fetch rules + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Request body containing rule object + * @param accountIdentifier Account Identifier for the Entity. + * @param optional nil or *RuleApiGetPoliciesOpts - Optional Parameters: + * @param "RuleNamePattern" (optional.String) - Search by Rule name pattern + @return ResponseDtoRuleList +*/ + +type RuleApiGetPoliciesOpts struct { + RuleNamePattern optional.String +} + +func (a *RuleApiService) GetPolicies(ctx context.Context, body ListDto, accountIdentifier string, localVarOptionals *RuleApiGetPoliciesOpts) (ResponseDtoRuleList, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoRuleList + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule/list" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + if localVarOptionals != nil && localVarOptionals.RuleNamePattern.IsSet() { + localVarQueryParams.Add("RuleNamePattern", parameterToString(localVarOptionals.RuleNamePattern.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoRuleList + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* + RuleApiService Custodian Schema + Get custodian schema for governance rule validation + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accountIdentifier + * @param optional nil or *RuleApiGovernanceRuleSchemaOpts - Optional Parameters: + * @param "ProjectIdentifier" (optional.String) - + * @param "OrgIdentifier" (optional.String) - + @return ResponseDtoString +*/ + +type RuleApiGovernanceRuleSchemaOpts struct { + ProjectIdentifier optional.String + OrgIdentifier optional.String +} + +func (a *RuleApiService) GovernanceRuleSchema(ctx context.Context, accountIdentifier string, localVarOptionals *RuleApiGovernanceRuleSchemaOpts) (ResponseDtoString, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoString + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/ruleSchema" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + if localVarOptionals != nil && localVarOptionals.ProjectIdentifier.IsSet() { + localVarQueryParams.Add("projectIdentifier", parameterToString(localVarOptionals.ProjectIdentifier.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OrgIdentifier.IsSet() { + localVarQueryParams.Add("orgIdentifier", parameterToString(localVarOptionals.OrgIdentifier.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoString + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* + RuleApiService Governance Targets + Get targets with governance enabled and valid permission + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accountIdentifier Account Identifier for the Entity. + * @param cloudProvider Cloud Provider + * @param optional nil or *RuleApiGovernanceTargetListOpts - Optional Parameters: + * @param "View" (optional.Bool) - View governance target list + * @param "OnlyTargetIds" (optional.Bool) - Only Target ids + @return ResponseDtoMapStringString +*/ + +type RuleApiGovernanceTargetListOpts struct { + View optional.Bool + OnlyTargetIds optional.Bool +} + +func (a *RuleApiService) GovernanceTargetList(ctx context.Context, accountIdentifier string, cloudProvider string, localVarOptionals *RuleApiGovernanceTargetListOpts) (ResponseDtoMapStringString, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoMapStringString + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/governanceTargetList" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + if localVarOptionals != nil && localVarOptionals.View.IsSet() { + localVarQueryParams.Add("view", parameterToString(localVarOptionals.View.Value(), "")) + } + localVarQueryParams.Add("cloudProvider", parameterToString(cloudProvider, "")) + if localVarOptionals != nil && localVarOptionals.OnlyTargetIds.IsSet() { + localVarQueryParams.Add("onlyTargetIds", parameterToString(localVarOptionals.OnlyTargetIds.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoMapStringString + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService List of Regions for Aws/Azure +List Aws/Azure Regions for filtering resources. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param accountIdentifier Account Identifier for the Entity. + - @param cloudProvider Cloud Provider + +@return ResponseDtoListString +*/ +func (a *RuleApiService) Regions(ctx context.Context, accountIdentifier string, cloudProvider string) (ResponseDtoListString, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoListString + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/regions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + localVarQueryParams.Add("cloudProvider", parameterToString(cloudProvider, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoListString + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* + RuleApiService Simple Request to enqueue rule for execution + Simple Request to enqueue rule for execution + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Request body for queuing the governance rule for execution + * @param optional nil or *RuleApiSimpleEnqueueAdhocGovernanceRuleOpts - Optional Parameters: + * @param "AccountIdentifier" (optional.String) - Account Identifier for the Entity. + +*/ + +type RuleApiSimpleEnqueueAdhocGovernanceRuleOpts struct { + AccountIdentifier optional.String +} + +func (a *RuleApiService) SimpleEnqueueAdhocGovernanceRule(ctx context.Context, body GovernanceAdhocEnqueueDtov2, localVarOptionals *RuleApiSimpleEnqueueAdhocGovernanceRuleOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/enqueueAdhocV2" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.AccountIdentifier.IsSet() { + localVarQueryParams.Add("accountIdentifier", parameterToString(localVarOptionals.AccountIdentifier.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* + RuleApiService Enable/Disable a custom Rule to be considered for recommendation + Toggle a Rule for Recommendation + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accountIdentifier Account Identifier for the Entity. + * @param optional nil or *RuleApiToggleForRecommendationOpts - Optional Parameters: + * @param "RuleId" (optional.String) - Rule Id + * @param "EnableRuleForRecommendation" (optional.Bool) - Enable rule for Recommendation + @return ResponseDtoRule +*/ + +type RuleApiToggleForRecommendationOpts struct { + RuleId optional.String + EnableRuleForRecommendation optional.Bool +} + +func (a *RuleApiService) ToggleForRecommendation(ctx context.Context, accountIdentifier string, localVarOptionals *RuleApiToggleForRecommendationOpts) (ResponseDtoRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule/toggleForRecommendation" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + if localVarOptionals != nil && localVarOptionals.RuleId.IsSet() { + localVarQueryParams.Add("ruleId", parameterToString(localVarOptionals.RuleId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnableRuleForRecommendation.IsSet() { + localVarQueryParams.Add("enableRuleForRecommendation", parameterToString(localVarOptionals.EnableRuleForRecommendation.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService Update a Rule +Update a Rule + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param body Request body containing rule object + - @param accountIdentifier Account Identifier for the Entity. + +@return ResponseDtoRule +*/ +func (a *RuleApiService) UpdateRule(ctx context.Context, body CreateRuleDto, accountIdentifier string) (ResponseDtoRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ResponseDtoRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/rule" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleApiService Validate Governance Rule +Validate governance rule for syntactical errors. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param body Request body containing Rule with set rulesYaml to validate + - @param accountIdentifier Account Identifier for the Entity. +*/ +func (a *RuleApiService) ValidateGovernanceRule(ctx context.Context, body CreateRuleDto, accountIdentifier string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ccm/api/governance/ruleValidate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/yaml"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v CcmError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/harness/nextgen/client.go b/harness/nextgen/client.go index 530e1e50..c95ef139 100644 --- a/harness/nextgen/client.go +++ b/harness/nextgen/client.go @@ -168,6 +168,8 @@ type APIClient struct { RolesApi *RolesApiService + RuleApi *RuleApiService + RuleEnforcementApi *RuleEnforcementApiService SCIMApi *SCIMApiService @@ -298,6 +300,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.RepositoryCredentialsApi = (*RepositoryCredentialsApiService)(&c.common) c.RoleAssignmentsApi = (*RoleAssignmentsApiService)(&c.common) c.RolesApi = (*RolesApiService)(&c.common) + c.RuleApi = (*RuleApiService)(&c.common) c.RuleEnforcementApi = (*RuleEnforcementApiService)(&c.common) c.SCIMApi = (*SCIMApiService)(&c.common) c.SCMApi = (*SCMApiService)(&c.common) diff --git a/harness/nextgen/model_ccm_rule.go b/harness/nextgen/model_ccm_rule.go new file mode 100644 index 00000000..df25bc2f --- /dev/null +++ b/harness/nextgen/model_ccm_rule.go @@ -0,0 +1,56 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +// This object will contain the complete definition of a Cloud Cost Policies +type CcmRule struct { + // unique id + Uuid string `json:"uuid,omitempty"` + // account id + AccountId string `json:"accountId,omitempty"` + // name + Name string `json:"name,omitempty"` + // Description of the entity + Description string `json:"description,omitempty"` + // Get YAML of the policy + RulesYaml string `json:"rulesYaml,omitempty"` + // Tags + Tags []string `json:"tags,omitempty"` + // Organization Identifier for the Entity. + OrgIdentifier string `json:"orgIdentifier,omitempty"` + // Project Identifier for the Entity. + ProjectIdentifier string `json:"projectIdentifier,omitempty"` + // cloudProvider + CloudProvider string `json:"cloudProvider,omitempty"` + // versionLabel + VersionLabel string `json:"versionLabel,omitempty"` + // isStablePolicy + IsStablePolicy bool `json:"isStablePolicy,omitempty"` + // storeType + StoreType string `json:"storeType,omitempty"` + // isOOTB + IsOOTB bool `json:"isOOTB"` + // deleted + Deleted bool `json:"deleted,omitempty"` + // forRecommendation + ForRecommendation bool `json:"forRecommendation,omitempty"` + // resourceType + ResourceType string `json:"resourceType,omitempty"` + // isMultiPolicyRule + IsMultiPolicyRule bool `json:"isMultiPolicyRule,omitempty"` + // subRulePolicyDetails + SubRulePolicyDetails []SubRulePolicyDetails `json:"subRulePolicyDetails,omitempty"` + // Time at which the entity was created + CreatedAt int64 `json:"createdAt,omitempty"` + // Time at which the entity was last updated + LastUpdatedAt int64 `json:"lastUpdatedAt,omitempty"` + CreatedBy *EmbeddedUser `json:"createdBy,omitempty"` + LastUpdatedBy *EmbeddedUser `json:"lastUpdatedBy,omitempty"` +} diff --git a/harness/nextgen/model_clone_rule_dto.go b/harness/nextgen/model_clone_rule_dto.go new file mode 100644 index 00000000..52d7da07 --- /dev/null +++ b/harness/nextgen/model_clone_rule_dto.go @@ -0,0 +1,14 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type CloneRuleDto struct { + RuleClone *RuleClone `json:"ruleClone,omitempty"` +} diff --git a/harness/nextgen/model_create_rule_dto.go b/harness/nextgen/model_create_rule_dto.go new file mode 100644 index 00000000..f25afca3 --- /dev/null +++ b/harness/nextgen/model_create_rule_dto.go @@ -0,0 +1,14 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type CreateRuleDto struct { + Rule *CcmRule `json:"rule,omitempty"` +} diff --git a/harness/nextgen/model_governance_adhoc_enqueue_dtov2.go b/harness/nextgen/model_governance_adhoc_enqueue_dtov2.go new file mode 100644 index 00000000..d7f0136a --- /dev/null +++ b/harness/nextgen/model_governance_adhoc_enqueue_dtov2.go @@ -0,0 +1,21 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type GovernanceAdhocEnqueueDtov2 struct { + // Target account_id/subscription_id/project_id + TargetAccounts []string `json:"targetAccounts"` + // Target region required for AWS/AZURE + TargetRegions []string `json:"targetRegions,omitempty"` + // Rule id/uuid + RuleId string `json:"ruleId"` + // Set to true for dry run or false for actual run + IsDryRun bool `json:"isDryRun,omitempty"` +} diff --git a/harness/nextgen/model_list_dto.go b/harness/nextgen/model_list_dto.go new file mode 100644 index 00000000..99d3c3fc --- /dev/null +++ b/harness/nextgen/model_list_dto.go @@ -0,0 +1,14 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type ListDto struct { + Query *RuleRequest `json:"query,omitempty"` +} diff --git a/harness/nextgen/model_response_dto_map_string_string.go b/harness/nextgen/model_response_dto_map_string_string.go new file mode 100644 index 00000000..267b6160 --- /dev/null +++ b/harness/nextgen/model_response_dto_map_string_string.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type ResponseDtoMapStringString struct { + Status string `json:"status,omitempty"` + Data map[string]string `json:"data,omitempty"` + MetaData *interface{} `json:"metaData,omitempty"` + CorrelationId string `json:"correlationId,omitempty"` +} diff --git a/harness/nextgen/model_response_dto_rule.go b/harness/nextgen/model_response_dto_rule.go new file mode 100644 index 00000000..4248610d --- /dev/null +++ b/harness/nextgen/model_response_dto_rule.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type ResponseDtoRule struct { + Status string `json:"status,omitempty"` + Data *CcmRule `json:"data,omitempty"` + MetaData *interface{} `json:"metaData,omitempty"` + CorrelationId string `json:"correlationId,omitempty"` +} diff --git a/harness/nextgen/model_response_dto_rule_list.go b/harness/nextgen/model_response_dto_rule_list.go new file mode 100644 index 00000000..34a24be9 --- /dev/null +++ b/harness/nextgen/model_response_dto_rule_list.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +type ResponseDtoRuleList struct { + Status string `json:"status,omitempty"` + Data *RuleList `json:"data,omitempty"` + MetaData *interface{} `json:"metaData,omitempty"` + CorrelationId string `json:"correlationId,omitempty"` +} diff --git a/harness/nextgen/model_rule_clone.go b/harness/nextgen/model_rule_clone.go new file mode 100644 index 00000000..23c402a5 --- /dev/null +++ b/harness/nextgen/model_rule_clone.go @@ -0,0 +1,15 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +// This is the view of Rule Clone as defined in Cloud asset Governance Harness. +type RuleClone struct { + Uuid string `json:"uuid,omitempty"` +} diff --git a/harness/nextgen/model_rule_list.go b/harness/nextgen/model_rule_list.go new file mode 100644 index 00000000..a947522d --- /dev/null +++ b/harness/nextgen/model_rule_list.go @@ -0,0 +1,18 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +// This object will contain the complete definition of a Cloud Cost Rule List +type RuleList struct { + // Total items + TotalItems int32 `json:"totalItems,omitempty"` + // List of rules executions + Rules []CcmRule `json:"rules,omitempty"` +} diff --git a/harness/nextgen/model_rule_request.go b/harness/nextgen/model_rule_request.go new file mode 100644 index 00000000..0245efc3 --- /dev/null +++ b/harness/nextgen/model_rule_request.go @@ -0,0 +1,42 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +// This has the query to list the policies +type RuleRequest struct { + // account id + AccountId string `json:"accountId,omitempty"` + // isOOTBPolicy + IsOOTB bool `json:"isOOTB,omitempty"` + // Organization Identifier for the Entity. + OrgIdentifier string `json:"orgIdentifier,omitempty"` + // Project Identifier for the Entity. + ProjectIdentifier string `json:"projectIdentifier,omitempty"` + // Tags + Tags string `json:"tags,omitempty"` + // cloudProvider + CloudProvider string `json:"cloudProvider,omitempty"` + // policyIds + PolicyIds []string `json:"policyIds,omitempty"` + // isStablePolicy + IsStablePolicy bool `json:"isStablePolicy,omitempty"` + // search + Search string `json:"search,omitempty"` + // limit + Limit int32 `json:"limit,omitempty"` + // offset + Offset int32 `json:"offset,omitempty"` + // The order by condition for Rule query + OrderBy []CcmSort `json:"orderBy,omitempty"` + // resourceType + ResourceType string `json:"resourceType,omitempty"` + // forRecommendation + ForRecommendation bool `json:"forRecommendation,omitempty"` +} diff --git a/harness/nextgen/model_sub_rule_policy_details.go b/harness/nextgen/model_sub_rule_policy_details.go new file mode 100644 index 00000000..ed9b99e3 --- /dev/null +++ b/harness/nextgen/model_sub_rule_policy_details.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes. # Introduction The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster. For more information about how Harness works, read our [documentation](https://developer.harness.io/docs/getting-started) or visit the [Harness Developer Hub](https://developer.harness.io/). ## How it works The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to [Authentication](#section/Introduction/Authentication). ## Get started Before you start integrating, get to know our API better by reading the following topics: * [Harness key concepts](https://developer.harness.io/docs/getting-started/learn-harness-key-concepts/) * [Authentication](#section/Introduction/Authentication) * [Requests and responses](#section/Introduction/Requests-and-Responses) * [Common Parameters](#section/Introduction/Common-Parameters-Beta) * [Status Codes](#section/Introduction/Status-Codes) * [Errors](#tag/Error-Response) * [Versioning](#section/Introduction/Versioning-Beta) * [Pagination](/#section/Introduction/Pagination-Beta) The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need. ## Authentication To authenticate with the Harness API, you need to: 1. Generate an API token on the Harness Platform. 2. Send the API token you generate in the `x-api-key` header in each request. ### Generate an API token To generate an API token, complete the following steps: 1. Go to the [Harness Platform](https://app.harness.io/). 2. On the left-hand navigation, click **My Profile**. 3. Click **+API Key**, enter a name for your key and then click **Save**. 4. Within the API Key tile, click **+Token**. 5. Enter a name for your token and click **Generate Token**. **Important**: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page. ### Send the API token in your requests Send the token you created in the Harness Platform in the x-api-key header. For example: `x-api-key: YOUR_API_KEY_HERE` ## Requests and Responses The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples. ## Common Parameters [Beta] | Field Name | Type | Default | Description | |------------|---------|---------|----------------| | identifier | string | none | URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope. | | name | string | none | Human-friendly name for the resource. | | org | string | none | Limit to provided org identifiers. | | project | string | none | Limit to provided project identifiers. | | description| string | none | More information about the specific resource. | | tags | map[string]string | none | List of labels applied to the resource. | | order | string | desc | Order to use when sorting the specified fields. Type: enum(asc,desc). | | sort | string | none | Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields. | | limit | int | 30 | Pagination: Number of items to return. | | page | int | 1 | Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page. | | created | int64 | none | Unix timestamp that shows when the resource was created (in milliseconds). | | updated | int64 | none | Unix timestamp that shows when the resource was last edited (in milliseconds). | ## Status Codes Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server. | Error Code | Description | |-------------|-------------| | 200 | OK | | 201 | Created | | 202 | Accepted | | 204 | No Content | | 400 | Bad Request | | 401 | Unauthorized | | 403 | Forbidden | | 412 | Precondition Failed | | 415 | Unsupported Media Type | | 500 | Server Error | To view our error response structures, go [here](#tag/Error-Response). ## Versioning [Beta] ### Harness Version The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs. ### Generation All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with `app.harness.io/v1/`, where v1 is the API Generation. The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources. ## Pagination [Beta] We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100. Following are the pagination headers supported in the response bodies of paginated APIs: 1. X-Total-Elements : Indicates the total number of entries in a paginated response. 2. X-Page-Number : Indicates the page number currently returned for a paginated response. 3. X-Page-Size : Indicates the number of entries per page for a paginated response. For example: ``` X-Total-Elements : 30 X-Page-Number : 0 X-Page-Size : 10 ``` + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package nextgen + +// This object stores policy details for a multi policy rule. +type SubRulePolicyDetails struct { + Name string `json:"name,omitempty"` + Yaml string `json:"yaml,omitempty"` + ResourceType string `json:"resourceType,omitempty"` +}