diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2c0f436fe34..b07cd485882 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. @@ -130198,6 +130342,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: |- @@ -212744,6 +213009,10 @@ 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/setup_dd_ci_visibility_pipelines/github_actions/) 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.java b/examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.java new file mode 100644 index 00000000000..73deeac599d --- /dev/null +++ b/examples/v2/ci-visibility-github-accounts/ListCIAppGitHubAccounts.java @@ -0,0 +1,25 @@ +// List GitHub CI Visibility status returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CiVisibilityGitHubAccountsApi; +import com.datadog.api.client.v2.model.CIAppGitHubAccountsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityGitHubAccountsApi apiInstance = new CiVisibilityGitHubAccountsApi(defaultClient); + + try { + CIAppGitHubAccountsResponse result = apiInstance.listCIAppGitHubAccounts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling CiVisibilityGitHubAccountsApi#listCIAppGitHubAccounts"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.java b/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.java new file mode 100644 index 00000000000..e002154af2f --- /dev/null +++ b/examples/v2/ci-visibility-github-accounts/UpdateCIAppGitHubAccount.java @@ -0,0 +1,45 @@ +// Update GitHub CI Visibility status returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CiVisibilityGitHubAccountsApi; +import com.datadog.api.client.v2.model.CIAppGitHubAccountResponse; +import com.datadog.api.client.v2.model.CIAppGitHubAccountType; +import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequest; +import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestData; +import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequestRepository; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityGitHubAccountsApi apiInstance = new CiVisibilityGitHubAccountsApi(defaultClient); + + CIAppGitHubAccountUpdateRequest body = + new CIAppGitHubAccountUpdateRequest() + .data( + new CIAppGitHubAccountUpdateRequestData() + .attributes( + new CIAppGitHubAccountUpdateRequestAttributes() + .account("datadog") + .enabled(true) + .host("github.com") + .repository( + new CIAppGitHubAccountUpdateRequestRepository() + .enabled(true) + .name("shopist"))) + .type(CIAppGitHubAccountType.CI_GITHUB_ACCOUNT)); + + try { + CIAppGitHubAccountResponse result = apiInstance.updateCIAppGitHubAccount(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling CiVisibilityGitHubAccountsApi#updateCIAppGitHubAccount"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/CiVisibilityGitHubAccountsApi.java b/src/main/java/com/datadog/api/client/v2/api/CiVisibilityGitHubAccountsApi.java new file mode 100644 index 00000000000..d4563f03645 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/CiVisibilityGitHubAccountsApi.java @@ -0,0 +1,305 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CIAppGitHubAccountResponse; +import com.datadog.api.client.v2.model.CIAppGitHubAccountUpdateRequest; +import com.datadog.api.client.v2.model.CIAppGitHubAccountsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CiVisibilityGitHubAccountsApi { + private ApiClient apiClient; + + public CiVisibilityGitHubAccountsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public CiVisibilityGitHubAccountsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * List GitHub CI Visibility status. + * + *

See {@link #listCIAppGitHubAccountsWithHttpInfo}. + * + * @return CIAppGitHubAccountsResponse + * @throws ApiException if fails to make API call + */ + public CIAppGitHubAccountsResponse listCIAppGitHubAccounts() throws ApiException { + return listCIAppGitHubAccountsWithHttpInfo().getData(); + } + + /** + * List GitHub CI Visibility status. + * + *

See {@link #listCIAppGitHubAccountsWithHttpInfoAsync}. + * + * @return CompletableFuture<CIAppGitHubAccountsResponse> + */ + public CompletableFuture listCIAppGitHubAccountsAsync() { + return listCIAppGitHubAccountsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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. + * + * @return ApiResponse<CIAppGitHubAccountsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listCIAppGitHubAccountsWithHttpInfo() + throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/ci/github/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CiVisibilityGitHubAccountsApi.listCIAppGitHubAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List GitHub CI Visibility status. + * + *

See {@link #listCIAppGitHubAccountsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<CIAppGitHubAccountsResponse>> + */ + public CompletableFuture> + listCIAppGitHubAccountsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/ci/github/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CiVisibilityGitHubAccountsApi.listCIAppGitHubAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update GitHub CI Visibility status. + * + *

See {@link #updateCIAppGitHubAccountWithHttpInfo}. + * + * @param body (required) + * @return CIAppGitHubAccountResponse + * @throws ApiException if fails to make API call + */ + public CIAppGitHubAccountResponse updateCIAppGitHubAccount(CIAppGitHubAccountUpdateRequest body) + throws ApiException { + return updateCIAppGitHubAccountWithHttpInfo(body).getData(); + } + + /** + * Update GitHub CI Visibility status. + * + *

See {@link #updateCIAppGitHubAccountWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CIAppGitHubAccountResponse> + */ + public CompletableFuture updateCIAppGitHubAccountAsync( + CIAppGitHubAccountUpdateRequest body) { + return updateCIAppGitHubAccountWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 (required) + * @return ApiResponse<CIAppGitHubAccountResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse updateCIAppGitHubAccountWithHttpInfo( + CIAppGitHubAccountUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateCIAppGitHubAccount"); + } + // create path and map variables + String localVarPath = "/api/v2/ci/github/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CiVisibilityGitHubAccountsApi.updateCIAppGitHubAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update GitHub CI Visibility status. + * + *

See {@link #updateCIAppGitHubAccountWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CIAppGitHubAccountResponse>> + */ + public CompletableFuture> + updateCIAppGitHubAccountWithHttpInfoAsync(CIAppGitHubAccountUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateCIAppGitHubAccount")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/ci/github/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CiVisibilityGitHubAccountsApi.updateCIAppGitHubAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountAttributes.java new file mode 100644 index 00000000000..97f374fea37 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountAttributes.java @@ -0,0 +1,270 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes describing a GitHub account's CI Visibility opt-in status. */ +@JsonPropertyOrder({ + CIAppGitHubAccountAttributes.JSON_PROPERTY_ACCOUNT, + CIAppGitHubAccountAttributes.JSON_PROPERTY_ENABLED, + CIAppGitHubAccountAttributes.JSON_PROPERTY_HOST, + CIAppGitHubAccountAttributes.JSON_PROPERTY_REPO_COUNT, + CIAppGitHubAccountAttributes.JSON_PROPERTY_REPOSITORIES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT = "account"; + private String account; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_HOST = "host"; + private String host; + + public static final String JSON_PROPERTY_REPO_COUNT = "repo_count"; + private Long repoCount; + + public static final String JSON_PROPERTY_REPOSITORIES = "repositories"; + private List repositories = null; + + public CIAppGitHubAccountAttributes account(String account) { + this.account = account; + return this; + } + + /** + * The GitHub account (organization or user) name. + * + * @return account + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public CIAppGitHubAccountAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether CI Visibility is enabled at the account level. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CIAppGitHubAccountAttributes host(String host) { + this.host = host; + return this; + } + + /** + * The GitHub host (github.com or a GitHub Enterprise Server (GHES) hostname) this + * account belongs to. + * + * @return host + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HOST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public CIAppGitHubAccountAttributes repoCount(Long repoCount) { + this.repoCount = repoCount; + return this; + } + + /** + * The number of repositories known for this account. + * + * @return repoCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPO_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getRepoCount() { + return repoCount; + } + + public void setRepoCount(Long repoCount) { + this.repoCount = repoCount; + } + + public CIAppGitHubAccountAttributes repositories( + List repositories) { + this.repositories = repositories; + if (repositories != null) { + for (CIAppGitHubAccountRepository item : repositories) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public CIAppGitHubAccountAttributes addRepositoriesItem( + CIAppGitHubAccountRepository repositoriesItem) { + if (this.repositories == null) { + this.repositories = new ArrayList<>(); + } + this.repositories.add(repositoriesItem); + this.unparsed |= repositoriesItem.unparsed; + return this; + } + + /** + * The repositories belonging to this account, with their individual opt-in status. + * + * @return repositories + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPOSITORIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getRepositories() { + return repositories; + } + + public void setRepositories(List repositories) { + this.repositories = repositories; + if (repositories != null) { + for (CIAppGitHubAccountRepository item : repositories) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountAttributes + */ + @JsonAnySetter + public CIAppGitHubAccountAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountAttributes ciAppGitHubAccountAttributes = (CIAppGitHubAccountAttributes) o; + return Objects.equals(this.account, ciAppGitHubAccountAttributes.account) + && Objects.equals(this.enabled, ciAppGitHubAccountAttributes.enabled) + && Objects.equals(this.host, ciAppGitHubAccountAttributes.host) + && Objects.equals(this.repoCount, ciAppGitHubAccountAttributes.repoCount) + && Objects.equals(this.repositories, ciAppGitHubAccountAttributes.repositories) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, enabled, host, repoCount, repositories, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountAttributes {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" repoCount: ").append(toIndentedString(repoCount)).append("\n"); + sb.append(" repositories: ").append(toIndentedString(repositories)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountData.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountData.java new file mode 100644 index 00000000000..b47adde5411 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountData.java @@ -0,0 +1,214 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data object for a GitHub account. */ +@JsonPropertyOrder({ + CIAppGitHubAccountData.JSON_PROPERTY_ATTRIBUTES, + CIAppGitHubAccountData.JSON_PROPERTY_ID, + CIAppGitHubAccountData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CIAppGitHubAccountAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CIAppGitHubAccountType type; + + public CIAppGitHubAccountData() {} + + @JsonCreator + public CIAppGitHubAccountData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CIAppGitHubAccountAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CIAppGitHubAccountType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CIAppGitHubAccountData attributes(CIAppGitHubAccountAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes describing a GitHub account's CI Visibility opt-in status. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CIAppGitHubAccountAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public CIAppGitHubAccountData id(String id) { + this.id = id; + return this; + } + + /** + * The account's unique identifier, in the form <host>/<account name> + * (for example github.com/datadog). + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CIAppGitHubAccountData type(CIAppGitHubAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for the GitHub account resource. The value must always be ci_github_account + * . + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountType getType() { + return type; + } + + public void setType(CIAppGitHubAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountData + */ + @JsonAnySetter + public CIAppGitHubAccountData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountData ciAppGitHubAccountData = (CIAppGitHubAccountData) o; + return Objects.equals(this.attributes, ciAppGitHubAccountData.attributes) + && Objects.equals(this.id, ciAppGitHubAccountData.id) + && Objects.equals(this.type, ciAppGitHubAccountData.type) + && Objects.equals(this.additionalProperties, ciAppGitHubAccountData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountRepository.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountRepository.java new file mode 100644 index 00000000000..595b806f307 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountRepository.java @@ -0,0 +1,165 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A GitHub repository within a GitHub account, and its CI Visibility opt-in status. */ +@JsonPropertyOrder({ + CIAppGitHubAccountRepository.JSON_PROPERTY_ENABLED, + CIAppGitHubAccountRepository.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountRepository { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CIAppGitHubAccountRepository enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether CI Visibility is enabled for this repository. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CIAppGitHubAccountRepository name(String name) { + this.name = name; + return this; + } + + /** + * The repository name. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountRepository + */ + @JsonAnySetter + public CIAppGitHubAccountRepository putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountRepository object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountRepository ciAppGitHubAccountRepository = (CIAppGitHubAccountRepository) o; + return Objects.equals(this.enabled, ciAppGitHubAccountRepository.enabled) + && Objects.equals(this.name, ciAppGitHubAccountRepository.name) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountRepository.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountRepository {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountResponse.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountResponse.java new file mode 100644 index 00000000000..ad6a2c340f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountResponse.java @@ -0,0 +1,149 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response object containing a single GitHub account's CI Visibility opt-in status. */ +@JsonPropertyOrder({CIAppGitHubAccountResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CIAppGitHubAccountData data; + + public CIAppGitHubAccountResponse() {} + + @JsonCreator + public CIAppGitHubAccountResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CIAppGitHubAccountData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CIAppGitHubAccountResponse data(CIAppGitHubAccountData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for a GitHub account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountData getData() { + return data; + } + + public void setData(CIAppGitHubAccountData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountResponse + */ + @JsonAnySetter + public CIAppGitHubAccountResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountResponse ciAppGitHubAccountResponse = (CIAppGitHubAccountResponse) o; + return Objects.equals(this.data, ciAppGitHubAccountResponse.data) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountType.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountType.java new file mode 100644 index 00000000000..73f79ab908d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountType.java @@ -0,0 +1,60 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * JSON:API type for the GitHub account resource. The value must always be ci_github_account + * . + */ +@JsonSerialize(using = CIAppGitHubAccountType.CIAppGitHubAccountTypeSerializer.class) +public class CIAppGitHubAccountType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ci_github_account")); + + public static final CIAppGitHubAccountType CI_GITHUB_ACCOUNT = + new CIAppGitHubAccountType("ci_github_account"); + + CIAppGitHubAccountType(String value) { + super(value, allowedValues); + } + + public static class CIAppGitHubAccountTypeSerializer + extends StdSerializer { + public CIAppGitHubAccountTypeSerializer(Class t) { + super(t); + } + + public CIAppGitHubAccountTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CIAppGitHubAccountType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CIAppGitHubAccountType fromValue(String value) { + return new CIAppGitHubAccountType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequest.java new file mode 100644 index 00000000000..afff92b391e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequest.java @@ -0,0 +1,151 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request object for updating a GitHub account's CI Visibility opt-in status. */ +@JsonPropertyOrder({CIAppGitHubAccountUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CIAppGitHubAccountUpdateRequestData data; + + public CIAppGitHubAccountUpdateRequest() {} + + @JsonCreator + public CIAppGitHubAccountUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + CIAppGitHubAccountUpdateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CIAppGitHubAccountUpdateRequest data(CIAppGitHubAccountUpdateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object for updating a GitHub account's CI Visibility opt-in status. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountUpdateRequestData getData() { + return data; + } + + public void setData(CIAppGitHubAccountUpdateRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountUpdateRequest + */ + @JsonAnySetter + public CIAppGitHubAccountUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountUpdateRequest ciAppGitHubAccountUpdateRequest = + (CIAppGitHubAccountUpdateRequest) o; + return Objects.equals(this.data, ciAppGitHubAccountUpdateRequest.data) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestAttributes.java new file mode 100644 index 00000000000..05d188fc35d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestAttributes.java @@ -0,0 +1,238 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Attributes for updating a GitHub account's CI Visibility opt-in status. At least one of + * enabled or repository.enabled must be provided. + */ +@JsonPropertyOrder({ + CIAppGitHubAccountUpdateRequestAttributes.JSON_PROPERTY_ACCOUNT, + CIAppGitHubAccountUpdateRequestAttributes.JSON_PROPERTY_ENABLED, + CIAppGitHubAccountUpdateRequestAttributes.JSON_PROPERTY_HOST, + CIAppGitHubAccountUpdateRequestAttributes.JSON_PROPERTY_REPOSITORY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountUpdateRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT = "account"; + private String account; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_HOST = "host"; + private String host; + + public static final String JSON_PROPERTY_REPOSITORY = "repository"; + private CIAppGitHubAccountUpdateRequestRepository repository; + + public CIAppGitHubAccountUpdateRequestAttributes() {} + + @JsonCreator + public CIAppGitHubAccountUpdateRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT) String account) { + this.account = account; + } + + public CIAppGitHubAccountUpdateRequestAttributes account(String account) { + this.account = account; + return this; + } + + /** + * The GitHub account (organization or user) name to update, identified by name. + * + * @return account + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public CIAppGitHubAccountUpdateRequestAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether to enable or disable CI Visibility at the account level. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CIAppGitHubAccountUpdateRequestAttributes host(String host) { + this.host = host; + return this; + } + + /** + * 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. + * + * @return host + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HOST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public CIAppGitHubAccountUpdateRequestAttributes repository( + CIAppGitHubAccountUpdateRequestRepository repository) { + this.repository = repository; + this.unparsed |= repository.unparsed; + return this; + } + + /** + * Repository-level opt-in change to apply, identified by name. + * + * @return repository + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPOSITORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CIAppGitHubAccountUpdateRequestRepository getRepository() { + return repository; + } + + public void setRepository(CIAppGitHubAccountUpdateRequestRepository repository) { + this.repository = repository; + if (repository != null) { + this.unparsed |= repository.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountUpdateRequestAttributes + */ + @JsonAnySetter + public CIAppGitHubAccountUpdateRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountUpdateRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountUpdateRequestAttributes ciAppGitHubAccountUpdateRequestAttributes = + (CIAppGitHubAccountUpdateRequestAttributes) o; + return Objects.equals(this.account, ciAppGitHubAccountUpdateRequestAttributes.account) + && Objects.equals(this.enabled, ciAppGitHubAccountUpdateRequestAttributes.enabled) + && Objects.equals(this.host, ciAppGitHubAccountUpdateRequestAttributes.host) + && Objects.equals(this.repository, ciAppGitHubAccountUpdateRequestAttributes.repository) + && Objects.equals( + this.additionalProperties, + ciAppGitHubAccountUpdateRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, enabled, host, repository, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountUpdateRequestAttributes {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestData.java new file mode 100644 index 00000000000..807b02b389f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestData.java @@ -0,0 +1,189 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data object for updating a GitHub account's CI Visibility opt-in status. */ +@JsonPropertyOrder({ + CIAppGitHubAccountUpdateRequestData.JSON_PROPERTY_ATTRIBUTES, + CIAppGitHubAccountUpdateRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountUpdateRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CIAppGitHubAccountUpdateRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CIAppGitHubAccountType type; + + public CIAppGitHubAccountUpdateRequestData() {} + + @JsonCreator + public CIAppGitHubAccountUpdateRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CIAppGitHubAccountUpdateRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CIAppGitHubAccountType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CIAppGitHubAccountUpdateRequestData attributes( + CIAppGitHubAccountUpdateRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating a GitHub account's CI Visibility opt-in status. At least one of + * enabled or repository.enabled must be provided. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountUpdateRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CIAppGitHubAccountUpdateRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public CIAppGitHubAccountUpdateRequestData type(CIAppGitHubAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for the GitHub account resource. The value must always be ci_github_account + * . + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppGitHubAccountType getType() { + return type; + } + + public void setType(CIAppGitHubAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountUpdateRequestData + */ + @JsonAnySetter + public CIAppGitHubAccountUpdateRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountUpdateRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountUpdateRequestData ciAppGitHubAccountUpdateRequestData = + (CIAppGitHubAccountUpdateRequestData) o; + return Objects.equals(this.attributes, ciAppGitHubAccountUpdateRequestData.attributes) + && Objects.equals(this.type, ciAppGitHubAccountUpdateRequestData.type) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountUpdateRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountUpdateRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestRepository.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestRepository.java new file mode 100644 index 00000000000..438b055631e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountUpdateRequestRepository.java @@ -0,0 +1,176 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Repository-level opt-in change to apply, identified by name. */ +@JsonPropertyOrder({ + CIAppGitHubAccountUpdateRequestRepository.JSON_PROPERTY_ENABLED, + CIAppGitHubAccountUpdateRequestRepository.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountUpdateRequestRepository { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CIAppGitHubAccountUpdateRequestRepository() {} + + @JsonCreator + public CIAppGitHubAccountUpdateRequestRepository( + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.enabled = enabled; + this.name = name; + } + + public CIAppGitHubAccountUpdateRequestRepository enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether to enable or disable CI Visibility for this repository. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CIAppGitHubAccountUpdateRequestRepository name(String name) { + this.name = name; + return this; + } + + /** + * The repository name to update. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountUpdateRequestRepository + */ + @JsonAnySetter + public CIAppGitHubAccountUpdateRequestRepository putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountUpdateRequestRepository object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountUpdateRequestRepository ciAppGitHubAccountUpdateRequestRepository = + (CIAppGitHubAccountUpdateRequestRepository) o; + return Objects.equals(this.enabled, ciAppGitHubAccountUpdateRequestRepository.enabled) + && Objects.equals(this.name, ciAppGitHubAccountUpdateRequestRepository.name) + && Objects.equals( + this.additionalProperties, + ciAppGitHubAccountUpdateRequestRepository.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountUpdateRequestRepository {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountsResponse.java b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountsResponse.java new file mode 100644 index 00000000000..6450653f9bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppGitHubAccountsResponse.java @@ -0,0 +1,164 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response object containing a list of GitHub accounts and their CI Visibility opt-in status. */ +@JsonPropertyOrder({CIAppGitHubAccountsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppGitHubAccountsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public CIAppGitHubAccountsResponse() {} + + @JsonCreator + public CIAppGitHubAccountsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (CIAppGitHubAccountData item : data) { + this.unparsed |= item.unparsed; + } + } + + public CIAppGitHubAccountsResponse data(List data) { + this.data = data; + for (CIAppGitHubAccountData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CIAppGitHubAccountsResponse addDataItem(CIAppGitHubAccountData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (CIAppGitHubAccountData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppGitHubAccountsResponse + */ + @JsonAnySetter + public CIAppGitHubAccountsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppGitHubAccountsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppGitHubAccountsResponse ciAppGitHubAccountsResponse = (CIAppGitHubAccountsResponse) o; + return Objects.equals(this.data, ciAppGitHubAccountsResponse.data) + && Objects.equals( + this.additionalProperties, ciAppGitHubAccountsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppGitHubAccountsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_github_accounts.feature b/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_github_accounts.feature new file mode 100644 index 00000000000..70ca35b1804 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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://do + cs.datadoghq.com/continuous_integration/setup_dd_ci_visibility_pipelines/g + ithub_actions/) 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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 1060e48a484..b603d857697 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {