diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 26e1246c449..c9b56f54b34 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -959,6 +959,41 @@ components: required: true schema: type: string + PersonalAccessTokenID: + description: The UUID of the personal access token. + in: path + name: pat_uuid + required: true + schema: + example: "00000000-0000-1234-0000-000000000000" + type: string + PersonalAccessTokensFilterOwnerUUIDParameter: + description: Filter personal access tokens by the owner's UUID. Supports multiple values. + in: query + name: filter[owner_uuid] + required: false + schema: + items: + example: "00000000-0000-1234-0000-000000000000" + type: string + type: array + PersonalAccessTokensFilterParameter: + description: Filter personal access tokens by the specified string. + in: query + name: filter + required: false + schema: + type: string + PersonalAccessTokensSortParameter: + description: |- + Personal access token attribute used to sort results. Sort order is ascending + by default. In order to specify a descending sort, prefix the + attribute with a minus sign. + in: query + name: sort + required: false + schema: + $ref: "#/components/schemas/PersonalAccessTokensSort" ProductName: description: Name of the product to be deleted, either `logs` or `rum`. in: path @@ -28010,6 +28045,63 @@ components: - name - requirements type: object + FullPersonalAccessToken: + description: Datadog personal access token, including the token key. + properties: + attributes: + $ref: "#/components/schemas/FullPersonalAccessTokenAttributes" + id: + description: ID of the personal access token. + type: string + relationships: + $ref: "#/components/schemas/PersonalAccessTokenRelationships" + type: + $ref: "#/components/schemas/PersonalAccessTokensType" + type: object + FullPersonalAccessTokenAttributes: + description: Attributes of a full personal access token, including the token key. + properties: + alias: + description: The alias (short identifier) of the personal access token. + example: "2H9MCNMBM8FQjQ16YucXkX" + readOnly: true + type: string + created_at: + description: Creation date of the personal access token. + example: "2024-01-01T00:00:00+00:00" + format: date-time + readOnly: true + type: string + expires_at: + description: Expiration date of the personal access token. + example: "2025-12-31T23:59:59+00:00" + format: date-time + nullable: true + readOnly: true + type: string + key: + description: The personal access token key. Only returned upon creation. + readOnly: true + type: string + name: + description: Name of the personal access token. + example: "My Personal Access Token" + type: string + public_portion: + description: The public portion of the personal access token. + example: "ddpat_abc123" + readOnly: true + type: string + scopes: + description: Array of scopes granted to the personal access token. + example: + - "dashboards_read" + - "dashboards_write" + items: + description: Name of scope. + type: string + type: array + type: object GCPCredentials: description: The definition of the `GCPCredentials` object. oneOf: @@ -38386,6 +38478,17 @@ components: $ref: "#/components/schemas/OnCallNotificationRulesIncluded" type: array type: object + ListPersonalAccessTokensResponse: + description: Response for a list of personal access tokens. + properties: + data: + description: Array of personal access tokens. + items: + $ref: "#/components/schemas/PersonalAccessToken" + type: array + meta: + $ref: "#/components/schemas/PersonalAccessTokenResponseMeta" + type: object ListPipelinesResponse: description: Represents the response payload containing a list of pipelines and associated metadata. properties: @@ -50121,6 +50224,218 @@ components: type: string x-enum-varnames: - PERMISSIONS + PersonalAccessToken: + description: Datadog personal access token. + properties: + attributes: + $ref: "#/components/schemas/PersonalAccessTokenAttributes" + id: + description: ID of the personal access token. + type: string + relationships: + $ref: "#/components/schemas/PersonalAccessTokenRelationships" + type: + $ref: "#/components/schemas/PersonalAccessTokensType" + type: object + PersonalAccessTokenAttributes: + description: Attributes of a personal access token. + properties: + alias: + description: The alias (short identifier) of the personal access token. + example: "2H9MCNMBM8FQjQ16YucXkX" + readOnly: true + type: string + created_at: + description: Creation date of the personal access token. + example: "2024-01-01T00:00:00+00:00" + format: date-time + readOnly: true + type: string + expires_at: + description: Expiration date of the personal access token. + example: "2025-12-31T23:59:59+00:00" + format: date-time + nullable: true + readOnly: true + type: string + last_used_at: + description: Date the personal access token was last used. + example: "2025-06-15T12:30:00+00:00" + format: date-time + nullable: true + readOnly: true + type: string + modified_at: + description: Date of last modification of the personal access token. + example: "2024-06-01T00:00:00+00:00" + format: date-time + nullable: true + readOnly: true + type: string + name: + description: Name of the personal access token. + example: "My Personal Access Token" + type: string + public_portion: + description: The public portion of the personal access token. + example: "ddpat_abc123" + readOnly: true + type: string + scopes: + description: Array of scopes granted to the personal access token. + example: + - "dashboards_read" + - "dashboards_write" + items: + description: Name of scope. + type: string + type: array + type: object + PersonalAccessTokenCreateAttributes: + description: Attributes used to create a personal access token. + properties: + expires_at: + description: Expiration date of the personal access token. Must be at least 24 hours in the future. + example: "2025-12-31T23:59:59+00:00" + format: date-time + type: string + name: + description: Name of the personal access token. + example: "My Personal Access Token" + type: string + scopes: + description: Array of scopes to grant the personal access token. + example: + - "dashboards_read" + - "dashboards_write" + items: + description: Name of scope. + type: string + type: array + required: + - name + - scopes + - expires_at + type: object + PersonalAccessTokenCreateData: + description: Object used to create a personal access token. + properties: + attributes: + $ref: "#/components/schemas/PersonalAccessTokenCreateAttributes" + type: + $ref: "#/components/schemas/PersonalAccessTokensType" + required: + - attributes + - type + type: object + PersonalAccessTokenCreateRequest: + description: Request used to create a personal access token. + properties: + data: + $ref: "#/components/schemas/PersonalAccessTokenCreateData" + required: + - data + type: object + PersonalAccessTokenCreateResponse: + description: Response for creating a personal access token. Includes the token key. + properties: + data: + $ref: "#/components/schemas/FullPersonalAccessToken" + type: object + PersonalAccessTokenRelationships: + description: Resources related to the personal access token. + properties: + owned_by: + $ref: "#/components/schemas/RelationshipToUser" + type: object + PersonalAccessTokenResponse: + description: Response for retrieving a personal access token. + properties: + data: + $ref: "#/components/schemas/PersonalAccessToken" + type: object + PersonalAccessTokenResponseMeta: + description: Additional information related to the personal access token response. + properties: + page: + $ref: "#/components/schemas/PersonalAccessTokenResponseMetaPage" + type: object + PersonalAccessTokenResponseMetaPage: + description: Pagination information. + properties: + total_filtered_count: + description: Total filtered personal access token count. + format: int64 + type: integer + type: object + PersonalAccessTokenUpdateAttributes: + description: Attributes used to update a personal access token. + properties: + name: + description: Name of the personal access token. + example: "Updated Personal Access Token" + type: string + scopes: + description: Array of scopes to grant the personal access token. + example: + - "dashboards_read" + - "dashboards_write" + items: + description: Name of scope. + type: string + type: array + type: object + PersonalAccessTokenUpdateData: + description: Object used to update a personal access token. + properties: + attributes: + $ref: "#/components/schemas/PersonalAccessTokenUpdateAttributes" + id: + description: ID of the personal access token. + example: "00112233-4455-6677-8899-aabbccddeeff" + type: string + type: + $ref: "#/components/schemas/PersonalAccessTokensType" + required: + - attributes + - id + - type + type: object + PersonalAccessTokenUpdateRequest: + description: Request used to update a personal access token. + properties: + data: + $ref: "#/components/schemas/PersonalAccessTokenUpdateData" + required: + - data + type: object + PersonalAccessTokensSort: + default: name + description: Sorting options + enum: + - name + - -name + - created_at + - -created_at + - expires_at + - -expires_at + type: string + x-enum-varnames: + - NAME_ASCENDING + - NAME_DESCENDING + - CREATED_AT_ASCENDING + - CREATED_AT_DESCENDING + - EXPIRES_AT_ASCENDING + - EXPIRES_AT_DESCENDING + PersonalAccessTokensType: + default: personal_access_tokens + description: Personal access tokens resource type. + enum: + - personal_access_tokens + example: personal_access_tokens + type: string + x-enum-varnames: + - PERSONAL_ACCESS_TOKENS Playlist: description: A single RUM replay playlist resource returned by create, update, or get operations. properties: @@ -62379,6 +62694,50 @@ components: - REPLACEMENT_STRING - PARTIAL_REPLACEMENT_FROM_BEGINNING - PARTIAL_REPLACEMENT_FROM_END + ServiceAccountAccessTokenCreateAttributes: + description: Attributes used to create a service account access token. + properties: + expires_at: + description: Expiration date of the access token. Optional for service account tokens. + example: "2025-12-31T23:59:59+00:00" + format: date-time + type: string + name: + description: Name of the access token. + example: "Service Account Access Token" + type: string + scopes: + description: Array of scopes to grant the access token. + example: + - "dashboards_read" + - "dashboards_write" + items: + description: Name of scope. + type: string + type: array + required: + - name + - scopes + type: object + ServiceAccountAccessTokenCreateData: + description: Object used to create a service account access token. + properties: + attributes: + $ref: "#/components/schemas/ServiceAccountAccessTokenCreateAttributes" + type: + $ref: "#/components/schemas/PersonalAccessTokensType" + required: + - attributes + - type + type: object + ServiceAccountAccessTokenCreateRequest: + description: Request used to create a service account access token. + properties: + data: + $ref: "#/components/schemas/ServiceAccountAccessTokenCreateData" + required: + - data + type: object ServiceAccountCreateAttributes: description: Attributes of the created user. properties: @@ -99245,6 +99604,195 @@ paths: operator: OR permissions: - user_access_read + /api/v2/personal_access_tokens: + get: + description: List all personal access tokens for the organization. + operationId: ListPersonalAccessTokens + parameters: + - $ref: "#/components/parameters/PageSize" + - $ref: "#/components/parameters/PageNumber" + - $ref: "#/components/parameters/PersonalAccessTokensSortParameter" + - $ref: "#/components/parameters/PersonalAccessTokensFilterParameter" + - $ref: "#/components/parameters/PersonalAccessTokensFilterOwnerUUIDParameter" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ListPersonalAccessTokensResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get all personal access tokens + tags: + - Key Management + "x-permission": + operator: OR + permissions: + - user_app_keys + - org_app_keys_read + post: + description: Create a personal access token for the current user. + operationId: CreatePersonalAccessToken + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenCreateRequest" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenCreateResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a personal access token + tags: + - Key Management + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - user_app_keys + /api/v2/personal_access_tokens/{pat_uuid}: + delete: + description: Revoke a specific personal access token. + operationId: RevokePersonalAccessToken + parameters: + - $ref: "#/components/parameters/PersonalAccessTokenID" + responses: + "204": + description: No Content + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Revoke a personal access token + tags: + - Key Management + "x-permission": + operator: OR + permissions: + - user_app_keys + - org_app_keys_write + get: + description: Get a specific personal access token by its UUID. + operationId: GetPersonalAccessToken + parameters: + - $ref: "#/components/parameters/PersonalAccessTokenID" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a personal access token + tags: + - Key Management + "x-permission": + operator: OR + permissions: + - user_app_keys + - org_app_keys_read + patch: + description: Update a specific personal access token. + operationId: UpdatePersonalAccessToken + parameters: + - $ref: "#/components/parameters/PersonalAccessTokenID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenUpdateRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a personal access token + tags: + - Key Management + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - user_app_keys + - org_app_keys_write /api/v2/posture_management/findings: get: description: |- @@ -108494,6 +109042,208 @@ paths: operator: OR permissions: - service_account_write + /api/v2/service_accounts/{service_account_id}/access_tokens: + get: + description: List all access tokens for a specific service account. + operationId: ListServiceAccountAccessTokens + parameters: + - $ref: "#/components/parameters/ServiceAccountID" + - $ref: "#/components/parameters/PageSize" + - $ref: "#/components/parameters/PageNumber" + - $ref: "#/components/parameters/PersonalAccessTokensSortParameter" + - $ref: "#/components/parameters/PersonalAccessTokensFilterParameter" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ListPersonalAccessTokensResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List access tokens for a service account + tags: + - Service Accounts + "x-permission": + operator: OR + permissions: + - service_account_write + post: + description: Create an access token for a service account. + operationId: CreateServiceAccountAccessToken + parameters: + - $ref: "#/components/parameters/ServiceAccountID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ServiceAccountAccessTokenCreateRequest" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenCreateResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create an access token for a service account + tags: + - Service Accounts + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - service_account_write + /api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}: + delete: + description: Revoke a specific access token for a service account. + operationId: RevokeServiceAccountAccessToken + parameters: + - $ref: "#/components/parameters/ServiceAccountID" + - $ref: "#/components/parameters/PersonalAccessTokenID" + responses: + "204": + description: No Content + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Revoke an access token for a service account + tags: + - Service Accounts + "x-permission": + operator: OR + permissions: + - service_account_write + get: + description: Get a specific access token for a service account by its UUID. + operationId: GetServiceAccountAccessToken + parameters: + - $ref: "#/components/parameters/ServiceAccountID" + - $ref: "#/components/parameters/PersonalAccessTokenID" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an access token for a service account + tags: + - Service Accounts + "x-permission": + operator: OR + permissions: + - service_account_write + patch: + description: Update a specific access token for a service account. + operationId: UpdateServiceAccountAccessToken + parameters: + - $ref: "#/components/parameters/ServiceAccountID" + - $ref: "#/components/parameters/PersonalAccessTokenID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenUpdateRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/PersonalAccessTokenResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update an access token for a service account + tags: + - Service Accounts + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - service_account_write /api/v2/service_accounts/{service_account_id}/application_keys: get: description: List all application keys available for this service account. diff --git a/examples/v2/key-management/CreatePersonalAccessToken.java b/examples/v2/key-management/CreatePersonalAccessToken.java new file mode 100644 index 00000000000..fa55fbabba8 --- /dev/null +++ b/examples/v2/key-management/CreatePersonalAccessToken.java @@ -0,0 +1,40 @@ +// Create a personal access token returns "Created" response +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.KeyManagementApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateAttributes; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateData; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokensType; +import java.time.OffsetDateTime; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + KeyManagementApi apiInstance = new KeyManagementApi(defaultClient); + + PersonalAccessTokenCreateRequest body = + new PersonalAccessTokenCreateRequest() + .data( + new PersonalAccessTokenCreateData() + .type(PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS) + .attributes( + new PersonalAccessTokenCreateAttributes() + .name("Example-Key-Management") + .scopes(Collections.singletonList("dashboards_read")) + .expiresAt(OffsetDateTime.now().plusDays(365)))); + + try { + PersonalAccessTokenCreateResponse result = apiInstance.createPersonalAccessToken(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling KeyManagementApi#createPersonalAccessToken"); + 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/key-management/GetPersonalAccessToken.java b/examples/v2/key-management/GetPersonalAccessToken.java new file mode 100644 index 00000000000..b177201d461 --- /dev/null +++ b/examples/v2/key-management/GetPersonalAccessToken.java @@ -0,0 +1,28 @@ +// Get a personal access token returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.KeyManagementApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + KeyManagementApi apiInstance = new KeyManagementApi(defaultClient); + + // there is a valid "personal_access_token" in the system + String PERSONAL_ACCESS_TOKEN_DATA_ID = System.getenv("PERSONAL_ACCESS_TOKEN_DATA_ID"); + + try { + PersonalAccessTokenResponse result = + apiInstance.getPersonalAccessToken(PERSONAL_ACCESS_TOKEN_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling KeyManagementApi#getPersonalAccessToken"); + 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/key-management/ListPersonalAccessTokens.java b/examples/v2/key-management/ListPersonalAccessTokens.java new file mode 100644 index 00000000000..c783941a07a --- /dev/null +++ b/examples/v2/key-management/ListPersonalAccessTokens.java @@ -0,0 +1,24 @@ +// Get all personal access tokens returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.KeyManagementApi; +import com.datadog.api.client.v2.model.ListPersonalAccessTokensResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + KeyManagementApi apiInstance = new KeyManagementApi(defaultClient); + + try { + ListPersonalAccessTokensResponse result = apiInstance.listPersonalAccessTokens(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling KeyManagementApi#listPersonalAccessTokens"); + 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/key-management/RevokePersonalAccessToken.java b/examples/v2/key-management/RevokePersonalAccessToken.java new file mode 100644 index 00000000000..290a003274b --- /dev/null +++ b/examples/v2/key-management/RevokePersonalAccessToken.java @@ -0,0 +1,25 @@ +// Revoke a personal access token returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.KeyManagementApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + KeyManagementApi apiInstance = new KeyManagementApi(defaultClient); + + // there is a valid "personal_access_token" in the system + String PERSONAL_ACCESS_TOKEN_DATA_ID = System.getenv("PERSONAL_ACCESS_TOKEN_DATA_ID"); + + try { + apiInstance.revokePersonalAccessToken(PERSONAL_ACCESS_TOKEN_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling KeyManagementApi#revokePersonalAccessToken"); + 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/key-management/UpdatePersonalAccessToken.java b/examples/v2/key-management/UpdatePersonalAccessToken.java new file mode 100644 index 00000000000..c0d4c676d59 --- /dev/null +++ b/examples/v2/key-management/UpdatePersonalAccessToken.java @@ -0,0 +1,42 @@ +// Update a personal access token returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.KeyManagementApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateAttributes; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateData; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokensType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + KeyManagementApi apiInstance = new KeyManagementApi(defaultClient); + + // there is a valid "personal_access_token" in the system + String PERSONAL_ACCESS_TOKEN_DATA_ID = System.getenv("PERSONAL_ACCESS_TOKEN_DATA_ID"); + + PersonalAccessTokenUpdateRequest body = + new PersonalAccessTokenUpdateRequest() + .data( + new PersonalAccessTokenUpdateData() + .type(PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS) + .id(PERSONAL_ACCESS_TOKEN_DATA_ID) + .attributes( + new PersonalAccessTokenUpdateAttributes() + .name("Example-Key-Management-updated"))); + + try { + PersonalAccessTokenResponse result = + apiInstance.updatePersonalAccessToken(PERSONAL_ACCESS_TOKEN_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling KeyManagementApi#updatePersonalAccessToken"); + 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/service-accounts/CreateServiceAccountAccessToken.java b/examples/v2/service-accounts/CreateServiceAccountAccessToken.java new file mode 100644 index 00000000000..94fa145b951 --- /dev/null +++ b/examples/v2/service-accounts/CreateServiceAccountAccessToken.java @@ -0,0 +1,44 @@ +// Create an access token for a service account returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ServiceAccountsApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokensType; +import com.datadog.api.client.v2.model.ServiceAccountAccessTokenCreateAttributes; +import com.datadog.api.client.v2.model.ServiceAccountAccessTokenCreateData; +import com.datadog.api.client.v2.model.ServiceAccountAccessTokenCreateRequest; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ServiceAccountsApi apiInstance = new ServiceAccountsApi(defaultClient); + + // there is a valid "service_account_user" in the system + String SERVICE_ACCOUNT_USER_DATA_ID = System.getenv("SERVICE_ACCOUNT_USER_DATA_ID"); + + ServiceAccountAccessTokenCreateRequest body = + new ServiceAccountAccessTokenCreateRequest() + .data( + new ServiceAccountAccessTokenCreateData() + .type(PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS) + .attributes( + new ServiceAccountAccessTokenCreateAttributes() + .name("Example-Service-Account") + .scopes(Collections.singletonList("dashboards_read")))); + + try { + PersonalAccessTokenCreateResponse result = + apiInstance.createServiceAccountAccessToken(SERVICE_ACCOUNT_USER_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling ServiceAccountsApi#createServiceAccountAccessToken"); + 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/service-accounts/GetServiceAccountAccessToken.java b/examples/v2/service-accounts/GetServiceAccountAccessToken.java new file mode 100644 index 00000000000..95e1d05b15f --- /dev/null +++ b/examples/v2/service-accounts/GetServiceAccountAccessToken.java @@ -0,0 +1,33 @@ +// Get an access token for a service account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ServiceAccountsApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ServiceAccountsApi apiInstance = new ServiceAccountsApi(defaultClient); + + // there is a valid "service_account_user" in the system + String SERVICE_ACCOUNT_USER_DATA_ID = System.getenv("SERVICE_ACCOUNT_USER_DATA_ID"); + + // there is a valid "service_account_access_token" for "service_account_user" + String SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = + System.getenv("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"); + + try { + PersonalAccessTokenResponse result = + apiInstance.getServiceAccountAccessToken( + SERVICE_ACCOUNT_USER_DATA_ID, SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ServiceAccountsApi#getServiceAccountAccessToken"); + 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/service-accounts/ListServiceAccountAccessTokens.java b/examples/v2/service-accounts/ListServiceAccountAccessTokens.java new file mode 100644 index 00000000000..5e10e0f99b0 --- /dev/null +++ b/examples/v2/service-accounts/ListServiceAccountAccessTokens.java @@ -0,0 +1,29 @@ +// List access tokens for a service account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ServiceAccountsApi; +import com.datadog.api.client.v2.model.ListPersonalAccessTokensResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ServiceAccountsApi apiInstance = new ServiceAccountsApi(defaultClient); + + // there is a valid "service_account_user" in the system + String SERVICE_ACCOUNT_USER_DATA_ID = System.getenv("SERVICE_ACCOUNT_USER_DATA_ID"); + + try { + ListPersonalAccessTokensResponse result = + apiInstance.listServiceAccountAccessTokens(SERVICE_ACCOUNT_USER_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling ServiceAccountsApi#listServiceAccountAccessTokens"); + 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/service-accounts/RevokeServiceAccountAccessToken.java b/examples/v2/service-accounts/RevokeServiceAccountAccessToken.java new file mode 100644 index 00000000000..135e56707be --- /dev/null +++ b/examples/v2/service-accounts/RevokeServiceAccountAccessToken.java @@ -0,0 +1,31 @@ +// Revoke an access token for a service account returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ServiceAccountsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ServiceAccountsApi apiInstance = new ServiceAccountsApi(defaultClient); + + // there is a valid "service_account_user" in the system + String SERVICE_ACCOUNT_USER_DATA_ID = System.getenv("SERVICE_ACCOUNT_USER_DATA_ID"); + + // there is a valid "service_account_access_token" for "service_account_user" + String SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = + System.getenv("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"); + + try { + apiInstance.revokeServiceAccountAccessToken( + SERVICE_ACCOUNT_USER_DATA_ID, SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID); + } catch (ApiException e) { + System.err.println( + "Exception when calling ServiceAccountsApi#revokeServiceAccountAccessToken"); + 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/service-accounts/UpdateServiceAccountAccessToken.java b/examples/v2/service-accounts/UpdateServiceAccountAccessToken.java new file mode 100644 index 00000000000..df1642835f8 --- /dev/null +++ b/examples/v2/service-accounts/UpdateServiceAccountAccessToken.java @@ -0,0 +1,50 @@ +// Update an access token for a service account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ServiceAccountsApi; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateAttributes; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateData; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokensType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ServiceAccountsApi apiInstance = new ServiceAccountsApi(defaultClient); + + // there is a valid "service_account_user" in the system + String SERVICE_ACCOUNT_USER_DATA_ID = System.getenv("SERVICE_ACCOUNT_USER_DATA_ID"); + + // there is a valid "service_account_access_token" for "service_account_user" + String SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ATTRIBUTES_NAME = + System.getenv("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ATTRIBUTES_NAME"); + String SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = + System.getenv("SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"); + + PersonalAccessTokenUpdateRequest body = + new PersonalAccessTokenUpdateRequest() + .data( + new PersonalAccessTokenUpdateData() + .id(SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID) + .type(PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS) + .attributes( + new PersonalAccessTokenUpdateAttributes() + .name("My Personal Access Token-updated"))); + + try { + PersonalAccessTokenResponse result = + apiInstance.updateServiceAccountAccessToken( + SERVICE_ACCOUNT_USER_DATA_ID, SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling ServiceAccountsApi#updateServiceAccountAccessToken"); + 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/KeyManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/KeyManagementApi.java index 4f894589930..1db4055410e 100644 --- a/src/main/java/com/datadog/api/client/v2/api/KeyManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/KeyManagementApi.java @@ -14,6 +14,12 @@ import com.datadog.api.client.v2.model.ApplicationKeyUpdateRequest; import com.datadog.api.client.v2.model.ApplicationKeysSort; import com.datadog.api.client.v2.model.ListApplicationKeysResponse; +import com.datadog.api.client.v2.model.ListPersonalAccessTokensResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokensSort; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -319,6 +325,141 @@ public ApiResponse createCurrentUserApplicationKeyWithHt new GenericType() {}); } + /** + * Create a personal access token. + * + *

See {@link #createPersonalAccessTokenWithHttpInfo}. + * + * @param body (required) + * @return PersonalAccessTokenCreateResponse + * @throws ApiException if fails to make API call + */ + public PersonalAccessTokenCreateResponse createPersonalAccessToken( + PersonalAccessTokenCreateRequest body) throws ApiException { + return createPersonalAccessTokenWithHttpInfo(body).getData(); + } + + /** + * Create a personal access token. + * + *

See {@link #createPersonalAccessTokenWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<PersonalAccessTokenCreateResponse> + */ + public CompletableFuture createPersonalAccessTokenAsync( + PersonalAccessTokenCreateRequest body) { + return createPersonalAccessTokenWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a personal access token for the current user. + * + * @param body (required) + * @return ApiResponse<PersonalAccessTokenCreateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createPersonalAccessTokenWithHttpInfo( + PersonalAccessTokenCreateRequest 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 createPersonalAccessToken"); + } + // create path and map variables + String localVarPath = "/api/v2/personal_access_tokens"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.KeyManagementApi.createPersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a personal access token. + * + *

See {@link #createPersonalAccessTokenWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenCreateResponse>> + */ + public CompletableFuture> + createPersonalAccessTokenWithHttpInfoAsync(PersonalAccessTokenCreateRequest 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 createPersonalAccessToken")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/personal_access_tokens"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.KeyManagementApi.createPersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete an API key. * @@ -1256,6 +1397,144 @@ public ApiResponse getCurrentUserApplicationKeyWithHttpI new GenericType() {}); } + /** + * Get a personal access token. + * + *

See {@link #getPersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @return PersonalAccessTokenResponse + * @throws ApiException if fails to make API call + */ + public PersonalAccessTokenResponse getPersonalAccessToken(String patUuid) throws ApiException { + return getPersonalAccessTokenWithHttpInfo(patUuid).getData(); + } + + /** + * Get a personal access token. + * + *

See {@link #getPersonalAccessTokenWithHttpInfoAsync}. + * + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<PersonalAccessTokenResponse> + */ + public CompletableFuture getPersonalAccessTokenAsync( + String patUuid) { + return getPersonalAccessTokenWithHttpInfoAsync(patUuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a specific personal access token by its UUID. + * + * @param patUuid The UUID of the personal access token. (required) + * @return ApiResponse<PersonalAccessTokenResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getPersonalAccessTokenWithHttpInfo(String patUuid) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'patUuid' when calling getPersonalAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.KeyManagementApi.getPersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a personal access token. + * + *

See {@link #getPersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenResponse>> + */ + public CompletableFuture> + getPersonalAccessTokenWithHttpInfoAsync(String patUuid) { + Object localVarPostBody = null; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'patUuid' when calling getPersonalAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.KeyManagementApi.getPersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + /** Manage optional parameters to listAPIKeys. */ public static class ListAPIKeysOptionalParameters { private Long pageSize; @@ -2167,14 +2446,393 @@ public ApiResponse listCurrentUserApplicationKeysWi new GenericType() {}); } + /** Manage optional parameters to listPersonalAccessTokens. */ + public static class ListPersonalAccessTokensOptionalParameters { + private Long pageSize; + private Long pageNumber; + private PersonalAccessTokensSort sort; + private String filter; + private List filterOwnerUuid; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListPersonalAccessTokensOptionalParameters + */ + public ListPersonalAccessTokensOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListPersonalAccessTokensOptionalParameters + */ + public ListPersonalAccessTokensOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set sort. + * + * @param sort Personal access token attribute used to sort results. Sort order is ascending by + * default. In order to specify a descending sort, prefix the attribute with a minus sign. + * (optional, default to "name") + * @return ListPersonalAccessTokensOptionalParameters + */ + public ListPersonalAccessTokensOptionalParameters sort(PersonalAccessTokensSort sort) { + this.sort = sort; + return this; + } + + /** + * Set filter. + * + * @param filter Filter personal access tokens by the specified string. (optional) + * @return ListPersonalAccessTokensOptionalParameters + */ + public ListPersonalAccessTokensOptionalParameters filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Set filterOwnerUuid. + * + * @param filterOwnerUuid Filter personal access tokens by the owner's UUID. Supports multiple + * values. (optional) + * @return ListPersonalAccessTokensOptionalParameters + */ + public ListPersonalAccessTokensOptionalParameters filterOwnerUuid( + List filterOwnerUuid) { + this.filterOwnerUuid = filterOwnerUuid; + return this; + } + } + /** - * Edit an API key. + * Get all personal access tokens. * - *

See {@link #updateAPIKeyWithHttpInfo}. + *

See {@link #listPersonalAccessTokensWithHttpInfo}. * - * @param apiKeyId The ID of the API key. (required) - * @param body (required) - * @return APIKeyResponse + * @return ListPersonalAccessTokensResponse + * @throws ApiException if fails to make API call + */ + public ListPersonalAccessTokensResponse listPersonalAccessTokens() throws ApiException { + return listPersonalAccessTokensWithHttpInfo(new ListPersonalAccessTokensOptionalParameters()) + .getData(); + } + + /** + * Get all personal access tokens. + * + *

See {@link #listPersonalAccessTokensWithHttpInfoAsync}. + * + * @return CompletableFuture<ListPersonalAccessTokensResponse> + */ + public CompletableFuture listPersonalAccessTokensAsync() { + return listPersonalAccessTokensWithHttpInfoAsync( + new ListPersonalAccessTokensOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all personal access tokens. + * + *

See {@link #listPersonalAccessTokensWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ListPersonalAccessTokensResponse + * @throws ApiException if fails to make API call + */ + public ListPersonalAccessTokensResponse listPersonalAccessTokens( + ListPersonalAccessTokensOptionalParameters parameters) throws ApiException { + return listPersonalAccessTokensWithHttpInfo(parameters).getData(); + } + + /** + * Get all personal access tokens. + * + *

See {@link #listPersonalAccessTokensWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListPersonalAccessTokensResponse> + */ + public CompletableFuture listPersonalAccessTokensAsync( + ListPersonalAccessTokensOptionalParameters parameters) { + return listPersonalAccessTokensWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all personal access tokens for the organization. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListPersonalAccessTokensResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listPersonalAccessTokensWithHttpInfo( + ListPersonalAccessTokensOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + PersonalAccessTokensSort sort = parameters.sort; + String filter = parameters.filter; + List filterOwnerUuid = parameters.filterOwnerUuid; + // create path and map variables + String localVarPath = "/api/v2/personal_access_tokens"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[owner_uuid]", filterOwnerUuid)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.KeyManagementApi.listPersonalAccessTokens", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all personal access tokens. + * + *

See {@link #listPersonalAccessTokensWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListPersonalAccessTokensResponse>> + */ + public CompletableFuture> + listPersonalAccessTokensWithHttpInfoAsync( + ListPersonalAccessTokensOptionalParameters parameters) { + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + PersonalAccessTokensSort sort = parameters.sort; + String filter = parameters.filter; + List filterOwnerUuid = parameters.filterOwnerUuid; + // create path and map variables + String localVarPath = "/api/v2/personal_access_tokens"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[owner_uuid]", filterOwnerUuid)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.KeyManagementApi.listPersonalAccessTokens", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Revoke a personal access token. + * + *

See {@link #revokePersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @throws ApiException if fails to make API call + */ + public void revokePersonalAccessToken(String patUuid) throws ApiException { + revokePersonalAccessTokenWithHttpInfo(patUuid); + } + + /** + * Revoke a personal access token. + * + *

See {@link #revokePersonalAccessTokenWithHttpInfoAsync}. + * + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture + */ + public CompletableFuture revokePersonalAccessTokenAsync(String patUuid) { + return revokePersonalAccessTokenWithHttpInfoAsync(patUuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Revoke a specific personal access token. + * + * @param patUuid The UUID of the personal access token. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse revokePersonalAccessTokenWithHttpInfo(String patUuid) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'patUuid' when calling revokePersonalAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.KeyManagementApi.revokePersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Revoke a personal access token. + * + *

See {@link #revokePersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> revokePersonalAccessTokenWithHttpInfoAsync( + String patUuid) { + Object localVarPostBody = null; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling revokePersonalAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.KeyManagementApi.revokePersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Edit an API key. + * + *

See {@link #updateAPIKeyWithHttpInfo}. + * + * @param apiKeyId The ID of the API key. (required) + * @param body (required) + * @return APIKeyResponse * @throws ApiException if fails to make API call */ public APIKeyResponse updateAPIKey(String apiKeyId, APIKeyUpdateRequest body) @@ -2646,4 +3304,166 @@ public ApiResponse updateCurrentUserApplicationKeyWithHt false, new GenericType() {}); } + + /** + * Update a personal access token. + * + *

See {@link #updatePersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return PersonalAccessTokenResponse + * @throws ApiException if fails to make API call + */ + public PersonalAccessTokenResponse updatePersonalAccessToken( + String patUuid, PersonalAccessTokenUpdateRequest body) throws ApiException { + return updatePersonalAccessTokenWithHttpInfo(patUuid, body).getData(); + } + + /** + * Update a personal access token. + * + *

See {@link #updatePersonalAccessTokenWithHttpInfoAsync}. + * + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return CompletableFuture<PersonalAccessTokenResponse> + */ + public CompletableFuture updatePersonalAccessTokenAsync( + String patUuid, PersonalAccessTokenUpdateRequest body) { + return updatePersonalAccessTokenWithHttpInfoAsync(patUuid, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a specific personal access token. + * + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return ApiResponse<PersonalAccessTokenResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updatePersonalAccessTokenWithHttpInfo( + String patUuid, PersonalAccessTokenUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'patUuid' when calling updatePersonalAccessToken"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updatePersonalAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.KeyManagementApi.updatePersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a personal access token. + * + *

See {@link #updatePersonalAccessTokenWithHttpInfo}. + * + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenResponse>> + */ + public CompletableFuture> + updatePersonalAccessTokenWithHttpInfoAsync( + String patUuid, PersonalAccessTokenUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling updatePersonalAccessToken")); + return result; + } + + // 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 updatePersonalAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/personal_access_tokens/{pat_uuid}" + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.KeyManagementApi.updatePersonalAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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/api/ServiceAccountsApi.java b/src/main/java/com/datadog/api/client/v2/api/ServiceAccountsApi.java index 9ec8b45e8b2..bf9dd0283b1 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ServiceAccountsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ServiceAccountsApi.java @@ -9,7 +9,13 @@ import com.datadog.api.client.v2.model.ApplicationKeyUpdateRequest; import com.datadog.api.client.v2.model.ApplicationKeysSort; import com.datadog.api.client.v2.model.ListApplicationKeysResponse; +import com.datadog.api.client.v2.model.ListPersonalAccessTokensResponse; import com.datadog.api.client.v2.model.PartialApplicationKeyResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenCreateResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenResponse; +import com.datadog.api.client.v2.model.PersonalAccessTokenUpdateRequest; +import com.datadog.api.client.v2.model.PersonalAccessTokensSort; +import com.datadog.api.client.v2.model.ServiceAccountAccessTokenCreateRequest; import com.datadog.api.client.v2.model.ServiceAccountCreateRequest; import com.datadog.api.client.v2.model.UserResponse; import jakarta.ws.rs.client.Invocation; @@ -183,6 +189,178 @@ public CompletableFuture> createServiceAccountWithHttp new GenericType() {}); } + /** + * Create an access token for a service account. + * + *

See {@link #createServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param body (required) + * @return PersonalAccessTokenCreateResponse + * @throws ApiException if fails to make API call + */ + public PersonalAccessTokenCreateResponse createServiceAccountAccessToken( + String serviceAccountId, ServiceAccountAccessTokenCreateRequest body) throws ApiException { + return createServiceAccountAccessTokenWithHttpInfo(serviceAccountId, body).getData(); + } + + /** + * Create an access token for a service account. + * + *

See {@link #createServiceAccountAccessTokenWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param body (required) + * @return CompletableFuture<PersonalAccessTokenCreateResponse> + */ + public CompletableFuture createServiceAccountAccessTokenAsync( + String serviceAccountId, ServiceAccountAccessTokenCreateRequest body) { + return createServiceAccountAccessTokenWithHttpInfoAsync(serviceAccountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an access token for a service account. + * + * @param serviceAccountId The ID of the service account. (required) + * @param body (required) + * @return ApiResponse<PersonalAccessTokenCreateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createServiceAccountAccessTokenWithHttpInfo( + String serviceAccountId, ServiceAccountAccessTokenCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " createServiceAccountAccessToken"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createServiceAccountAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.createServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an access token for a service account. + * + *

See {@link #createServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenCreateResponse>> + */ + public CompletableFuture> + createServiceAccountAccessTokenWithHttpInfoAsync( + String serviceAccountId, ServiceAccountAccessTokenCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " createServiceAccountAccessToken")); + return result; + } + + // 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" + + " createServiceAccountAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.createServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create an application key for this service account. * @@ -521,32 +699,32 @@ public CompletableFuture> deleteServiceAccountApplicationKeyWi } /** - * Get one application key for this service account. + * Get an access token for a service account. * - *

See {@link #getServiceAccountApplicationKeyWithHttpInfo}. + *

See {@link #getServiceAccountAccessTokenWithHttpInfo}. * * @param serviceAccountId The ID of the service account. (required) - * @param appKeyId The ID of the application key. (required) - * @return PartialApplicationKeyResponse + * @param patUuid The UUID of the personal access token. (required) + * @return PersonalAccessTokenResponse * @throws ApiException if fails to make API call */ - public PartialApplicationKeyResponse getServiceAccountApplicationKey( - String serviceAccountId, String appKeyId) throws ApiException { - return getServiceAccountApplicationKeyWithHttpInfo(serviceAccountId, appKeyId).getData(); + public PersonalAccessTokenResponse getServiceAccountAccessToken( + String serviceAccountId, String patUuid) throws ApiException { + return getServiceAccountAccessTokenWithHttpInfo(serviceAccountId, patUuid).getData(); } /** - * Get one application key for this service account. + * Get an access token for a service account. * - *

See {@link #getServiceAccountApplicationKeyWithHttpInfoAsync}. + *

See {@link #getServiceAccountAccessTokenWithHttpInfoAsync}. * * @param serviceAccountId The ID of the service account. (required) - * @param appKeyId The ID of the application key. (required) - * @return CompletableFuture<PartialApplicationKeyResponse> + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<PersonalAccessTokenResponse> */ - public CompletableFuture getServiceAccountApplicationKeyAsync( - String serviceAccountId, String appKeyId) { - return getServiceAccountApplicationKeyWithHttpInfoAsync(serviceAccountId, appKeyId) + public CompletableFuture getServiceAccountAccessTokenAsync( + String serviceAccountId, String patUuid) { + return getServiceAccountAccessTokenWithHttpInfoAsync(serviceAccountId, patUuid) .thenApply( response -> { return response.getData(); @@ -554,11 +732,11 @@ public CompletableFuture getServiceAccountApplica } /** - * Get an application key owned by this service account. + * Get a specific access token for a service account by its UUID. * * @param serviceAccountId The ID of the service account. (required) - * @param appKeyId The ID of the application key. (required) - * @return ApiResponse<PartialApplicationKeyResponse> + * @param patUuid The UUID of the personal access token. (required) + * @return ApiResponse<PersonalAccessTokenResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -570,8 +748,8 @@ public CompletableFuture getServiceAccountApplica * *
429 Too many requests -
*/ - public ApiResponse getServiceAccountApplicationKeyWithHttpInfo( - String serviceAccountId, String appKeyId) throws ApiException { + public ApiResponse getServiceAccountAccessTokenWithHttpInfo( + String serviceAccountId, String patUuid) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'serviceAccountId' is set @@ -579,28 +757,28 @@ public ApiResponse getServiceAccountApplicationKe throw new ApiException( 400, "Missing the required parameter 'serviceAccountId' when calling" - + " getServiceAccountApplicationKey"); + + " getServiceAccountAccessToken"); } - // verify the required parameter 'appKeyId' is set - if (appKeyId == null) { + // verify the required parameter 'patUuid' is set + if (patUuid == null) { throw new ApiException( 400, - "Missing the required parameter 'appKeyId' when calling getServiceAccountApplicationKey"); + "Missing the required parameter 'patUuid' when calling getServiceAccountAccessToken"); } // create path and map variables String localVarPath = - "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" .replaceAll( "\\{" + "service_account_id" + "\\}", apiClient.escapeString(serviceAccountId.toString())) - .replaceAll("\\{" + "app_key_id" + "\\}", apiClient.escapeString(appKeyId.toString())); + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceAccountsApi.getServiceAccountApplicationKey", + "v2.ServiceAccountsApi.getServiceAccountAccessToken", localVarPath, new ArrayList(), localVarHeaderParams, @@ -615,52 +793,52 @@ public ApiResponse getServiceAccountApplicationKe localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get one application key for this service account. + * Get an access token for a service account. * - *

See {@link #getServiceAccountApplicationKeyWithHttpInfo}. + *

See {@link #getServiceAccountAccessTokenWithHttpInfo}. * * @param serviceAccountId The ID of the service account. (required) - * @param appKeyId The ID of the application key. (required) - * @return CompletableFuture<ApiResponse<PartialApplicationKeyResponse>> + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenResponse>> */ - public CompletableFuture> - getServiceAccountApplicationKeyWithHttpInfoAsync(String serviceAccountId, String appKeyId) { + public CompletableFuture> + getServiceAccountAccessTokenWithHttpInfoAsync(String serviceAccountId, String patUuid) { Object localVarPostBody = null; // verify the required parameter 'serviceAccountId' is set if (serviceAccountId == null) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'serviceAccountId' when calling" - + " getServiceAccountApplicationKey")); + + " getServiceAccountAccessToken")); return result; } - // verify the required parameter 'appKeyId' is set - if (appKeyId == null) { - CompletableFuture> result = + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'appKeyId' when calling" - + " getServiceAccountApplicationKey")); + "Missing the required parameter 'patUuid' when calling" + + " getServiceAccountAccessToken")); return result; } // create path and map variables String localVarPath = - "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" .replaceAll( "\\{" + "service_account_id" + "\\}", apiClient.escapeString(serviceAccountId.toString())) - .replaceAll("\\{" + "app_key_id" + "\\}", apiClient.escapeString(appKeyId.toString())); + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); Map localVarHeaderParams = new HashMap(); @@ -668,7 +846,7 @@ public ApiResponse getServiceAccountApplicationKe try { builder = apiClient.createBuilder( - "v2.ServiceAccountsApi.getServiceAccountApplicationKey", + "v2.ServiceAccountsApi.getServiceAccountAccessToken", localVarPath, new ArrayList(), localVarHeaderParams, @@ -676,7 +854,7 @@ public ApiResponse getServiceAccountApplicationKe new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -689,120 +867,264 @@ public ApiResponse getServiceAccountApplicationKe localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } - /** Manage optional parameters to listServiceAccountApplicationKeys. */ - public static class ListServiceAccountApplicationKeysOptionalParameters { - private Long pageSize; - private Long pageNumber; - private ApplicationKeysSort sort; - private String filter; - private String filterCreatedAtStart; - private String filterCreatedAtEnd; - - /** - * Set pageSize. - * - * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default - * to 10) - * @return ListServiceAccountApplicationKeysOptionalParameters - */ - public ListServiceAccountApplicationKeysOptionalParameters pageSize(Long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set pageNumber. - * - * @param pageNumber Specific page number to return. (optional, default to 0) - * @return ListServiceAccountApplicationKeysOptionalParameters - */ - public ListServiceAccountApplicationKeysOptionalParameters pageNumber(Long pageNumber) { - this.pageNumber = pageNumber; - return this; - } + /** + * Get one application key for this service account. + * + *

See {@link #getServiceAccountApplicationKeyWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param appKeyId The ID of the application key. (required) + * @return PartialApplicationKeyResponse + * @throws ApiException if fails to make API call + */ + public PartialApplicationKeyResponse getServiceAccountApplicationKey( + String serviceAccountId, String appKeyId) throws ApiException { + return getServiceAccountApplicationKeyWithHttpInfo(serviceAccountId, appKeyId).getData(); + } - /** - * Set sort. - * - * @param sort Application key attribute used to sort results. Sort order is ascending by - * default. In order to specify a descending sort, prefix the attribute with a minus sign. - * (optional, default to "name") - * @return ListServiceAccountApplicationKeysOptionalParameters - */ - public ListServiceAccountApplicationKeysOptionalParameters sort(ApplicationKeysSort sort) { - this.sort = sort; - return this; - } + /** + * Get one application key for this service account. + * + *

See {@link #getServiceAccountApplicationKeyWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param appKeyId The ID of the application key. (required) + * @return CompletableFuture<PartialApplicationKeyResponse> + */ + public CompletableFuture getServiceAccountApplicationKeyAsync( + String serviceAccountId, String appKeyId) { + return getServiceAccountApplicationKeyWithHttpInfoAsync(serviceAccountId, appKeyId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an application key owned by this service account. + * + * @param serviceAccountId The ID of the service account. (required) + * @param appKeyId The ID of the application key. (required) + * @return ApiResponse<PartialApplicationKeyResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getServiceAccountApplicationKeyWithHttpInfo( + String serviceAccountId, String appKeyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " getServiceAccountApplicationKey"); + } + + // verify the required parameter 'appKeyId' is set + if (appKeyId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'appKeyId' when calling getServiceAccountApplicationKey"); + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "app_key_id" + "\\}", apiClient.escapeString(appKeyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.getServiceAccountApplicationKey", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get one application key for this service account. + * + *

See {@link #getServiceAccountApplicationKeyWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param appKeyId The ID of the application key. (required) + * @return CompletableFuture<ApiResponse<PartialApplicationKeyResponse>> + */ + public CompletableFuture> + getServiceAccountApplicationKeyWithHttpInfoAsync(String serviceAccountId, String appKeyId) { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " getServiceAccountApplicationKey")); + return result; + } + + // verify the required parameter 'appKeyId' is set + if (appKeyId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'appKeyId' when calling" + + " getServiceAccountApplicationKey")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "app_key_id" + "\\}", apiClient.escapeString(appKeyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.getServiceAccountApplicationKey", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** Manage optional parameters to listServiceAccountAccessTokens. */ + public static class ListServiceAccountAccessTokensOptionalParameters { + private Long pageSize; + private Long pageNumber; + private PersonalAccessTokensSort sort; + private String filter; /** - * Set filter. + * Set pageSize. * - * @param filter Filter application keys by the specified string. (optional) - * @return ListServiceAccountApplicationKeysOptionalParameters + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListServiceAccountAccessTokensOptionalParameters */ - public ListServiceAccountApplicationKeysOptionalParameters filter(String filter) { - this.filter = filter; + public ListServiceAccountAccessTokensOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; return this; } /** - * Set filterCreatedAtStart. + * Set pageNumber. * - * @param filterCreatedAtStart Only include application keys created on or after the specified - * date. (optional) - * @return ListServiceAccountApplicationKeysOptionalParameters + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListServiceAccountAccessTokensOptionalParameters */ - public ListServiceAccountApplicationKeysOptionalParameters filterCreatedAtStart( - String filterCreatedAtStart) { - this.filterCreatedAtStart = filterCreatedAtStart; + public ListServiceAccountAccessTokensOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; return this; } /** - * Set filterCreatedAtEnd. + * Set sort. * - * @param filterCreatedAtEnd Only include application keys created on or before the specified - * date. (optional) - * @return ListServiceAccountApplicationKeysOptionalParameters + * @param sort Personal access token attribute used to sort results. Sort order is ascending by + * default. In order to specify a descending sort, prefix the attribute with a minus sign. + * (optional, default to "name") + * @return ListServiceAccountAccessTokensOptionalParameters */ - public ListServiceAccountApplicationKeysOptionalParameters filterCreatedAtEnd( - String filterCreatedAtEnd) { - this.filterCreatedAtEnd = filterCreatedAtEnd; + public ListServiceAccountAccessTokensOptionalParameters sort(PersonalAccessTokensSort sort) { + this.sort = sort; + return this; + } + + /** + * Set filter. + * + * @param filter Filter personal access tokens by the specified string. (optional) + * @return ListServiceAccountAccessTokensOptionalParameters + */ + public ListServiceAccountAccessTokensOptionalParameters filter(String filter) { + this.filter = filter; return this; } } /** - * List application keys for this service account. + * List access tokens for a service account. * - *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + *

See {@link #listServiceAccountAccessTokensWithHttpInfo}. * * @param serviceAccountId The ID of the service account. (required) - * @return ListApplicationKeysResponse + * @return ListPersonalAccessTokensResponse * @throws ApiException if fails to make API call */ - public ListApplicationKeysResponse listServiceAccountApplicationKeys(String serviceAccountId) + public ListPersonalAccessTokensResponse listServiceAccountAccessTokens(String serviceAccountId) throws ApiException { - return listServiceAccountApplicationKeysWithHttpInfo( - serviceAccountId, new ListServiceAccountApplicationKeysOptionalParameters()) + return listServiceAccountAccessTokensWithHttpInfo( + serviceAccountId, new ListServiceAccountAccessTokensOptionalParameters()) .getData(); } /** - * List application keys for this service account. + * List access tokens for a service account. * - *

See {@link #listServiceAccountApplicationKeysWithHttpInfoAsync}. + *

See {@link #listServiceAccountAccessTokensWithHttpInfoAsync}. * * @param serviceAccountId The ID of the service account. (required) - * @return CompletableFuture<ListApplicationKeysResponse> + * @return CompletableFuture<ListPersonalAccessTokensResponse> */ - public CompletableFuture listServiceAccountApplicationKeysAsync( + public CompletableFuture listServiceAccountAccessTokensAsync( String serviceAccountId) { - return listServiceAccountApplicationKeysWithHttpInfoAsync( - serviceAccountId, new ListServiceAccountApplicationKeysOptionalParameters()) + return listServiceAccountAccessTokensWithHttpInfoAsync( + serviceAccountId, new ListServiceAccountAccessTokensOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -810,33 +1132,33 @@ serviceAccountId, new ListServiceAccountApplicationKeysOptionalParameters()) } /** - * List application keys for this service account. + * List access tokens for a service account. * - *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + *

See {@link #listServiceAccountAccessTokensWithHttpInfo}. * * @param serviceAccountId The ID of the service account. (required) * @param parameters Optional parameters for the request. - * @return ListApplicationKeysResponse + * @return ListPersonalAccessTokensResponse * @throws ApiException if fails to make API call */ - public ListApplicationKeysResponse listServiceAccountApplicationKeys( - String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) + public ListPersonalAccessTokensResponse listServiceAccountAccessTokens( + String serviceAccountId, ListServiceAccountAccessTokensOptionalParameters parameters) throws ApiException { - return listServiceAccountApplicationKeysWithHttpInfo(serviceAccountId, parameters).getData(); + return listServiceAccountAccessTokensWithHttpInfo(serviceAccountId, parameters).getData(); } /** - * List application keys for this service account. + * List access tokens for a service account. * - *

See {@link #listServiceAccountApplicationKeysWithHttpInfoAsync}. + *

See {@link #listServiceAccountAccessTokensWithHttpInfoAsync}. * * @param serviceAccountId The ID of the service account. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ListApplicationKeysResponse> + * @return CompletableFuture<ListPersonalAccessTokensResponse> */ - public CompletableFuture listServiceAccountApplicationKeysAsync( - String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) { - return listServiceAccountApplicationKeysWithHttpInfoAsync(serviceAccountId, parameters) + public CompletableFuture listServiceAccountAccessTokensAsync( + String serviceAccountId, ListServiceAccountAccessTokensOptionalParameters parameters) { + return listServiceAccountAccessTokensWithHttpInfoAsync(serviceAccountId, parameters) .thenApply( response -> { return response.getData(); @@ -844,11 +1166,11 @@ public CompletableFuture listServiceAccountApplicat } /** - * List all application keys available for this service account. + * List all access tokens for a specific service account. * * @param serviceAccountId The ID of the service account. (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<ListApplicationKeysResponse> + * @return ApiResponse<ListPersonalAccessTokensResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -861,8 +1183,8 @@ public CompletableFuture listServiceAccountApplicat * *
429 Too many requests -
*/ - public ApiResponse listServiceAccountApplicationKeysWithHttpInfo( - String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) + public ApiResponse listServiceAccountAccessTokensWithHttpInfo( + String serviceAccountId, ListServiceAccountAccessTokensOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; @@ -871,17 +1193,15 @@ public ApiResponse listServiceAccountApplicationKey throw new ApiException( 400, "Missing the required parameter 'serviceAccountId' when calling" - + " listServiceAccountApplicationKeys"); + + " listServiceAccountAccessTokens"); } Long pageSize = parameters.pageSize; Long pageNumber = parameters.pageNumber; - ApplicationKeysSort sort = parameters.sort; + PersonalAccessTokensSort sort = parameters.sort; String filter = parameters.filter; - String filterCreatedAtStart = parameters.filterCreatedAtStart; - String filterCreatedAtEnd = parameters.filterCreatedAtEnd; // create path and map variables String localVarPath = - "/api/v2/service_accounts/{service_account_id}/application_keys" + "/api/v2/service_accounts/{service_account_id}/access_tokens" .replaceAll( "\\{" + "service_account_id" + "\\}", apiClient.escapeString(serviceAccountId.toString())); @@ -893,14 +1213,10 @@ public ApiResponse listServiceAccountApplicationKey localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[created_at][start]", filterCreatedAtStart)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[created_at][end]", filterCreatedAtEnd)); Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceAccountsApi.listServiceAccountApplicationKeys", + "v2.ServiceAccountsApi.listServiceAccountAccessTokens", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -915,43 +1231,41 @@ public ApiResponse listServiceAccountApplicationKey localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * List application keys for this service account. + * List access tokens for a service account. * - *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + *

See {@link #listServiceAccountAccessTokensWithHttpInfo}. * * @param serviceAccountId The ID of the service account. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<ListApplicationKeysResponse>> + * @return CompletableFuture<ApiResponse<ListPersonalAccessTokensResponse>> */ - public CompletableFuture> - listServiceAccountApplicationKeysWithHttpInfoAsync( - String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) { + public CompletableFuture> + listServiceAccountAccessTokensWithHttpInfoAsync( + String serviceAccountId, ListServiceAccountAccessTokensOptionalParameters parameters) { Object localVarPostBody = null; // verify the required parameter 'serviceAccountId' is set if (serviceAccountId == null) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'serviceAccountId' when calling" - + " listServiceAccountApplicationKeys")); + + " listServiceAccountAccessTokens")); return result; } Long pageSize = parameters.pageSize; Long pageNumber = parameters.pageNumber; - ApplicationKeysSort sort = parameters.sort; + PersonalAccessTokensSort sort = parameters.sort; String filter = parameters.filter; - String filterCreatedAtStart = parameters.filterCreatedAtStart; - String filterCreatedAtEnd = parameters.filterCreatedAtEnd; // create path and map variables String localVarPath = - "/api/v2/service_accounts/{service_account_id}/application_keys" + "/api/v2/service_accounts/{service_account_id}/access_tokens" .replaceAll( "\\{" + "service_account_id" + "\\}", apiClient.escapeString(serviceAccountId.toString())); @@ -963,16 +1277,12 @@ public ApiResponse listServiceAccountApplicationKey localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[created_at][start]", filterCreatedAtStart)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[created_at][end]", filterCreatedAtEnd)); Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.ServiceAccountsApi.listServiceAccountApplicationKeys", + "v2.ServiceAccountsApi.listServiceAccountAccessTokens", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -980,7 +1290,7 @@ public ApiResponse listServiceAccountApplicationKey new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -993,7 +1303,678 @@ public ApiResponse listServiceAccountApplicationKey localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); + } + + /** Manage optional parameters to listServiceAccountApplicationKeys. */ + public static class ListServiceAccountApplicationKeysOptionalParameters { + private Long pageSize; + private Long pageNumber; + private ApplicationKeysSort sort; + private String filter; + private String filterCreatedAtStart; + private String filterCreatedAtEnd; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set sort. + * + * @param sort Application key attribute used to sort results. Sort order is ascending by + * default. In order to specify a descending sort, prefix the attribute with a minus sign. + * (optional, default to "name") + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters sort(ApplicationKeysSort sort) { + this.sort = sort; + return this; + } + + /** + * Set filter. + * + * @param filter Filter application keys by the specified string. (optional) + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Set filterCreatedAtStart. + * + * @param filterCreatedAtStart Only include application keys created on or after the specified + * date. (optional) + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters filterCreatedAtStart( + String filterCreatedAtStart) { + this.filterCreatedAtStart = filterCreatedAtStart; + return this; + } + + /** + * Set filterCreatedAtEnd. + * + * @param filterCreatedAtEnd Only include application keys created on or before the specified + * date. (optional) + * @return ListServiceAccountApplicationKeysOptionalParameters + */ + public ListServiceAccountApplicationKeysOptionalParameters filterCreatedAtEnd( + String filterCreatedAtEnd) { + this.filterCreatedAtEnd = filterCreatedAtEnd; + return this; + } + } + + /** + * List application keys for this service account. + * + *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @return ListApplicationKeysResponse + * @throws ApiException if fails to make API call + */ + public ListApplicationKeysResponse listServiceAccountApplicationKeys(String serviceAccountId) + throws ApiException { + return listServiceAccountApplicationKeysWithHttpInfo( + serviceAccountId, new ListServiceAccountApplicationKeysOptionalParameters()) + .getData(); + } + + /** + * List application keys for this service account. + * + *

See {@link #listServiceAccountApplicationKeysWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @return CompletableFuture<ListApplicationKeysResponse> + */ + public CompletableFuture listServiceAccountApplicationKeysAsync( + String serviceAccountId) { + return listServiceAccountApplicationKeysWithHttpInfoAsync( + serviceAccountId, new ListServiceAccountApplicationKeysOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List application keys for this service account. + * + *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param parameters Optional parameters for the request. + * @return ListApplicationKeysResponse + * @throws ApiException if fails to make API call + */ + public ListApplicationKeysResponse listServiceAccountApplicationKeys( + String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) + throws ApiException { + return listServiceAccountApplicationKeysWithHttpInfo(serviceAccountId, parameters).getData(); + } + + /** + * List application keys for this service account. + * + *

See {@link #listServiceAccountApplicationKeysWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListApplicationKeysResponse> + */ + public CompletableFuture listServiceAccountApplicationKeysAsync( + String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) { + return listServiceAccountApplicationKeysWithHttpInfoAsync(serviceAccountId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all application keys available for this service account. + * + * @param serviceAccountId The ID of the service account. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListApplicationKeysResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listServiceAccountApplicationKeysWithHttpInfo( + String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " listServiceAccountApplicationKeys"); + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + ApplicationKeysSort sort = parameters.sort; + String filter = parameters.filter; + String filterCreatedAtStart = parameters.filterCreatedAtStart; + String filterCreatedAtEnd = parameters.filterCreatedAtEnd; + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/application_keys" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[created_at][start]", filterCreatedAtStart)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[created_at][end]", filterCreatedAtEnd)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.listServiceAccountApplicationKeys", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List application keys for this service account. + * + *

See {@link #listServiceAccountApplicationKeysWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListApplicationKeysResponse>> + */ + public CompletableFuture> + listServiceAccountApplicationKeysWithHttpInfoAsync( + String serviceAccountId, ListServiceAccountApplicationKeysOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " listServiceAccountApplicationKeys")); + return result; + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + ApplicationKeysSort sort = parameters.sort; + String filter = parameters.filter; + String filterCreatedAtStart = parameters.filterCreatedAtStart; + String filterCreatedAtEnd = parameters.filterCreatedAtEnd; + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/application_keys" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[created_at][start]", filterCreatedAtStart)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[created_at][end]", filterCreatedAtEnd)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.listServiceAccountApplicationKeys", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Revoke an access token for a service account. + * + *

See {@link #revokeServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @throws ApiException if fails to make API call + */ + public void revokeServiceAccountAccessToken(String serviceAccountId, String patUuid) + throws ApiException { + revokeServiceAccountAccessTokenWithHttpInfo(serviceAccountId, patUuid); + } + + /** + * Revoke an access token for a service account. + * + *

See {@link #revokeServiceAccountAccessTokenWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture + */ + public CompletableFuture revokeServiceAccountAccessTokenAsync( + String serviceAccountId, String patUuid) { + return revokeServiceAccountAccessTokenWithHttpInfoAsync(serviceAccountId, patUuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Revoke a specific access token for a service account. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse revokeServiceAccountAccessTokenWithHttpInfo( + String serviceAccountId, String patUuid) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " revokeServiceAccountAccessToken"); + } + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + throw new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling revokeServiceAccountAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.revokeServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Revoke an access token for a service account. + * + *

See {@link #revokeServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> revokeServiceAccountAccessTokenWithHttpInfoAsync( + String serviceAccountId, String patUuid) { + Object localVarPostBody = null; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " revokeServiceAccountAccessToken")); + return result; + } + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling" + + " revokeServiceAccountAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.revokeServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Update an access token for a service account. + * + *

See {@link #updateServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return PersonalAccessTokenResponse + * @throws ApiException if fails to make API call + */ + public PersonalAccessTokenResponse updateServiceAccountAccessToken( + String serviceAccountId, String patUuid, PersonalAccessTokenUpdateRequest body) + throws ApiException { + return updateServiceAccountAccessTokenWithHttpInfo(serviceAccountId, patUuid, body).getData(); + } + + /** + * Update an access token for a service account. + * + *

See {@link #updateServiceAccountAccessTokenWithHttpInfoAsync}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return CompletableFuture<PersonalAccessTokenResponse> + */ + public CompletableFuture updateServiceAccountAccessTokenAsync( + String serviceAccountId, String patUuid, PersonalAccessTokenUpdateRequest body) { + return updateServiceAccountAccessTokenWithHttpInfoAsync(serviceAccountId, patUuid, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a specific access token for a service account. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return ApiResponse<PersonalAccessTokenResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateServiceAccountAccessTokenWithHttpInfo( + String serviceAccountId, String patUuid, PersonalAccessTokenUpdateRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " updateServiceAccountAccessToken"); + } + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + throw new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling updateServiceAccountAccessToken"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling updateServiceAccountAccessToken"); + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.updateServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an access token for a service account. + * + *

See {@link #updateServiceAccountAccessTokenWithHttpInfo}. + * + * @param serviceAccountId The ID of the service account. (required) + * @param patUuid The UUID of the personal access token. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<PersonalAccessTokenResponse>> + */ + public CompletableFuture> + updateServiceAccountAccessTokenWithHttpInfoAsync( + String serviceAccountId, String patUuid, PersonalAccessTokenUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'serviceAccountId' is set + if (serviceAccountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'serviceAccountId' when calling" + + " updateServiceAccountAccessToken")); + return result; + } + + // verify the required parameter 'patUuid' is set + if (patUuid == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'patUuid' when calling" + + " updateServiceAccountAccessToken")); + return result; + } + + // 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" + + " updateServiceAccountAccessToken")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}" + .replaceAll( + "\\{" + "service_account_id" + "\\}", + apiClient.escapeString(serviceAccountId.toString())) + .replaceAll("\\{" + "pat_uuid" + "\\}", apiClient.escapeString(patUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ServiceAccountsApi.updateServiceAccountAccessToken", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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/FullPersonalAccessToken.java b/src/main/java/com/datadog/api/client/v2/model/FullPersonalAccessToken.java new file mode 100644 index 00000000000..1ffbbed9632 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FullPersonalAccessToken.java @@ -0,0 +1,224 @@ +/* + * 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; + +/** Datadog personal access token, including the token key. */ +@JsonPropertyOrder({ + FullPersonalAccessToken.JSON_PROPERTY_ATTRIBUTES, + FullPersonalAccessToken.JSON_PROPERTY_ID, + FullPersonalAccessToken.JSON_PROPERTY_RELATIONSHIPS, + FullPersonalAccessToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FullPersonalAccessToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FullPersonalAccessTokenAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private PersonalAccessTokenRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PersonalAccessTokensType type = PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS; + + public FullPersonalAccessToken attributes(FullPersonalAccessTokenAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a full personal access token, including the token key. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FullPersonalAccessTokenAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FullPersonalAccessTokenAttributes attributes) { + this.attributes = attributes; + } + + public FullPersonalAccessToken id(String id) { + this.id = id; + return this; + } + + /** + * ID of the personal access token. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FullPersonalAccessToken relationships(PersonalAccessTokenRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Resources related to the personal access token. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokenRelationships getRelationships() { + return relationships; + } + + public void setRelationships(PersonalAccessTokenRelationships relationships) { + this.relationships = relationships; + } + + public FullPersonalAccessToken type(PersonalAccessTokensType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Personal access tokens resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokensType getType() { + return type; + } + + public void setType(PersonalAccessTokensType 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 FullPersonalAccessToken + */ + @JsonAnySetter + public FullPersonalAccessToken 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 FullPersonalAccessToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FullPersonalAccessToken fullPersonalAccessToken = (FullPersonalAccessToken) o; + return Objects.equals(this.attributes, fullPersonalAccessToken.attributes) + && Objects.equals(this.id, fullPersonalAccessToken.id) + && Objects.equals(this.relationships, fullPersonalAccessToken.relationships) + && Objects.equals(this.type, fullPersonalAccessToken.type) + && Objects.equals(this.additionalProperties, fullPersonalAccessToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FullPersonalAccessToken {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/FullPersonalAccessTokenAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FullPersonalAccessTokenAttributes.java new file mode 100644 index 00000000000..59a9d4e5d07 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FullPersonalAccessTokenAttributes.java @@ -0,0 +1,283 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of a full personal access token, including the token key. */ +@JsonPropertyOrder({ + FullPersonalAccessTokenAttributes.JSON_PROPERTY_ALIAS, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_CREATED_AT, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_EXPIRES_AT, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_KEY, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_NAME, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_PUBLIC_PORTION, + FullPersonalAccessTokenAttributes.JSON_PROPERTY_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FullPersonalAccessTokenAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private JsonNullable expiresAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PUBLIC_PORTION = "public_portion"; + private String publicPortion; + + public static final String JSON_PROPERTY_SCOPES = "scopes"; + private List scopes = null; + + /** + * The alias (short identifier) of the personal access token. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + /** + * Creation date of the personal access token. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Expiration date of the personal access token. + * + * @return expiresAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getExpiresAt() { + + if (expiresAt == null) { + expiresAt = JsonNullable.undefined(); + } + return expiresAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getExpiresAt_JsonNullable() { + return expiresAt; + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + private void setExpiresAt_JsonNullable(JsonNullable expiresAt) { + this.expiresAt = expiresAt; + } + + /** + * The personal access token key. Only returned upon creation. + * + * @return key + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getKey() { + return key; + } + + public FullPersonalAccessTokenAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the personal access token. + * + * @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; + } + + /** + * The public portion of the personal access token. + * + * @return publicPortion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PUBLIC_PORTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPublicPortion() { + return publicPortion; + } + + public FullPersonalAccessTokenAttributes scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public FullPersonalAccessTokenAttributes addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } + this.scopes.add(scopesItem); + return this; + } + + /** + * Array of scopes granted to the personal access token. + * + * @return scopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + /** + * 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 FullPersonalAccessTokenAttributes + */ + @JsonAnySetter + public FullPersonalAccessTokenAttributes 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 FullPersonalAccessTokenAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FullPersonalAccessTokenAttributes fullPersonalAccessTokenAttributes = + (FullPersonalAccessTokenAttributes) o; + return Objects.equals(this.alias, fullPersonalAccessTokenAttributes.alias) + && Objects.equals(this.createdAt, fullPersonalAccessTokenAttributes.createdAt) + && Objects.equals(this.expiresAt, fullPersonalAccessTokenAttributes.expiresAt) + && Objects.equals(this.key, fullPersonalAccessTokenAttributes.key) + && Objects.equals(this.name, fullPersonalAccessTokenAttributes.name) + && Objects.equals(this.publicPortion, fullPersonalAccessTokenAttributes.publicPortion) + && Objects.equals(this.scopes, fullPersonalAccessTokenAttributes.scopes) + && Objects.equals( + this.additionalProperties, fullPersonalAccessTokenAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alias, createdAt, expiresAt, key, name, publicPortion, scopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FullPersonalAccessTokenAttributes {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicPortion: ").append(toIndentedString(publicPortion)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).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/ListPersonalAccessTokensResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListPersonalAccessTokensResponse.java new file mode 100644 index 00000000000..596cdb002d6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListPersonalAccessTokensResponse.java @@ -0,0 +1,181 @@ +/* + * 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; + +/** Response for a list of personal access tokens. */ +@JsonPropertyOrder({ + ListPersonalAccessTokensResponse.JSON_PROPERTY_DATA, + ListPersonalAccessTokensResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListPersonalAccessTokensResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private PersonalAccessTokenResponseMeta meta; + + public ListPersonalAccessTokensResponse data(List data) { + this.data = data; + for (PersonalAccessToken item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListPersonalAccessTokensResponse addDataItem(PersonalAccessToken dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of personal access tokens. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListPersonalAccessTokensResponse meta(PersonalAccessTokenResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Additional information related to the personal access token response. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokenResponseMeta getMeta() { + return meta; + } + + public void setMeta(PersonalAccessTokenResponseMeta meta) { + this.meta = meta; + } + + /** + * 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 ListPersonalAccessTokensResponse + */ + @JsonAnySetter + public ListPersonalAccessTokensResponse 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 ListPersonalAccessTokensResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPersonalAccessTokensResponse listPersonalAccessTokensResponse = + (ListPersonalAccessTokensResponse) o; + return Objects.equals(this.data, listPersonalAccessTokensResponse.data) + && Objects.equals(this.meta, listPersonalAccessTokensResponse.meta) + && Objects.equals( + this.additionalProperties, listPersonalAccessTokensResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPersonalAccessTokensResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/PersonalAccessToken.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessToken.java new file mode 100644 index 00000000000..8858d226eb9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessToken.java @@ -0,0 +1,224 @@ +/* + * 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; + +/** Datadog personal access token. */ +@JsonPropertyOrder({ + PersonalAccessToken.JSON_PROPERTY_ATTRIBUTES, + PersonalAccessToken.JSON_PROPERTY_ID, + PersonalAccessToken.JSON_PROPERTY_RELATIONSHIPS, + PersonalAccessToken.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PersonalAccessTokenAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private PersonalAccessTokenRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PersonalAccessTokensType type = PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS; + + public PersonalAccessToken attributes(PersonalAccessTokenAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a personal access token. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokenAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PersonalAccessTokenAttributes attributes) { + this.attributes = attributes; + } + + public PersonalAccessToken id(String id) { + this.id = id; + return this; + } + + /** + * ID of the personal access token. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PersonalAccessToken relationships(PersonalAccessTokenRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Resources related to the personal access token. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokenRelationships getRelationships() { + return relationships; + } + + public void setRelationships(PersonalAccessTokenRelationships relationships) { + this.relationships = relationships; + } + + public PersonalAccessToken type(PersonalAccessTokensType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Personal access tokens resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokensType getType() { + return type; + } + + public void setType(PersonalAccessTokensType 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 PersonalAccessToken + */ + @JsonAnySetter + public PersonalAccessToken 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 PersonalAccessToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessToken personalAccessToken = (PersonalAccessToken) o; + return Objects.equals(this.attributes, personalAccessToken.attributes) + && Objects.equals(this.id, personalAccessToken.id) + && Objects.equals(this.relationships, personalAccessToken.relationships) + && Objects.equals(this.type, personalAccessToken.type) + && Objects.equals(this.additionalProperties, personalAccessToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessToken {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/PersonalAccessTokenAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenAttributes.java new file mode 100644 index 00000000000..1a9b5f964af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenAttributes.java @@ -0,0 +1,336 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of a personal access token. */ +@JsonPropertyOrder({ + PersonalAccessTokenAttributes.JSON_PROPERTY_ALIAS, + PersonalAccessTokenAttributes.JSON_PROPERTY_CREATED_AT, + PersonalAccessTokenAttributes.JSON_PROPERTY_EXPIRES_AT, + PersonalAccessTokenAttributes.JSON_PROPERTY_LAST_USED_AT, + PersonalAccessTokenAttributes.JSON_PROPERTY_MODIFIED_AT, + PersonalAccessTokenAttributes.JSON_PROPERTY_NAME, + PersonalAccessTokenAttributes.JSON_PROPERTY_PUBLIC_PORTION, + PersonalAccessTokenAttributes.JSON_PROPERTY_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private JsonNullable expiresAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LAST_USED_AT = "last_used_at"; + private JsonNullable lastUsedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private JsonNullable modifiedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PUBLIC_PORTION = "public_portion"; + private String publicPortion; + + public static final String JSON_PROPERTY_SCOPES = "scopes"; + private List scopes = null; + + /** + * The alias (short identifier) of the personal access token. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + /** + * Creation date of the personal access token. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Expiration date of the personal access token. + * + * @return expiresAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getExpiresAt() { + + if (expiresAt == null) { + expiresAt = JsonNullable.undefined(); + } + return expiresAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getExpiresAt_JsonNullable() { + return expiresAt; + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + private void setExpiresAt_JsonNullable(JsonNullable expiresAt) { + this.expiresAt = expiresAt; + } + + /** + * Date the personal access token was last used. + * + * @return lastUsedAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getLastUsedAt() { + + if (lastUsedAt == null) { + lastUsedAt = JsonNullable.undefined(); + } + return lastUsedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_USED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getLastUsedAt_JsonNullable() { + return lastUsedAt; + } + + @JsonProperty(JSON_PROPERTY_LAST_USED_AT) + private void setLastUsedAt_JsonNullable(JsonNullable lastUsedAt) { + this.lastUsedAt = lastUsedAt; + } + + /** + * Date of last modification of the personal access token. + * + * @return modifiedAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getModifiedAt() { + + if (modifiedAt == null) { + modifiedAt = JsonNullable.undefined(); + } + return modifiedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getModifiedAt_JsonNullable() { + return modifiedAt; + } + + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + private void setModifiedAt_JsonNullable(JsonNullable modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public PersonalAccessTokenAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the personal access token. + * + * @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; + } + + /** + * The public portion of the personal access token. + * + * @return publicPortion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PUBLIC_PORTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPublicPortion() { + return publicPortion; + } + + public PersonalAccessTokenAttributes scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public PersonalAccessTokenAttributes addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } + this.scopes.add(scopesItem); + return this; + } + + /** + * Array of scopes granted to the personal access token. + * + * @return scopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + /** + * 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 PersonalAccessTokenAttributes + */ + @JsonAnySetter + public PersonalAccessTokenAttributes 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 PersonalAccessTokenAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenAttributes personalAccessTokenAttributes = (PersonalAccessTokenAttributes) o; + return Objects.equals(this.alias, personalAccessTokenAttributes.alias) + && Objects.equals(this.createdAt, personalAccessTokenAttributes.createdAt) + && Objects.equals(this.expiresAt, personalAccessTokenAttributes.expiresAt) + && Objects.equals(this.lastUsedAt, personalAccessTokenAttributes.lastUsedAt) + && Objects.equals(this.modifiedAt, personalAccessTokenAttributes.modifiedAt) + && Objects.equals(this.name, personalAccessTokenAttributes.name) + && Objects.equals(this.publicPortion, personalAccessTokenAttributes.publicPortion) + && Objects.equals(this.scopes, personalAccessTokenAttributes.scopes) + && Objects.equals( + this.additionalProperties, personalAccessTokenAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alias, + createdAt, + expiresAt, + lastUsedAt, + modifiedAt, + name, + publicPortion, + scopes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenAttributes {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" lastUsedAt: ").append(toIndentedString(lastUsedAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicPortion: ").append(toIndentedString(publicPortion)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).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/PersonalAccessTokenCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateAttributes.java new file mode 100644 index 00000000000..f9e59f0e00b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateAttributes.java @@ -0,0 +1,211 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes used to create a personal access token. */ +@JsonPropertyOrder({ + PersonalAccessTokenCreateAttributes.JSON_PROPERTY_EXPIRES_AT, + PersonalAccessTokenCreateAttributes.JSON_PROPERTY_NAME, + PersonalAccessTokenCreateAttributes.JSON_PROPERTY_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SCOPES = "scopes"; + private List scopes = new ArrayList<>(); + + public PersonalAccessTokenCreateAttributes() {} + + @JsonCreator + public PersonalAccessTokenCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_EXPIRES_AT) OffsetDateTime expiresAt, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SCOPES) List scopes) { + this.expiresAt = expiresAt; + this.name = name; + this.scopes = scopes; + } + + public PersonalAccessTokenCreateAttributes expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Expiration date of the personal access token. Must be at least 24 hours in the future. + * + * @return expiresAt + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public PersonalAccessTokenCreateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the personal access token. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public PersonalAccessTokenCreateAttributes scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public PersonalAccessTokenCreateAttributes addScopesItem(String scopesItem) { + this.scopes.add(scopesItem); + return this; + } + + /** + * Array of scopes to grant the personal access token. + * + * @return scopes + */ + @JsonProperty(JSON_PROPERTY_SCOPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + /** + * 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 PersonalAccessTokenCreateAttributes + */ + @JsonAnySetter + public PersonalAccessTokenCreateAttributes 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 PersonalAccessTokenCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenCreateAttributes personalAccessTokenCreateAttributes = + (PersonalAccessTokenCreateAttributes) o; + return Objects.equals(this.expiresAt, personalAccessTokenCreateAttributes.expiresAt) + && Objects.equals(this.name, personalAccessTokenCreateAttributes.name) + && Objects.equals(this.scopes, personalAccessTokenCreateAttributes.scopes) + && Objects.equals( + this.additionalProperties, personalAccessTokenCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expiresAt, name, scopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenCreateAttributes {\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).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/PersonalAccessTokenCreateData.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateData.java new file mode 100644 index 00000000000..49d8ed53661 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateData.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** Object used to create a personal access token. */ +@JsonPropertyOrder({ + PersonalAccessTokenCreateData.JSON_PROPERTY_ATTRIBUTES, + PersonalAccessTokenCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PersonalAccessTokenCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PersonalAccessTokensType type = PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS; + + public PersonalAccessTokenCreateData() {} + + @JsonCreator + public PersonalAccessTokenCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + PersonalAccessTokenCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) PersonalAccessTokensType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PersonalAccessTokenCreateData attributes(PersonalAccessTokenCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes used to create a personal access token. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokenCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PersonalAccessTokenCreateAttributes attributes) { + this.attributes = attributes; + } + + public PersonalAccessTokenCreateData type(PersonalAccessTokensType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Personal access tokens resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokensType getType() { + return type; + } + + public void setType(PersonalAccessTokensType 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 PersonalAccessTokenCreateData + */ + @JsonAnySetter + public PersonalAccessTokenCreateData 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 PersonalAccessTokenCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenCreateData personalAccessTokenCreateData = (PersonalAccessTokenCreateData) o; + return Objects.equals(this.attributes, personalAccessTokenCreateData.attributes) + && Objects.equals(this.type, personalAccessTokenCreateData.type) + && Objects.equals( + this.additionalProperties, personalAccessTokenCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenCreateData {\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/PersonalAccessTokenCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateRequest.java new file mode 100644 index 00000000000..de5b07fa8ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateRequest.java @@ -0,0 +1,148 @@ +/* + * 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 used to create a personal access token. */ +@JsonPropertyOrder({PersonalAccessTokenCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PersonalAccessTokenCreateData data; + + public PersonalAccessTokenCreateRequest() {} + + @JsonCreator + public PersonalAccessTokenCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + PersonalAccessTokenCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PersonalAccessTokenCreateRequest data(PersonalAccessTokenCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object used to create a personal access token. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokenCreateData getData() { + return data; + } + + public void setData(PersonalAccessTokenCreateData data) { + this.data = data; + } + + /** + * 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 PersonalAccessTokenCreateRequest + */ + @JsonAnySetter + public PersonalAccessTokenCreateRequest 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 PersonalAccessTokenCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenCreateRequest personalAccessTokenCreateRequest = + (PersonalAccessTokenCreateRequest) o; + return Objects.equals(this.data, personalAccessTokenCreateRequest.data) + && Objects.equals( + this.additionalProperties, personalAccessTokenCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenCreateRequest {\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/PersonalAccessTokenCreateResponse.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateResponse.java new file mode 100644 index 00000000000..7f94c81eba6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenCreateResponse.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** Response for creating a personal access token. Includes the token key. */ +@JsonPropertyOrder({PersonalAccessTokenCreateResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenCreateResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FullPersonalAccessToken data; + + public PersonalAccessTokenCreateResponse data(FullPersonalAccessToken data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Datadog personal access token, including the token key. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FullPersonalAccessToken getData() { + return data; + } + + public void setData(FullPersonalAccessToken data) { + this.data = data; + } + + /** + * 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 PersonalAccessTokenCreateResponse + */ + @JsonAnySetter + public PersonalAccessTokenCreateResponse 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 PersonalAccessTokenCreateResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenCreateResponse personalAccessTokenCreateResponse = + (PersonalAccessTokenCreateResponse) o; + return Objects.equals(this.data, personalAccessTokenCreateResponse.data) + && Objects.equals( + this.additionalProperties, personalAccessTokenCreateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenCreateResponse {\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/PersonalAccessTokenRelationships.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenRelationships.java new file mode 100644 index 00000000000..ffe981bb959 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenRelationships.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** Resources related to the personal access token. */ +@JsonPropertyOrder({PersonalAccessTokenRelationships.JSON_PROPERTY_OWNED_BY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OWNED_BY = "owned_by"; + private RelationshipToUser ownedBy; + + public PersonalAccessTokenRelationships ownedBy(RelationshipToUser ownedBy) { + this.ownedBy = ownedBy; + this.unparsed |= ownedBy.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return ownedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OWNED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(RelationshipToUser ownedBy) { + this.ownedBy = ownedBy; + } + + /** + * 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 PersonalAccessTokenRelationships + */ + @JsonAnySetter + public PersonalAccessTokenRelationships 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 PersonalAccessTokenRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenRelationships personalAccessTokenRelationships = + (PersonalAccessTokenRelationships) o; + return Objects.equals(this.ownedBy, personalAccessTokenRelationships.ownedBy) + && Objects.equals( + this.additionalProperties, personalAccessTokenRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ownedBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenRelationships {\n"); + sb.append(" ownedBy: ").append(toIndentedString(ownedBy)).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/PersonalAccessTokenResponse.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponse.java new file mode 100644 index 00000000000..0ca298c8bf4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponse.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** Response for retrieving a personal access token. */ +@JsonPropertyOrder({PersonalAccessTokenResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PersonalAccessToken data; + + public PersonalAccessTokenResponse data(PersonalAccessToken data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Datadog personal access token. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessToken getData() { + return data; + } + + public void setData(PersonalAccessToken data) { + this.data = data; + } + + /** + * 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 PersonalAccessTokenResponse + */ + @JsonAnySetter + public PersonalAccessTokenResponse 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 PersonalAccessTokenResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenResponse personalAccessTokenResponse = (PersonalAccessTokenResponse) o; + return Objects.equals(this.data, personalAccessTokenResponse.data) + && Objects.equals( + this.additionalProperties, personalAccessTokenResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenResponse {\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/PersonalAccessTokenResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponseMeta.java new file mode 100644 index 00000000000..55811f20413 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponseMeta.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** Additional information related to the personal access token response. */ +@JsonPropertyOrder({PersonalAccessTokenResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private PersonalAccessTokenResponseMetaPage page; + + public PersonalAccessTokenResponseMeta page(PersonalAccessTokenResponseMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Pagination information. + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PersonalAccessTokenResponseMetaPage getPage() { + return page; + } + + public void setPage(PersonalAccessTokenResponseMetaPage page) { + this.page = page; + } + + /** + * 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 PersonalAccessTokenResponseMeta + */ + @JsonAnySetter + public PersonalAccessTokenResponseMeta 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 PersonalAccessTokenResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenResponseMeta personalAccessTokenResponseMeta = + (PersonalAccessTokenResponseMeta) o; + return Objects.equals(this.page, personalAccessTokenResponseMeta.page) + && Objects.equals( + this.additionalProperties, personalAccessTokenResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/PersonalAccessTokenResponseMetaPage.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponseMetaPage.java new file mode 100644 index 00000000000..439102327a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenResponseMetaPage.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** Pagination information. */ +@JsonPropertyOrder({PersonalAccessTokenResponseMetaPage.JSON_PROPERTY_TOTAL_FILTERED_COUNT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenResponseMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TOTAL_FILTERED_COUNT = "total_filtered_count"; + private Long totalFilteredCount; + + public PersonalAccessTokenResponseMetaPage totalFilteredCount(Long totalFilteredCount) { + this.totalFilteredCount = totalFilteredCount; + return this; + } + + /** + * Total filtered personal access token count. + * + * @return totalFilteredCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_FILTERED_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalFilteredCount() { + return totalFilteredCount; + } + + public void setTotalFilteredCount(Long totalFilteredCount) { + this.totalFilteredCount = totalFilteredCount; + } + + /** + * 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 PersonalAccessTokenResponseMetaPage + */ + @JsonAnySetter + public PersonalAccessTokenResponseMetaPage 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 PersonalAccessTokenResponseMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenResponseMetaPage personalAccessTokenResponseMetaPage = + (PersonalAccessTokenResponseMetaPage) o; + return Objects.equals( + this.totalFilteredCount, personalAccessTokenResponseMetaPage.totalFilteredCount) + && Objects.equals( + this.additionalProperties, personalAccessTokenResponseMetaPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(totalFilteredCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenResponseMetaPage {\n"); + sb.append(" totalFilteredCount: ").append(toIndentedString(totalFilteredCount)).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/PersonalAccessTokenUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateAttributes.java new file mode 100644 index 00000000000..546912dfd6d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateAttributes.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.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 used to update a personal access token. */ +@JsonPropertyOrder({ + PersonalAccessTokenUpdateAttributes.JSON_PROPERTY_NAME, + PersonalAccessTokenUpdateAttributes.JSON_PROPERTY_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SCOPES = "scopes"; + private List scopes = null; + + public PersonalAccessTokenUpdateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the personal access token. + * + * @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; + } + + public PersonalAccessTokenUpdateAttributes scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public PersonalAccessTokenUpdateAttributes addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } + this.scopes.add(scopesItem); + return this; + } + + /** + * Array of scopes to grant the personal access token. + * + * @return scopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + /** + * 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 PersonalAccessTokenUpdateAttributes + */ + @JsonAnySetter + public PersonalAccessTokenUpdateAttributes 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 PersonalAccessTokenUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenUpdateAttributes personalAccessTokenUpdateAttributes = + (PersonalAccessTokenUpdateAttributes) o; + return Objects.equals(this.name, personalAccessTokenUpdateAttributes.name) + && Objects.equals(this.scopes, personalAccessTokenUpdateAttributes.scopes) + && Objects.equals( + this.additionalProperties, personalAccessTokenUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, scopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenUpdateAttributes {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).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/PersonalAccessTokenUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateData.java new file mode 100644 index 00000000000..f2cae513c6b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateData.java @@ -0,0 +1,210 @@ +/* + * 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; + +/** Object used to update a personal access token. */ +@JsonPropertyOrder({ + PersonalAccessTokenUpdateData.JSON_PROPERTY_ATTRIBUTES, + PersonalAccessTokenUpdateData.JSON_PROPERTY_ID, + PersonalAccessTokenUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PersonalAccessTokenUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PersonalAccessTokensType type = PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS; + + public PersonalAccessTokenUpdateData() {} + + @JsonCreator + public PersonalAccessTokenUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + PersonalAccessTokenUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) PersonalAccessTokensType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PersonalAccessTokenUpdateData attributes(PersonalAccessTokenUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes used to update a personal access token. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokenUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PersonalAccessTokenUpdateAttributes attributes) { + this.attributes = attributes; + } + + public PersonalAccessTokenUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * ID of the personal access token. + * + * @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 PersonalAccessTokenUpdateData type(PersonalAccessTokensType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Personal access tokens resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokensType getType() { + return type; + } + + public void setType(PersonalAccessTokensType 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 PersonalAccessTokenUpdateData + */ + @JsonAnySetter + public PersonalAccessTokenUpdateData 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 PersonalAccessTokenUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenUpdateData personalAccessTokenUpdateData = (PersonalAccessTokenUpdateData) o; + return Objects.equals(this.attributes, personalAccessTokenUpdateData.attributes) + && Objects.equals(this.id, personalAccessTokenUpdateData.id) + && Objects.equals(this.type, personalAccessTokenUpdateData.type) + && Objects.equals( + this.additionalProperties, personalAccessTokenUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenUpdateData {\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/PersonalAccessTokenUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateRequest.java new file mode 100644 index 00000000000..7b62de76f9c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokenUpdateRequest.java @@ -0,0 +1,148 @@ +/* + * 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 used to update a personal access token. */ +@JsonPropertyOrder({PersonalAccessTokenUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PersonalAccessTokenUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PersonalAccessTokenUpdateData data; + + public PersonalAccessTokenUpdateRequest() {} + + @JsonCreator + public PersonalAccessTokenUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + PersonalAccessTokenUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PersonalAccessTokenUpdateRequest data(PersonalAccessTokenUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object used to update a personal access token. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokenUpdateData getData() { + return data; + } + + public void setData(PersonalAccessTokenUpdateData data) { + this.data = data; + } + + /** + * 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 PersonalAccessTokenUpdateRequest + */ + @JsonAnySetter + public PersonalAccessTokenUpdateRequest 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 PersonalAccessTokenUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PersonalAccessTokenUpdateRequest personalAccessTokenUpdateRequest = + (PersonalAccessTokenUpdateRequest) o; + return Objects.equals(this.data, personalAccessTokenUpdateRequest.data) + && Objects.equals( + this.additionalProperties, personalAccessTokenUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PersonalAccessTokenUpdateRequest {\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/PersonalAccessTokensSort.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokensSort.java new file mode 100644 index 00000000000..91fdc974771 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokensSort.java @@ -0,0 +1,68 @@ +/* + * 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; + +/** Sorting options */ +@JsonSerialize(using = PersonalAccessTokensSort.PersonalAccessTokensSortSerializer.class) +public class PersonalAccessTokensSort extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("name", "-name", "created_at", "-created_at", "expires_at", "-expires_at")); + + public static final PersonalAccessTokensSort NAME_ASCENDING = + new PersonalAccessTokensSort("name"); + public static final PersonalAccessTokensSort NAME_DESCENDING = + new PersonalAccessTokensSort("-name"); + public static final PersonalAccessTokensSort CREATED_AT_ASCENDING = + new PersonalAccessTokensSort("created_at"); + public static final PersonalAccessTokensSort CREATED_AT_DESCENDING = + new PersonalAccessTokensSort("-created_at"); + public static final PersonalAccessTokensSort EXPIRES_AT_ASCENDING = + new PersonalAccessTokensSort("expires_at"); + public static final PersonalAccessTokensSort EXPIRES_AT_DESCENDING = + new PersonalAccessTokensSort("-expires_at"); + + PersonalAccessTokensSort(String value) { + super(value, allowedValues); + } + + public static class PersonalAccessTokensSortSerializer + extends StdSerializer { + public PersonalAccessTokensSortSerializer(Class t) { + super(t); + } + + public PersonalAccessTokensSortSerializer() { + this(null); + } + + @Override + public void serialize( + PersonalAccessTokensSort value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PersonalAccessTokensSort fromValue(String value) { + return new PersonalAccessTokensSort(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokensType.java b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokensType.java new file mode 100644 index 00000000000..4234ae86743 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PersonalAccessTokensType.java @@ -0,0 +1,57 @@ +/* + * 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; + +/** Personal access tokens resource type. */ +@JsonSerialize(using = PersonalAccessTokensType.PersonalAccessTokensTypeSerializer.class) +public class PersonalAccessTokensType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("personal_access_tokens")); + + public static final PersonalAccessTokensType PERSONAL_ACCESS_TOKENS = + new PersonalAccessTokensType("personal_access_tokens"); + + PersonalAccessTokensType(String value) { + super(value, allowedValues); + } + + public static class PersonalAccessTokensTypeSerializer + extends StdSerializer { + public PersonalAccessTokensTypeSerializer(Class t) { + super(t); + } + + public PersonalAccessTokensTypeSerializer() { + this(null); + } + + @Override + public void serialize( + PersonalAccessTokensType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PersonalAccessTokensType fromValue(String value) { + return new PersonalAccessTokensType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateAttributes.java new file mode 100644 index 00000000000..25efc41fe8d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateAttributes.java @@ -0,0 +1,211 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes used to create a service account access token. */ +@JsonPropertyOrder({ + ServiceAccountAccessTokenCreateAttributes.JSON_PROPERTY_EXPIRES_AT, + ServiceAccountAccessTokenCreateAttributes.JSON_PROPERTY_NAME, + ServiceAccountAccessTokenCreateAttributes.JSON_PROPERTY_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceAccountAccessTokenCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SCOPES = "scopes"; + private List scopes = new ArrayList<>(); + + public ServiceAccountAccessTokenCreateAttributes() {} + + @JsonCreator + public ServiceAccountAccessTokenCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SCOPES) List scopes) { + this.name = name; + this.scopes = scopes; + } + + public ServiceAccountAccessTokenCreateAttributes expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Expiration date of the access token. Optional for service account tokens. + * + * @return expiresAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public ServiceAccountAccessTokenCreateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the access token. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ServiceAccountAccessTokenCreateAttributes scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public ServiceAccountAccessTokenCreateAttributes addScopesItem(String scopesItem) { + this.scopes.add(scopesItem); + return this; + } + + /** + * Array of scopes to grant the access token. + * + * @return scopes + */ + @JsonProperty(JSON_PROPERTY_SCOPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + /** + * 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 ServiceAccountAccessTokenCreateAttributes + */ + @JsonAnySetter + public ServiceAccountAccessTokenCreateAttributes 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 ServiceAccountAccessTokenCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceAccountAccessTokenCreateAttributes serviceAccountAccessTokenCreateAttributes = + (ServiceAccountAccessTokenCreateAttributes) o; + return Objects.equals(this.expiresAt, serviceAccountAccessTokenCreateAttributes.expiresAt) + && Objects.equals(this.name, serviceAccountAccessTokenCreateAttributes.name) + && Objects.equals(this.scopes, serviceAccountAccessTokenCreateAttributes.scopes) + && Objects.equals( + this.additionalProperties, + serviceAccountAccessTokenCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expiresAt, name, scopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceAccountAccessTokenCreateAttributes {\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scopes: ").append(toIndentedString(scopes)).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/ServiceAccountAccessTokenCreateData.java b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateData.java new file mode 100644 index 00000000000..e84b4e94c96 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateData.java @@ -0,0 +1,184 @@ +/* + * 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; + +/** Object used to create a service account access token. */ +@JsonPropertyOrder({ + ServiceAccountAccessTokenCreateData.JSON_PROPERTY_ATTRIBUTES, + ServiceAccountAccessTokenCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceAccountAccessTokenCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ServiceAccountAccessTokenCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PersonalAccessTokensType type = PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS; + + public ServiceAccountAccessTokenCreateData() {} + + @JsonCreator + public ServiceAccountAccessTokenCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ServiceAccountAccessTokenCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) PersonalAccessTokensType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ServiceAccountAccessTokenCreateData attributes( + ServiceAccountAccessTokenCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes used to create a service account access token. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceAccountAccessTokenCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ServiceAccountAccessTokenCreateAttributes attributes) { + this.attributes = attributes; + } + + public ServiceAccountAccessTokenCreateData type(PersonalAccessTokensType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Personal access tokens resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PersonalAccessTokensType getType() { + return type; + } + + public void setType(PersonalAccessTokensType 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 ServiceAccountAccessTokenCreateData + */ + @JsonAnySetter + public ServiceAccountAccessTokenCreateData 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 ServiceAccountAccessTokenCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceAccountAccessTokenCreateData serviceAccountAccessTokenCreateData = + (ServiceAccountAccessTokenCreateData) o; + return Objects.equals(this.attributes, serviceAccountAccessTokenCreateData.attributes) + && Objects.equals(this.type, serviceAccountAccessTokenCreateData.type) + && Objects.equals( + this.additionalProperties, serviceAccountAccessTokenCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceAccountAccessTokenCreateData {\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/ServiceAccountAccessTokenCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateRequest.java new file mode 100644 index 00000000000..b1e43a66bac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ServiceAccountAccessTokenCreateRequest.java @@ -0,0 +1,148 @@ +/* + * 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 used to create a service account access token. */ +@JsonPropertyOrder({ServiceAccountAccessTokenCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ServiceAccountAccessTokenCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ServiceAccountAccessTokenCreateData data; + + public ServiceAccountAccessTokenCreateRequest() {} + + @JsonCreator + public ServiceAccountAccessTokenCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + ServiceAccountAccessTokenCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ServiceAccountAccessTokenCreateRequest data(ServiceAccountAccessTokenCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object used to create a service account access token. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ServiceAccountAccessTokenCreateData getData() { + return data; + } + + public void setData(ServiceAccountAccessTokenCreateData data) { + this.data = data; + } + + /** + * 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 ServiceAccountAccessTokenCreateRequest + */ + @JsonAnySetter + public ServiceAccountAccessTokenCreateRequest 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 ServiceAccountAccessTokenCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServiceAccountAccessTokenCreateRequest serviceAccountAccessTokenCreateRequest = + (ServiceAccountAccessTokenCreateRequest) o; + return Objects.equals(this.data, serviceAccountAccessTokenCreateRequest.data) + && Objects.equals( + this.additionalProperties, serviceAccountAccessTokenCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceAccountAccessTokenCreateRequest {\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/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.freeze new file mode 100644 index 00000000000..1ab7569dc43 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.freeze @@ -0,0 +1 @@ +2026-04-08T16:45:23.208Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.json b/src/test/resources/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.json new file mode 100644 index 00000000000..2d730d84e11 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_personal_access_token_returns_Created_response.json @@ -0,0 +1,53 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"expires_at\":\"2027-04-08T16:45:23.208Z\",\"name\":\"Test-Create_a_personal_access_token_returns_Created_response-1775666723\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"da1bd5f8-847b-4aec-a33d-11b04ebde244\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:23.302611856Z\",\"expires_at\":\"2027-04-08T16:45:23.208Z\",\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxXxxxxxxxxxx\",\"name\":\"Test-Create_a_personal_access_token_returns_Created_response-1775666723\",\"public_portion\":\"6dZ2zcpumTdlnHIgx2SlHA\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "701b1c5a-5d54-808b-9982-95e3c0a1fa57" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/da1bd5f8-847b-4aec-a33d-11b04ebde244", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6471b957-3472-d301-cda2-88e226c22f9d" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.freeze new file mode 100644 index 00000000000..b457d0ec92c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.freeze @@ -0,0 +1 @@ +2026-04-03T21:02:56.793Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.json b/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.json new file mode 100644 index 00000000000..ebd30ca2de3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_access_token_for_a_service_account_returns_Created_response.json @@ -0,0 +1,104 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Create_an_access_token_for_a_service_account_returns_Created_response-1775250176@datadoghq.com\",\"service_account\":true,\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0\",\"attributes\":{\"name\":null,\"handle\":\"7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0\",\"created_at\":\"2026-04-03T21:02:56.980609+00:00\",\"modified_at\":\"2026-04-03T21:02:56.980609+00:00\",\"email\":\"test-create_an_access_token_for_a_service_account_returns_created_response-1775250176@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/1a703b50769c96d7b84a5470f474ef74?s=48&d=retro\",\"title\":\"user title\",\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "567c34c3-ae3c-8785-a73a-27fcc9a742ba" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Create_an_access_token_for_a_service_account_returns_Created_response-1775250176\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0/access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"6f2491f5-8c3f-45a3-962a-5f769b95e806\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"3NirNJ5Y2qB4Fmac8B4wnm\",\"created_at\":\"2026-04-03T21:02:57.288351972Z\",\"expires_at\":null,\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxXxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Create_an_access_token_for_a_service_account_returns_Created_response-1775250176\",\"public_portion\":\"3NirNJ5Y2qB4Fmac8B4wnm\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c6adfa6b-1027-61d3-a8c2-030c2ba28080" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/service_accounts/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0/access_tokens/6f2491f5-8c3f-45a3-962a-5f769b95e806", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "09473a0a-cca9-78f1-677a-1a4f8ac133da" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "393e616c-bf05-7584-1cd3-0dad62ab2cff" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.freeze new file mode 100644 index 00000000000..04a4adeef36 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-08T16:45:35.914Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.json new file mode 100644 index 00000000000..c0c1ec4e5ce --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_personal_access_token_returns_OK_response.json @@ -0,0 +1,79 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"expires_at\":\"2027-04-08T16:45:35.914Z\",\"name\":\"Test-Get_a_personal_access_token_returns_OK_response-1775666735\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"6ada9c44-0b7f-4e35-826b-ccecd6d358d5\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:36.006189144Z\",\"expires_at\":\"2027-04-08T16:45:35.914Z\",\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxXxxxxxxxxx\",\"name\":\"Test-Get_a_personal_access_token_returns_OK_response-1775666735\",\"public_portion\":\"3Fd5hG1s1rf27qn2E4nNdF\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3c92659f-294b-3a51-8d41-47b417d4f56e" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/personal_access_tokens/6ada9c44-0b7f-4e35-826b-ccecd6d358d5", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"6ada9c44-0b7f-4e35-826b-ccecd6d358d5\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:36.006189Z\",\"expires_at\":\"2027-04-08T16:45:35.914Z\",\"last_used_at\":null,\"name\":\"Test-Get_a_personal_access_token_returns_OK_response-1775666735\",\"public_portion\":\"3Fd5hG1s1rf27qn2E4nNdF\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "06c23add-d301-b195-2af9-43742ec197a3" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/6ada9c44-0b7f-4e35-826b-ccecd6d358d5", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "aa67ab07-a322-bf2f-5a43-30fe7a11ce0e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.freeze new file mode 100644 index 00000000000..fc8e158682b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-08T16:46:16.639Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.json new file mode 100644 index 00000000000..7ef9376c684 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_personal_access_tokens_returns_OK_response.json @@ -0,0 +1,79 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"expires_at\":\"2027-04-08T16:46:16.639Z\",\"name\":\"Test-Get_all_personal_access_tokens_returns_OK_response-1775666776\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"35ef7728-4761-41dd-8a7b-f1112a26f840\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:46:16.769979863Z\",\"expires_at\":\"2027-04-08T16:46:16.639Z\",\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Get_all_personal_access_tokens_returns_OK_response-1775666776\",\"public_portion\":\"1dm1op4lL89nV8pt94Tdk8\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "104f5cb2-38e1-b6c0-87ab-2d4d6c059b84" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"61c07794-df2a-4403-a6ad-caa6bb70dae2\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T08:58:54.688182Z\",\"expires_at\":\"2026-04-09T08:58:54Z\",\"last_used_at\":\"2026-04-08T08:58:55.302839705Z\",\"name\":\"dd_auth_cli-DhhOC4JHLtgPkfDr6DEXUcTL79UOCx1w2ENxgmIHh7w\",\"public_portion\":\"2ySDERb6wx1YqV1udJl61q\",\"scopes\":[\"admin\",\"standard\",\"logs_read_index_data\",\"logs_modify_indexes\",\"logs_live_tail\",\"logs_write_exclusion_filters\",\"logs_write_pipelines\",\"logs_write_processors\",\"logs_write_archives\",\"logs_generate_metrics\",\"dashboards_read\",\"dashboards_write\",\"dashboards_public_share\",\"monitors_read\",\"monitors_write\",\"monitors_downtime\",\"logs_read_data\",\"logs_read_archives\",\"security_monitoring_rules_read\",\"security_monitoring_rules_write\",\"security_monitoring_signals_read\",\"security_monitoring_signals_write\",\"user_access_invite\",\"user_access_manage\",\"user_app_keys\",\"org_app_keys_read\",\"org_app_keys_write\",\"synthetics_private_location_read\",\"synthetics_private_location_write\",\"billing_read\",\"billing_edit\",\"usage_read\",\"usage_edit\",\"metric_tags_write\",\"logs_write_historical_view\",\"audit_logs_read\",\"api_keys_read\",\"api_keys_write\",\"synthetics_global_variable_read\",\"synthetics_global_variable_write\",\"synthetics_read\",\"synthetics_write\",\"synthetics_default_settings_read\",\"synthetics_default_settings_write\",\"logs_write_facets\",\"service_account_write\",\"integrations_api\",\"apm_read\",\"apm_retention_filter_read\",\"apm_retention_filter_write\",\"apm_service_ingest_read\",\"apm_service_ingest_write\",\"apm_apdex_manage_write\",\"apm_tag_management_write\",\"apm_primary_operation_write\",\"audit_logs_write\",\"rum_apps_write\",\"debugger_write\",\"debugger_read\",\"data_scanner_read\",\"data_scanner_write\",\"org_management\",\"security_monitoring_filters_read\",\"security_monitoring_filters_write\",\"incident_read\",\"incident_write\",\"incident_settings_read\",\"incident_settings_write\",\"metrics_read\",\"timeseries_query\",\"events_read\",\"appsec_event_rule_read\",\"appsec_event_rule_write\",\"rum_apps_read\",\"rum_session_replay_read\",\"security_monitoring_notification_profiles_read\",\"security_monitoring_notification_profiles_write\",\"apm_generate_metrics\",\"security_monitoring_cws_agent_rules_read\",\"security_monitoring_cws_agent_rules_write\",\"apm_pipelines_write\",\"apm_pipelines_read\",\"observability_pipelines_read\",\"observability_pipelines_write\",\"workflows_read\",\"workflows_write\",\"workflows_run\",\"connections_read\",\"connections_write\",\"notebooks_read\",\"notebooks_write\",\"logs_delete_data\",\"rum_generate_metrics\",\"aws_configurations_manage\",\"azure_configurations_manage\",\"gcp_configurations_manage\",\"manage_integrations\",\"usage_notifications_read\",\"usage_notifications_write\",\"generate_dashboard_reports\",\"slos_read\",\"slos_write\",\"slos_corrections\",\"monitor_config_policy_write\",\"apm_service_catalog_write\",\"apm_service_catalog_read\",\"logs_write_forwarding_rules\",\"watchdog_insights_read\",\"connections_resolve\",\"user_access_read\",\"appsec_protect_read\",\"appsec_protect_write\",\"appsec_activation_read\",\"appsec_activation_write\",\"apps_run\",\"apps_write\",\"cases_read\",\"cases_write\",\"apm_remote_configuration_write\",\"apm_remote_configuration_read\",\"ci_visibility_read\",\"ci_visibility_write\",\"ci_provider_settings_write\",\"ci_visibility_settings_write\",\"continuous_profiler_read\",\"teams_read\",\"teams_manage\",\"security_monitoring_findings_read\",\"incident_notification_settings_read\",\"incident_notification_settings_write\",\"ci_ingestion_control_write\",\"error_tracking_write\",\"watchdog_alerts_write\",\"saved_views_write\",\"client_tokens_read\",\"client_tokens_write\",\"event_correlation_config_read\",\"event_correlation_config_write\",\"event_config_write\",\"security_monitoring_findings_write\",\"cloud_cost_management_read\",\"cloud_cost_management_write\",\"host_tags_write\",\"ci_visibility_pipelines_write\",\"quality_gate_rules_read\",\"quality_gate_rules_write\",\"metrics_metadata_write\",\"rum_delete_data\",\"appsec_vm_write\",\"reference_tables_write\",\"rum_playlist_write\",\"observability_pipelines_delete\",\"observability_pipelines_deploy\",\"processes_generate_metrics\",\"api_keys_delete\",\"agent_flare_collection\",\"org_connections_write\",\"org_connections_read\",\"facets_write\",\"security_monitoring_suppressions_read\",\"security_monitoring_suppressions_write\",\"static_analysis_settings_write\",\"create_webhooks\",\"cd_visibility_read\",\"ndm_netflow_port_mappings_write\",\"appsec_vm_read\",\"debugger_capture_variables\",\"error_tracking_settings_write\",\"error_tracking_exclusion_filters_write\",\"integrations_read\",\"apm_api_catalog_write\",\"apm_api_catalog_read\",\"containers_generate_image_metrics\",\"rum_extend_retention\",\"on_prem_runner_read\",\"on_prem_runner_use\",\"on_prem_runner_write\",\"dora_settings_write\",\"agent_upgrade_write\",\"continuous_profiler_pgo_read\",\"oci_configurations_manage\",\"aws_configuration_read\",\"azure_configuration_read\",\"gcp_configuration_read\",\"oci_configuration_read\",\"hosts_read\",\"aws_configuration_edit\",\"azure_configuration_edit\",\"gcp_configuration_edit\",\"oci_configuration_edit\",\"llm_observability_read\",\"flex_logs_config_write\",\"reference_tables_read\",\"fleet_policies_write\",\"orchestration_custom_resource_definitions_write\",\"code_analysis_read\",\"orchestration_workload_scaling_write\",\"llm_observability_write\",\"observability_pipelines_capture_read\",\"observability_pipelines_capture_write\",\"apps_datastore_read\",\"apps_datastore_write\",\"apps_datastore_manage\",\"security_pipelines_read\",\"security_pipelines_write\",\"connection_groups_write\",\"quality_gates_evaluations_read\",\"connection_groups_read\",\"security_monitoring_cws_agent_rules_actions\",\"rum_retention_filters_read\",\"rum_retention_filters_write\",\"ddsql_editor_read\",\"disaster_recovery_status_read\",\"disaster_recovery_status_write\",\"rum_settings_write\",\"test_optimization_read\",\"test_optimization_write\",\"test_optimization_settings_write\",\"security_comments_write\",\"security_comments_read\",\"dashboards_invite_share\",\"dashboards_embed_share\",\"embeddable_graphs_share\",\"logs_read_workspaces\",\"logs_write_workspaces\",\"audience_management_read\",\"audience_management_write\",\"logs_read_config\",\"on_call_read\",\"on_call_write\",\"on_call_page\",\"dora_metrics_read\",\"error_tracking_read\",\"on_call_respond\",\"process_tags_read\",\"process_tags_write\",\"network_connections_read\",\"serverless_aws_instrumentation_read\",\"serverless_aws_instrumentation_write\",\"coterm_write\",\"coterm_read\",\"data_streams_monitoring_capture_messages\",\"cloudcraft_read\",\"ndm_device_profiles_view\",\"ndm_device_profiles_edit\",\"generate_log_reports\",\"manage_log_reports\",\"ndm_devices_read\",\"ndm_device_tags_write\",\"bits_investigations_read\",\"sheets_read\",\"sheets_write\",\"status_pages_settings_read\",\"status_pages_settings_write\",\"status_pages_incident_write\",\"on_call_admin\",\"orchestration_autoscaling_manage\",\"code_coverage_read\",\"cases_shared_settings_write\",\"repo_info_read\",\"repo_settings_write\",\"product_analytics_apps_write\",\"actions_interface_run\",\"ai_guard_evaluate\",\"generate_ccm_report_schedules\",\"manage_ccm_report_schedules\",\"user_self_profile_read\",\"governance_console_read\",\"data_scanner_unmask\",\"apps_form_read\",\"apps_form_manage\",\"user_self_profile_write\",\"dora_metrics_write\",\"bits_investigations_write\",\"debugger_write_pre_prod\",\"network_health_insights_read\",\"security_monitoring_datasets_read\",\"security_monitoring_datasets_write\",\"feature_flag_config_write\",\"feature_flag_config_read\",\"feature_flag_environment_config_write\",\"feature_flag_environment_config_read\",\"assistant_access\",\"dbm_read\",\"ndm_geomap_locations_write\",\"ndm_device_config_read\",\"dbm_parameterized_queries_read\",\"apm_service_renaming_write\",\"deployment_gates_read\",\"deployment_gates_write\",\"deployment_gates_evaluate\",\"product_analytics_saved_widgets_read\",\"product_analytics_saved_widgets_write\",\"mcp_write\",\"mcp_read\",\"external_provider_status_notifications_read\",\"external_provider_status_notifications_write\",\"governance_console_write\",\"bits_security_analyst_write\",\"bits_security_analyst_config_write\",\"feature_flag_approvals_override\",\"infrastructure_resource_policies_read\",\"infrastructure_resource_policies_write\",\"agent_builder_read\",\"agent_builder_write\",\"agent_builder_run\",\"bits_dev_write\",\"product_analytics_settings_read\",\"product_analytics_settings_write\",\"product_analytics_experiments_read\",\"product_analytics_experiments_write\",\"product_analytics_metrics_read\",\"product_analytics_metrics_write\",\"product_analytics_certified_metrics_write\",\"product_analytics_warehouse_model_write\",\"data_streams_kafka_produce_message\",\"org_group_read\",\"org_group_write\",\"apm_recommendations_notification_rules_read\",\"apm_recommendations_notification_rules_write\",\"product_dashboards_write\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"48e5159f-e308-11ef-bcfc-2666505bfd8f\",\"type\":\"users\"}}}},{\"id\":\"717da798-83bd-4f68-8b0a-dfa98c65bddb\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-02T20:01:42.043142Z\",\"expires_at\":null,\"last_used_at\":null,\"name\":\"Test-Create_a_service_account_access_token_returns_Created_response-1775160101\",\"public_portion\":\"3S9YYEuPThXA4AbPGMcqjr\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"c465e3ca-2ece-11f1-b6f0-363c69093c72\",\"type\":\"users\"}}}},{\"id\":\"35ef7728-4761-41dd-8a7b-f1112a26f840\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:46:16.769979Z\",\"expires_at\":\"2027-04-08T16:46:16.639Z\",\"last_used_at\":null,\"name\":\"Test-Get_all_personal_access_tokens_returns_OK_response-1775666776\",\"public_portion\":\"1dm1op4lL89nV8pt94Tdk8\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}],\"meta\":{\"page\":{\"total_filtered_count\":3}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "febc19af-c6ac-e134-d44e-bc7c2a392754" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/35ef7728-4761-41dd-8a7b-f1112a26f840", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "919c090a-3b15-74b0-cbcf-a0ddc82047a5" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.freeze new file mode 100644 index 00000000000..55c4828532c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-03T21:03:03.500Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.json new file mode 100644 index 00000000000..8ce61fc245e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_access_token_for_a_service_account_returns_OK_response.json @@ -0,0 +1,130 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Get_an_access_token_for_a_service_account_returns_OK_response-1775250183@datadoghq.com\",\"service_account\":true,\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"8161ef90-2fa0-11f1-991f-62f4bfc595d0\",\"attributes\":{\"name\":null,\"handle\":\"8161ef90-2fa0-11f1-991f-62f4bfc595d0\",\"created_at\":\"2026-04-03T21:03:03.714879+00:00\",\"modified_at\":\"2026-04-03T21:03:03.714879+00:00\",\"email\":\"test-get_an_access_token_for_a_service_account_returns_ok_response-1775250183@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/bb3c6df0d99066bbe05cf7dff99b5561?s=48&d=retro\",\"title\":\"user title\",\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "145227f5-47e3-35aa-327f-58dc2e4b258b" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Get_an_access_token_for_a_service_account_returns_OK_response-1775250183\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f2362958-1e67-414b-985d-d3196afd9315\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"7N2tUOwxIjSF8QziOBIpVd\",\"created_at\":\"2026-04-03T21:03:04.002376467Z\",\"expires_at\":null,\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Get_an_access_token_for_a_service_account_returns_OK_response-1775250183\",\"public_portion\":\"7N2tUOwxIjSF8QziOBIpVd\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"8161ef90-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fdccf204-9c1e-92e9-0008-e334c10c3ed8" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens/f2362958-1e67-414b-985d-d3196afd9315", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f2362958-1e67-414b-985d-d3196afd9315\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"7N2tUOwxIjSF8QziOBIpVd\",\"created_at\":\"2026-04-03T21:03:04.002376Z\",\"expires_at\":null,\"last_used_at\":null,\"name\":\"Test-Get_an_access_token_for_a_service_account_returns_OK_response-1775250183\",\"public_portion\":\"7N2tUOwxIjSF8QziOBIpVd\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"8161ef90-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8e65c5a6-4047-d080-cfc9-d5fed107089c" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens/f2362958-1e67-414b-985d-d3196afd9315", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c26607f1-bdf6-dc7e-1abe-ba1d99b0d986" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/8161ef90-2fa0-11f1-991f-62f4bfc595d0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "18d29cd2-ed05-67c0-ce3f-cd340445e82f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.freeze new file mode 100644 index 00000000000..6234af8a3e4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-03T21:03:09.026Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.json new file mode 100644 index 00000000000..63738b91632 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_access_tokens_for_a_service_account_returns_OK_response.json @@ -0,0 +1,79 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-List_access_tokens_for_a_service_account_returns_OK_response-1775250189@datadoghq.com\",\"service_account\":true,\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7\",\"attributes\":{\"name\":null,\"handle\":\"84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7\",\"created_at\":\"2026-04-03T21:03:09.205232+00:00\",\"modified_at\":\"2026-04-03T21:03:09.205232+00:00\",\"email\":\"test-list_access_tokens_for_a_service_account_returns_ok_response-1775250189@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/816e106f74328dd4c20e98c116a9edeb?s=48&d=retro\",\"title\":\"user title\",\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "15159beb-c452-f76c-c58b-3dd52e769af5" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/service_accounts/84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7/access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[],\"meta\":{\"page\":{\"total_filtered_count\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fcd67808-c945-bd4d-6169-075b41c61c92" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "29e3fcdb-4d74-bd98-edbd-15ce7445207c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.freeze new file mode 100644 index 00000000000..96f3a2ce253 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2026-04-08T16:45:51.557Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.json new file mode 100644 index 00000000000..0efe2798cc6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Revoke_a_personal_access_token_returns_No_Content_response.json @@ -0,0 +1,74 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"expires_at\":\"2027-04-08T16:45:51.557Z\",\"name\":\"Test-Revoke_a_personal_access_token_returns_No_Content_response-1775666751\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"6bebbb55-0f75-4444-bec1-52de5987290f\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:51.638215611Z\",\"expires_at\":\"2027-04-08T16:45:51.557Z\",\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxXxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Revoke_a_personal_access_token_returns_No_Content_response-1775666751\",\"public_portion\":\"3HduL45lLrtTDsrdaAXE6B\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b9cb8147-3f99-b78e-5df8-fa9745f986f9" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/6bebbb55-0f75-4444-bec1-52de5987290f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f1b4b602-c8cd-b8a9-666f-22e6a38eb288" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/6bebbb55-0f75-4444-bec1-52de5987290f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f1b4b602-c8cd-b8a9-666f-22e6a38eb289" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.freeze new file mode 100644 index 00000000000..fa38ba91a95 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2026-04-03T21:03:10.520Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.json new file mode 100644 index 00000000000..d9de91753fa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Revoke_an_access_token_for_a_service_account_returns_No_Content_response.json @@ -0,0 +1,125 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Revoke_an_access_token_for_a_service_account_returns_No_Content_response-1775250190@datadoghq.com\",\"service_account\":true,\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"860878b5-2fa0-11f1-991f-62f4bfc595d0\",\"attributes\":{\"name\":null,\"handle\":\"860878b5-2fa0-11f1-991f-62f4bfc595d0\",\"created_at\":\"2026-04-03T21:03:11.517157+00:00\",\"modified_at\":\"2026-04-03T21:03:11.517157+00:00\",\"email\":\"test-revoke_an_access_token_for_a_service_account_returns_no_content_response-1775250190@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7d18813f3cbc71a5e46b1184fc3ad8fb?s=48&d=retro\",\"title\":\"user title\",\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8e80ce1e-baea-0855-a516-5204026b7cb0" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Revoke_an_access_token_for_a_service_account_returns_No_Content_response-1775250190\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"7346d75b-83f3-48ba-9186-899fc80bce16\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"3VWUVmuRsjFIKue2Uq9ii6\",\"created_at\":\"2026-04-03T21:03:11.782016283Z\",\"expires_at\":null,\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Revoke_an_access_token_for_a_service_account_returns_No_Content_response-1775250190\",\"public_portion\":\"3VWUVmuRsjFIKue2Uq9ii6\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"860878b5-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0f38e844-7171-92c4-d557-1f9a6b65056c" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens/7346d75b-83f3-48ba-9186-899fc80bce16", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "69600d26-98fc-c50d-de4a-9a91c7a31bbe" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens/7346d75b-83f3-48ba-9186-899fc80bce16", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "69600d26-98fc-c50d-de4a-9a91c7a31bbf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/860878b5-2fa0-11f1-991f-62f4bfc595d0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6877b2e2-ef94-29e4-86b5-baf7800f86bd" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.freeze new file mode 100644 index 00000000000..0d415665772 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-08T16:45:59.540Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.json new file mode 100644 index 00000000000..fcf1d1c0873 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_personal_access_token_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"expires_at\":\"2027-04-08T16:45:59.540Z\",\"name\":\"Test-Update_a_personal_access_token_returns_OK_response-1775666759\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/personal_access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"7d2c1007-41f2-482e-8ee8-a4dab4a5369e\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:59.640614886Z\",\"expires_at\":\"2027-04-08T16:45:59.54Z\",\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Update_a_personal_access_token_returns_OK_response-1775666759\",\"public_portion\":\"3oCB0TOwLiDNpTdO6FYPq2\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a5ada858-7025-acb4-555d-5e95e3acd4dd" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Update_a_personal_access_token_returns_OK_response-1775666759-updated\"},\"id\":\"7d2c1007-41f2-482e-8ee8-a4dab4a5369e\",\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/personal_access_tokens/7d2c1007-41f2-482e-8ee8-a4dab4a5369e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"7d2c1007-41f2-482e-8ee8-a4dab4a5369e\",\"type\":\"personal_access_tokens\",\"attributes\":{\"created_at\":\"2026-04-08T16:45:59.640614Z\",\"expires_at\":\"2027-04-08T16:45:59.54Z\",\"last_used_at\":null,\"modified_at\":\"2026-04-08T16:45:59.747202Z\",\"name\":\"Test-Update_a_personal_access_token_returns_OK_response-1775666759-updated\",\"public_portion\":\"3oCB0TOwLiDNpTdO6FYPq2\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ac739ca7-00ca-d6bf-f717-1b99b7eefa41" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/personal_access_tokens/7d2c1007-41f2-482e-8ee8-a4dab4a5369e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "04cbca67-99f5-64ee-8043-f6deddc6473b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.freeze new file mode 100644 index 00000000000..6a894d59da1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-03T21:03:12.499Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.json new file mode 100644 index 00000000000..084402251cc --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_access_token_for_a_service_account_returns_OK_response.json @@ -0,0 +1,134 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192@datadoghq.com\",\"service_account\":true,\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0\",\"attributes\":{\"name\":null,\"handle\":\"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0\",\"created_at\":\"2026-04-03T21:03:12.706435+00:00\",\"modified_at\":\"2026-04-03T21:03:12.706435+00:00\",\"email\":\"test-update_an_access_token_for_a_service_account_returns_ok_response-1775250192@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/8ef25c203ebdbe5e11acb74bd99ba7da?s=48&d=retro\",\"title\":\"user title\",\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "284472d5-9973-7d0e-2c04-6ac82d23b165" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192\",\"scopes\":[\"dashboards_read\"]},\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"9a7d27cc-4969-4a57-990c-03c23a9f2adc\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"4hW0tyOpjf5Dj84mZaXqwe\",\"created_at\":\"2026-04-03T21:03:12.978132411Z\",\"expires_at\":null,\"key\":\"xxxxx_xxxxxxxxxxxxxxxxxxXxxx_xxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"name\":\"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192\",\"public_portion\":\"4hW0tyOpjf5Dj84mZaXqwe\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "00c32353-a37b-6c00-e267-5c108c52d533" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192-updated\"},\"id\":\"9a7d27cc-4969-4a57-990c-03c23a9f2adc\",\"type\":\"personal_access_tokens\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens/9a7d27cc-4969-4a57-990c-03c23a9f2adc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"9a7d27cc-4969-4a57-990c-03c23a9f2adc\",\"type\":\"personal_access_tokens\",\"attributes\":{\"alias\":\"4hW0tyOpjf5Dj84mZaXqwe\",\"created_at\":\"2026-04-03T21:03:12.978132Z\",\"expires_at\":null,\"last_used_at\":null,\"modified_at\":\"2026-04-03T21:03:13.152078Z\",\"name\":\"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192-updated\",\"public_portion\":\"4hW0tyOpjf5Dj84mZaXqwe\",\"scopes\":[\"dashboards_read\"]},\"relationships\":{\"owned_by\":{\"data\":{\"id\":\"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "601591e1-22a4-cbbd-2ab8-729d01a9e7bb" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens/9a7d27cc-4969-4a57-990c-03c23a9f2adc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d69fc8d6-6af5-6d67-b249-12a17d3fc28f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "96de1c9c-aa07-1667-ed8e-5edd9be98b5e" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index e4a5d881716..e9a2d38cfd0 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -950,6 +950,18 @@ "tag": "Roles", "operationId": "ListPermissions" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"scopes\": [\"dashboards_read\"],\n \"expires_at\": \"{{ timeISO('now+365d') }}\"\n },\n \"type\": \"personal_access_tokens\"\n }\n}" + } + ], + "step": "there is a valid \"personal_access_token\" in the system", + "key": "personal_access_token", + "tag": "Key Management", + "operationId": "CreatePersonalAccessToken" + }, { "parameters": [ { @@ -1264,6 +1276,22 @@ "tag": "Service Accounts", "operationId": "CreateServiceAccount" }, + { + "parameters": [ + { + "name": "service_account_id", + "value": "\"{{ service_account_user.data.id }}\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"scopes\": [\"dashboards_read\"]\n },\n \"type\": \"personal_access_tokens\"\n }\n}" + } + ], + "step": "there is a valid \"service_account_access_token\" for \"service_account_user\"", + "key": "service_account_access_token", + "tag": "Service Accounts", + "operationId": "CreateServiceAccountAccessToken" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/key_management.feature b/src/test/resources/com/datadog/api/client/v2/api/key_management.feature index 40daf9df54f..6c464845562 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/key_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/key_management.feature @@ -12,6 +12,24 @@ Feature: Key Management And a valid "appKeyAuth" key in the system And an instance of "KeyManagement" API + @generated @skip @team:DataDog/credentials-management + Scenario: Create a personal access token returns "Bad Request" response + Given new "CreatePersonalAccessToken" request + And body with value {"data": {"attributes": {"expires_at": "2025-12-31T23:59:59+00:00", "name": "My Personal Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/credentials-management + Scenario: Create a personal access token returns "Created" response + Given new "CreatePersonalAccessToken" request + And body with value {"data": {"type": "personal_access_tokens", "attributes": {"name": "{{ unique }}", "scopes": ["dashboards_read"], "expires_at": "{{ timeISO('now+365d') }}"}}} + When the request is sent + Then the response status is 201 Created + And the response "data.type" is equal to "personal_access_tokens" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.scopes" is equal to ["dashboards_read"] + And the response "data.attributes" has field "key" + @generated @skip @team:DataDog/credentials-management Scenario: Create an API key returns "Bad Request" response Given new "CreateAPIKey" request @@ -200,6 +218,23 @@ Feature: Key Management And the response "data.id" is equal to "{{ api_key.data.id }}" And the response "data.attributes" has field "date_last_used" + @generated @skip @team:DataDog/credentials-management + Scenario: Get a personal access token returns "Not Found" response + Given new "GetPersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: Get a personal access token returns "OK" response + Given there is a valid "personal_access_token" in the system + And new "GetPersonalAccessToken" request + And request contains "pat_uuid" parameter from "personal_access_token.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "personal_access_tokens" + And the response "data.id" has the same value as "personal_access_token.data.id" + @generated @skip @team:DataDog/credentials-management Scenario: Get all API keys returns "Bad Request" response Given new "ListAPIKeys" request @@ -257,6 +292,20 @@ Feature: Key Management And the response "data[0].type" is equal to "application_keys" And the response "data[0].attributes" has field "last_used_at" + @generated @skip @team:DataDog/credentials-management + Scenario: Get all personal access tokens returns "Bad Request" response + Given new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/credentials-management + Scenario: Get all personal access tokens returns "OK" response + Given there is a valid "personal_access_token" in the system + And new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 200 OK + And the response "data" has item with field "type" with value "personal_access_tokens" + @generated @skip @team:DataDog/credentials-management Scenario: Get an application key returns "Bad Request" response Given new "GetApplicationKey" request @@ -301,3 +350,44 @@ Feature: Key Management And the response "data.attributes.name" is equal to "{{ application_key.data.attributes.name }}" And the response "data.attributes" has field "scopes" And the response "data.attributes" has field "last_used_at" + + @team:DataDog/credentials-management + Scenario: Revoke a personal access token returns "No Content" response + Given there is a valid "personal_access_token" in the system + And new "RevokePersonalAccessToken" request + And request contains "pat_uuid" parameter from "personal_access_token.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke a personal access token returns "Not Found" response + Given new "RevokePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/credentials-management + Scenario: Update a personal access token returns "Bad Request" response + Given new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: Update a personal access token returns "Not Found" response + Given new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: Update a personal access token returns "OK" response + Given there is a valid "personal_access_token" in the system + And new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "personal_access_token.data.id" + And body with value {"data": {"type": "personal_access_tokens", "id": "{{ personal_access_token.data.id }}", "attributes": {"name": "{{ unique }}-updated"}}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "{{ unique }}-updated" diff --git a/src/test/resources/com/datadog/api/client/v2/api/service_accounts.feature b/src/test/resources/com/datadog/api/client/v2/api/service_accounts.feature index 12976f5ebce..25744abc832 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/service_accounts.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/service_accounts.feature @@ -29,6 +29,34 @@ Feature: Service Accounts And the response "data.attributes.service_account" is equal to true And the response "data.relationships.roles.data[0].id" is equal to "{{ role.data.id }}" + @generated @skip @team:DataDog/credentials-management + Scenario: Create an access token for a service account returns "Bad Request" response + Given new "CreateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"expires_at": "2025-12-31T23:59:59+00:00", "name": "Service Account Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/credentials-management + Scenario: Create an access token for a service account returns "Created" response + Given there is a valid "service_account_user" in the system + And new "CreateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "service_account_user.data.id" + And body with value {"data": {"type": "personal_access_tokens", "attributes": {"name": "{{ unique }}", "scopes": ["dashboards_read"]}}} + When the request is sent + Then the response status is 201 Created + And the response "data.type" is equal to "personal_access_tokens" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.relationships.owned_by.data.id" has the same value as "service_account_user.data.id" + + @generated @skip @team:DataDog/credentials-management + Scenario: Create an access token for a service account returns "Not Found" response + Given new "CreateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"expires_at": "2025-12-31T23:59:59+00:00", "name": "Service Account Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/credentials-management @team:DataDog/org-management Scenario: Create an application key for this service account returns "Bad Request" response Given new "CreateServiceAccountApplicationKey" request @@ -110,6 +138,27 @@ Feature: Service Accounts And the response "data.type" is equal to "application_keys" And the response "data.id" is equal to "{{ service_account_application_key.data.id }}" + @generated @skip @team:DataDog/credentials-management + Scenario: Get an access token for a service account returns "Not Found" response + Given new "GetServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And request contains "pat_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: Get an access token for a service account returns "OK" response + Given there is a valid "service_account_user" in the system + And there is a valid "service_account_access_token" for "service_account_user" + And new "GetServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "service_account_user.data.id" + And request contains "pat_uuid" parameter from "service_account_access_token.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" has the same value as "service_account_access_token.data.attributes.name" + And the response "data.type" is equal to "personal_access_tokens" + And the response "data.id" is equal to "{{ service_account_access_token.data.id }}" + @generated @skip @team:DataDog/credentials-management @team:DataDog/org-management Scenario: Get one application key for this service account returns "Not Found" response Given new "GetServiceAccountApplicationKey" request @@ -131,6 +180,29 @@ Feature: Service Accounts And the response "data.type" is equal to "application_keys" And the response "data.id" is equal to "{{ service_account_application_key.data.id }}" + @generated @skip @team:DataDog/credentials-management + Scenario: List access tokens for a service account returns "Bad Request" response + Given new "ListServiceAccountAccessTokens" request + And request contains "service_account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: List access tokens for a service account returns "Not Found" response + Given new "ListServiceAccountAccessTokens" request + And request contains "service_account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: List access tokens for a service account returns "OK" response + Given there is a valid "service_account_user" in the system + And new "ListServiceAccountAccessTokens" request + And request contains "service_account_id" parameter from "service_account_user.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 0 + @generated @skip @team:DataDog/credentials-management @team:DataDog/org-management Scenario: List application keys for this service account returns "Bad Request" response Given new "ListServiceAccountApplicationKeys" request @@ -153,3 +225,53 @@ Feature: Service Accounts When the request is sent Then the response status is 200 OK And the response "data" has length 0 + + @team:DataDog/credentials-management + Scenario: Revoke an access token for a service account returns "No Content" response + Given there is a valid "service_account_user" in the system + And there is a valid "service_account_access_token" for "service_account_user" + And new "RevokeServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "service_account_user.data.id" + And request contains "pat_uuid" parameter from "service_account_access_token.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke an access token for a service account returns "Not Found" response + Given new "RevokeServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And request contains "pat_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/credentials-management + Scenario: Update an access token for a service account returns "Bad Request" response + Given new "UpdateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: Update an access token for a service account returns "Not Found" response + Given new "UpdateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "REPLACE.ME" + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: Update an access token for a service account returns "OK" response + Given there is a valid "service_account_user" in the system + And there is a valid "service_account_access_token" for "service_account_user" + And new "UpdateServiceAccountAccessToken" request + And request contains "service_account_id" parameter from "service_account_user.data.id" + And request contains "pat_uuid" parameter from "service_account_access_token.data.id" + And body with value {"data": {"id": "{{ service_account_access_token.data.id }}", "type": "personal_access_tokens", "attributes": {"name": "{{ service_account_access_token.data.attributes.name }}-updated"}}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "{{ service_account_access_token.data.attributes.name }}-updated" + And the response "data.type" is equal to "personal_access_tokens" + And the response "data.id" is equal to "{{ service_account_access_token.data.id }}" 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 078ced2bd84..3afd50688be 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 @@ -4066,6 +4066,43 @@ "type": "safe" } }, + "ListPersonalAccessTokens": { + "tag": "Key Management", + "undo": { + "type": "safe" + } + }, + "CreatePersonalAccessToken": { + "tag": "Key Management", + "undo": { + "operationId": "RevokePersonalAccessToken", + "parameters": [ + { + "name": "pat_uuid", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "RevokePersonalAccessToken": { + "tag": "Key Management", + "undo": { + "type": "idempotent" + } + }, + "GetPersonalAccessToken": { + "tag": "Key Management", + "undo": { + "type": "safe" + } + }, + "UpdatePersonalAccessToken": { + "tag": "Key Management", + "undo": { + "type": "idempotent" + } + }, "ListFindings": { "tag": "Security Monitoring", "undo": { @@ -5548,6 +5585,47 @@ "type": "unsafe" } }, + "ListServiceAccountAccessTokens": { + "tag": "Service Accounts", + "undo": { + "type": "safe" + } + }, + "CreateServiceAccountAccessToken": { + "tag": "Service Accounts", + "undo": { + "operationId": "RevokeServiceAccountAccessToken", + "parameters": [ + { + "name": "service_account_id", + "source": "data.relationships.owned_by.data.id" + }, + { + "name": "pat_uuid", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "RevokeServiceAccountAccessToken": { + "tag": "Service Accounts", + "undo": { + "type": "idempotent" + } + }, + "GetServiceAccountAccessToken": { + "tag": "Service Accounts", + "undo": { + "type": "safe" + } + }, + "UpdateServiceAccountAccessToken": { + "tag": "Service Accounts", + "undo": { + "type": "idempotent" + } + }, "ListServiceAccountApplicationKeys": { "tag": "Service Accounts", "undo": {