From 588b136b4d32f1a6c97ed9869a096a06aa843ef8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 11 Aug 2026 10:29:39 +0000 Subject: [PATCH] Regenerate client from commit c1466c2 of spec repo --- .generator/schemas/v2/openapi.yaml | 270 ++++++++++++++++++ .../ListCIAppGitHubAccounts.rb | 5 + .../UpdateCIAppGitHubAccount.rb | 20 ++ features/scenarios_model_mapping.rb | 3 + .../v2/ci_visibility_github_accounts.feature | 57 ++++ features/v2/undo.json | 12 + lib/datadog_api_client/inflector.rb | 11 + .../api/ci_visibility_git_hub_accounts_api.rb | 160 +++++++++++ .../ci_app_git_hub_account_attributes.rb | 147 ++++++++++ .../v2/models/ci_app_git_hub_account_data.rb | 167 +++++++++++ .../ci_app_git_hub_account_repository.rb | 115 ++++++++ .../models/ci_app_git_hub_account_response.rb | 123 ++++++++ .../v2/models/ci_app_git_hub_account_type.rb | 27 ++ .../ci_app_git_hub_account_update_request.rb | 123 ++++++++ ...t_hub_account_update_request_attributes.rb | 159 +++++++++++ ...app_git_hub_account_update_request_data.rb | 146 ++++++++++ ...t_hub_account_update_request_repository.rb | 148 ++++++++++ .../ci_app_git_hub_accounts_response.rb | 125 ++++++++ 18 files changed, 1818 insertions(+) create mode 100644 examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.rb create mode 100644 examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.rb create mode 100644 features/v2/ci_visibility_github_accounts.feature create mode 100644 lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_data.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_repository.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_response.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_type.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_repository.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_git_hub_accounts_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7afb2b537d23..a62adae3e1c9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14276,6 +14276,150 @@ components: test_level: $ref: "#/components/schemas/CIAppTestLevel" type: object + CIAppGitHubAccountAttributes: + description: Attributes describing a GitHub account's CI Visibility opt-in status. + properties: + account: + description: The GitHub account (organization or user) name. + example: datadog + type: string + enabled: + description: Whether CI Visibility is enabled at the account level. + example: true + type: boolean + host: + description: The GitHub host (`github.com` or a GitHub Enterprise Server (GHES) hostname) this account belongs to. + example: github.com + type: string + repo_count: + description: The number of repositories known for this account. + example: 12 + format: int64 + type: integer + repositories: + description: The repositories belonging to this account, with their individual opt-in status. + items: + $ref: "#/components/schemas/CIAppGitHubAccountRepository" + type: array + type: object + CIAppGitHubAccountData: + description: Data object for a GitHub account. + properties: + attributes: + $ref: "#/components/schemas/CIAppGitHubAccountAttributes" + id: + description: |- + The account's unique identifier, in the form `/` + (for example `github.com/datadog`). + example: github.com/datadog + type: string + type: + $ref: "#/components/schemas/CIAppGitHubAccountType" + required: + - id + - type + - attributes + type: object + CIAppGitHubAccountRepository: + description: A GitHub repository within a GitHub account, and its CI Visibility opt-in status. + properties: + enabled: + description: Whether CI Visibility is enabled for this repository. + example: true + type: boolean + name: + description: The repository name. + example: shopist + type: string + type: object + CIAppGitHubAccountResponse: + description: Response object containing a single GitHub account's CI Visibility opt-in status. + properties: + data: + $ref: "#/components/schemas/CIAppGitHubAccountData" + required: + - data + type: object + CIAppGitHubAccountType: + description: |- + JSON:API type for the GitHub account resource. + The value must always be `ci_github_account`. + enum: + - ci_github_account + example: ci_github_account + type: string + x-enum-varnames: + - CI_GITHUB_ACCOUNT + CIAppGitHubAccountUpdateRequest: + description: Request object for updating a GitHub account's CI Visibility opt-in status. + properties: + data: + $ref: "#/components/schemas/CIAppGitHubAccountUpdateRequestData" + required: + - data + type: object + CIAppGitHubAccountUpdateRequestAttributes: + description: |- + Attributes for updating a GitHub account's CI Visibility opt-in status. + At least one of `enabled` or `repository.enabled` must be provided. + properties: + account: + description: The GitHub account (organization or user) name to update, identified by name. + example: datadog + minLength: 1 + type: string + enabled: + description: Whether to enable or disable CI Visibility at the account level. + example: true + type: boolean + host: + description: |- + The GitHub host (`github.com` or a GHES hostname) the account belongs to. Required to disambiguate + when the same account name exists on more than one host. + example: github.com + type: string + repository: + $ref: "#/components/schemas/CIAppGitHubAccountUpdateRequestRepository" + required: + - account + type: object + CIAppGitHubAccountUpdateRequestData: + description: Data object for updating a GitHub account's CI Visibility opt-in status. + properties: + attributes: + $ref: "#/components/schemas/CIAppGitHubAccountUpdateRequestAttributes" + type: + $ref: "#/components/schemas/CIAppGitHubAccountType" + required: + - type + - attributes + type: object + CIAppGitHubAccountUpdateRequestRepository: + description: Repository-level opt-in change to apply, identified by name. + properties: + enabled: + description: Whether to enable or disable CI Visibility for this repository. + example: true + type: boolean + name: + description: The repository name to update. + example: shopist + minLength: 1 + type: string + required: + - name + - enabled + type: object + CIAppGitHubAccountsResponse: + description: Response object containing a list of GitHub accounts and their CI Visibility opt-in status. + properties: + data: + items: + $ref: "#/components/schemas/CIAppGitHubAccountData" + type: array + required: + - data + type: object CIAppGitInfo: description: |- If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. @@ -130365,6 +130509,127 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/ci/github/accounts: + get: + description: |- + Retrieve the list of GitHub accounts (organizations or users) available to this Datadog organization + through its GitHub App installation, along with each account's and repository's CI Visibility opt-in status. + operationId: ListCIAppGitHubAccounts + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + account: datadog + enabled: true + host: github.com + repo_count: 2 + repositories: + - enabled: true + name: shopist + - enabled: false + name: dd-source + id: github.com/datadog + type: ci_github_account + schema: + $ref: "#/components/schemas/CIAppGitHubAccountsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - integrations_read + summary: List GitHub CI Visibility status + tags: ["CI Visibility GitHub Accounts"] + x-permission: + operator: OR + permissions: + - integrations_read + patch: + description: |- + Enable or disable CI Visibility for a GitHub account, one of its repositories, or both in the same request. + The account (and, optionally, repository) are identified by name. Account-level and repository-level + changes are independent and may both be supplied in the same request. At least one of `enabled` or + `repository.enabled` must be provided. If the account name matches installations on more than one host, + `host` must be supplied to disambiguate, otherwise a 409 is returned. Returns a 404 if the CI Visibility + GitHub integration is not enabled for this organization, or if the given account or repository cannot be + found by name. + operationId: UpdateCIAppGitHubAccount + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + account: datadog + enabled: true + host: github.com + repository: + enabled: true + name: shopist + type: ci_github_account + schema: + $ref: "#/components/schemas/CIAppGitHubAccountUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + account: datadog + enabled: true + host: github.com + repo_count: 2 + repositories: + - enabled: true + name: shopist + - enabled: false + name: dd-source + id: github.com/datadog + type: ci_github_account + schema: + $ref: "#/components/schemas/CIAppGitHubAccountResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ci_provider_settings_write + summary: Update GitHub CI Visibility status + tags: ["CI Visibility GitHub Accounts"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - ci_provider_settings_write /api/v2/ci/pipeline: post: description: |- @@ -212986,6 +213251,11 @@ tags: - description: |- Use the Bits AI endpoints to retrieve AI-powered investigations. name: Bits AI + - description: |- + Manage CI Visibility opt-in status for your GitHub accounts and repositories. See the + [CI Visibility GitHub Actions setup page](https://docs.datadoghq.com/continuous_integration/pipelines/github/) + for more information. + name: CI Visibility GitHub Accounts - description: |- Search or aggregate your CI Visibility pipeline events and send them to your Datadog site over HTTP. See the [CI Pipeline Visibility in Datadog page](https://docs.datadoghq.com/continuous_integration/pipelines/) for more information. name: CI Visibility Pipelines diff --git a/examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.rb b/examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.rb new file mode 100644 index 000000000000..42ed70af53d6 --- /dev/null +++ b/examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.rb @@ -0,0 +1,5 @@ +# List GitHub CI Visibility status returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CIVisibilityGitHubAccountsAPI.new +p api_instance.list_ci_app_git_hub_accounts() diff --git a/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.rb b/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.rb new file mode 100644 index 000000000000..026c59407e87 --- /dev/null +++ b/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.rb @@ -0,0 +1,20 @@ +# Update GitHub CI Visibility status returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CIVisibilityGitHubAccountsAPI.new + +body = DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequest.new({ + data: DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestAttributes.new({ + account: "datadog", + enabled: true, + host: "github.com", + repository: DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestRepository.new({ + enabled: true, + name: "shopist", + }), + }), + type: DatadogAPIClient::V2::CIAppGitHubAccountType::CI_GITHUB_ACCOUNT, + }), +}) +p api_instance.update_ci_app_git_hub_account(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c7fec5d2c183..dd271fdd5eaf 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1975,6 +1975,9 @@ "decision_id" => "String", "body" => "ChangeRequestDecisionUpdateRequest", }, + "v2.UpdateCIAppGitHubAccount" => { + "body" => "CIAppGitHubAccountUpdateRequest", + }, "v2.CreateCIAppPipelineEvent" => { "body" => "CIAppCreatePipelineEventRequest", }, diff --git a/features/v2/ci_visibility_github_accounts.feature b/features/v2/ci_visibility_github_accounts.feature new file mode 100644 index 000000000000..ad57cc983628 --- /dev/null +++ b/features/v2/ci_visibility_github_accounts.feature @@ -0,0 +1,57 @@ +@endpoint(ci-visibility-github-accounts) @endpoint(ci-visibility-github-accounts-v2) +Feature: CI Visibility GitHub Accounts + Manage CI Visibility opt-in status for your GitHub accounts and + repositories. See the [CI Visibility GitHub Actions setup + page](https://docs.datadoghq.com/continuous_integration/pipelines/github/) + for more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CIVisibilityGitHubAccounts" API + + @generated @skip @team:DataDog/ci-app-backend + Scenario: List GitHub CI Visibility status returns "Bad Request" response + Given new "ListCIAppGitHubAccounts" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: List GitHub CI Visibility status returns "Not Found" response + Given new "ListCIAppGitHubAccounts" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: List GitHub CI Visibility status returns "OK" response + Given new "ListCIAppGitHubAccounts" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update GitHub CI Visibility status returns "Bad Request" response + Given new "UpdateCIAppGitHubAccount" request + And body with value {"data": {"attributes": {"account": "datadog", "enabled": true, "host": "github.com", "repository": {"enabled": true, "name": "shopist"}}, "type": "ci_github_account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update GitHub CI Visibility status returns "Conflict" response + Given new "UpdateCIAppGitHubAccount" request + And body with value {"data": {"attributes": {"account": "datadog", "enabled": true, "host": "github.com", "repository": {"enabled": true, "name": "shopist"}}, "type": "ci_github_account"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update GitHub CI Visibility status returns "Not Found" response + Given new "UpdateCIAppGitHubAccount" request + And body with value {"data": {"attributes": {"account": "datadog", "enabled": true, "host": "github.com", "repository": {"enabled": true, "name": "shopist"}}, "type": "ci_github_account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update GitHub CI Visibility status returns "OK" response + Given new "UpdateCIAppGitHubAccount" request + And body with value {"data": {"attributes": {"account": "datadog", "enabled": true, "host": "github.com", "repository": {"enabled": true, "name": "shopist"}}, "type": "ci_github_account"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 3bafe8bcbd76..2b932a0a328f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1362,6 +1362,18 @@ "type": "idempotent" } }, + "ListCIAppGitHubAccounts": { + "tag": "CI Visibility GitHub Accounts", + "undo": { + "type": "safe" + } + }, + "UpdateCIAppGitHubAccount": { + "tag": "CI Visibility GitHub Accounts", + "undo": { + "type": "idempotent" + } + }, "CreateCIAppPipelineEvent": { "tag": "CI Visibility Pipelines", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index fe9006312d10..7e5eced6bca6 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2066,6 +2066,16 @@ def overrides "v2.ci_app_create_pipeline_event_request_data_single_or_array" => "CIAppCreatePipelineEventRequestDataSingleOrArray", "v2.ci_app_create_pipeline_event_request_data_type" => "CIAppCreatePipelineEventRequestDataType", "v2.ci_app_event_attributes" => "CIAppEventAttributes", + "v2.ci_app_git_hub_account_attributes" => "CIAppGitHubAccountAttributes", + "v2.ci_app_git_hub_account_data" => "CIAppGitHubAccountData", + "v2.ci_app_git_hub_account_repository" => "CIAppGitHubAccountRepository", + "v2.ci_app_git_hub_account_response" => "CIAppGitHubAccountResponse", + "v2.ci_app_git_hub_accounts_response" => "CIAppGitHubAccountsResponse", + "v2.ci_app_git_hub_account_type" => "CIAppGitHubAccountType", + "v2.ci_app_git_hub_account_update_request" => "CIAppGitHubAccountUpdateRequest", + "v2.ci_app_git_hub_account_update_request_attributes" => "CIAppGitHubAccountUpdateRequestAttributes", + "v2.ci_app_git_hub_account_update_request_data" => "CIAppGitHubAccountUpdateRequestData", + "v2.ci_app_git_hub_account_update_request_repository" => "CIAppGitHubAccountUpdateRequestRepository", "v2.ci_app_git_info" => "CIAppGitInfo", "v2.ci_app_group_by_histogram" => "CIAppGroupByHistogram", "v2.ci_app_group_by_missing" => "CIAppGroupByMissing", @@ -8530,6 +8540,7 @@ def overrides "v2.case_management_attribute_api" => "CaseManagementAttributeAPI", "v2.case_management_type_api" => "CaseManagementTypeAPI", "v2.change_management_api" => "ChangeManagementAPI", + "v2.ci_visibility_git_hub_accounts_api" => "CIVisibilityGitHubAccountsAPI", "v2.ci_visibility_pipelines_api" => "CIVisibilityPipelinesAPI", "v2.ci_visibility_tests_api" => "CIVisibilityTestsAPI", "v2.cloud_authentication_api" => "CloudAuthenticationAPI", diff --git a/lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb b/lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb new file mode 100644 index 000000000000..83206960029d --- /dev/null +++ b/lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb @@ -0,0 +1,160 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class CIVisibilityGitHubAccountsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List GitHub CI Visibility status. + # + # @see #list_ci_app_git_hub_accounts_with_http_info + def list_ci_app_git_hub_accounts(opts = {}) + data, _status_code, _headers = list_ci_app_git_hub_accounts_with_http_info(opts) + data + end + + # List GitHub CI Visibility status. + # + # Retrieve the list of GitHub accounts (organizations or users) available to this Datadog organization + # through its GitHub App installation, along with each account's and repository's CI Visibility opt-in status. + # + # @param opts [Hash] the optional parameters + # @return [Array<(CIAppGitHubAccountsResponse, Integer, Hash)>] CIAppGitHubAccountsResponse data, response status code and response headers + def list_ci_app_git_hub_accounts_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CIVisibilityGitHubAccountsAPI.list_ci_app_git_hub_accounts ...' + end + # resource path + local_var_path = '/api/v2/ci/github/accounts' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CIAppGitHubAccountsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_ci_app_git_hub_accounts, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CIVisibilityGitHubAccountsAPI#list_ci_app_git_hub_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update GitHub CI Visibility status. + # + # @see #update_ci_app_git_hub_account_with_http_info + def update_ci_app_git_hub_account(body, opts = {}) + data, _status_code, _headers = update_ci_app_git_hub_account_with_http_info(body, opts) + data + end + + # Update GitHub CI Visibility status. + # + # Enable or disable CI Visibility for a GitHub account, one of its repositories, or both in the same request. + # The account (and, optionally, repository) are identified by name. Account-level and repository-level + # changes are independent and may both be supplied in the same request. At least one of `enabled` or + # `repository.enabled` must be provided. If the account name matches installations on more than one host, + # `host` must be supplied to disambiguate, otherwise a 409 is returned. Returns a 404 if the CI Visibility + # GitHub integration is not enabled for this organization, or if the given account or repository cannot be + # found by name. + # + # @param body [CIAppGitHubAccountUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CIAppGitHubAccountResponse, Integer, Hash)>] CIAppGitHubAccountResponse data, response status code and response headers + def update_ci_app_git_hub_account_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CIVisibilityGitHubAccountsAPI.update_ci_app_git_hub_account ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CIVisibilityGitHubAccountsAPI.update_ci_app_git_hub_account" + end + # resource path + local_var_path = '/api/v2/ci/github/accounts' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CIAppGitHubAccountResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_ci_app_git_hub_account, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CIVisibilityGitHubAccountsAPI#update_ci_app_git_hub_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_attributes.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_attributes.rb new file mode 100644 index 000000000000..f6f810516384 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_attributes.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes describing a GitHub account's CI Visibility opt-in status. + class CIAppGitHubAccountAttributes + include BaseGenericModel + + # The GitHub account (organization or user) name. + attr_accessor :account + + # Whether CI Visibility is enabled at the account level. + attr_accessor :enabled + + # The GitHub host (`github.com` or a GitHub Enterprise Server (GHES) hostname) this account belongs to. + attr_accessor :host + + # The number of repositories known for this account. + attr_accessor :repo_count + + # The repositories belonging to this account, with their individual opt-in status. + attr_accessor :repositories + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account' => :'account', + :'enabled' => :'enabled', + :'host' => :'host', + :'repo_count' => :'repo_count', + :'repositories' => :'repositories' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account' => :'String', + :'enabled' => :'Boolean', + :'host' => :'String', + :'repo_count' => :'Integer', + :'repositories' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account') + self.account = attributes[:'account'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'repo_count') + self.repo_count = attributes[:'repo_count'] + end + + if attributes.key?(:'repositories') + if (value = attributes[:'repositories']).is_a?(Array) + self.repositories = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account == o.account && + enabled == o.enabled && + host == o.host && + repo_count == o.repo_count && + repositories == o.repositories && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account, enabled, host, repo_count, repositories, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_data.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_data.rb new file mode 100644 index 000000000000..3b903b954db6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_data.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for a GitHub account. + class CIAppGitHubAccountData + include BaseGenericModel + + # Attributes describing a GitHub account's CI Visibility opt-in status. + attr_reader :attributes + + # The account's unique identifier, in the form `/` + # (for example `github.com/datadog`). + attr_reader :id + + # JSON:API type for the GitHub account resource. + # The value must always be `ci_github_account`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CIAppGitHubAccountAttributes', + :'id' => :'String', + :'type' => :'CIAppGitHubAccountType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_repository.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_repository.rb new file mode 100644 index 000000000000..e792eb81eaaf --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_repository.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A GitHub repository within a GitHub account, and its CI Visibility opt-in status. + class CIAppGitHubAccountRepository + include BaseGenericModel + + # Whether CI Visibility is enabled for this repository. + attr_accessor :enabled + + # The repository name. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountRepository` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_response.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_response.rb new file mode 100644 index 000000000000..414131f3f688 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object containing a single GitHub account's CI Visibility opt-in status. + class CIAppGitHubAccountResponse + include BaseGenericModel + + # Data object for a GitHub account. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CIAppGitHubAccountData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_type.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_type.rb new file mode 100644 index 000000000000..36b91a4bf6a3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for the GitHub account resource. + # The value must always be `ci_github_account`. + class CIAppGitHubAccountType + include BaseEnumModel + + CI_GITHUB_ACCOUNT = "ci_github_account".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request.rb new file mode 100644 index 000000000000..acaa27fab2a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object for updating a GitHub account's CI Visibility opt-in status. + class CIAppGitHubAccountUpdateRequest + include BaseGenericModel + + # Data object for updating a GitHub account's CI Visibility opt-in status. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CIAppGitHubAccountUpdateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_attributes.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_attributes.rb new file mode 100644 index 000000000000..81523bf280f6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_attributes.rb @@ -0,0 +1,159 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for updating a GitHub account's CI Visibility opt-in status. + # At least one of `enabled` or `repository.enabled` must be provided. + class CIAppGitHubAccountUpdateRequestAttributes + include BaseGenericModel + + # The GitHub account (organization or user) name to update, identified by name. + attr_reader :account + + # Whether to enable or disable CI Visibility at the account level. + attr_accessor :enabled + + # The GitHub host (`github.com` or a GHES hostname) the account belongs to. Required to disambiguate + # when the same account name exists on more than one host. + attr_accessor :host + + # Repository-level opt-in change to apply, identified by name. + attr_accessor :repository + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account' => :'account', + :'enabled' => :'enabled', + :'host' => :'host', + :'repository' => :'repository' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account' => :'String', + :'enabled' => :'Boolean', + :'host' => :'String', + :'repository' => :'CIAppGitHubAccountUpdateRequestRepository' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account') + self.account = attributes[:'account'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'repository') + self.repository = attributes[:'repository'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account.nil? + return false if @account.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param account [Object] Object to be assigned + # @!visibility private + def account=(account) + if account.nil? + fail ArgumentError, 'invalid value for "account", account cannot be nil.' + end + if account.to_s.length < 1 + fail ArgumentError, 'invalid value for "account", the character length must be great than or equal to 1.' + end + @account = account + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account == o.account && + enabled == o.enabled && + host == o.host && + repository == o.repository && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account, enabled, host, repository, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_data.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_data.rb new file mode 100644 index 000000000000..d7caa452c68d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_data.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for updating a GitHub account's CI Visibility opt-in status. + class CIAppGitHubAccountUpdateRequestData + include BaseGenericModel + + # Attributes for updating a GitHub account's CI Visibility opt-in status. + # At least one of `enabled` or `repository.enabled` must be provided. + attr_reader :attributes + + # JSON:API type for the GitHub account resource. + # The value must always be `ci_github_account`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CIAppGitHubAccountUpdateRequestAttributes', + :'type' => :'CIAppGitHubAccountType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_repository.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_repository.rb new file mode 100644 index 000000000000..e51ff1705de4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_account_update_request_repository.rb @@ -0,0 +1,148 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Repository-level opt-in change to apply, identified by name. + class CIAppGitHubAccountUpdateRequestRepository + include BaseGenericModel + + # Whether to enable or disable CI Visibility for this repository. + attr_reader :enabled + + # The repository name to update. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountUpdateRequestRepository` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @enabled.nil? + return false if @name.nil? + return false if @name.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_git_hub_accounts_response.rb b/lib/datadog_api_client/v2/models/ci_app_git_hub_accounts_response.rb new file mode 100644 index 000000000000..66961a1ea40d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_git_hub_accounts_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object containing a list of GitHub accounts and their CI Visibility opt-in status. + class CIAppGitHubAccountsResponse + include BaseGenericModel + + # + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitHubAccountsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end