diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index a38d274f9b..5e187a0e14 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1291,6 +1291,152 @@ components: type: string x-enum-varnames: - CHECK_STATUS + ClientToken: + description: 'Client token object. Client tokens (also known as public API keys) + enable you to submit + + data from your browser or mobile applications to Datadog.' + properties: + created_at: + description: Creation timestamp of the client token. + example: '2024-03-15T10:30:00.000000+00:00' + format: date-time + readOnly: true + type: string + created_by_handle: + description: Handle of the user who created the client token. + example: user@example.com + readOnly: true + type: string + created_by_uuid: + description: UUID of the user who created the client token. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + readOnly: true + type: string + disabled_at: + description: Timestamp when the client token was disabled. + example: '2024-03-20T10:30:00.000000+00:00' + format: date-time + nullable: true + readOnly: true + type: string + disabled_by: + description: ID of the user who disabled the client token. + format: int64 + readOnly: true + type: integer + disabled_by_handle: + description: Handle of the user who disabled the client token. + example: user@example.com + readOnly: true + type: string + hash: + description: 'The hash value of the client token. This is the secret token + value that should be + + used in your browser or mobile application.' + example: 1234567890abcdef1234567890abcdef123 + maxLength: 35 + readOnly: true + type: string + modified_by: + description: ID of the user who last modified the client token. + format: int64 + readOnly: true + type: integer + name: + description: Name of the client token. + example: Example Client Token + maxLength: 255 + minLength: 1 + type: string + org_id: + description: Organization ID associated with the client token. + example: 12345 + format: int64 + readOnly: true + type: integer + origin_urls: + description: 'List of allowed origin URLs for browser-based applications. + Requests from URLs + + not in this list will be rejected.' + example: + - https://example.com + items: + example: https://example.com + maxLength: 2500 + type: string + maxItems: 100 + type: array + required: + - origin_urls + type: object + ClientTokenCreateRequest: + description: Request to create a new client token. + properties: + name: + description: Name of the client token. + example: Example Client Token + maxLength: 255 + minLength: 1 + type: string + origin_urls: + description: 'List of allowed origin URLs for browser-based applications. + Requests from URLs + + not in this list will be rejected.' + example: + - https://example.com + items: + example: https://example.com + maxLength: 2500 + type: string + maxItems: 100 + type: array + required: + - name + - origin_urls + type: object + ClientTokenRevokeRequest: + description: Request to revoke a client token. + properties: + hash: + description: Hash value of the client token to revoke. + example: 1234567890abcdef1234567890abcdef123 + maxLength: 35 + type: string + required: + - hash + type: object + ClientTokenUpdateRequest: + description: Request to update an existing client token. + properties: + hash: + description: Hash value of the client token to update. + example: 1234567890abcdef1234567890abcdef123 + maxLength: 35 + type: string + name: + description: New name for the client token. + example: Updated Client Token Name + maxLength: 255 + minLength: 1 + type: string + origin_urls: + description: New list of allowed origin URLs. If provided, this will replace + the existing list. + items: + example: https://example.com + maxLength: 2500 + type: string + maxItems: 100 + type: array + required: + - hash + - name + type: object ContentEncoding: description: HTTP header used to compress the media-type. enum: @@ -26206,6 +26352,7 @@ components: ci_visibility_pipelines_write: Create CI Visibility pipeline spans using the API. ci_visibility_read: View CI Visibility. + client_tokens_write: Create, edit, and delete client tokens. cloud_cost_management_read: View Cloud Cost pages and the cloud cost data source in dashboards and notebooks. For more details, see the Cloud Cost Management docs. @@ -33294,6 +33441,148 @@ paths: tags: - Organizations x-codegen-request-body-name: body + /api/v1/public_api_key: + delete: + description: 'Revoke a client token (public API key). Once revoked, the token + can no longer be used + + to submit data to Datadog.' + operationId: RevokeClientToken + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClientTokenRevokeRequest' + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - client_tokens_write + summary: Revoke client token + tags: + - Key Management + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Create a new client token (public API key) to submit data from + your browser or mobile + + applications to Datadog.' + operationId: CreateClientToken + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClientTokenCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ClientToken' + 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': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - client_tokens_write + summary: Create client token + tags: + - Key Management + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Update the name and/or origin URLs of an existing client token + (public API key). + operationId: UpdateClientToken + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClientTokenUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ClientToken' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - client_tokens_write + summary: Update client token + tags: + - Key Management + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v1/query: get: description: Query timeseries points. diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e301432aca..1d00ffc84d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -853,6 +853,43 @@ components: example: 10 format: int64 type: integer + PersonalAccessTokenFilterOwnerUUIDParameter: + description: Filter personal access tokens by owner UUID. + in: query + name: filter[owner_uuid] + required: false + schema: + items: + format: uuid + type: string + type: array + PersonalAccessTokenFilterParameter: + description: Filter personal access tokens by name. + in: query + name: filter + required: false + schema: + type: string + PersonalAccessTokenID: + description: The UUID of the personal access token. + in: path + name: pat_uuid + required: true + schema: + format: uuid + type: string + PersonalAccessTokenSortParameter: + 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 @@ -25702,6 +25739,87 @@ components: - name - requirements type: object + FullPersonalAccessToken: + description: 'Personal access token object with the secret key value. This is + only + + returned when creating a new token.' + properties: + attributes: + $ref: '#/components/schemas/FullPersonalAccessTokenAttributes' + id: + description: UUID of the personal access token. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/PersonalAccessTokenRelationships' + type: + $ref: '#/components/schemas/PersonalAccessTokenType' + required: + - id + - type + - attributes + - relationships + type: object + FullPersonalAccessTokenAttributes: + description: 'Attributes of a personal access token including the secret key + value. + + This is only returned when creating a new token.' + properties: + created_at: + description: Creation timestamp of the personal access token. + example: '2024-03-15T10:30:00.000000+00:00' + format: date-time + readOnly: true + type: string + expires_at: + description: Expiration timestamp of the personal access token. + example: '2025-03-15T10:30:00.000000+00:00' + format: date-time + type: string + key: + description: 'The secret token value. This is only returned when creating + a new personal + + access token and cannot be retrieved later.' + example: dd_pat_1234567890abcdef1234567890abcdef12345678 + readOnly: true + type: string + modified_at: + description: Last modification timestamp of the personal access token. + example: '2024-03-20T10:30:00.000000+00:00' + format: date-time + nullable: true + readOnly: true + type: string + name: + description: Name of the personal access token. + example: Example Personal Access Token + maxLength: 256 + minLength: 1 + type: string + scopes: + description: 'Array of scopes granted to the personal access token. These + define what + + permissions the token has.' + example: + - dashboards_read + - monitors_read + items: + description: Name of scope. + type: string + minItems: 1 + type: array + required: + - name + - scopes + - created_at + - expires_at + - key + type: object GCPCredentials: description: The definition of the `GCPCredentials` object. oneOf: @@ -45108,6 +45226,241 @@ components: type: string x-enum-varnames: - PERMISSIONS + PersonalAccessToken: + description: Personal access token object. + properties: + attributes: + $ref: '#/components/schemas/PersonalAccessTokenAttributes' + id: + description: UUID of the personal access token. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/PersonalAccessTokenRelationships' + type: + $ref: '#/components/schemas/PersonalAccessTokenType' + required: + - id + - type + - attributes + - relationships + type: object + PersonalAccessTokenAttributes: + description: Attributes of a personal access token. + properties: + created_at: + description: Creation timestamp of the personal access token. + example: '2024-03-15T10:30:00.000000+00:00' + format: date-time + readOnly: true + type: string + expires_at: + description: Expiration timestamp of the personal access token. + example: '2025-03-15T10:30:00.000000+00:00' + format: date-time + type: string + modified_at: + description: Last modification timestamp of the personal access token. + example: '2024-03-20T10:30:00.000000+00:00' + format: date-time + nullable: true + readOnly: true + type: string + name: + description: Name of the personal access token. + example: Example Personal Access Token + maxLength: 256 + minLength: 1 + type: string + scopes: + description: 'Array of scopes granted to the personal access token. These + define what + + permissions the token has.' + example: + - dashboards_read + - monitors_read + items: + description: Name of scope. + type: string + minItems: 1 + type: array + required: + - name + - scopes + - created_at + - expires_at + type: object + PersonalAccessTokenCreateAttributes: + description: Attributes used to create a personal access token. + properties: + expires_at: + description: Expiration timestamp for the personal access token. + example: '2025-03-15T10:30:00.000000+00:00' + format: date-time + type: string + name: + description: Name of the personal access token. + example: Example Personal Access Token + maxLength: 256 + minLength: 1 + type: string + scopes: + description: 'Array of scopes to grant the personal access token. These + define what + + permissions the token will have.' + example: + - dashboards_read + - monitors_read + items: + description: Name of scope. + type: string + minItems: 1 + 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/PersonalAccessTokenType' + required: + - type + - attributes + type: object + PersonalAccessTokenCreateRequest: + description: Request to create a personal access token. + properties: + data: + $ref: '#/components/schemas/PersonalAccessTokenCreateData' + required: + - data + type: object + PersonalAccessTokenGetResponse: + description: Response for retrieving a personal access token. + properties: + data: + $ref: '#/components/schemas/PersonalAccessToken' + type: object + PersonalAccessTokenRelationships: + description: Resources related to the personal access token. + properties: + owned_by: + $ref: '#/components/schemas/RelationshipToUser' + type: object + PersonalAccessTokenResponse: + description: Response for creating a personal access token. + properties: + data: + $ref: '#/components/schemas/FullPersonalAccessToken' + type: object + PersonalAccessTokenType: + 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 + PersonalAccessTokenUpdateAttributes: + description: Attributes used to update a personal access token. + properties: + name: + description: New name for the personal access token. + example: Updated Personal Access Token Name + maxLength: 256 + minLength: 1 + type: string + scopes: + description: 'New array of scopes for the personal access token. If provided, + this will + + replace the existing scopes.' + example: + - dashboards_read + - dashboards_write + items: + description: Name of scope. + type: string + minItems: 1 + type: array + type: object + PersonalAccessTokenUpdateData: + description: Object used to update a personal access token. + properties: + attributes: + $ref: '#/components/schemas/PersonalAccessTokenUpdateAttributes' + id: + description: UUID of the personal access token. Must match the path parameter. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: '#/components/schemas/PersonalAccessTokenType' + required: + - id + - type + - attributes + type: object + PersonalAccessTokenUpdateRequest: + description: Request to update a personal access token. + properties: + data: + $ref: '#/components/schemas/PersonalAccessTokenUpdateData' + required: + - data + type: object + PersonalAccessTokensListResponse: + 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/PersonalAccessTokensResponseMeta' + type: object + PersonalAccessTokensResponseMeta: + description: Additional information related to the personal access tokens response. + properties: + page: + $ref: '#/components/schemas/PersonalAccessTokensResponseMetaPage' + type: object + PersonalAccessTokensResponseMetaPage: + description: Pagination information for personal access tokens response. + properties: + total_filtered_count: + description: Total filtered personal access token count. + format: int64 + type: integer + type: object + PersonalAccessTokensSort: + default: name + description: Sorting options for personal access tokens. + 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 Playlist: properties: data: @@ -67432,6 +67785,9 @@ components: is not required to set downtimes. monitors_read: View monitors. monitors_write: Edit, delete, and resolve individual monitors. + org_app_keys_read: View personal access tokens for all users in your organization. + org_app_keys_write: Create, edit, and delete personal access tokens for + all users in your organization. org_connections_read: Read cross organization connections. org_connections_write: Create, edit, and delete cross organization connections. org_management: Edit org configurations, including authentication and @@ -67482,6 +67838,7 @@ components: user_access_manage: Disable users, manage user roles, manage SAML-to-role mappings, and configure logs restriction queries. user_access_read: View users and their roles and settings. + user_app_keys: Create, view, and manage your own personal access tokens. workflows_read: View workflows. workflows_run: Run workflows. workflows_write: Create, edit, and delete workflows. @@ -87522,6 +87879,239 @@ paths: operator: OR permissions: - user_access_read + /api/v2/personal_access_tokens: + get: + description: 'List all personal access tokens in your organization. Supports + filtering, + + pagination, and sorting.' + operationId: ListPersonalAccessTokens + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - $ref: '#/components/parameters/PersonalAccessTokenSortParameter' + - $ref: '#/components/parameters/PersonalAccessTokenFilterParameter' + - $ref: '#/components/parameters/PersonalAccessTokenFilterOwnerUUIDParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PersonalAccessTokensListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found - Personal access tokens feature is not enabled + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_app_keys_read + summary: List personal access tokens + tags: + - Key Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Create a new personal access token with fine-grained permissions. + The token value + + will be returned in the response and cannot be retrieved later. Be sure to + save it + + securely.' + operationId: CreatePersonalAccessToken + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PersonalAccessTokenCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PersonalAccessTokenResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found - Personal access tokens feature is not enabled + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_app_keys + summary: Create personal access token + tags: + - Key Management + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/personal_access_tokens/{pat_uuid}: + delete: + description: 'Revoke a personal access token. Once revoked, the token can no + longer be used + + to authenticate API requests.' + operationId: RevokePersonalAccessToken + parameters: + - $ref: '#/components/parameters/PersonalAccessTokenID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_app_keys + - org_app_keys_write + summary: Revoke personal access token + tags: + - Key Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a specific personal access token by UUID. + operationId: GetPersonalAccessToken + parameters: + - $ref: '#/components/parameters/PersonalAccessTokenID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PersonalAccessTokenGetResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_app_keys_read + summary: Get personal access token + tags: + - Key Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: 'Update the name and/or scopes of an existing personal access token. + The ID in the + + request body must match the UUID in the path.' + 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/PersonalAccessTokenGetResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_app_keys_write + summary: Update personal access token + tags: + - Key Management + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/posture_management/findings: get: description: "Get a list of findings. These include both misconfigurations and diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 11d7ba1320..36aae0f8a8 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -473,6 +473,34 @@ datadog\_api\_client.v1.model.check\_status\_widget\_definition\_type module :members: :show-inheritance: +datadog\_api\_client.v1.model.client\_token module +-------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.client_token + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.client\_token\_create\_request module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.client_token_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.client\_token\_revoke\_request module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.client_token_revoke_request + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.client\_token\_update\_request module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.client_token_update_request + :members: + :show-inheritance: + datadog\_api\_client.v1.model.content\_encoding module ------------------------------------------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index ca47cf72a1..167ff3091c 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -10637,6 +10637,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 ----------------------------------------------------- @@ -19583,6 +19597,118 @@ 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\_get\_response module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_token_get_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\_type module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.personal_access_token_type + :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\_list\_response module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_tokens_list_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_tokens\_response\_meta module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_tokens_response_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.personal\_access\_tokens\_response\_meta\_page module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.personal_access_tokens_response_meta_page + :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.playlist module --------------------------------------------- diff --git a/examples/v1/key-management/CreateClientToken.py b/examples/v1/key-management/CreateClientToken.py new file mode 100644 index 0000000000..dadb0ddecf --- /dev/null +++ b/examples/v1/key-management/CreateClientToken.py @@ -0,0 +1,22 @@ +""" +Create client token returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.key_management_api import KeyManagementApi +from datadog_api_client.v1.model.client_token_create_request import ClientTokenCreateRequest + +body = ClientTokenCreateRequest( + name="Example Client Token", + origin_urls=[ + "https://example.com", + ], +) + +configuration = Configuration() +configuration.unstable_operations["create_client_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.create_client_token(body=body) + + print(response) diff --git a/examples/v1/key-management/RevokeClientToken.py b/examples/v1/key-management/RevokeClientToken.py new file mode 100644 index 0000000000..52a103132c --- /dev/null +++ b/examples/v1/key-management/RevokeClientToken.py @@ -0,0 +1,17 @@ +""" +Revoke client token returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.key_management_api import KeyManagementApi +from datadog_api_client.v1.model.client_token_revoke_request import ClientTokenRevokeRequest + +body = ClientTokenRevokeRequest( + hash="1234567890abcdef1234567890abcdef123", +) + +configuration = Configuration() +configuration.unstable_operations["revoke_client_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + api_instance.revoke_client_token(body=body) diff --git a/examples/v1/key-management/UpdateClientToken.py b/examples/v1/key-management/UpdateClientToken.py new file mode 100644 index 0000000000..d5203b2fe4 --- /dev/null +++ b/examples/v1/key-management/UpdateClientToken.py @@ -0,0 +1,23 @@ +""" +Update client token returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.key_management_api import KeyManagementApi +from datadog_api_client.v1.model.client_token_update_request import ClientTokenUpdateRequest + +body = ClientTokenUpdateRequest( + hash="1234567890abcdef1234567890abcdef123", + name="Updated Client Token Name", + origin_urls=[ + "https://example.com", + ], +) + +configuration = Configuration() +configuration.unstable_operations["update_client_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.update_client_token(body=body) + + print(response) diff --git a/examples/v2/key-management/CreatePersonalAccessToken.py b/examples/v2/key-management/CreatePersonalAccessToken.py new file mode 100644 index 0000000000..d3dc0c4998 --- /dev/null +++ b/examples/v2/key-management/CreatePersonalAccessToken.py @@ -0,0 +1,34 @@ +""" +Create personal access token returns "OK" response +""" + +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_token_type import PersonalAccessTokenType +from datetime import datetime +from dateutil.tz import tzutc + +body = PersonalAccessTokenCreateRequest( + data=PersonalAccessTokenCreateData( + attributes=PersonalAccessTokenCreateAttributes( + expires_at=datetime(2025, 3, 15, 10, 30, tzinfo=tzutc()), + name="Example Personal Access Token", + scopes=[ + "dashboards_read", + "monitors_read", + ], + ), + type=PersonalAccessTokenType.PERSONAL_ACCESS_TOKENS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_personal_access_token"] = True +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..a7ce30eaec --- /dev/null +++ b/examples/v2/key-management/GetPersonalAccessToken.py @@ -0,0 +1,17 @@ +""" +Get personal access token returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["get_personal_access_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.get_personal_access_token( + pat_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) + + print(response) diff --git a/examples/v2/key-management/ListPersonalAccessTokens.py b/examples/v2/key-management/ListPersonalAccessTokens.py new file mode 100644 index 0000000000..78f825ba30 --- /dev/null +++ b/examples/v2/key-management/ListPersonalAccessTokens.py @@ -0,0 +1,14 @@ +""" +List 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() +configuration.unstable_operations["list_personal_access_tokens"] = True +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..b08721e0b1 --- /dev/null +++ b/examples/v2/key-management/RevokePersonalAccessToken.py @@ -0,0 +1,15 @@ +""" +Revoke personal access token returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.key_management_api import KeyManagementApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["revoke_personal_access_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + api_instance.revoke_personal_access_token( + pat_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) diff --git a/examples/v2/key-management/UpdatePersonalAccessToken.py b/examples/v2/key-management/UpdatePersonalAccessToken.py new file mode 100644 index 0000000000..68fe1bfd7e --- /dev/null +++ b/examples/v2/key-management/UpdatePersonalAccessToken.py @@ -0,0 +1,35 @@ +""" +Update personal access token returns "OK" response +""" + +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_type import PersonalAccessTokenType +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 uuid import UUID + +body = PersonalAccessTokenUpdateRequest( + data=PersonalAccessTokenUpdateData( + attributes=PersonalAccessTokenUpdateAttributes( + name="Updated Personal Access Token Name", + scopes=[ + "dashboards_read", + "dashboards_write", + ], + ), + id=UUID("00000000-0000-0000-0000-000000000000"), + type=PersonalAccessTokenType.PERSONAL_ACCESS_TOKENS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_personal_access_token"] = True +with ApiClient(configuration) as api_client: + api_instance = KeyManagementApi(api_client) + response = api_instance.update_personal_access_token( + pat_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index f715f758fc..b10bcaa807 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -247,6 +247,9 @@ def __init__( # Keep track of unstable operations self.unstable_operations = _UnstableOperations( { + "v1.create_client_token": False, + "v1.revoke_client_token": False, + "v1.update_client_token": False, "v2.cancel_fleet_deployment": False, "v2.create_fleet_deployment_configure": False, "v2.create_fleet_deployment_upgrade": False, @@ -261,6 +264,11 @@ def __init__( "v2.list_fleet_schedules": False, "v2.trigger_fleet_schedule": False, "v2.update_fleet_schedule": False, + "v2.create_personal_access_token": False, + "v2.get_personal_access_token": False, + "v2.list_personal_access_tokens": False, + "v2.revoke_personal_access_token": False, + "v2.update_personal_access_token": False, "v2.create_open_api": False, "v2.delete_open_api": False, "v2.get_open_api": False, diff --git a/src/datadog_api_client/v1/api/key_management_api.py b/src/datadog_api_client/v1/api/key_management_api.py index 08b1bad9bd..5b69642703 100644 --- a/src/datadog_api_client/v1/api/key_management_api.py +++ b/src/datadog_api_client/v1/api/key_management_api.py @@ -13,6 +13,10 @@ from datadog_api_client.v1.model.application_key_list_response import ApplicationKeyListResponse from datadog_api_client.v1.model.application_key_response import ApplicationKeyResponse from datadog_api_client.v1.model.application_key import ApplicationKey +from datadog_api_client.v1.model.client_token_revoke_request import ClientTokenRevokeRequest +from datadog_api_client.v1.model.client_token import ClientToken +from datadog_api_client.v1.model.client_token_create_request import ClientTokenCreateRequest +from datadog_api_client.v1.model.client_token_update_request import ClientTokenUpdateRequest class KeyManagementApi: @@ -71,6 +75,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_client_token_endpoint = _Endpoint( + settings={ + "response_type": (ClientToken,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v1/public_api_key", + "operation_id": "create_client_token", + "http_method": "POST", + "version": "v1", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (ClientTokenCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_api_key_endpoint = _Endpoint( settings={ "response_type": (ApiKeyResponse,), @@ -195,6 +219,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._revoke_client_token_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v1/public_api_key", + "operation_id": "revoke_client_token", + "http_method": "DELETE", + "version": "v1", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (ClientTokenRevokeRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_api_key_endpoint = _Endpoint( settings={ "response_type": (ApiKeyResponse,), @@ -247,6 +291,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_client_token_endpoint = _Endpoint( + settings={ + "response_type": (ClientToken,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v1/public_api_key", + "operation_id": "update_client_token", + "http_method": "PUT", + "version": "v1", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (ClientTokenUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_api_key( self, body: ApiKey, @@ -280,6 +344,23 @@ def create_application_key( return self._create_application_key_endpoint.call_with_http_info(**kwargs) + def create_client_token( + self, + body: ClientTokenCreateRequest, + ) -> ClientToken: + """Create client token. + + Create a new client token (public API key) to submit data from your browser or mobile + applications to Datadog. + + :type body: ClientTokenCreateRequest + :rtype: ClientToken + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_client_token_endpoint.call_with_http_info(**kwargs) + def delete_api_key( self, key: str, @@ -375,6 +456,23 @@ def list_application_keys( kwargs: Dict[str, Any] = {} return self._list_application_keys_endpoint.call_with_http_info(**kwargs) + def revoke_client_token( + self, + body: ClientTokenRevokeRequest, + ) -> None: + """Revoke client token. + + Revoke a client token (public API key). Once revoked, the token can no longer be used + to submit data to Datadog. + + :type body: ClientTokenRevokeRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._revoke_client_token_endpoint.call_with_http_info(**kwargs) + def update_api_key( self, key: str, @@ -417,3 +515,19 @@ def update_application_key( kwargs["body"] = body return self._update_application_key_endpoint.call_with_http_info(**kwargs) + + def update_client_token( + self, + body: ClientTokenUpdateRequest, + ) -> ClientToken: + """Update client token. + + Update the name and/or origin URLs of an existing client token (public API key). + + :type body: ClientTokenUpdateRequest + :rtype: ClientToken + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._update_client_token_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v1/model/client_token.py b/src/datadog_api_client/v1/model/client_token.py new file mode 100644 index 0000000000..ffe828d0ac --- /dev/null +++ b/src/datadog_api_client/v1/model/client_token.py @@ -0,0 +1,150 @@ +# 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, + UUID, +) + + +class ClientToken(ModelNormal): + validations = { + "hash": { + "max_length": 35, + }, + "name": { + "max_length": 255, + "min_length": 1, + }, + "origin_urls": { + "max_items": 100, + }, + } + + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "created_by_handle": (str,), + "created_by_uuid": (UUID,), + "disabled_at": (datetime, none_type), + "disabled_by": (int,), + "disabled_by_handle": (str,), + "hash": (str,), + "modified_by": (int,), + "name": (str,), + "org_id": (int,), + "origin_urls": ([str],), + } + + attribute_map = { + "created_at": "created_at", + "created_by_handle": "created_by_handle", + "created_by_uuid": "created_by_uuid", + "disabled_at": "disabled_at", + "disabled_by": "disabled_by", + "disabled_by_handle": "disabled_by_handle", + "hash": "hash", + "modified_by": "modified_by", + "name": "name", + "org_id": "org_id", + "origin_urls": "origin_urls", + } + read_only_vars = { + "created_at", + "created_by_handle", + "created_by_uuid", + "disabled_at", + "disabled_by", + "disabled_by_handle", + "hash", + "modified_by", + "org_id", + } + + def __init__( + self_, + origin_urls: List[str], + created_at: Union[datetime, UnsetType] = unset, + created_by_handle: Union[str, UnsetType] = unset, + created_by_uuid: Union[UUID, UnsetType] = unset, + disabled_at: Union[datetime, none_type, UnsetType] = unset, + disabled_by: Union[int, UnsetType] = unset, + disabled_by_handle: Union[str, UnsetType] = unset, + hash: Union[str, UnsetType] = unset, + modified_by: Union[int, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + org_id: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Client token object. Client tokens (also known as public API keys) enable you to submit + data from your browser or mobile applications to Datadog. + + :param created_at: Creation timestamp of the client token. + :type created_at: datetime, optional + + :param created_by_handle: Handle of the user who created the client token. + :type created_by_handle: str, optional + + :param created_by_uuid: UUID of the user who created the client token. + :type created_by_uuid: UUID, optional + + :param disabled_at: Timestamp when the client token was disabled. + :type disabled_at: datetime, none_type, optional + + :param disabled_by: ID of the user who disabled the client token. + :type disabled_by: int, optional + + :param disabled_by_handle: Handle of the user who disabled the client token. + :type disabled_by_handle: str, optional + + :param hash: The hash value of the client token. This is the secret token value that should be + used in your browser or mobile application. + :type hash: str, optional + + :param modified_by: ID of the user who last modified the client token. + :type modified_by: int, optional + + :param name: Name of the client token. + :type name: str, optional + + :param org_id: Organization ID associated with the client token. + :type org_id: int, optional + + :param origin_urls: List of allowed origin URLs for browser-based applications. Requests from URLs + not in this list will be rejected. + :type origin_urls: [str] + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if created_by_handle is not unset: + kwargs["created_by_handle"] = created_by_handle + if created_by_uuid is not unset: + kwargs["created_by_uuid"] = created_by_uuid + if disabled_at is not unset: + kwargs["disabled_at"] = disabled_at + if disabled_by is not unset: + kwargs["disabled_by"] = disabled_by + if disabled_by_handle is not unset: + kwargs["disabled_by_handle"] = disabled_by_handle + if hash is not unset: + kwargs["hash"] = hash + if modified_by is not unset: + kwargs["modified_by"] = modified_by + if name is not unset: + kwargs["name"] = name + if org_id is not unset: + kwargs["org_id"] = org_id + super().__init__(kwargs) + + self_.origin_urls = origin_urls diff --git a/src/datadog_api_client/v1/model/client_token_create_request.py b/src/datadog_api_client/v1/model/client_token_create_request.py new file mode 100644 index 0000000000..6e392a87fa --- /dev/null +++ b/src/datadog_api_client/v1/model/client_token_create_request.py @@ -0,0 +1,51 @@ +# 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, +) + + +class ClientTokenCreateRequest(ModelNormal): + validations = { + "name": { + "max_length": 255, + "min_length": 1, + }, + "origin_urls": { + "max_items": 100, + }, + } + + @cached_property + def openapi_types(_): + return { + "name": (str,), + "origin_urls": ([str],), + } + + attribute_map = { + "name": "name", + "origin_urls": "origin_urls", + } + + def __init__(self_, name: str, origin_urls: List[str], **kwargs): + """ + Request to create a new client token. + + :param name: Name of the client token. + :type name: str + + :param origin_urls: List of allowed origin URLs for browser-based applications. Requests from URLs + not in this list will be rejected. + :type origin_urls: [str] + """ + super().__init__(kwargs) + + self_.name = name + self_.origin_urls = origin_urls diff --git a/src/datadog_api_client/v1/model/client_token_revoke_request.py b/src/datadog_api_client/v1/model/client_token_revoke_request.py new file mode 100644 index 0000000000..9c444f6b22 --- /dev/null +++ b/src/datadog_api_client/v1/model/client_token_revoke_request.py @@ -0,0 +1,39 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class ClientTokenRevokeRequest(ModelNormal): + validations = { + "hash": { + "max_length": 35, + }, + } + + @cached_property + def openapi_types(_): + return { + "hash": (str,), + } + + attribute_map = { + "hash": "hash", + } + + def __init__(self_, hash: str, **kwargs): + """ + Request to revoke a client token. + + :param hash: Hash value of the client token to revoke. + :type hash: str + """ + super().__init__(kwargs) + + self_.hash = hash diff --git a/src/datadog_api_client/v1/model/client_token_update_request.py b/src/datadog_api_client/v1/model/client_token_update_request.py new file mode 100644 index 0000000000..8103aead7f --- /dev/null +++ b/src/datadog_api_client/v1/model/client_token_update_request.py @@ -0,0 +1,62 @@ +# 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 ClientTokenUpdateRequest(ModelNormal): + validations = { + "hash": { + "max_length": 35, + }, + "name": { + "max_length": 255, + "min_length": 1, + }, + "origin_urls": { + "max_items": 100, + }, + } + + @cached_property + def openapi_types(_): + return { + "hash": (str,), + "name": (str,), + "origin_urls": ([str],), + } + + attribute_map = { + "hash": "hash", + "name": "name", + "origin_urls": "origin_urls", + } + + def __init__(self_, hash: str, name: str, origin_urls: Union[List[str], UnsetType] = unset, **kwargs): + """ + Request to update an existing client token. + + :param hash: Hash value of the client token to update. + :type hash: str + + :param name: New name for the client token. + :type name: str + + :param origin_urls: New list of allowed origin URLs. If provided, this will replace the existing list. + :type origin_urls: [str], optional + """ + if origin_urls is not unset: + kwargs["origin_urls"] = origin_urls + super().__init__(kwargs) + + self_.hash = hash + self_.name = name diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 43893fead5..4688849b38 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -65,6 +65,10 @@ from datadog_api_client.v1.model.check_can_delete_slo_response_data import CheckCanDeleteSLOResponseData from datadog_api_client.v1.model.check_status_widget_definition import CheckStatusWidgetDefinition from datadog_api_client.v1.model.check_status_widget_definition_type import CheckStatusWidgetDefinitionType +from datadog_api_client.v1.model.client_token import ClientToken +from datadog_api_client.v1.model.client_token_create_request import ClientTokenCreateRequest +from datadog_api_client.v1.model.client_token_revoke_request import ClientTokenRevokeRequest +from datadog_api_client.v1.model.client_token_update_request import ClientTokenUpdateRequest from datadog_api_client.v1.model.content_encoding import ContentEncoding from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.dashboard import Dashboard @@ -1216,6 +1220,10 @@ "CheckCanDeleteSLOResponseData", "CheckStatusWidgetDefinition", "CheckStatusWidgetDefinitionType", + "ClientToken", + "ClientTokenCreateRequest", + "ClientTokenRevokeRequest", + "ClientTokenUpdateRequest", "ContentEncoding", "Creator", "Dashboard", 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..f24e1362ac 100644 --- a/src/datadog_api_client/v2/api/key_management_api.py +++ b/src/datadog_api_client/v2/api/key_management_api.py @@ -3,13 +3,14 @@ # 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 from datadog_api_client.model_utils import ( UnsetType, unset, + UUID, ) from datadog_api_client.v2.model.api_keys_response import APIKeysResponse from datadog_api_client.v2.model.api_keys_sort import APIKeysSort @@ -21,6 +22,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.personal_access_tokens_list_response import PersonalAccessTokensListResponse +from datadog_api_client.v2.model.personal_access_tokens_sort import PersonalAccessTokensSort +from datadog_api_client.v2.model.personal_access_token_response import PersonalAccessTokenResponse +from datadog_api_client.v2.model.personal_access_token_create_request import PersonalAccessTokenCreateRequest +from datadog_api_client.v2.model.personal_access_token_get_response import PersonalAccessTokenGetResponse +from datadog_api_client.v2.model.personal_access_token_update_request import PersonalAccessTokenUpdateRequest class KeyManagementApi: @@ -79,6 +86,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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 +254,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenGetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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": (UUID,), + "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 +453,72 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_personal_access_tokens_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokensListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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": ([UUID],), + "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", "AuthZ"], + "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": (UUID,), + "attribute": "pat_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._update_api_key_endpoint = _Endpoint( settings={ "response_type": (APIKeyResponse,), @@ -481,6 +597,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_personal_access_token_endpoint = _Endpoint( + settings={ + "response_type": (PersonalAccessTokenGetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "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": (UUID,), + "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 +655,24 @@ 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, + ) -> PersonalAccessTokenResponse: + """Create personal access token. + + Create a new personal access token with fine-grained permissions. The token value + will be returned in the response and cannot be retrieved later. Be sure to save it + securely. + + :type body: PersonalAccessTokenCreateRequest + :rtype: PersonalAccessTokenResponse + """ + 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 +790,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: UUID, + ) -> PersonalAccessTokenGetResponse: + """Get personal access token. + + Get a specific personal access token by UUID. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: UUID + :rtype: PersonalAccessTokenGetResponse + """ + 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 +1002,70 @@ 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[UUID], UnsetType] = unset, + ) -> PersonalAccessTokensListResponse: + """List personal access tokens. + + List all personal access tokens in your organization. Supports filtering, + pagination, and sorting. + + :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 name. + :type filter: str, optional + :param filter_owner_uuid: Filter personal access tokens by owner UUID. + :type filter_owner_uuid: [UUID], optional + :rtype: PersonalAccessTokensListResponse + """ + 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: UUID, + ) -> None: + """Revoke personal access token. + + Revoke a personal access token. Once revoked, the token can no longer be used + to authenticate API requests. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: UUID + :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 +1129,25 @@ 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: UUID, + body: PersonalAccessTokenUpdateRequest, + ) -> PersonalAccessTokenGetResponse: + """Update personal access token. + + Update the name and/or scopes of an existing personal access token. The ID in the + request body must match the UUID in the path. + + :param pat_uuid: The UUID of the personal access token. + :type pat_uuid: UUID + :type body: PersonalAccessTokenUpdateRequest + :rtype: PersonalAccessTokenGetResponse + """ + 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/model/full_personal_access_token.py b/src/datadog_api_client/v2/model/full_personal_access_token.py new file mode 100644 index 0000000000..71a4a883f0 --- /dev/null +++ b/src/datadog_api_client/v2/model/full_personal_access_token.py @@ -0,0 +1,72 @@ +# 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, + UUID, +) + + +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_token_type import PersonalAccessTokenType + + +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_token_type import PersonalAccessTokenType + + return { + "attributes": (FullPersonalAccessTokenAttributes,), + "id": (UUID,), + "relationships": (PersonalAccessTokenRelationships,), + "type": (PersonalAccessTokenType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: FullPersonalAccessTokenAttributes, + id: UUID, + relationships: PersonalAccessTokenRelationships, + type: PersonalAccessTokenType, + **kwargs, + ): + """ + Personal access token object with the secret key value. This is only + returned when creating a new token. + + :param attributes: Attributes of a personal access token including the secret key value. + This is only returned when creating a new token. + :type attributes: FullPersonalAccessTokenAttributes + + :param id: UUID of the personal access token. + :type id: UUID + + :param relationships: Resources related to the personal access token. + :type relationships: PersonalAccessTokenRelationships + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokenType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.relationships = relationships + self_.type = type 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..c0820980d8 --- /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, + none_type, + unset, + UnsetType, +) + + +class FullPersonalAccessTokenAttributes(ModelNormal): + validations = { + "name": { + "max_length": 256, + "min_length": 1, + }, + "scopes": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "expires_at": (datetime,), + "key": (str,), + "modified_at": (datetime, none_type), + "name": (str,), + "scopes": ([str],), + } + + attribute_map = { + "created_at": "created_at", + "expires_at": "expires_at", + "key": "key", + "modified_at": "modified_at", + "name": "name", + "scopes": "scopes", + } + read_only_vars = { + "created_at", + "key", + "modified_at", + } + + def __init__( + self_, + created_at: datetime, + expires_at: datetime, + key: str, + name: str, + scopes: List[str], + modified_at: Union[datetime, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a personal access token including the secret key value. + This is only returned when creating a new token. + + :param created_at: Creation timestamp of the personal access token. + :type created_at: datetime + + :param expires_at: Expiration timestamp of the personal access token. + :type expires_at: datetime + + :param key: The secret token value. This is only returned when creating a new personal + access token and cannot be retrieved later. + :type key: str + + :param modified_at: Last modification timestamp of the personal access token. + :type modified_at: datetime, none_type, optional + + :param name: Name of the personal access token. + :type name: str + + :param scopes: Array of scopes granted to the personal access token. These define what + permissions the token has. + :type scopes: [str] + """ + if modified_at is not unset: + kwargs["modified_at"] = modified_at + super().__init__(kwargs) + + self_.created_at = created_at + self_.expires_at = expires_at + self_.key = key + self_.name = name + self_.scopes = scopes 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..86338fd78a --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token.py @@ -0,0 +1,70 @@ +# 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, + UUID, +) + + +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_token_type import PersonalAccessTokenType + + +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_token_type import PersonalAccessTokenType + + return { + "attributes": (PersonalAccessTokenAttributes,), + "id": (UUID,), + "relationships": (PersonalAccessTokenRelationships,), + "type": (PersonalAccessTokenType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: PersonalAccessTokenAttributes, + id: UUID, + relationships: PersonalAccessTokenRelationships, + type: PersonalAccessTokenType, + **kwargs, + ): + """ + Personal access token object. + + :param attributes: Attributes of a personal access token. + :type attributes: PersonalAccessTokenAttributes + + :param id: UUID of the personal access token. + :type id: UUID + + :param relationships: Resources related to the personal access token. + :type relationships: PersonalAccessTokenRelationships + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokenType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.relationships = relationships + self_.type = type 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..6fe13ffcf6 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_attributes.py @@ -0,0 +1,86 @@ +# 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): + validations = { + "name": { + "max_length": 256, + "min_length": 1, + }, + "scopes": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "expires_at": (datetime,), + "modified_at": (datetime, none_type), + "name": (str,), + "scopes": ([str],), + } + + attribute_map = { + "created_at": "created_at", + "expires_at": "expires_at", + "modified_at": "modified_at", + "name": "name", + "scopes": "scopes", + } + read_only_vars = { + "created_at", + "modified_at", + } + + def __init__( + self_, + created_at: datetime, + expires_at: datetime, + name: str, + scopes: List[str], + modified_at: Union[datetime, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a personal access token. + + :param created_at: Creation timestamp of the personal access token. + :type created_at: datetime + + :param expires_at: Expiration timestamp of the personal access token. + :type expires_at: datetime + + :param modified_at: Last modification timestamp of the personal access token. + :type modified_at: datetime, none_type, optional + + :param name: Name of the personal access token. + :type name: str + + :param scopes: Array of scopes granted to the personal access token. These define what + permissions the token has. + :type scopes: [str] + """ + if modified_at is not unset: + kwargs["modified_at"] = modified_at + super().__init__(kwargs) + + self_.created_at = created_at + self_.expires_at = expires_at + self_.name = name + self_.scopes = scopes 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..b756071f4e --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_create_attributes.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 List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +class PersonalAccessTokenCreateAttributes(ModelNormal): + validations = { + "name": { + "max_length": 256, + "min_length": 1, + }, + "scopes": { + "min_items": 1, + }, + } + + @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 timestamp for the personal access token. + :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. These define what + permissions the token will have. + :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..a4573775d0 --- /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_token_type import PersonalAccessTokenType + + +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_token_type import PersonalAccessTokenType + + return { + "attributes": (PersonalAccessTokenCreateAttributes,), + "type": (PersonalAccessTokenType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: PersonalAccessTokenCreateAttributes, type: PersonalAccessTokenType, **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: PersonalAccessTokenType + """ + 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..73114a1332 --- /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 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_get_response.py b/src/datadog_api_client/v2/model/personal_access_token_get_response.py new file mode 100644 index 0000000000..3868bcbcbb --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_get_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 PersonalAccessTokenGetResponse(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: Personal access token object. + :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_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..647d254816 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_response.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 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 PersonalAccessTokenResponse(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. + + :param data: Personal access token object with the secret key value. This is only + returned when creating a new token. + :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_type.py b/src/datadog_api_client/v2/model/personal_access_token_type.py new file mode 100644 index 0000000000..a380c6fed5 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_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 PersonalAccessTokenType(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["PersonalAccessTokenType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PersonalAccessTokenType.PERSONAL_ACCESS_TOKENS = PersonalAccessTokenType("personal_access_tokens") 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..087d44bd7b --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_update_attributes.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 List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class PersonalAccessTokenUpdateAttributes(ModelNormal): + validations = { + "name": { + "max_length": 256, + "min_length": 1, + }, + "scopes": { + "min_items": 1, + }, + } + + @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: New name for the personal access token. + :type name: str, optional + + :param scopes: New array of scopes for the personal access token. If provided, this will + replace the existing scopes. + :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..21d2c2252a --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_token_update_data.py @@ -0,0 +1,59 @@ +# 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, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.personal_access_token_update_attributes import PersonalAccessTokenUpdateAttributes + from datadog_api_client.v2.model.personal_access_token_type import PersonalAccessTokenType + + +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_token_type import PersonalAccessTokenType + + return { + "attributes": (PersonalAccessTokenUpdateAttributes,), + "id": (UUID,), + "type": (PersonalAccessTokenType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: PersonalAccessTokenUpdateAttributes, id: UUID, type: PersonalAccessTokenType, **kwargs + ): + """ + Object used to update a personal access token. + + :param attributes: Attributes used to update a personal access token. + :type attributes: PersonalAccessTokenUpdateAttributes + + :param id: UUID of the personal access token. Must match the path parameter. + :type id: UUID + + :param type: Personal access tokens resource type. + :type type: PersonalAccessTokenType + """ + 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..4cc35515a6 --- /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 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_list_response.py b/src/datadog_api_client/v2/model/personal_access_tokens_list_response.py new file mode 100644 index 0000000000..3d04abc9d0 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_tokens_list_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_tokens_response_meta import PersonalAccessTokensResponseMeta + + +class PersonalAccessTokensListResponse(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_tokens_response_meta import PersonalAccessTokensResponseMeta + + return { + "data": ([PersonalAccessToken],), + "meta": (PersonalAccessTokensResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[PersonalAccessToken], UnsetType] = unset, + meta: Union[PersonalAccessTokensResponseMeta, 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 tokens response. + :type meta: PersonalAccessTokensResponseMeta, 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_tokens_response_meta.py b/src/datadog_api_client/v2/model/personal_access_tokens_response_meta.py new file mode 100644 index 0000000000..5638a6a7a6 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_tokens_response_meta.py @@ -0,0 +1,46 @@ +# 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_tokens_response_meta_page import ( + PersonalAccessTokensResponseMetaPage, + ) + + +class PersonalAccessTokensResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.personal_access_tokens_response_meta_page import ( + PersonalAccessTokensResponseMetaPage, + ) + + return { + "page": (PersonalAccessTokensResponseMetaPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: Union[PersonalAccessTokensResponseMetaPage, UnsetType] = unset, **kwargs): + """ + Additional information related to the personal access tokens response. + + :param page: Pagination information for personal access tokens response. + :type page: PersonalAccessTokensResponseMetaPage, optional + """ + if page is not unset: + kwargs["page"] = page + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/personal_access_tokens_response_meta_page.py b/src/datadog_api_client/v2/model/personal_access_tokens_response_meta_page.py new file mode 100644 index 0000000000..dcf4ba6e69 --- /dev/null +++ b/src/datadog_api_client/v2/model/personal_access_tokens_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 PersonalAccessTokensResponseMetaPage(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 for personal access tokens response. + + :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_tokens_sort.py b/src/datadog_api_client/v2/model/personal_access_tokens_sort.py new file mode 100644 index 0000000000..0905b7fd06 --- /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 for personal access tokens. + + :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/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index a84dbb2a08..3c93fb6b9b 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2060,6 +2060,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 @@ -4023,6 +4025,22 @@ 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_get_response import PersonalAccessTokenGetResponse +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_type import PersonalAccessTokenType +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_list_response import PersonalAccessTokensListResponse +from datadog_api_client.v2.model.personal_access_tokens_response_meta import PersonalAccessTokensResponseMeta +from datadog_api_client.v2.model.personal_access_tokens_response_meta_page import PersonalAccessTokensResponseMetaPage +from datadog_api_client.v2.model.personal_access_tokens_sort import PersonalAccessTokensSort 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 @@ -7517,6 +7535,8 @@ "FullApplicationKeyAttributes", "FullCustomFrameworkData", "FullCustomFrameworkDataAttributes", + "FullPersonalAccessToken", + "FullPersonalAccessTokenAttributes", "GCPCredentials", "GCPCredentialsUpdate", "GCPIntegration", @@ -8796,6 +8816,22 @@ "PermissionAttributes", "PermissionsResponse", "PermissionsType", + "PersonalAccessToken", + "PersonalAccessTokenAttributes", + "PersonalAccessTokenCreateAttributes", + "PersonalAccessTokenCreateData", + "PersonalAccessTokenCreateRequest", + "PersonalAccessTokenGetResponse", + "PersonalAccessTokenRelationships", + "PersonalAccessTokenResponse", + "PersonalAccessTokenType", + "PersonalAccessTokenUpdateAttributes", + "PersonalAccessTokenUpdateData", + "PersonalAccessTokenUpdateRequest", + "PersonalAccessTokensListResponse", + "PersonalAccessTokensResponseMeta", + "PersonalAccessTokensResponseMetaPage", + "PersonalAccessTokensSort", "Playlist", "PlaylistArray", "PlaylistData", diff --git a/tests/v1/features/key_management.feature b/tests/v1/features/key_management.feature index c3f18c2346..7013ea44fe 100644 --- a/tests/v1/features/key_management.feature +++ b/tests/v1/features/key_management.feature @@ -47,6 +47,22 @@ Feature: Key Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/credentials-management + Scenario: Create client token returns "Bad Request" response + Given operation "CreateClientToken" enabled + And new "CreateClientToken" request + And body with value {"name": "Example Client Token", "origin_urls": ["https://example.com"]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: Create client token returns "OK" response + Given operation "CreateClientToken" enabled + And new "CreateClientToken" request + And body with value {"name": "Example Client Token", "origin_urls": ["https://example.com"]} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/credentials-management Scenario: Delete an API key returns "Bad Request" response Given new "DeleteAPIKey" request @@ -177,3 +193,51 @@ Feature: Key Management And request contains "key" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke client token returns "Bad Request" response + Given operation "RevokeClientToken" enabled + And new "RevokeClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke client token returns "No Content" response + Given operation "RevokeClientToken" enabled + And new "RevokeClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123"} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke client token returns "Not Found" response + Given operation "RevokeClientToken" enabled + And new "RevokeClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123"} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/credentials-management + Scenario: Update client token returns "Bad Request" response + Given operation "UpdateClientToken" enabled + And new "UpdateClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123", "name": "Updated Client Token Name", "origin_urls": ["https://example.com"]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: Update client token returns "Not Found" response + Given operation "UpdateClientToken" enabled + And new "UpdateClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123", "name": "Updated Client Token Name", "origin_urls": ["https://example.com"]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/credentials-management + Scenario: Update client token returns "OK" response + Given operation "UpdateClientToken" enabled + And new "UpdateClientToken" request + And body with value {"hash": "1234567890abcdef1234567890abcdef123", "name": "Updated Client Token Name", "origin_urls": ["https://example.com"]} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v1/features/undo.json b/tests/v1/features/undo.json index 341ebe6c4e..edc3c5f6a1 100644 --- a/tests/v1/features/undo.json +++ b/tests/v1/features/undo.json @@ -939,6 +939,31 @@ "type": "safe" } }, + "RevokeClientToken": { + "tag": "Key Management", + "undo": { + "type": "idempotent" + } + }, + "CreateClientToken": { + "tag": "Key Management", + "undo": { + "operationId": "RevokeClientToken", + "parameters": [ + { + "name": "hash", + "source": "data.hash" + } + ], + "type": "unsafe" + } + }, + "UpdateClientToken": { + "tag": "Key Management", + "undo": { + "type": "idempotent" + } + }, "QueryMetrics": { "tag": "Metrics", "undo": { diff --git a/tests/v2/features/key_management.feature b/tests/v2/features/key_management.feature index 40daf9df54..5adb2ecc95 100644 --- a/tests/v2/features/key_management.feature +++ b/tests/v2/features/key_management.feature @@ -53,6 +53,30 @@ Feature: Key Management And the response "data.type" is equal to "application_keys" And the response "data.attributes.name" is equal to "{{ unique }}" + @generated @skip @team:DataDog/credentials-management + Scenario: Create personal access token returns "Bad Request" response + Given operation "CreatePersonalAccessToken" enabled + And new "CreatePersonalAccessToken" request + And body with value {"data": {"attributes": {"expires_at": "2025-03-15T10:30:00.000000+00:00", "name": "Example Personal Access Token", "scopes": ["dashboards_read", "monitors_read"]}, "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 personal access token returns "Not Found - Personal access tokens feature is not enabled" response + Given operation "CreatePersonalAccessToken" enabled + And new "CreatePersonalAccessToken" request + And body with value {"data": {"attributes": {"expires_at": "2025-03-15T10:30:00.000000+00:00", "name": "Example Personal Access Token", "scopes": ["dashboards_read", "monitors_read"]}, "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 404 Not Found - Personal access tokens feature is not enabled + + @generated @skip @team:DataDog/credentials-management + Scenario: Create personal access token returns "OK" response + Given operation "CreatePersonalAccessToken" enabled + And new "CreatePersonalAccessToken" request + And body with value {"data": {"attributes": {"expires_at": "2025-03-15T10:30:00.000000+00:00", "name": "Example Personal Access Token", "scopes": ["dashboards_read", "monitors_read"]}, "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/credentials-management Scenario: Delete an API key returns "No Content" response Given there is a valid "api_key" in the system @@ -301,3 +325,83 @@ 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: Get personal access token returns "Not Found" response + Given operation "GetPersonalAccessToken" enabled + And 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 personal access token returns "OK" response + Given operation "GetPersonalAccessToken" enabled + And 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: List personal access tokens returns "Bad Request" response + Given operation "ListPersonalAccessTokens" enabled + And new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/credentials-management + Scenario: List personal access tokens returns "Not Found - Personal access tokens feature is not enabled" response + Given operation "ListPersonalAccessTokens" enabled + And new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 404 Not Found - Personal access tokens feature is not enabled + + @generated @skip @team:DataDog/credentials-management + Scenario: List personal access tokens returns "OK" response + Given operation "ListPersonalAccessTokens" enabled + And new "ListPersonalAccessTokens" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/credentials-management + Scenario: Revoke personal access token returns "No Content" response + Given operation "RevokePersonalAccessToken" enabled + And 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 personal access token returns "Not Found" response + Given operation "RevokePersonalAccessToken" enabled + And 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 personal access token returns "Bad Request" response + Given operation "UpdatePersonalAccessToken" enabled + And new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token Name", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00000000-0000-0000-0000-000000000000", "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 personal access token returns "Not Found" response + Given operation "UpdatePersonalAccessToken" enabled + And new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token Name", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00000000-0000-0000-0000-000000000000", "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 personal access token returns "OK" response + Given operation "UpdatePersonalAccessToken" enabled + And new "UpdatePersonalAccessToken" request + And request contains "pat_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Updated Personal Access Token Name", "scopes": ["dashboards_read", "dashboards_write"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "personal_access_tokens"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index c77dfee335..4828520126 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3424,6 +3424,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": {