diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441b..aee5d1a332 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -951,6 +951,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 @@ -27300,6 +27335,62 @@ 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 + 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: @@ -37152,6 +37243,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: @@ -48767,6 +48869,217 @@ 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 + 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: @@ -60809,6 +61122,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: @@ -96619,6 +96976,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: |- @@ -105192,6 +105738,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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 3325139a68..d63ab900c3 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -11638,6 +11638,20 @@ datadog\_api\_client.v2.model.full\_custom\_framework\_data\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.full\_personal\_access\_token module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.full_personal_access_token + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.full\_personal\_access\_token\_attributes module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.full_personal_access_token_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.gcp\_credentials module ----------------------------------------------------- @@ -15887,6 +15901,13 @@ datadog\_api\_client.v2.model.list\_on\_call\_notification\_rules\_response modu :members: :show-inheritance: +datadog\_api\_client.v2.model.list\_personal\_access\_tokens\_response module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_personal_access_tokens_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.list\_pipelines\_response module -------------------------------------------------------------- @@ -21879,6 +21900,111 @@ datadog\_api\_client.v2.model.permissions\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.personal\_access\_token module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.personal_access_token + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_attributes module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.personal_access_token_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_create\_attributes module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_create\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_create\_request module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_create\_response module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.personal_access_token_create_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_relationships module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_response\_meta module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_response_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_response\_meta\_page module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_response_meta_page + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_update\_attributes module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_update\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_token\_update\_request module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_tokens\_sort module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_tokens_sort + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_tokens\_type module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_tokens_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.playlist module --------------------------------------------- @@ -27402,6 +27528,27 @@ datadog\_api\_client.v2.model.sensitive\_data\_scanner\_text\_replacement\_type :members: :show-inheritance: +datadog\_api\_client.v2.model.service\_account\_access\_token\_create\_attributes module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_account_access_token_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.service\_account\_access\_token\_create\_data module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_account_access_token_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.service\_account\_access\_token\_create\_request module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_account_access_token_create_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.service\_account\_create\_attributes module ------------------------------------------------------------------------- diff --git a/examples/v2/key-management/CreatePersonalAccessToken.py b/examples/v2/key-management/CreatePersonalAccessToken.py new file mode 100644 index 0000000000..3f46fd48e3 --- /dev/null +++ b/examples/v2/key-management/CreatePersonalAccessToken.py @@ -0,0 +1,32 @@ +""" +Create a personal access token returns "Created" response +""" + +from datetime import datetime +from dateutil.relativedelta import relativedelta +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi +from datadog_api_client.v2.model.personal_access_token_create_attributes import PersonalAccessTokenCreateAttributes +from datadog_api_client.v2.model.personal_access_token_create_data import PersonalAccessTokenCreateData +from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + +body = PersonalAccessTokenCreateRequest( + data=PersonalAccessTokenCreateData( + type=PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS, + attributes=PersonalAccessTokenCreateAttributes( + name="Example-Personal-Access-Token", + scopes=[ + "dashboards_read", + ], + expires_at=(datetime.now() + relativedelta(days=365)), + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.create_personal_access_token(body=body) + + print(response) diff --git a/examples/v2/key-management/GetPersonalAccessToken.py b/examples/v2/key-management/GetPersonalAccessToken.py new file mode 100644 index 0000000000..a233e8f84b --- /dev/null +++ b/examples/v2/key-management/GetPersonalAccessToken.py @@ -0,0 +1,19 @@ +""" +Get a personal access token returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi + +# there is a valid "personal_access_token" in the system +PERSONAL_ACCESS_TOKEN_DATA_ID = environ["PERSONAL_ACCESS_TOKEN_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.get_personal_access_token( + pat_uuid=PERSONAL_ACCESS_TOKEN_DATA_ID, + ) + + print(response) diff --git a/examples/v2/key-management/ListPersonalAccessTokens.py b/examples/v2/key-management/ListPersonalAccessTokens.py new file mode 100644 index 0000000000..5e01b3eea3 --- /dev/null +++ b/examples/v2/key-management/ListPersonalAccessTokens.py @@ -0,0 +1,13 @@ +""" +Get all personal access tokens returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.list_personal_access_tokens() + + print(response) diff --git a/examples/v2/key-management/RevokePersonalAccessToken.py b/examples/v2/key-management/RevokePersonalAccessToken.py new file mode 100644 index 0000000000..3b58563d3c --- /dev/null +++ b/examples/v2/key-management/RevokePersonalAccessToken.py @@ -0,0 +1,17 @@ +""" +Revoke a personal access token returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi + +# there is a valid "personal_access_token" in the system +PERSONAL_ACCESS_TOKEN_DATA_ID = environ["PERSONAL_ACCESS_TOKEN_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + api_instance.revoke_personal_access_token( + pat_uuid=PERSONAL_ACCESS_TOKEN_DATA_ID, + ) diff --git a/examples/v2/key-management/UpdatePersonalAccessToken.py b/examples/v2/key-management/UpdatePersonalAccessToken.py new file mode 100644 index 0000000000..671b620a55 --- /dev/null +++ b/examples/v2/key-management/UpdatePersonalAccessToken.py @@ -0,0 +1,31 @@ +""" +Update a personal access token returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi +from datadog_api_client.v2.model.personal_access_token_update_attributes import PersonalAccessTokenUpdateAttributes +from datadog_api_client.v2.model.personal_access_token_update_data import PersonalAccessTokenUpdateData +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + +# there is a valid "personal_access_token" in the system +PERSONAL_ACCESS_TOKEN_DATA_ID = environ["PERSONAL_ACCESS_TOKEN_DATA_ID"] + +body = PersonalAccessTokenUpdateRequest( + data=PersonalAccessTokenUpdateData( + type=PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS, + id=PERSONAL_ACCESS_TOKEN_DATA_ID, + attributes=PersonalAccessTokenUpdateAttributes( + name="Example-Personal-Access-Token-updated", + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.update_personal_access_token(pat_uuid=PERSONAL_ACCESS_TOKEN_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/service-accounts/CreateServiceAccountAccessToken.py b/examples/v2/service-accounts/CreateServiceAccountAccessToken.py new file mode 100644 index 0000000000..c48b45b6ca --- /dev/null +++ b/examples/v2/service-accounts/CreateServiceAccountAccessToken.py @@ -0,0 +1,39 @@ +""" +Create an access token for a service account returns "Created" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType +from datadog_api_client.v2.model.service_account_access_token_create_attributes import ( + ServiceAccountAccessTokenCreateAttributes, +) +from datadog_api_client.v2.model.service_account_access_token_create_data import ServiceAccountAccessTokenCreateData +from datadog_api_client.v2.model.service_account_access_token_create_request import ( + ServiceAccountAccessTokenCreateRequest, +) + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +body = ServiceAccountAccessTokenCreateRequest( + data=ServiceAccountAccessTokenCreateData( + type=PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS, + attributes=ServiceAccountAccessTokenCreateAttributes( + name="Example-Service-Account", + scopes=[ + "dashboards_read", + ], + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceAccountsApi(api_client) + response = api_instance.create_service_account_access_token( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/service-accounts/CreateServiceAccountAccessToken_4212922277.py b/examples/v2/service-accounts/CreateServiceAccountAccessToken_4212922277.py new file mode 100644 index 0000000000..8e861c147f --- /dev/null +++ b/examples/v2/service-accounts/CreateServiceAccountAccessToken_4212922277.py @@ -0,0 +1,39 @@ +""" +Create a service account access token returns "Created" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType +from datadog_api_client.v2.model.service_account_access_token_create_attributes import ( + ServiceAccountAccessTokenCreateAttributes, +) +from datadog_api_client.v2.model.service_account_access_token_create_data import ServiceAccountAccessTokenCreateData +from datadog_api_client.v2.model.service_account_access_token_create_request import ( + ServiceAccountAccessTokenCreateRequest, +) + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +body = ServiceAccountAccessTokenCreateRequest( + data=ServiceAccountAccessTokenCreateData( + type=PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS, + attributes=ServiceAccountAccessTokenCreateAttributes( + name="Example-Personal-Access-Token", + scopes=[ + "dashboards_read", + ], + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.create_service_account_access_token( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/service-accounts/GetServiceAccountAccessToken.py b/examples/v2/service-accounts/GetServiceAccountAccessToken.py new file mode 100644 index 0000000000..efde74d186 --- /dev/null +++ b/examples/v2/service-accounts/GetServiceAccountAccessToken.py @@ -0,0 +1,23 @@ +""" +Get an access token for a service account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +# there is a valid "service_account_access_token" for "service_account_user" +SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = environ["SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceAccountsApi(api_client) + response = api_instance.get_service_account_access_token( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, + pat_uuid=SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID, + ) + + print(response) diff --git a/examples/v2/service-accounts/ListServiceAccountAccessTokens.py b/examples/v2/service-accounts/ListServiceAccountAccessTokens.py new file mode 100644 index 0000000000..f1e9ad1d35 --- /dev/null +++ b/examples/v2/service-accounts/ListServiceAccountAccessTokens.py @@ -0,0 +1,19 @@ +""" +List access tokens for a service account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceAccountsApi(api_client) + response = api_instance.list_service_account_access_tokens( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, + ) + + print(response) diff --git a/examples/v2/service-accounts/RevokeServiceAccountAccessToken.py b/examples/v2/service-accounts/RevokeServiceAccountAccessToken.py new file mode 100644 index 0000000000..6c299ceb1a --- /dev/null +++ b/examples/v2/service-accounts/RevokeServiceAccountAccessToken.py @@ -0,0 +1,21 @@ +""" +Revoke an access token for a service account returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +# there is a valid "service_account_access_token" for "service_account_user" +SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = environ["SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceAccountsApi(api_client) + api_instance.revoke_service_account_access_token( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, + pat_uuid=SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID, + ) diff --git a/examples/v2/service-accounts/UpdateServiceAccountAccessToken.py b/examples/v2/service-accounts/UpdateServiceAccountAccessToken.py new file mode 100644 index 0000000000..791fb71c99 --- /dev/null +++ b/examples/v2/service-accounts/UpdateServiceAccountAccessToken.py @@ -0,0 +1,37 @@ +""" +Update an access token for a service account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi +from datadog_api_client.v2.model.personal_access_token_update_attributes import PersonalAccessTokenUpdateAttributes +from datadog_api_client.v2.model.personal_access_token_update_data import PersonalAccessTokenUpdateData +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + +# there is a valid "service_account_user" in the system +SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"] + +# there is a valid "service_account_access_token" for "service_account_user" +SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ATTRIBUTES_NAME = environ["SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ATTRIBUTES_NAME"] +SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID = environ["SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID"] + +body = PersonalAccessTokenUpdateRequest( + data=PersonalAccessTokenUpdateData( + id=SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID, + type=PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS, + attributes=PersonalAccessTokenUpdateAttributes( + name="My Personal Access Token-updated", + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceAccountsApi(api_client) + response = api_instance.update_service_account_access_token( + service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, pat_uuid=SERVICE_ACCOUNT_ACCESS_TOKEN_DATA_ID, body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/key_management_api.py b/src/datadog_api_client/v2/api/key_management_api.py index 29940c9727..11060b7a16 100644 --- a/src/datadog_api_client/v2/api/key_management_api.py +++ b/src/datadog_api_client/v2/api/key_management_api.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict, Union +from typing import Any, Dict, List, Union from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration @@ -21,6 +21,12 @@ from datadog_api_client.v2.model.application_key_response import ApplicationKeyResponse from datadog_api_client.v2.model.application_key_update_request import ApplicationKeyUpdateRequest from datadog_api_client.v2.model.application_key_create_request import ApplicationKeyCreateRequest +from datadog_api_client.v2.model.list_personal_access_tokens_response import ListPersonalAccessTokensResponse +from datadog_api_client.v2.model.personal_access_tokens_sort import PersonalAccessTokensSort +from datadog_api_client.v2.model.personal_access_token_create_response import PersonalAccessTokenCreateResponse +from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest +from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest class KeyManagementApi: @@ -79,6 +85,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenCreateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/personal_access_tokens", + "operation_id": "create_personal_access_token", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (PersonalAccessTokenCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_api_key_endpoint = _Endpoint( settings={ "response_type": None, @@ -227,6 +253,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/personal_access_tokens/{pat_uuid}", + "operation_id": "get_personal_access_token", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_api_keys_endpoint = _Endpoint( settings={ "response_type": (APIKeysResponse,), @@ -403,6 +452,72 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_personal_access_tokens_endpoint = _Endpoint( + settings={ + "response_type": (ListPersonalAccessTokensResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/personal_access_tokens", + "operation_id": "list_personal_access_tokens", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "sort": { + "openapi_types": (PersonalAccessTokensSort,), + "attribute": "sort", + "location": "query", + }, + "filter": { + "openapi_types": (str,), + "attribute": "filter", + "location": "query", + }, + "filter_owner_uuid": { + "openapi_types": ([str],), + "attribute": "filter[owner_uuid]", + "location": "query", + "collection_format": "multi", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._revoke_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/personal_access_tokens/{pat_uuid}", + "operation_id": "revoke_personal_access_token", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._update_api_key_endpoint = _Endpoint( settings={ "response_type": (APIKeyResponse,), @@ -481,6 +596,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/personal_access_tokens/{pat_uuid}", + "operation_id": "update_personal_access_token", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (PersonalAccessTokenUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_api_key( self, body: APIKeyCreateRequest, @@ -513,6 +654,22 @@ def create_current_user_application_key( return self._create_current_user_application_key_endpoint.call_with_http_info(**kwargs) + def create_personal_access_token( + self, + body: PersonalAccessTokenCreateRequest, + ) -> PersonalAccessTokenCreateResponse: + """Create a personal access token. + + Create a personal access token for the current user. + + :type body: PersonalAccessTokenCreateRequest + :rtype: PersonalAccessTokenCreateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_personal_access_token_endpoint.call_with_http_info(**kwargs) + def delete_api_key( self, api_key_id: str, @@ -630,6 +787,23 @@ def get_current_user_application_key( return self._get_current_user_application_key_endpoint.call_with_http_info(**kwargs) + def get_personal_access_token( + self, + pat_uuid: str, + ) -> PersonalAccessTokenResponse: + """Get a personal access token. + + Get a specific personal access token by its UUID. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :rtype: PersonalAccessTokenResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["pat_uuid"] = pat_uuid + + return self._get_personal_access_token_endpoint.call_with_http_info(**kwargs) + def list_api_keys( self, *, @@ -825,6 +999,68 @@ def list_current_user_application_keys( return self._list_current_user_application_keys_endpoint.call_with_http_info(**kwargs) + def list_personal_access_tokens( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + sort: Union[PersonalAccessTokensSort, UnsetType] = unset, + filter: Union[str, UnsetType] = unset, + filter_owner_uuid: Union[List[str], UnsetType] = unset, + ) -> ListPersonalAccessTokensResponse: + """Get all personal access tokens. + + List all personal access tokens for the organization. + + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :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. + :type sort: PersonalAccessTokensSort, optional + :param filter: Filter personal access tokens by the specified string. + :type filter: str, optional + :param filter_owner_uuid: Filter personal access tokens by the owner's UUID. Supports multiple values. + :type filter_owner_uuid: [str], optional + :rtype: ListPersonalAccessTokensResponse + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if sort is not unset: + kwargs["sort"] = sort + + if filter is not unset: + kwargs["filter"] = filter + + if filter_owner_uuid is not unset: + kwargs["filter_owner_uuid"] = filter_owner_uuid + + return self._list_personal_access_tokens_endpoint.call_with_http_info(**kwargs) + + def revoke_personal_access_token( + self, + pat_uuid: str, + ) -> None: + """Revoke a personal access token. + + Revoke a specific personal access token. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["pat_uuid"] = pat_uuid + + return self._revoke_personal_access_token_endpoint.call_with_http_info(**kwargs) + def update_api_key( self, api_key_id: str, @@ -888,3 +1124,24 @@ def update_current_user_application_key( kwargs["body"] = body return self._update_current_user_application_key_endpoint.call_with_http_info(**kwargs) + + def update_personal_access_token( + self, + pat_uuid: str, + body: PersonalAccessTokenUpdateRequest, + ) -> PersonalAccessTokenResponse: + """Update a personal access token. + + Update a specific personal access token. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :type body: PersonalAccessTokenUpdateRequest + :rtype: PersonalAccessTokenResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["pat_uuid"] = pat_uuid + + kwargs["body"] = body + + return self._update_personal_access_token_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/api/service_accounts_api.py b/src/datadog_api_client/v2/api/service_accounts_api.py index 38fd736768..79b63e3b78 100644 --- a/src/datadog_api_client/v2/api/service_accounts_api.py +++ b/src/datadog_api_client/v2/api/service_accounts_api.py @@ -13,6 +13,14 @@ ) from datadog_api_client.v2.model.user_response import UserResponse from datadog_api_client.v2.model.service_account_create_request import ServiceAccountCreateRequest +from datadog_api_client.v2.model.list_personal_access_tokens_response import ListPersonalAccessTokensResponse +from datadog_api_client.v2.model.personal_access_tokens_sort import PersonalAccessTokensSort +from datadog_api_client.v2.model.personal_access_token_create_response import PersonalAccessTokenCreateResponse +from datadog_api_client.v2.model.service_account_access_token_create_request import ( + ServiceAccountAccessTokenCreateRequest, +) +from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest from datadog_api_client.v2.model.list_application_keys_response import ListApplicationKeysResponse from datadog_api_client.v2.model.application_keys_sort import ApplicationKeysSort from datadog_api_client.v2.model.application_key_response import ApplicationKeyResponse @@ -51,6 +59,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_service_account_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenCreateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/service_accounts/{service_account_id}/access_tokens", + "operation_id": "create_service_account_access_token", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "service_account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "service_account_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ServiceAccountAccessTokenCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_service_account_application_key_endpoint = _Endpoint( settings={ "response_type": (ApplicationKeyResponse,), @@ -106,6 +140,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_service_account_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}", + "operation_id": "get_service_account_access_token", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "service_account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "service_account_id", + "location": "path", + }, + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_service_account_application_key_endpoint = _Endpoint( settings={ "response_type": (PartialApplicationKeyResponse,), @@ -135,6 +198,49 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_service_account_access_tokens_endpoint = _Endpoint( + settings={ + "response_type": (ListPersonalAccessTokensResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/service_accounts/{service_account_id}/access_tokens", + "operation_id": "list_service_account_access_tokens", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "service_account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "service_account_id", + "location": "path", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "sort": { + "openapi_types": (PersonalAccessTokensSort,), + "attribute": "sort", + "location": "query", + }, + "filter": { + "openapi_types": (str,), + "attribute": "filter", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_service_account_application_keys_endpoint = _Endpoint( settings={ "response_type": (ListApplicationKeysResponse,), @@ -188,6 +294,67 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._revoke_service_account_access_token_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}", + "operation_id": "revoke_service_account_access_token", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "service_account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "service_account_id", + "location": "path", + }, + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._update_service_account_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/service_accounts/{service_account_id}/access_tokens/{pat_uuid}", + "operation_id": "update_service_account_access_token", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "service_account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "service_account_id", + "location": "path", + }, + "pat_uuid": { + "required": True, + "openapi_types": (str,), + "attribute": "pat_uuid", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (PersonalAccessTokenUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_service_account_application_key_endpoint = _Endpoint( settings={ "response_type": (PartialApplicationKeyResponse,), @@ -236,6 +403,27 @@ def create_service_account( return self._create_service_account_endpoint.call_with_http_info(**kwargs) + def create_service_account_access_token( + self, + service_account_id: str, + body: ServiceAccountAccessTokenCreateRequest, + ) -> PersonalAccessTokenCreateResponse: + """Create an access token for a service account. + + Create an access token for a service account. + + :param service_account_id: The ID of the service account. + :type service_account_id: str + :type body: ServiceAccountAccessTokenCreateRequest + :rtype: PersonalAccessTokenCreateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["service_account_id"] = service_account_id + + kwargs["body"] = body + + return self._create_service_account_access_token_endpoint.call_with_http_info(**kwargs) + def create_service_account_application_key( self, service_account_id: str, @@ -279,6 +467,28 @@ def delete_service_account_application_key( return self._delete_service_account_application_key_endpoint.call_with_http_info(**kwargs) + def get_service_account_access_token( + self, + service_account_id: str, + pat_uuid: str, + ) -> PersonalAccessTokenResponse: + """Get an access token for a service account. + + Get a specific access token for a service account by its UUID. + + :param service_account_id: The ID of the service account. + :type service_account_id: str + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :rtype: PersonalAccessTokenResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["service_account_id"] = service_account_id + + kwargs["pat_uuid"] = pat_uuid + + return self._get_service_account_access_token_endpoint.call_with_http_info(**kwargs) + def get_service_account_application_key( self, service_account_id: str, @@ -301,6 +511,50 @@ def get_service_account_application_key( return self._get_service_account_application_key_endpoint.call_with_http_info(**kwargs) + def list_service_account_access_tokens( + self, + service_account_id: str, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + sort: Union[PersonalAccessTokensSort, UnsetType] = unset, + filter: Union[str, UnsetType] = unset, + ) -> ListPersonalAccessTokensResponse: + """List access tokens for a service account. + + List all access tokens for a specific service account. + + :param service_account_id: The ID of the service account. + :type service_account_id: str + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :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. + :type sort: PersonalAccessTokensSort, optional + :param filter: Filter personal access tokens by the specified string. + :type filter: str, optional + :rtype: ListPersonalAccessTokensResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["service_account_id"] = service_account_id + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if sort is not unset: + kwargs["sort"] = sort + + if filter is not unset: + kwargs["filter"] = filter + + return self._list_service_account_access_tokens_endpoint.call_with_http_info(**kwargs) + def list_service_account_application_keys( self, service_account_id: str, @@ -357,6 +611,54 @@ def list_service_account_application_keys( return self._list_service_account_application_keys_endpoint.call_with_http_info(**kwargs) + def revoke_service_account_access_token( + self, + service_account_id: str, + pat_uuid: str, + ) -> None: + """Revoke an access token for a service account. + + Revoke a specific access token for a service account. + + :param service_account_id: The ID of the service account. + :type service_account_id: str + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["service_account_id"] = service_account_id + + kwargs["pat_uuid"] = pat_uuid + + return self._revoke_service_account_access_token_endpoint.call_with_http_info(**kwargs) + + def update_service_account_access_token( + self, + service_account_id: str, + pat_uuid: str, + body: PersonalAccessTokenUpdateRequest, + ) -> PersonalAccessTokenResponse: + """Update an access token for a service account. + + Update a specific access token for a service account. + + :param service_account_id: The ID of the service account. + :type service_account_id: str + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: str + :type body: PersonalAccessTokenUpdateRequest + :rtype: PersonalAccessTokenResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["service_account_id"] = service_account_id + + kwargs["pat_uuid"] = pat_uuid + + kwargs["body"] = body + + return self._update_service_account_access_token_endpoint.call_with_http_info(**kwargs) + def update_service_account_application_key( self, service_account_id: str, diff --git a/src/datadog_api_client/v2/model/full_personal_access_token.py b/src/datadog_api_client/v2/model/full_personal_access_token.py new file mode 100644 index 0000000000..9dcb003b3a --- /dev/null +++ b/src/datadog_api_client/v2/model/full_personal_access_token.py @@ -0,0 +1,74 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.full_personal_access_token_attributes import FullPersonalAccessTokenAttributes + from datadog_api_client.v2.model.personal_access_token_relationships import PersonalAccessTokenRelationships + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + +class FullPersonalAccessToken(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.full_personal_access_token_attributes import FullPersonalAccessTokenAttributes + from datadog_api_client.v2.model.personal_access_token_relationships import PersonalAccessTokenRelationships + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + return { + "attributes": (FullPersonalAccessTokenAttributes,), + "id": (str,), + "relationships": (PersonalAccessTokenRelationships,), + "type": (PersonalAccessTokensType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: Union[FullPersonalAccessTokenAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + relationships: Union[PersonalAccessTokenRelationships, UnsetType] = unset, + type: Union[PersonalAccessTokensType, UnsetType] = unset, + **kwargs, + ): + """ + Datadog personal access token, including the token key. + + :param attributes: Attributes of a full personal access token, including the token key. + :type attributes: FullPersonalAccessTokenAttributes, optional + + :param id: ID of the personal access token. + :type id: str, optional + + :param relationships: Resources related to the personal access token. + :type relationships: PersonalAccessTokenRelationships, optional + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokensType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if relationships is not unset: + kwargs["relationships"] = relationships + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/full_personal_access_token_attributes.py b/src/datadog_api_client/v2/model/full_personal_access_token_attributes.py new file mode 100644 index 0000000000..2f3c209cf8 --- /dev/null +++ b/src/datadog_api_client/v2/model/full_personal_access_token_attributes.py @@ -0,0 +1,96 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class FullPersonalAccessTokenAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "alias": (str,), + "created_at": (datetime,), + "expires_at": (datetime,), + "key": (str,), + "name": (str,), + "public_portion": (str,), + "scopes": ([str],), + } + + attribute_map = { + "alias": "alias", + "created_at": "created_at", + "expires_at": "expires_at", + "key": "key", + "name": "name", + "public_portion": "public_portion", + "scopes": "scopes", + } + read_only_vars = { + "alias", + "created_at", + "expires_at", + "key", + "public_portion", + } + + def __init__( + self_, + alias: Union[str, UnsetType] = unset, + created_at: Union[datetime, UnsetType] = unset, + expires_at: Union[datetime, UnsetType] = unset, + key: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + public_portion: Union[str, UnsetType] = unset, + scopes: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a full personal access token, including the token key. + + :param alias: The alias (short identifier) of the personal access token. + :type alias: str, optional + + :param created_at: Creation date of the personal access token. + :type created_at: datetime, optional + + :param expires_at: Expiration date of the personal access token. + :type expires_at: datetime, optional + + :param key: The personal access token key. Only returned upon creation. + :type key: str, optional + + :param name: Name of the personal access token. + :type name: str, optional + + :param public_portion: The public portion of the personal access token. + :type public_portion: str, optional + + :param scopes: Array of scopes granted to the personal access token. + :type scopes: [str], optional + """ + if alias is not unset: + kwargs["alias"] = alias + if created_at is not unset: + kwargs["created_at"] = created_at + if expires_at is not unset: + kwargs["expires_at"] = expires_at + if key is not unset: + kwargs["key"] = key + if name is not unset: + kwargs["name"] = name + if public_portion is not unset: + kwargs["public_portion"] = public_portion + if scopes is not unset: + kwargs["scopes"] = scopes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/list_personal_access_tokens_response.py b/src/datadog_api_client/v2/model/list_personal_access_tokens_response.py new file mode 100644 index 0000000000..efff865020 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_personal_access_tokens_response.py @@ -0,0 +1,56 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token import PersonalAccessToken + from datadog_api_client.v2.model.personal_access_token_response_meta import PersonalAccessTokenResponseMeta + + +class ListPersonalAccessTokensResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token import PersonalAccessToken + from datadog_api_client.v2.model.personal_access_token_response_meta import PersonalAccessTokenResponseMeta + + return { + "data": ([PersonalAccessToken],), + "meta": (PersonalAccessTokenResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[PersonalAccessToken], UnsetType] = unset, + meta: Union[PersonalAccessTokenResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response for a list of personal access tokens. + + :param data: Array of personal access tokens. + :type data: [PersonalAccessToken], optional + + :param meta: Additional information related to the personal access token response. + :type meta: PersonalAccessTokenResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token.py b/src/datadog_api_client/v2/model/personal_access_token.py new file mode 100644 index 0000000000..ee8440aa93 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token.py @@ -0,0 +1,74 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_attributes import PersonalAccessTokenAttributes + from datadog_api_client.v2.model.personal_access_token_relationships import PersonalAccessTokenRelationships + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + +class PersonalAccessToken(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_attributes import PersonalAccessTokenAttributes + from datadog_api_client.v2.model.personal_access_token_relationships import PersonalAccessTokenRelationships + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + return { + "attributes": (PersonalAccessTokenAttributes,), + "id": (str,), + "relationships": (PersonalAccessTokenRelationships,), + "type": (PersonalAccessTokensType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: Union[PersonalAccessTokenAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + relationships: Union[PersonalAccessTokenRelationships, UnsetType] = unset, + type: Union[PersonalAccessTokensType, UnsetType] = unset, + **kwargs, + ): + """ + Datadog personal access token. + + :param attributes: Attributes of a personal access token. + :type attributes: PersonalAccessTokenAttributes, optional + + :param id: ID of the personal access token. + :type id: str, optional + + :param relationships: Resources related to the personal access token. + :type relationships: PersonalAccessTokenRelationships, optional + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokensType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if relationships is not unset: + kwargs["relationships"] = relationships + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_attributes.py b/src/datadog_api_client/v2/model/personal_access_token_attributes.py new file mode 100644 index 0000000000..b4ef2ce0f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_attributes.py @@ -0,0 +1,106 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +class PersonalAccessTokenAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "alias": (str,), + "created_at": (datetime,), + "expires_at": (datetime,), + "last_used_at": (datetime, none_type), + "modified_at": (datetime, none_type), + "name": (str,), + "public_portion": (str,), + "scopes": ([str],), + } + + attribute_map = { + "alias": "alias", + "created_at": "created_at", + "expires_at": "expires_at", + "last_used_at": "last_used_at", + "modified_at": "modified_at", + "name": "name", + "public_portion": "public_portion", + "scopes": "scopes", + } + read_only_vars = { + "alias", + "created_at", + "expires_at", + "last_used_at", + "modified_at", + "public_portion", + } + + def __init__( + self_, + alias: Union[str, UnsetType] = unset, + created_at: Union[datetime, UnsetType] = unset, + expires_at: Union[datetime, UnsetType] = unset, + last_used_at: Union[datetime, none_type, UnsetType] = unset, + modified_at: Union[datetime, none_type, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + public_portion: Union[str, UnsetType] = unset, + scopes: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a personal access token. + + :param alias: The alias (short identifier) of the personal access token. + :type alias: str, optional + + :param created_at: Creation date of the personal access token. + :type created_at: datetime, optional + + :param expires_at: Expiration date of the personal access token. + :type expires_at: datetime, optional + + :param last_used_at: Date the personal access token was last used. + :type last_used_at: datetime, none_type, optional + + :param modified_at: Date of last modification of the personal access token. + :type modified_at: datetime, none_type, optional + + :param name: Name of the personal access token. + :type name: str, optional + + :param public_portion: The public portion of the personal access token. + :type public_portion: str, optional + + :param scopes: Array of scopes granted to the personal access token. + :type scopes: [str], optional + """ + if alias is not unset: + kwargs["alias"] = alias + if created_at is not unset: + kwargs["created_at"] = created_at + if expires_at is not unset: + kwargs["expires_at"] = expires_at + if last_used_at is not unset: + kwargs["last_used_at"] = last_used_at + if modified_at is not unset: + kwargs["modified_at"] = modified_at + if name is not unset: + kwargs["name"] = name + if public_portion is not unset: + kwargs["public_portion"] = public_portion + if scopes is not unset: + kwargs["scopes"] = scopes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_create_attributes.py b/src/datadog_api_client/v2/model/personal_access_token_create_attributes.py new file mode 100644 index 0000000000..d3e22e73b8 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_create_attributes.py @@ -0,0 +1,47 @@ +# 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. +from __future__ import annotations + +from typing import List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +class PersonalAccessTokenCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "expires_at": (datetime,), + "name": (str,), + "scopes": ([str],), + } + + attribute_map = { + "expires_at": "expires_at", + "name": "name", + "scopes": "scopes", + } + + def __init__(self_, expires_at: datetime, name: str, scopes: List[str], **kwargs): + """ + Attributes used to create a personal access token. + + :param expires_at: Expiration date of the personal access token. Must be at least 24 hours in the future. + :type expires_at: datetime + + :param name: Name of the personal access token. + :type name: str + + :param scopes: Array of scopes to grant the personal access token. + :type scopes: [str] + """ + super().__init__(kwargs) + + self_.expires_at = expires_at + self_.name = name + self_.scopes = scopes diff --git a/src/datadog_api_client/v2/model/personal_access_token_create_data.py b/src/datadog_api_client/v2/model/personal_access_token_create_data.py new file mode 100644 index 0000000000..fdf23e8740 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_create_data.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_create_attributes import PersonalAccessTokenCreateAttributes + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + +class PersonalAccessTokenCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_create_attributes import ( + PersonalAccessTokenCreateAttributes, + ) + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + return { + "attributes": (PersonalAccessTokenCreateAttributes,), + "type": (PersonalAccessTokensType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: PersonalAccessTokenCreateAttributes, type: PersonalAccessTokensType, **kwargs): + """ + Object used to create a personal access token. + + :param attributes: Attributes used to create a personal access token. + :type attributes: PersonalAccessTokenCreateAttributes + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokensType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/personal_access_token_create_request.py b/src/datadog_api_client/v2/model/personal_access_token_create_request.py new file mode 100644 index 0000000000..fcbba3fe92 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_create_request.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_create_data import PersonalAccessTokenCreateData + + +class PersonalAccessTokenCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_create_data import PersonalAccessTokenCreateData + + return { + "data": (PersonalAccessTokenCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PersonalAccessTokenCreateData, **kwargs): + """ + Request used to create a personal access token. + + :param data: Object used to create a personal access token. + :type data: PersonalAccessTokenCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/personal_access_token_create_response.py b/src/datadog_api_client/v2/model/personal_access_token_create_response.py new file mode 100644 index 0000000000..431ee0ccaa --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_create_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.full_personal_access_token import FullPersonalAccessToken + + +class PersonalAccessTokenCreateResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.full_personal_access_token import FullPersonalAccessToken + + return { + "data": (FullPersonalAccessToken,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[FullPersonalAccessToken, UnsetType] = unset, **kwargs): + """ + Response for creating a personal access token. Includes the token key. + + :param data: Datadog personal access token, including the token key. + :type data: FullPersonalAccessToken, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_relationships.py b/src/datadog_api_client/v2/model/personal_access_token_relationships.py new file mode 100644 index 0000000000..1848f8c884 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_relationships.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + + +class PersonalAccessTokenRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + + return { + "owned_by": (RelationshipToUser,), + } + + attribute_map = { + "owned_by": "owned_by", + } + + def __init__(self_, owned_by: Union[RelationshipToUser, UnsetType] = unset, **kwargs): + """ + Resources related to the personal access token. + + :param owned_by: Relationship to user. + :type owned_by: RelationshipToUser, optional + """ + if owned_by is not unset: + kwargs["owned_by"] = owned_by + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_response.py b/src/datadog_api_client/v2/model/personal_access_token_response.py new file mode 100644 index 0000000000..7b60d894aa --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token import PersonalAccessToken + + +class PersonalAccessTokenResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token import PersonalAccessToken + + return { + "data": (PersonalAccessToken,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[PersonalAccessToken, UnsetType] = unset, **kwargs): + """ + Response for retrieving a personal access token. + + :param data: Datadog personal access token. + :type data: PersonalAccessToken, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_response_meta.py b/src/datadog_api_client/v2/model/personal_access_token_response_meta.py new file mode 100644 index 0000000000..1cddc860b9 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_response_meta.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_response_meta_page import PersonalAccessTokenResponseMetaPage + + +class PersonalAccessTokenResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_response_meta_page import ( + PersonalAccessTokenResponseMetaPage, + ) + + return { + "page": (PersonalAccessTokenResponseMetaPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: Union[PersonalAccessTokenResponseMetaPage, UnsetType] = unset, **kwargs): + """ + Additional information related to the personal access token response. + + :param page: Pagination information. + :type page: PersonalAccessTokenResponseMetaPage, optional + """ + if page is not unset: + kwargs["page"] = page + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_response_meta_page.py b/src/datadog_api_client/v2/model/personal_access_token_response_meta_page.py new file mode 100644 index 0000000000..28d4a894ee --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_response_meta_page.py @@ -0,0 +1,36 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class PersonalAccessTokenResponseMetaPage(ModelNormal): + @cached_property + def openapi_types(_): + return { + "total_filtered_count": (int,), + } + + attribute_map = { + "total_filtered_count": "total_filtered_count", + } + + def __init__(self_, total_filtered_count: Union[int, UnsetType] = unset, **kwargs): + """ + Pagination information. + + :param total_filtered_count: Total filtered personal access token count. + :type total_filtered_count: int, optional + """ + if total_filtered_count is not unset: + kwargs["total_filtered_count"] = total_filtered_count + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_update_attributes.py b/src/datadog_api_client/v2/model/personal_access_token_update_attributes.py new file mode 100644 index 0000000000..731e6364a4 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_update_attributes.py @@ -0,0 +1,43 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class PersonalAccessTokenUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "scopes": ([str],), + } + + attribute_map = { + "name": "name", + "scopes": "scopes", + } + + def __init__(self_, name: Union[str, UnsetType] = unset, scopes: Union[List[str], UnsetType] = unset, **kwargs): + """ + Attributes used to update a personal access token. + + :param name: Name of the personal access token. + :type name: str, optional + + :param scopes: Array of scopes to grant the personal access token. + :type scopes: [str], optional + """ + if name is not unset: + kwargs["name"] = name + if scopes is not unset: + kwargs["scopes"] = scopes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_token_update_data.py b/src/datadog_api_client/v2/model/personal_access_token_update_data.py new file mode 100644 index 0000000000..59d8576eb9 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_update_data.py @@ -0,0 +1,58 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_update_attributes import PersonalAccessTokenUpdateAttributes + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + +class PersonalAccessTokenUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_update_attributes import ( + PersonalAccessTokenUpdateAttributes, + ) + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + return { + "attributes": (PersonalAccessTokenUpdateAttributes,), + "id": (str,), + "type": (PersonalAccessTokensType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: PersonalAccessTokenUpdateAttributes, id: str, type: PersonalAccessTokensType, **kwargs + ): + """ + Object used to update a personal access token. + + :param attributes: Attributes used to update a personal access token. + :type attributes: PersonalAccessTokenUpdateAttributes + + :param id: ID of the personal access token. + :type id: str + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokensType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/personal_access_token_update_request.py b/src/datadog_api_client/v2/model/personal_access_token_update_request.py new file mode 100644 index 0000000000..531001f149 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_update_request.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_update_data import PersonalAccessTokenUpdateData + + +class PersonalAccessTokenUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_token_update_data import PersonalAccessTokenUpdateData + + return { + "data": (PersonalAccessTokenUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PersonalAccessTokenUpdateData, **kwargs): + """ + Request used to update a personal access token. + + :param data: Object used to update a personal access token. + :type data: PersonalAccessTokenUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/personal_access_tokens_sort.py b/src/datadog_api_client/v2/model/personal_access_tokens_sort.py new file mode 100644 index 0000000000..1ca1e9c40e --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_tokens_sort.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PersonalAccessTokensSort(ModelSimple): + """ + Sorting options + + :param value: If omitted defaults to "name". Must be one of ["name", "-name", "created_at", "-created_at", "expires_at", "-expires_at"]. + :type value: str + """ + + allowed_values = { + "name", + "-name", + "created_at", + "-created_at", + "expires_at", + "-expires_at", + } + NAME_ASCENDING: ClassVar["PersonalAccessTokensSort"] + NAME_DESCENDING: ClassVar["PersonalAccessTokensSort"] + CREATED_AT_ASCENDING: ClassVar["PersonalAccessTokensSort"] + CREATED_AT_DESCENDING: ClassVar["PersonalAccessTokensSort"] + EXPIRES_AT_ASCENDING: ClassVar["PersonalAccessTokensSort"] + EXPIRES_AT_DESCENDING: ClassVar["PersonalAccessTokensSort"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PersonalAccessTokensSort.NAME_ASCENDING = PersonalAccessTokensSort("name") +PersonalAccessTokensSort.NAME_DESCENDING = PersonalAccessTokensSort("-name") +PersonalAccessTokensSort.CREATED_AT_ASCENDING = PersonalAccessTokensSort("created_at") +PersonalAccessTokensSort.CREATED_AT_DESCENDING = PersonalAccessTokensSort("-created_at") +PersonalAccessTokensSort.EXPIRES_AT_ASCENDING = PersonalAccessTokensSort("expires_at") +PersonalAccessTokensSort.EXPIRES_AT_DESCENDING = PersonalAccessTokensSort("-expires_at") diff --git a/src/datadog_api_client/v2/model/personal_access_tokens_type.py b/src/datadog_api_client/v2/model/personal_access_tokens_type.py new file mode 100644 index 0000000000..b0a1664cff --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_tokens_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PersonalAccessTokensType(ModelSimple): + """ + Personal access tokens resource type. + + :param value: If omitted defaults to "personal_access_tokens". Must be one of ["personal_access_tokens"]. + :type value: str + """ + + allowed_values = { + "personal_access_tokens", + } + PERSONAL_ACCESS_TOKENS: ClassVar["PersonalAccessTokensType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PersonalAccessTokensType.PERSONAL_ACCESS_TOKENS = PersonalAccessTokensType("personal_access_tokens") diff --git a/src/datadog_api_client/v2/model/service_account_access_token_create_attributes.py b/src/datadog_api_client/v2/model/service_account_access_token_create_attributes.py new file mode 100644 index 0000000000..54b0b2f92c --- /dev/null +++ b/src/datadog_api_client/v2/model/service_account_access_token_create_attributes.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class ServiceAccountAccessTokenCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "expires_at": (datetime,), + "name": (str,), + "scopes": ([str],), + } + + attribute_map = { + "expires_at": "expires_at", + "name": "name", + "scopes": "scopes", + } + + def __init__(self_, name: str, scopes: List[str], expires_at: Union[datetime, UnsetType] = unset, **kwargs): + """ + Attributes used to create a service account access token. + + :param expires_at: Expiration date of the access token. Optional for service account tokens. + :type expires_at: datetime, optional + + :param name: Name of the access token. + :type name: str + + :param scopes: Array of scopes to grant the access token. + :type scopes: [str] + """ + if expires_at is not unset: + kwargs["expires_at"] = expires_at + super().__init__(kwargs) + + self_.name = name + self_.scopes = scopes diff --git a/src/datadog_api_client/v2/model/service_account_access_token_create_data.py b/src/datadog_api_client/v2/model/service_account_access_token_create_data.py new file mode 100644 index 0000000000..9afa038925 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_account_access_token_create_data.py @@ -0,0 +1,54 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_account_access_token_create_attributes import ( + ServiceAccountAccessTokenCreateAttributes, + ) + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + +class ServiceAccountAccessTokenCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_account_access_token_create_attributes import ( + ServiceAccountAccessTokenCreateAttributes, + ) + from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType + + return { + "attributes": (ServiceAccountAccessTokenCreateAttributes,), + "type": (PersonalAccessTokensType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, attributes: ServiceAccountAccessTokenCreateAttributes, type: PersonalAccessTokensType, **kwargs + ): + """ + Object used to create a service account access token. + + :param attributes: Attributes used to create a service account access token. + :type attributes: ServiceAccountAccessTokenCreateAttributes + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokensType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/service_account_access_token_create_request.py b/src/datadog_api_client/v2/model/service_account_access_token_create_request.py new file mode 100644 index 0000000000..e85b4cbfe3 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_account_access_token_create_request.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_account_access_token_create_data import ServiceAccountAccessTokenCreateData + + +class ServiceAccountAccessTokenCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_account_access_token_create_data import ( + ServiceAccountAccessTokenCreateData, + ) + + return { + "data": (ServiceAccountAccessTokenCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ServiceAccountAccessTokenCreateData, **kwargs): + """ + Request used to create a service account access token. + + :param data: Object used to create a service account access token. + :type data: ServiceAccountAccessTokenCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 50b1f6b750..f87b2c61bf 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2247,6 +2247,8 @@ from datadog_api_client.v2.model.full_application_key_attributes import FullApplicationKeyAttributes from datadog_api_client.v2.model.full_custom_framework_data import FullCustomFrameworkData from datadog_api_client.v2.model.full_custom_framework_data_attributes import FullCustomFrameworkDataAttributes +from datadog_api_client.v2.model.full_personal_access_token import FullPersonalAccessToken +from datadog_api_client.v2.model.full_personal_access_token_attributes import FullPersonalAccessTokenAttributes from datadog_api_client.v2.model.gcp_credentials import GCPCredentials from datadog_api_client.v2.model.gcp_credentials_update import GCPCredentialsUpdate from datadog_api_client.v2.model.gcp_integration import GCPIntegration @@ -3101,6 +3103,7 @@ from datadog_api_client.v2.model.list_kind_catalog_response import ListKindCatalogResponse from datadog_api_client.v2.model.list_notification_channels_response import ListNotificationChannelsResponse from datadog_api_client.v2.model.list_on_call_notification_rules_response import ListOnCallNotificationRulesResponse +from datadog_api_client.v2.model.list_personal_access_tokens_response import ListPersonalAccessTokensResponse from datadog_api_client.v2.model.list_pipelines_response import ListPipelinesResponse from datadog_api_client.v2.model.list_pipelines_response_meta import ListPipelinesResponseMeta from datadog_api_client.v2.model.list_powerpacks_response import ListPowerpacksResponse @@ -4515,6 +4518,21 @@ from datadog_api_client.v2.model.permission_attributes import PermissionAttributes from datadog_api_client.v2.model.permissions_response import PermissionsResponse from datadog_api_client.v2.model.permissions_type import PermissionsType +from datadog_api_client.v2.model.personal_access_token import PersonalAccessToken +from datadog_api_client.v2.model.personal_access_token_attributes import PersonalAccessTokenAttributes +from datadog_api_client.v2.model.personal_access_token_create_attributes import PersonalAccessTokenCreateAttributes +from datadog_api_client.v2.model.personal_access_token_create_data import PersonalAccessTokenCreateData +from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest +from datadog_api_client.v2.model.personal_access_token_create_response import PersonalAccessTokenCreateResponse +from datadog_api_client.v2.model.personal_access_token_relationships import PersonalAccessTokenRelationships +from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse +from datadog_api_client.v2.model.personal_access_token_response_meta import PersonalAccessTokenResponseMeta +from datadog_api_client.v2.model.personal_access_token_response_meta_page import PersonalAccessTokenResponseMetaPage +from datadog_api_client.v2.model.personal_access_token_update_attributes import PersonalAccessTokenUpdateAttributes +from datadog_api_client.v2.model.personal_access_token_update_data import PersonalAccessTokenUpdateData +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest +from datadog_api_client.v2.model.personal_access_tokens_sort import PersonalAccessTokensSort +from datadog_api_client.v2.model.personal_access_tokens_type import PersonalAccessTokensType from datadog_api_client.v2.model.playlist import Playlist from datadog_api_client.v2.model.playlist_array import PlaylistArray from datadog_api_client.v2.model.playlist_data import PlaylistData @@ -5651,6 +5669,13 @@ from datadog_api_client.v2.model.sensitive_data_scanner_text_replacement_type import ( SensitiveDataScannerTextReplacementType, ) +from datadog_api_client.v2.model.service_account_access_token_create_attributes import ( + ServiceAccountAccessTokenCreateAttributes, +) +from datadog_api_client.v2.model.service_account_access_token_create_data import ServiceAccountAccessTokenCreateData +from datadog_api_client.v2.model.service_account_access_token_create_request import ( + ServiceAccountAccessTokenCreateRequest, +) from datadog_api_client.v2.model.service_account_create_attributes import ServiceAccountCreateAttributes from datadog_api_client.v2.model.service_account_create_data import ServiceAccountCreateData from datadog_api_client.v2.model.service_account_create_request import ServiceAccountCreateRequest @@ -8439,6 +8464,8 @@ "FullApplicationKeyAttributes", "FullCustomFrameworkData", "FullCustomFrameworkDataAttributes", + "FullPersonalAccessToken", + "FullPersonalAccessTokenAttributes", "GCPCredentials", "GCPCredentialsUpdate", "GCPIntegration", @@ -9117,6 +9144,7 @@ "ListKindCatalogResponse", "ListNotificationChannelsResponse", "ListOnCallNotificationRulesResponse", + "ListPersonalAccessTokensResponse", "ListPipelinesResponse", "ListPipelinesResponseMeta", "ListPowerpacksResponse", @@ -9903,6 +9931,21 @@ "PermissionAttributes", "PermissionsResponse", "PermissionsType", + "PersonalAccessToken", + "PersonalAccessTokenAttributes", + "PersonalAccessTokenCreateAttributes", + "PersonalAccessTokenCreateData", + "PersonalAccessTokenCreateRequest", + "PersonalAccessTokenCreateResponse", + "PersonalAccessTokenRelationships", + "PersonalAccessTokenResponse", + "PersonalAccessTokenResponseMeta", + "PersonalAccessTokenResponseMetaPage", + "PersonalAccessTokenUpdateAttributes", + "PersonalAccessTokenUpdateData", + "PersonalAccessTokenUpdateRequest", + "PersonalAccessTokensSort", + "PersonalAccessTokensType", "Playlist", "PlaylistArray", "PlaylistData", @@ -10699,6 +10742,9 @@ "SensitiveDataScannerSuppressions", "SensitiveDataScannerTextReplacement", "SensitiveDataScannerTextReplacementType", + "ServiceAccountAccessTokenCreateAttributes", + "ServiceAccountAccessTokenCreateData", + "ServiceAccountAccessTokenCreateRequest", "ServiceAccountCreateAttributes", "ServiceAccountCreateData", "ServiceAccountCreateRequest", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.frozen new file mode 100644 index 0000000000..0e8d0e96cc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:27.916Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.yaml new file mode 100644 index 0000000000..6e8cd33f9f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_personal_access_token_returns_created_response.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: '{"data":{"attributes":{"expires_at":"2027-04-03T21:03:27.916Z","name":"Test-Create_a_personal_access_token_returns_Created_response-1775250207","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":{"id":"4acd86c7-0b9d-4118-9461-485094f0d3d9","type":"personal_access_tokens","attributes":{"alias":"2H9MCNMBM8FQjQ16YucXkX","created_at":"2026-04-03T21:03:28.105263095Z","expires_at":"2027-04-03T21:03:27.916Z","key":"xxxxx_xxxxxxxxxxxxxxxxxxxXxX_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"Test-Create_a_personal_access_token_returns_Created_response-1775250207","public_portion":"2H9MCNMBM8FQjQ16YucXkX","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/4acd86c7-0b9d-4118-9461-485094f0d3d9 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.frozen new file mode 100644 index 0000000000..2f8a6f0b9e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:30.155Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.yaml new file mode 100644 index 0000000000..1db4fbfed1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_access_token_returns_created_response.yaml @@ -0,0 +1,70 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Create_a_service_account_access_token_returns_Created_response-1775250210@datadoghq.com","service_account":true,"title":"user + title"},"type":"users"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"9140f182-2fa0-11f1-aa8f-eea1be72dca6","attributes":{"uuid":"9140f182-2fa0-11f1-aa8f-eea1be72dca6","name":null,"handle":"9140f182-2fa0-11f1-aa8f-eea1be72dca6","created_at":"2026-04-03T21:03:30.342186+00:00","modified_at":"2026-04-03T21:03:30.342186+00:00","email":"test-create_a_service_account_access_token_returns_created_response-1775250210@datadoghq.com","icon":"https://secure.gravatar.com/avatar/809c18f1349366dd8e11d2eddd048cb1?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 + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Create_a_service_account_access_token_returns_Created_response-1775250210","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts/9140f182-2fa0-11f1-aa8f-eea1be72dca6/access_tokens + response: + body: + string: '{"data":{"id":"39c3faad-fa0f-4118-a95e-f38250eb5343","type":"personal_access_tokens","attributes":{"alias":"1l07m08lcK2rROp95DXB4t","created_at":"2026-04-03T21:03:30.63247746Z","expires_at":null,"key":"xxxxx_xxxxxxxxxxxxxxxxxxXxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"Test-Create_a_service_account_access_token_returns_Created_response-1775250210","public_portion":"1l07m08lcK2rROp95DXB4t","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"9140f182-2fa0-11f1-aa8f-eea1be72dca6","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/9140f182-2fa0-11f1-aa8f-eea1be72dca6/access_tokens/39c3faad-fa0f-4118-a95e-f38250eb5343 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/9140f182-2fa0-11f1-aa8f-eea1be72dca6 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.frozen index 7536a9c5b3..f23457e153 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-01-30T14:58:54.329Z \ No newline at end of file +2026-04-03T21:02:55.411Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.yaml index 5eea82885a..650a891314 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_service_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"name":"Test-Create_a_service_account_returns_OK_response-1675090734"},"type":"roles"}}' + body: '{"data":{"attributes":{"name":"Test-Create_a_service_account_returns_OK_response-1775250175"},"type":"roles"}}' headers: accept: - application/json @@ -10,18 +10,16 @@ interactions: uri: https://api.datadoghq.com/api/v2/roles response: body: - string: '{"data":{"type":"roles","id":"9d7c873e-a0ae-11ed-975e-da7ad0900002","attributes":{"name":"Test-Create_a_service_account_returns_OK_response-1675090734","created_at":"2023-01-30T14:58:54.528421+00:00","modified_at":"2023-01-30T14:58:54.566829+00:00"},"relationships":{"permissions":{"data":[{"type":"permissions","id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2"},{"type":"permissions","id":"4441648c-d8b1-11e9-a77a-1b899a04b304"},{"type":"permissions","id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0"},{"type":"permissions","id":"12efc20e-d36c-11eb-a9b8-da7ad0900002"},{"type":"permissions","id":"7605ef24-f376-11eb-b90b-da7ad0900002"},{"type":"permissions","id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002"},{"type":"permissions","id":"f8e941cf-e746-11ec-b22d-da7ad0900002"},{"type":"permissions","id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002"}]}}}} - - ' + string: '{"data":{"id":"7c8dd40e-2fa0-11f1-b1d4-da7ad0900002","type":"roles","attributes":{"created_at":"2026-04-03T21:02:55.623363Z","modified_at":"2026-04-03T21:02:55.613643Z","name":"Test-Create_a_service_account_returns_OK_response-1775250175","team_count":0,"user_count":0},"relationships":{"permissions":{"data":[{"id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","type":"permissions"},{"id":"4441648c-d8b1-11e9-a77a-1b899a04b304","type":"permissions"},{"id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","type":"permissions"},{"id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","type":"permissions"},{"id":"7605ef24-f376-11eb-b90b-da7ad0900002","type":"permissions"},{"id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002","type":"permissions"},{"id":"f8e941cf-e746-11ec-b22d-da7ad0900002","type":"permissions"},{"id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","type":"permissions"},{"id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","type":"permissions"},{"id":"50c270de-69ee-11ee-9151-da7ad0900002","type":"permissions"}]}}}}' headers: content-type: - - application/json + - application/vnd.api+json status: code: 200 message: OK - request: - body: '{"data":{"attributes":{"email":"Test-Create_a_service_account_returns_OK_response-1675090734@datadoghq.com","name":"Test - API Client","service_account":true},"relationships":{"roles":{"data":[{"id":"9d7c873e-a0ae-11ed-975e-da7ad0900002","type":"roles"}]}},"type":"users"}}' + body: '{"data":{"attributes":{"email":"Test-Create_a_service_account_returns_OK_response-1775250175@datadoghq.com","name":"Test + API Client","service_account":true},"relationships":{"roles":{"data":[{"id":"7c8dd40e-2fa0-11f1-b1d4-da7ad0900002","type":"roles"}]}},"type":"users"}}' headers: accept: - application/json @@ -31,11 +29,11 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"9d9c0565-a0ae-11ed-88af-be56a8628f3f","attributes":{"name":"Test - API Client","handle":"9d9c0565-a0ae-11ed-88af-be56a8628f3f","created_at":"2023-01-30T14:58:54.736093+00:00","modified_at":"2023-01-30T14:58:54.738680+00:00","email":"test-create_a_service_account_returns_ok_response-1675090734@datadoghq.com","icon":"https://secure.gravatar.com/avatar/5bf68b66c63c55ddb80602fc2d183c28?s=48&d=retro","title":null,"verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[{"type":"roles","id":"9d7c873e-a0ae-11ed-975e-da7ad0900002"}]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}},"included":[{"type":"roles","id":"9d7c873e-a0ae-11ed-975e-da7ad0900002","attributes":{"name":"Test-Create_a_service_account_returns_OK_response-1675090734","created_at":"2023-01-30T14:58:54.528421+00:00","modified_at":"2023-01-30T14:58:54.566829+00:00"},"relationships":{"permissions":{"data":[{"type":"permissions","id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2"},{"type":"permissions","id":"4441648c-d8b1-11e9-a77a-1b899a04b304"},{"type":"permissions","id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0"},{"type":"permissions","id":"12efc20e-d36c-11eb-a9b8-da7ad0900002"},{"type":"permissions","id":"7605ef24-f376-11eb-b90b-da7ad0900002"},{"type":"permissions","id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002"},{"type":"permissions","id":"f8e941cf-e746-11ec-b22d-da7ad0900002"},{"type":"permissions","id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002"}]}}},{"type":"permissions","id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","attributes":{"name":"dashboards_read","display_name":"Dashboards + string: '{"data":{"type":"users","id":"7cefc5f1-2fa0-11f1-991f-62f4bfc595d0","attributes":{"uuid":"7cefc5f1-2fa0-11f1-991f-62f4bfc595d0","name":"Test + API Client","handle":"7cefc5f1-2fa0-11f1-991f-62f4bfc595d0","created_at":"2026-04-03T21:02:56.255800+00:00","modified_at":"2026-04-03T21:02:56.255800+00:00","email":"test-create_a_service_account_returns_ok_response-1775250175@datadoghq.com","icon":"https://secure.gravatar.com/avatar/7ee42950f6c7a4eaae0f7a4b3bfd4fc5?s=48&d=retro","title":null,"verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active","last_login_time":null},"relationships":{"roles":{"data":[{"type":"roles","id":"7c8dd40e-2fa0-11f1-b1d4-da7ad0900002"}]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}},"included":[{"type":"roles","id":"7c8dd40e-2fa0-11f1-b1d4-da7ad0900002","attributes":{"name":"Test-Create_a_service_account_returns_OK_response-1775250175","managed":false,"created_at":"2026-04-03T21:02:55.623363+00:00","modified_at":"2026-04-03T21:02:55.613643+00:00"},"relationships":{"permissions":{"data":[{"type":"permissions","id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2"},{"type":"permissions","id":"4441648c-d8b1-11e9-a77a-1b899a04b304"},{"type":"permissions","id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0"},{"type":"permissions","id":"12efc20e-d36c-11eb-a9b8-da7ad0900002"},{"type":"permissions","id":"7605ef24-f376-11eb-b90b-da7ad0900002"},{"type":"permissions","id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002"},{"type":"permissions","id":"f8e941cf-e746-11ec-b22d-da7ad0900002"},{"type":"permissions","id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002"},{"type":"permissions","id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002"},{"type":"permissions","id":"50c270de-69ee-11ee-9151-da7ad0900002"}]}}},{"type":"permissions","id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","attributes":{"name":"dashboards_read","display_name":"Dashboards Read","description":"View dashboards.","created":"2019-09-10T14:39:51.955175+00:00","group_name":"Dashboards","display_type":"read","restricted":true}},{"type":"permissions","id":"4441648c-d8b1-11e9-a77a-1b899a04b304","attributes":{"name":"monitors_read","display_name":"Monitors Read","description":"View monitors.","created":"2019-09-16T18:39:07.744297+00:00","group_name":"Monitors","display_type":"read","restricted":true}},{"type":"permissions","id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","attributes":{"name":"apm_read","display_name":"APM - Read","description":"Read and query APM and Trace Analytics.","created":"2020-11-23T20:55:45.006110+00:00","group_name":"APM","display_type":"read","restricted":true}},{"type":"permissions","id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","attributes":{"name":"incident_read","display_name":"Incident + Read","description":"Read and query APM and Trace Analytics.","created":"2020-11-23T20:55:45.006110+00:00","group_name":"APM","display_type":"read","restricted":true}},{"type":"permissions","id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","attributes":{"name":"incident_read","display_name":"Incidents Read","description":"View incidents in Datadog.","created":"2021-06-22T15:11:09.255499+00:00","group_name":"Case and Incident Management","display_type":"read","restricted":true}},{"type":"permissions","id":"7605ef24-f376-11eb-b90b-da7ad0900002","attributes":{"name":"rum_apps_read","display_name":"RUM Apps Read","description":"View RUM Applications data.","created":"2021-08-02T09:46:07.671535+00:00","group_name":"Real @@ -43,8 +41,14 @@ interactions: Read","description":"View notebooks.","created":"2022-03-02T18:51:05.040950+00:00","group_name":"Notebooks","display_type":"read","restricted":true}},{"type":"permissions","id":"f8e941cf-e746-11ec-b22d-da7ad0900002","attributes":{"name":"slos_read","display_name":"SLOs Read","description":"View SLOs and status corrections.","created":"2022-06-08T16:20:55.142591+00:00","group_name":"Service Level Objectives","display_type":"read","restricted":true}},{"type":"permissions","id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","attributes":{"name":"ci_visibility_read","display_name":"CI - Visibility Read","description":"View CI Visibility.","created":"2022-12-13T16:01:37.149406+00:00","group_name":"CI - Visibility","display_type":"read","restricted":true}}]} + Visibility Read","description":"View CI Visibility.","created":"2022-12-13T16:01:37.149406+00:00","group_name":"Software + Delivery","display_type":"read","restricted":true}},{"type":"permissions","id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","attributes":{"name":"cd_visibility_read","display_name":"CD + Visibility Read","description":"View CD Visibility.","created":"2023-09-09T00:06:00.708335+00:00","group_name":"Software + Delivery","display_type":"read","restricted":true}},{"type":"permissions","id":"50c270de-69ee-11ee-9151-da7ad0900002","attributes":{"name":"appsec_vm_read","display_name":"Vulnerability + Management Read","description":"View infrastructure, application code and + library vulnerabilities. This does not restrict access to the vulnerability + data source through the API or inventory SQL.","created":"2023-10-13T17:31:17.311029+00:00","group_name":"Cloud + Security Platform","display_type":"read","restricted":true}}]} ' headers: @@ -59,7 +63,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/9d9c0565-a0ae-11ed-88af-be56a8628f3f + uri: https://api.datadoghq.com/api/v2/users/7cefc5f1-2fa0-11f1-991f-62f4bfc595d0 response: body: string: '' @@ -73,13 +77,11 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/roles/9d7c873e-a0ae-11ed-975e-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/roles/7c8dd40e-2fa0-11f1-b1d4-da7ad0900002 response: body: string: '' - headers: - content-type: - - text/html; charset=utf-8 + headers: {} status: code: 204 message: No Content diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.frozen new file mode 100644 index 0000000000..b457d0ec92 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:02:56.793Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.yaml new file mode 100644 index 0000000000..ff1ea5f131 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_access_token_for_a_service_account_returns_created_response.yaml @@ -0,0 +1,70 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0","attributes":{"uuid":"7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0","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"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Create_an_access_token_for_a_service_account_returns_Created_response-1775250176","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0/access_tokens + response: + body: + string: '{"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 + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0/access_tokens/6f2491f5-8c3f-45a3-962a-5f769b95e806 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/7d5e5ea9-2fa0-11f1-991f-62f4bfc595d0 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.frozen index ea2a5c5179..4240edad9a 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.frozen @@ -1 +1 @@ -2023-10-12T10:11:47.418Z \ No newline at end of file +2026-04-03T21:02:58.272Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.yaml index bf5bdf2daf..ea4f5894da 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_for_this_service_account_returns_created_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1697105507@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1775250178@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"c0ea5a28-68e7-11ee-af78-7221d1e45f66","attributes":{"name":null,"handle":"c0ea5a28-68e7-11ee-af78-7221d1e45f66","created_at":"2023-10-12T10:11:47.838233+00:00","modified_at":"2023-10-12T10:11:47.838233+00:00","email":"test-create_an_application_key_for_this_service_account_returns_created_response-1697105507@datadoghq.com","icon":"https://secure.gravatar.com/avatar/45057f7ed4c5662bd175fd2657bf58f2?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + string: '{"data":{"type":"users","id":"7e44d257-2fa0-11f1-96b6-7a9b8860a1d7","attributes":{"uuid":"7e44d257-2fa0-11f1-96b6-7a9b8860a1d7","name":null,"handle":"7e44d257-2fa0-11f1-96b6-7a9b8860a1d7","created_at":"2026-04-03T21:02:58.490890+00:00","modified_at":"2026-04-03T21:02:58.490890+00:00","email":"test-create_an_application_key_for_this_service_account_returns_created_response-1775250178@datadoghq.com","icon":"https://secure.gravatar.com/avatar/f39de85ea89e472ea78a6e034df61719?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: @@ -22,17 +22,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1697105507"},"type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1775250178"},"type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: POST - uri: https://api.datadoghq.com/api/v2/service_accounts/c0ea5a28-68e7-11ee-af78-7221d1e45f66/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/7e44d257-2fa0-11f1-96b6-7a9b8860a1d7/application_keys response: body: - string: '{"data":{"type":"application_keys","id":"6315ab43-ce92-4130-b6d2-94ceb5f7142a","attributes":{"name":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1697105507","created_at":"2023-10-12T10:11:48.340554+00:00","last4":"xxxx","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"c0ea5a28-68e7-11ee-af78-7221d1e45f66"}},"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"da50bc1d-fc06-459f-9d89-5de3211fe853","attributes":{"name":"Test-Create_an_application_key_for_this_service_account_returns_Created_response-1775250178","created_at":"2026-04-03T21:02:58.799343+00:00","last4":"xxxx","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"7e44d257-2fa0-11f1-96b6-7a9b8860a1d7"}},"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -45,7 +45,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/c0ea5a28-68e7-11ee-af78-7221d1e45f66/application_keys/6315ab43-ce92-4130-b6d2-94ceb5f7142a + uri: https://api.datadoghq.com/api/v2/service_accounts/7e44d257-2fa0-11f1-96b6-7a9b8860a1d7/application_keys/da50bc1d-fc06-459f-9d89-5de3211fe853 response: body: string: '' @@ -61,7 +61,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/c0ea5a28-68e7-11ee-af78-7221d1e45f66 + uri: https://api.datadoghq.com/api/v2/users/7e44d257-2fa0-11f1-96b6-7a9b8860a1d7 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.frozen index da6baa113b..035283d8a5 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.frozen @@ -1 +1 @@ -2022-05-12T09:53:20.809Z \ No newline at end of file +2026-04-03T21:02:59.524Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.yaml index b0577d3008..682845e673 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_an_application_key_with_scopes_for_this_service_account_returns_created_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1652349200@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1775250179@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"fbebe517-c0ed-45a9-b3c9-4377cbe04efd","attributes":{"name":null,"handle":"fbebe517-c0ed-45a9-b3c9-4377cbe04efd","created_at":"2022-05-12T09:53:21.271368+00:00","modified_at":"2022-05-12T09:53:21.302672+00:00","email":"test-create_an_application_key_with_scopes_for_this_service_account_returns_created_response-1652349200@datadoghq.com","icon":"https://secure.gravatar.com/avatar/cdd87aef7fe7eed9427d1e53ac7219c2?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}' + string: '{"data":{"type":"users","id":"7f012bdc-2fa0-11f1-ba00-fae4928ee5de","attributes":{"uuid":"7f012bdc-2fa0-11f1-ba00-fae4928ee5de","name":null,"handle":"7f012bdc-2fa0-11f1-ba00-fae4928ee5de","created_at":"2026-04-03T21:02:59.725268+00:00","modified_at":"2026-04-03T21:02:59.725268+00:00","email":"test-create_an_application_key_with_scopes_for_this_service_account_returns_created_response-1775250179@datadoghq.com","icon":"https://secure.gravatar.com/avatar/9af71986d5e58afac7d7355d0b0e062e?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 @@ -20,17 +22,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1652349200","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1775250179","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: POST - uri: https://api.datadoghq.com/api/v2/service_accounts/fbebe517-c0ed-45a9-b3c9-4377cbe04efd/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/7f012bdc-2fa0-11f1-ba00-fae4928ee5de/application_keys response: body: - string: '{"data":{"type":"application_keys","id":"e01199cd-849e-4fb8-ae34-af8b6a8cd129","attributes":{"name":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1652349200","created_at":"2022-05-12T09:53:22.022194+00:00","last4":"xxxx","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"relationships":{"owned_by":{"data":{"type":"users","id":"fbebe517-c0ed-45a9-b3c9-4377cbe04efd"}},"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"f0e43051-3cef-45ea-a3db-b8f82928f199","attributes":{"name":"Test-Create_an_application_key_with_scopes_for_this_service_account_returns_Created_response-1775250179","created_at":"2026-04-03T21:03:00.038479+00:00","last4":"xxxx","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":["dashboards_read","dashboards_write","dashboards_public_share"]},"relationships":{"owned_by":{"data":{"type":"users","id":"7f012bdc-2fa0-11f1-ba00-fae4928ee5de"}},"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -43,11 +45,13 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/fbebe517-c0ed-45a9-b3c9-4377cbe04efd/application_keys/e01199cd-849e-4fb8-ae34-af8b6a8cd129 + uri: https://api.datadoghq.com/api/v2/service_accounts/7f012bdc-2fa0-11f1-ba00-fae4928ee5de/application_keys/f0e43051-3cef-45ea-a3db-b8f82928f199 response: body: string: '' - headers: {} + headers: + content-type: + - text/html; charset=utf-8 status: code: 204 message: No Content @@ -57,7 +61,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/fbebe517-c0ed-45a9-b3c9-4377cbe04efd + uri: https://api.datadoghq.com/api/v2/users/7f012bdc-2fa0-11f1-ba00-fae4928ee5de response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.frozen index 96b3901455..df4416a0cd 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.frozen @@ -1 +1 @@ -2023-10-12T07:12:21.913Z \ No newline at end of file +2026-04-03T21:03:00.820Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.yaml index b2adc4572e..75b026c6f2 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_application_key_for_this_service_account_returns_no_content_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1697094741@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1775250180@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"b0338c3c-68ce-11ee-9dc7-02a9eb8880d8","attributes":{"name":null,"handle":"b0338c3c-68ce-11ee-9dc7-02a9eb8880d8","created_at":"2023-10-12T07:12:22.378427+00:00","modified_at":"2023-10-12T07:12:22.378427+00:00","email":"test-delete_an_application_key_for_this_service_account_returns_no_content_response-1697094741@datadoghq.com","icon":"https://secure.gravatar.com/avatar/ed84f324d81c653aae4b87a2eb517a97?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + string: '{"data":{"type":"users","id":"7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de","attributes":{"uuid":"7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de","name":null,"handle":"7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de","created_at":"2026-04-03T21:03:01.053065+00:00","modified_at":"2026-04-03T21:03:01.053065+00:00","email":"test-delete_an_application_key_for_this_service_account_returns_no_content_response-1775250180@datadoghq.com","icon":"https://secure.gravatar.com/avatar/4f6531a70f0027009464b13a2620fbad?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: @@ -22,17 +22,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1697094741"},"type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1775250180"},"type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: POST - uri: https://api.datadoghq.com/api/v2/service_accounts/b0338c3c-68ce-11ee-9dc7-02a9eb8880d8/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de/application_keys response: body: - string: '{"data":{"type":"application_keys","id":"6a147414-e85c-4b92-829b-fff59f8bd8e0","attributes":{"name":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1697094741","created_at":"2023-10-12T07:12:22.935154+00:00","last4":"xxxx","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"b0338c3c-68ce-11ee-9dc7-02a9eb8880d8"}},"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"85819bfb-f419-4486-89b4-c48d1c564b76","attributes":{"name":"Test-Delete_an_application_key_for_this_service_account_returns_No_Content_response-1775250180","created_at":"2026-04-03T21:03:01.363576+00:00","last4":"xxxx","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de"}},"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -45,7 +45,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/b0338c3c-68ce-11ee-9dc7-02a9eb8880d8/application_keys/6a147414-e85c-4b92-829b-fff59f8bd8e0 + uri: https://api.datadoghq.com/api/v2/service_accounts/7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de/application_keys/85819bfb-f419-4486-89b4-c48d1c564b76 response: body: string: '' @@ -61,7 +61,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/b0338c3c-68ce-11ee-9dc7-02a9eb8880d8/application_keys/6a147414-e85c-4b92-829b-fff59f8bd8e0 + uri: https://api.datadoghq.com/api/v2/service_accounts/7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de/application_keys/85819bfb-f419-4486-89b4-c48d1c564b76 response: body: string: '{"errors":["Application key not found"]}' @@ -77,7 +77,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/b0338c3c-68ce-11ee-9dc7-02a9eb8880d8 + uri: https://api.datadoghq.com/api/v2/users/7fcbc6f7-2fa0-11f1-ba00-fae4928ee5de response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.frozen index ba160164f0..d818df645a 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-10-12T10:10:58.448Z \ No newline at end of file +2026-04-03T21:03:02.137Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.yaml index f4e72520f1..3ab8657267 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_edit_an_application_key_for_this_service_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1697105458@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1775250182@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"a3b86b00-68e7-11ee-b081-e2f0333fd1ce","attributes":{"name":null,"handle":"a3b86b00-68e7-11ee-b081-e2f0333fd1ce","created_at":"2023-10-12T10:10:58.857066+00:00","modified_at":"2023-10-12T10:10:58.857066+00:00","email":"test-edit_an_application_key_for_this_service_account_returns_ok_response-1697105458@datadoghq.com","icon":"https://secure.gravatar.com/avatar/00878614ca2acb0d68087ee17a33e3f4?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + string: '{"data":{"type":"users","id":"808ffc9c-2fa0-11f1-adcd-e60174513686","attributes":{"uuid":"808ffc9c-2fa0-11f1-adcd-e60174513686","name":null,"handle":"808ffc9c-2fa0-11f1-adcd-e60174513686","created_at":"2026-04-03T21:03:02.338940+00:00","modified_at":"2026-04-03T21:03:02.338940+00:00","email":"test-edit_an_application_key_for_this_service_account_returns_ok_response-1775250182@datadoghq.com","icon":"https://secure.gravatar.com/avatar/1663a4ece4c0ce2efa5db481f912a5db?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: @@ -22,17 +22,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1697105458"},"type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1775250182"},"type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: POST - uri: https://api.datadoghq.com/api/v2/service_accounts/a3b86b00-68e7-11ee-b081-e2f0333fd1ce/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/808ffc9c-2fa0-11f1-adcd-e60174513686/application_keys response: body: - string: '{"data":{"type":"application_keys","id":"8dca4456-bd90-4cb4-a182-5868501d8a9b","attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1697105458","created_at":"2023-10-12T10:10:59.392476+00:00","last4":"xxxx","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"a3b86b00-68e7-11ee-b081-e2f0333fd1ce"}},"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"a624627a-ebfc-4af4-8101-5ca4619fdbad","attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1775250182","created_at":"2026-04-03T21:03:02.629516+00:00","last4":"xxxx","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"808ffc9c-2fa0-11f1-adcd-e60174513686"}},"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -40,17 +40,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1697105458-updated"},"id":"8dca4456-bd90-4cb4-a182-5868501d8a9b","type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1775250182-updated"},"id":"a624627a-ebfc-4af4-8101-5ca4619fdbad","type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/service_accounts/a3b86b00-68e7-11ee-b081-e2f0333fd1ce/application_keys/8dca4456-bd90-4cb4-a182-5868501d8a9b + uri: https://api.datadoghq.com/api/v2/service_accounts/808ffc9c-2fa0-11f1-adcd-e60174513686/application_keys/a624627a-ebfc-4af4-8101-5ca4619fdbad response: body: - string: '{"data":{"type":"application_keys","id":"8dca4456-bd90-4cb4-a182-5868501d8a9b","attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1697105458-updated","created_at":"2023-10-12T10:10:59.392477+00:00","last4":"xxxx","scopes":null},"relationships":{"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"a624627a-ebfc-4af4-8101-5ca4619fdbad","attributes":{"name":"Test-Edit_an_application_key_for_this_service_account_returns_OK_response-1775250182-updated","created_at":"2026-04-03T21:03:02.629516+00:00","last4":"xxxx","scopes":null},"relationships":{"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -63,7 +63,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/a3b86b00-68e7-11ee-b081-e2f0333fd1ce/application_keys/8dca4456-bd90-4cb4-a182-5868501d8a9b + uri: https://api.datadoghq.com/api/v2/service_accounts/808ffc9c-2fa0-11f1-adcd-e60174513686/application_keys/a624627a-ebfc-4af4-8101-5ca4619fdbad response: body: string: '' @@ -79,7 +79,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/a3b86b00-68e7-11ee-b081-e2f0333fd1ce + uri: https://api.datadoghq.com/api/v2/users/808ffc9c-2fa0-11f1-adcd-e60174513686 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.frozen new file mode 100644 index 0000000000..7642b0dbf6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:28.808Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.yaml new file mode 100644 index 0000000000..36ed242a92 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_personal_access_token_returns_ok_response.yaml @@ -0,0 +1,50 @@ +interactions: +- request: + body: '{"data":{"attributes":{"expires_at":"2027-04-03T21:03:28.808Z","name":"Test-Get_a_personal_access_token_returns_OK_response-1775250208","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":{"id":"c05c3fb9-496b-46cd-a490-5a663485f581","type":"personal_access_tokens","attributes":{"alias":"5qygRojZc6mCZ8pk5VYBfd","created_at":"2026-04-03T21:03:29.01777755Z","expires_at":"2027-04-03T21:03:28.808Z","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"Test-Get_a_personal_access_token_returns_OK_response-1775250208","public_portion":"5qygRojZc6mCZ8pk5VYBfd","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/c05c3fb9-496b-46cd-a490-5a663485f581 + response: + body: + string: '{"data":{"id":"c05c3fb9-496b-46cd-a490-5a663485f581","type":"personal_access_tokens","attributes":{"alias":"5qygRojZc6mCZ8pk5VYBfd","created_at":"2026-04-03T21:03:29.017777Z","expires_at":"2027-04-03T21:03:28.808Z","last_used_at":null,"name":"Test-Get_a_personal_access_token_returns_OK_response-1775250208","public_portion":"5qygRojZc6mCZ8pk5VYBfd","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/c05c3fb9-496b-46cd-a490-5a663485f581 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.frozen new file mode 100644 index 0000000000..d73e002368 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:28.249Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.yaml new file mode 100644 index 0000000000..c067b35b08 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_personal_access_tokens_returns_ok_response.yaml @@ -0,0 +1,50 @@ +interactions: +- request: + body: '{"data":{"attributes":{"expires_at":"2027-04-03T21:03:28.249Z","name":"Test-Get_all_personal_access_tokens_returns_OK_response-1775250208","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":{"id":"bc6be4ba-34c0-412e-a5e3-2ace86a34ff9","type":"personal_access_tokens","attributes":{"alias":"5jXrclwFWbjCs2UcUHRngH","created_at":"2026-04-03T21:03:28.434136399Z","expires_at":"2027-04-03T21:03:28.249Z","key":"xxxxx_xxXxxxxxxxxxxxxxxxxxxx_xxxxxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"Test-Get_all_personal_access_tokens_returns_OK_response-1775250208","public_portion":"5jXrclwFWbjCs2UcUHRngH","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":[{"id":"7ac0ee9a-f707-450f-b588-a52f9e9f208a","type":"personal_access_tokens","attributes":{"alias":"3jdEVpOJCWBbZT8Xc1CBLO","created_at":"2026-04-03T12:19:47.125448Z","expires_at":"2026-04-04T12:19:47Z","last_used_at":"2026-04-03T13:45:02.412946626Z","name":"dd_auth_cli-LoY3-YJ8TUCCuxSHfQFr1lluuwJv6ANADcjnPKyaN4o","public_portion":"3jdEVpOJCWBbZT8Xc1CBLO","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","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","status_pages_public_page_publish","status_pages_internal_page_publish","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":{"alias":"3S9YYEuPThXA4AbPGMcqjr","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":"bc6be4ba-34c0-412e-a5e3-2ace86a34ff9","type":"personal_access_tokens","attributes":{"alias":"5jXrclwFWbjCs2UcUHRngH","created_at":"2026-04-03T21:03:28.434136Z","expires_at":"2027-04-03T21:03:28.249Z","last_used_at":null,"name":"Test-Get_all_personal_access_tokens_returns_OK_response-1775250208","public_portion":"5jXrclwFWbjCs2UcUHRngH","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 + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/bc6be4ba-34c0-412e-a5e3-2ace86a34ff9 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.frozen new file mode 100644 index 0000000000..55c4828532 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:03.500Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.yaml new file mode 100644 index 0000000000..7298c73921 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_an_access_token_for_a_service_account_returns_ok_response.yaml @@ -0,0 +1,86 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"8161ef90-2fa0-11f1-991f-62f4bfc595d0","attributes":{"uuid":"8161ef90-2fa0-11f1-991f-62f4bfc595d0","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"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Get_an_access_token_for_a_service_account_returns_OK_response-1775250183","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens + response: + body: + string: '{"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 + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens/f2362958-1e67-414b-985d-d3196afd9315 + response: + body: + string: '{"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 + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/8161ef90-2fa0-11f1-991f-62f4bfc595d0/access_tokens/f2362958-1e67-414b-985d-d3196afd9315 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/8161ef90-2fa0-11f1-991f-62f4bfc595d0 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.frozen index 8b52406f37..6177feb9a8 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-10-12T07:18:33.140Z \ No newline at end of file +2026-04-03T21:03:04.603Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.yaml index 2395525f8d..a34f933fdd 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_one_application_key_for_this_service_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1697095113@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1775250184@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"8d6f1427-68cf-11ee-b38b-b697d9f51e5c","attributes":{"name":null,"handle":"8d6f1427-68cf-11ee-b38b-b697d9f51e5c","created_at":"2023-10-12T07:18:33.545035+00:00","modified_at":"2023-10-12T07:18:33.545035+00:00","email":"test-get_one_application_key_for_this_service_account_returns_ok_response-1697095113@datadoghq.com","icon":"https://secure.gravatar.com/avatar/675597cb6c88dc2642385e567f57b727?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + string: '{"data":{"type":"users","id":"821dac45-2fa0-11f1-be7d-4ae93322f3b6","attributes":{"uuid":"821dac45-2fa0-11f1-be7d-4ae93322f3b6","name":null,"handle":"821dac45-2fa0-11f1-be7d-4ae93322f3b6","created_at":"2026-04-03T21:03:04.945216+00:00","modified_at":"2026-04-03T21:03:04.945216+00:00","email":"test-get_one_application_key_for_this_service_account_returns_ok_response-1775250184@datadoghq.com","icon":"https://secure.gravatar.com/avatar/215ce36092d8e62b4bb9ee4cb9684778?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: @@ -22,17 +22,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1697095113"},"type":"application_keys"}}' + body: '{"data":{"attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1775250184"},"type":"application_keys"}}' headers: accept: - application/json content-type: - application/json method: POST - uri: https://api.datadoghq.com/api/v2/service_accounts/8d6f1427-68cf-11ee-b38b-b697d9f51e5c/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/821dac45-2fa0-11f1-be7d-4ae93322f3b6/application_keys response: body: - string: '{"data":{"type":"application_keys","id":"490b7601-a457-449c-8d8c-72c848e669d5","attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1697095113","created_at":"2023-10-12T07:18:34.052468+00:00","last4":"xxxx","key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"8d6f1427-68cf-11ee-b38b-b697d9f51e5c"}},"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"b5c97dad-de58-4c31-a8a9-2b86917e6cb6","attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1775250184","created_at":"2026-04-03T21:03:05.262442+00:00","last4":"xxxx","key":"xxxxx_xxxxxxxxxxxxxxxXxxxxxxxxxxxxxxxxxx","scopes":null},"relationships":{"owned_by":{"data":{"type":"users","id":"821dac45-2fa0-11f1-be7d-4ae93322f3b6"}},"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -45,10 +45,10 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/service_accounts/8d6f1427-68cf-11ee-b38b-b697d9f51e5c/application_keys/490b7601-a457-449c-8d8c-72c848e669d5 + uri: https://api.datadoghq.com/api/v2/service_accounts/821dac45-2fa0-11f1-be7d-4ae93322f3b6/application_keys/b5c97dad-de58-4c31-a8a9-2b86917e6cb6 response: body: - string: '{"data":{"type":"application_keys","id":"490b7601-a457-449c-8d8c-72c848e669d5","attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1697095113","created_at":"2023-10-12T07:18:34.052468+00:00","last4":"xxxx","scopes":null},"relationships":{"leak_information":{"data":null}}}}' + string: '{"data":{"type":"application_keys","id":"b5c97dad-de58-4c31-a8a9-2b86917e6cb6","attributes":{"name":"Test-Get_one_application_key_for_this_service_account_returns_OK_response-1775250184","created_at":"2026-04-03T21:03:05.262443+00:00","last4":"xxxx","scopes":null,"last_used_at":null},"relationships":{"leak_information":{"data":null}}}}' headers: content-type: - application/json @@ -61,7 +61,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/service_accounts/8d6f1427-68cf-11ee-b38b-b697d9f51e5c/application_keys/490b7601-a457-449c-8d8c-72c848e669d5 + uri: https://api.datadoghq.com/api/v2/service_accounts/821dac45-2fa0-11f1-be7d-4ae93322f3b6/application_keys/b5c97dad-de58-4c31-a8a9-2b86917e6cb6 response: body: string: '' @@ -77,7 +77,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/8d6f1427-68cf-11ee-b38b-b697d9f51e5c + uri: https://api.datadoghq.com/api/v2/users/821dac45-2fa0-11f1-be7d-4ae93322f3b6 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.frozen new file mode 100644 index 0000000000..6234af8a3e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:09.026Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.yaml new file mode 100644 index 0000000000..61501e9ce4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_access_tokens_for_a_service_account_returns_ok_response.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7","attributes":{"uuid":"84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7","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 + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/service_accounts/84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7/access_tokens + response: + body: + string: '{"data":[],"meta":{"page":{"total_filtered_count":0}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/84a7b33b-2fa0-11f1-96b6-7a9b8860a1d7 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.frozen index 7fa2e779bc..cb0c6e25b5 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-10-12T10:12:18.993Z \ No newline at end of file +2026-04-03T21:03:09.754Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.yaml index f17b4119c3..4d7da246d9 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_list_application_keys_for_this_service_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"email":"Test-List_application_keys_for_this_service_account_returns_OK_response-1697105538@datadoghq.com","service_account":true,"title":"user + body: '{"data":{"attributes":{"email":"Test-List_application_keys_for_this_service_account_returns_OK_response-1775250189@datadoghq.com","service_account":true,"title":"user title"},"type":"users"}}' headers: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/service_accounts response: body: - string: '{"data":{"type":"users","id":"d3bd8ebd-68e7-11ee-8628-2e5a5b6c83f3","attributes":{"name":null,"handle":"d3bd8ebd-68e7-11ee-8628-2e5a5b6c83f3","created_at":"2023-10-12T10:12:19.421394+00:00","modified_at":"2023-10-12T10:12:19.421394+00:00","email":"test-list_application_keys_for_this_service_account_returns_ok_response-1697105538@datadoghq.com","icon":"https://secure.gravatar.com/avatar/79fd260ec49c01b5dde9172579034626?s=48&d=retro","title":"user - title","verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + string: '{"data":{"type":"users","id":"85197e38-2fa0-11f1-aa8f-eea1be72dca6","attributes":{"uuid":"85197e38-2fa0-11f1-aa8f-eea1be72dca6","name":null,"handle":"85197e38-2fa0-11f1-aa8f-eea1be72dca6","created_at":"2026-04-03T21:03:09.950991+00:00","modified_at":"2026-04-03T21:03:09.950991+00:00","email":"test-list_application_keys_for_this_service_account_returns_ok_response-1775250189@datadoghq.com","icon":"https://secure.gravatar.com/avatar/10bfb5e1516b0d10604b19a02e2d99f1?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: @@ -27,7 +27,7 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/service_accounts/d3bd8ebd-68e7-11ee-8628-2e5a5b6c83f3/application_keys + uri: https://api.datadoghq.com/api/v2/service_accounts/85197e38-2fa0-11f1-aa8f-eea1be72dca6/application_keys response: body: string: '{"data":[],"meta":{"page":{"total_filtered_count":0},"max_allowed_per_user":1000}}' @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/d3bd8ebd-68e7-11ee-8628-2e5a5b6c83f3 + uri: https://api.datadoghq.com/api/v2/users/85197e38-2fa0-11f1-aa8f-eea1be72dca6 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.frozen new file mode 100644 index 0000000000..c6d7ebb2cc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:29.642Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.yaml new file mode 100644 index 0000000000..ea867752e0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_revoke_a_personal_access_token_returns_no_content_response.yaml @@ -0,0 +1,48 @@ +interactions: +- request: + body: '{"data":{"attributes":{"expires_at":"2027-04-03T21:03:29.642Z","name":"Test-Revoke_a_personal_access_token_returns_No_Content_response-1775250209","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":{"id":"58aa40d5-3478-40c9-b7c6-b312a98aa205","type":"personal_access_tokens","attributes":{"alias":"2hJ86WNzxxAq0kue3PHK8T","created_at":"2026-04-03T21:03:29.846574885Z","expires_at":"2027-04-03T21:03:29.642Z","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxXxxxxxx","name":"Test-Revoke_a_personal_access_token_returns_No_Content_response-1775250209","public_portion":"2hJ86WNzxxAq0kue3PHK8T","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/58aa40d5-3478-40c9-b7c6-b312a98aa205 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/58aa40d5-3478-40c9-b7c6-b312a98aa205 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.frozen new file mode 100644 index 0000000000..fa38ba91a9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:10.520Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.yaml new file mode 100644 index 0000000000..36273eacd9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_revoke_an_access_token_for_a_service_account_returns_no_content_response.yaml @@ -0,0 +1,84 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"860878b5-2fa0-11f1-991f-62f4bfc595d0","attributes":{"uuid":"860878b5-2fa0-11f1-991f-62f4bfc595d0","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"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens + response: + body: + string: '{"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 + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens/7346d75b-83f3-48ba-9186-899fc80bce16 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/860878b5-2fa0-11f1-991f-62f4bfc595d0/access_tokens/7346d75b-83f3-48ba-9186-899fc80bce16 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/860878b5-2fa0-11f1-991f-62f4bfc595d0 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.frozen new file mode 100644 index 0000000000..ab789a2aa5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:29.264Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.yaml new file mode 100644 index 0000000000..24ac1fc286 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_personal_access_token_returns_ok_response.yaml @@ -0,0 +1,52 @@ +interactions: +- request: + body: '{"data":{"attributes":{"expires_at":"2027-04-03T21:03:29.264Z","name":"Test-Update_a_personal_access_token_returns_OK_response-1775250209","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/personal_access_tokens + response: + body: + string: '{"data":{"id":"62ef326f-92d6-424b-a000-d7212e2568fd","type":"personal_access_tokens","attributes":{"alias":"30gYny15czuas9ipvuFUOD","created_at":"2026-04-03T21:03:29.373074209Z","expires_at":"2027-04-03T21:03:29.264Z","key":"xxxxx_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxXxxxxxxxxxxxxxxxxxxxXxxxxxxxxx","name":"Test-Update_a_personal_access_token_returns_OK_response-1775250209","public_portion":"30gYny15czuas9ipvuFUOD","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Update_a_personal_access_token_returns_OK_response-1775250209-updated"},"id":"62ef326f-92d6-424b-a000-d7212e2568fd","type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/62ef326f-92d6-424b-a000-d7212e2568fd + response: + body: + string: '{"data":{"id":"62ef326f-92d6-424b-a000-d7212e2568fd","type":"personal_access_tokens","attributes":{"alias":"30gYny15czuas9ipvuFUOD","created_at":"2026-04-03T21:03:29.373074Z","expires_at":"2027-04-03T21:03:29.264Z","last_used_at":null,"modified_at":"2026-04-03T21:03:29.522659Z","name":"Test-Update_a_personal_access_token_returns_OK_response-1775250209-updated","public_portion":"30gYny15czuas9ipvuFUOD","scopes":["dashboards_read"]},"relationships":{"owned_by":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/personal_access_tokens/62ef326f-92d6-424b-a000-d7212e2568fd + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.frozen new file mode 100644 index 0000000000..6a894d59da --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-04-03T21:03:12.499Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.yaml new file mode 100644 index 0000000000..3ceae6a4fe --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_an_access_token_for_a_service_account_returns_ok_response.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts + response: + body: + string: '{"data":{"type":"users","id":"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0","attributes":{"uuid":"86bdf0d7-2fa0-11f1-991f-62f4bfc595d0","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"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Update_an_access_token_for_a_service_account_returns_OK_response-1775250192","scopes":["dashboards_read"]},"type":"personal_access_tokens"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens + response: + body: + string: '{"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 + status: + code: 201 + message: Created +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens/9a7d27cc-4969-4a57-990c-03c23a9f2adc + response: + body: + string: '{"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 + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/service_accounts/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0/access_tokens/9a7d27cc-4969-4a57-990c-03c23a9f2adc + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/86bdf0d7-2fa0-11f1-991f-62f4bfc595d0 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 8413be265a..5d9d7c8899 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -929,6 +929,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": [ { @@ -1243,6 +1255,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/tests/v2/features/key_management.feature b/tests/v2/features/key_management.feature index 40daf9df54..bef357388c 100644 --- a/tests/v2/features/key_management.feature +++ b/tests/v2/features/key_management.feature @@ -12,6 +12,20 @@ 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 + + @generated @skip @team:DataDog/credentials-management + Scenario: Create a personal access token returns "Created" 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 201 Created + @generated @skip @team:DataDog/credentials-management Scenario: Create an API key returns "Bad Request" response Given new "CreateAPIKey" request @@ -200,6 +214,20 @@ 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 + + @generated @skip @team:DataDog/credentials-management + Scenario: Get a personal access token returns "OK" response + Given new "GetPersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/credentials-management Scenario: Get all API keys returns "Bad Request" response Given new "ListAPIKeys" request @@ -257,6 +285,18 @@ 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 + + @generated @skip @team:DataDog/credentials-management + Scenario: Get all personal access tokens returns "OK" response + Given new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/credentials-management Scenario: Get an application key returns "Bad Request" response Given new "GetApplicationKey" request @@ -301,3 +341,41 @@ 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" + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke a personal access token returns "No Content" response + Given new "RevokePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + 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 + + @generated @skip @team:DataDog/credentials-management + Scenario: Update a personal access token returns "OK" 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 200 OK diff --git a/tests/v2/features/personal_access_tokens.feature b/tests/v2/features/personal_access_tokens.feature new file mode 100644 index 0000000000..78f13ba209 --- /dev/null +++ b/tests/v2/features/personal_access_tokens.feature @@ -0,0 +1,98 @@ +@endpoint(key-management) @endpoint(key-management-v2) +Feature: Personal Access Tokens + Manage personal access tokens (PATs) and service account access tokens (SATs) + for your organization. PATs provide scoped, time-limited access to the Datadog + API for individual users, while SATs provide the same for service accounts. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "KeyManagement" API + + @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 a personal access token returns "Bad Request" response + Given new "CreatePersonalAccessToken" request + And body with value {"data": {"type": "personal_access_tokens", "attributes": {"name": "", "scopes": ["dashboards_read"], "expires_at": "{{ timeISO('now+365d') }}"}}} + 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" + + @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 a personal access token returns "Not Found" response + Given new "GetPersonalAccessToken" request + And request contains "pat_uuid" parameter with value "00000000-0000-0000-0000-000000000000" + 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" + + @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 with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"type": "personal_access_tokens", "id": "00000000-0000-0000-0000-000000000000", "attributes": {"name": "updated"}}} + When the request is sent + Then the response status is 404 Not Found + + @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 with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/credentials-management + Scenario: Create a service account access token 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.attributes" has field "key" diff --git a/tests/v2/features/service_accounts.feature b/tests/v2/features/service_accounts.feature index 6e25db1e8f..3842b478f5 100644 --- a/tests/v2/features/service_accounts.feature +++ b/tests/v2/features/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/team-aaa-identity 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/team-aaa-identity 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/team-aaa-identity 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/tests/v2/features/undo.json b/tests/v2/features/undo.json index 8b9940b568..450f4891a8 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3970,6 +3970,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": { @@ -5404,6 +5441,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": {