diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 65d674fb23d..6424cf71884 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1968,6 +1968,64 @@ components: type: string requestBodies: {} responses: + AmsIntegrationAccountSchemaBadRequestResponse: + content: + application/json: + examples: + invalid_integration_name: + summary: Invalid integration name format + value: + errors: + - detail: Invalid integration name format + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The integration name format is invalid." + AmsIntegrationAccountSchemaForbiddenResponse: + content: + application/json: + examples: + integration_not_allowed: + summary: Integration not allowed + value: + errors: + - detail: "The API is currently disabled for this integration" + status: "403" + title: Integration Not Allowed + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access." + AmsIntegrationAccountSchemaNotFoundResponse: + content: + application/json: + examples: + schema_not_found: + summary: Schema not found for integration + value: + errors: + - detail: "Schema not found for integration: twilio" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration does not exist or has no schema available." + AmsIntegrationAccountSchemaTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after the rate limit window expires." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 12000 requests per organization every 60 seconds. BadRequestResponse: content: "application/json": @@ -2100,6 +2158,324 @@ components: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: The server cannot process the request because it contains invalid data. + WebIntegrationCreateAccountBadRequestResponse: + content: + application/json: + examples: + invalid_request: + summary: Invalid request body + value: + errors: + - detail: "Invalid request body: missing required field 'name'" + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The request body is malformed or the integration name format is invalid." + WebIntegrationCreateAccountForbiddenResponse: + content: + application/json: + examples: + permission_denied: + summary: Permission denied + value: + errors: + - detail: "User does not have permission to manage integrations" + status: "403" + title: Forbidden + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access or the user lacks permissions to manage integrations." + WebIntegrationCreateAccountNotFoundResponse: + content: + application/json: + examples: + integration_not_found: + summary: Integration not found + value: + errors: + - detail: "Integration not found: unknown_integration" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration does not exist." + WebIntegrationCreateAccountTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after 20 seconds." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 50 requests per user every 20 seconds. + WebIntegrationCreateAccountUnprocessableEntityResponse: + content: + application/json: + examples: + validation_failed: + summary: Validation failed + value: + errors: + - detail: "settings.account_sid is required" + status: "422" + title: Unprocessable Entity + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Unprocessable Entity: The account configuration does not match the integration schema." + WebIntegrationDeleteAccountBadRequestResponse: + content: + application/json: + examples: + invalid_account_id: + summary: Invalid account ID format + value: + errors: + - detail: "Invalid account ID format" + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The integration name or account ID format is invalid." + WebIntegrationDeleteAccountForbiddenResponse: + content: + application/json: + examples: + permission_denied: + summary: Permission denied + value: + errors: + - detail: "User does not have permission to delete this account" + status: "403" + title: Forbidden + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access or the user lacks permissions to manage this account." + WebIntegrationDeleteAccountNotFoundResponse: + content: + application/json: + examples: + account_not_found: + summary: Account not found + value: + errors: + - detail: "Account not found: abc123def456" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration or account does not exist." + WebIntegrationDeleteAccountTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after 20 seconds." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 50 requests per user every 20 seconds. + WebIntegrationGetAccountBadRequestResponse: + content: + application/json: + examples: + invalid_account_id: + summary: Invalid account ID format + value: + errors: + - detail: "Invalid account ID format" + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The integration name or account ID format is invalid." + WebIntegrationGetAccountForbiddenResponse: + content: + application/json: + examples: + permission_denied: + summary: Permission denied + value: + errors: + - detail: "User does not have permission to access this account" + status: "403" + title: Forbidden + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access or the user lacks required permissions." + WebIntegrationGetAccountNotFoundResponse: + content: + application/json: + examples: + account_not_found: + summary: Account not found + value: + errors: + - detail: "Account not found: abc123def456" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration or account does not exist." + WebIntegrationGetAccountTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after 60 seconds." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 12000 requests per organization every 60 seconds. + WebIntegrationListAccountsBadRequestResponse: + content: + application/json: + examples: + invalid_integration_name: + summary: Invalid integration name format + value: + errors: + - detail: Invalid integration name format + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The integration name format is invalid." + WebIntegrationListAccountsForbiddenResponse: + content: + application/json: + examples: + integration_not_allowed: + summary: Integration not allowed + value: + errors: + - detail: "The API is currently disabled for this integration" + status: "403" + title: Forbidden + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access or the user lacks required permissions." + WebIntegrationListAccountsNotFoundResponse: + content: + application/json: + examples: + integration_not_found: + summary: Integration not found + value: + errors: + - detail: "Integration not found: unknown_integration" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration does not exist." + WebIntegrationListAccountsTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after 20 seconds." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 50 requests per user every 20 seconds. + WebIntegrationUpdateAccountBadRequestResponse: + content: + application/json: + examples: + invalid_request: + summary: Invalid request body + value: + errors: + - detail: "Invalid request body format" + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Bad Request: The request body is malformed or the integration name/account ID format is invalid." + WebIntegrationUpdateAccountForbiddenResponse: + content: + application/json: + examples: + permission_denied: + summary: Permission denied + value: + errors: + - detail: "User does not have permission to update this account" + status: "403" + title: Forbidden + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Forbidden: The integration is not enabled for API access or the user lacks permissions to manage this account." + WebIntegrationUpdateAccountNotFoundResponse: + content: + application/json: + examples: + account_not_found: + summary: Account not found + value: + errors: + - detail: "Account not found: abc123def456" + status: "404" + title: Not Found + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Not Found: The integration or account does not exist." + WebIntegrationUpdateAccountTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: "Rate limit exceeded. Please retry after 20 seconds." + status: "429" + title: Too Many Requests + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: |- + Too Many Requests: Rate limit exceeded. + This endpoint has a rate limit of 50 requests per user every 20 seconds. + WebIntegrationUpdateAccountUnprocessableEntityResponse: + content: + application/json: + examples: + validation_failed: + summary: Validation failed + value: + errors: + - detail: "settings.api_key must be at least 32 characters" + status: "422" + title: Unprocessable Entity + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: "Unprocessable Entity: The account configuration does not match the integration schema." schemas: APIErrorResponse: description: API error response. @@ -6394,6 +6770,370 @@ components: x-enum-varnames: - FEATURE_GATE - CANARY + AmsIntegrationAccountAttributes: + description: Attributes for a web integration account. + properties: + name: + description: The name of the account. + example: "My Production Account" + type: string + settings: + additionalProperties: {} + description: |- + Integration-specific settings for the account. The structure and required fields vary by integration type. + Use the schema endpoint to retrieve the specific requirements for each integration. + example: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + alerts: false + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + call_summaries: true + ccm_enabled: true + censor_logs: true + events: true + messages: true + type: object + required: + - name + - settings + type: object + AmsIntegrationAccountCreateRequest: + description: Payload for creating a web integration account. + properties: + data: + $ref: "#/components/schemas/AmsIntegrationAccountCreateRequestData" + required: + - data + type: object + AmsIntegrationAccountCreateRequestAttributes: + description: Attributes for creating a web integration account. + properties: + name: + description: The name of the account. + example: "My Production Account" + type: string + secrets: + additionalProperties: {} + description: |- + Sensitive credentials for the account. The structure and required fields vary by integration type. + These values are write-only and never returned in responses. + example: + api_key_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + type: object + settings: + additionalProperties: {} + description: |- + Integration-specific settings for the account. The structure and required fields vary by integration type. + Use the schema endpoint (GET /api/v2/integrations/{integration_name}/accounts/schema) to retrieve + the specific requirements for your integration before creating an account. + example: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + alerts: true + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + call_summaries: true + ccm_enabled: true + censor_logs: true + events: true + messages: true + type: object + required: + - name + - settings + - secrets + type: object + AmsIntegrationAccountCreateRequestData: + description: Data object for creating a web integration account. + properties: + attributes: + $ref: "#/components/schemas/AmsIntegrationAccountCreateRequestAttributes" + type: + $ref: "#/components/schemas/AmsIntegrationAccountType" + required: + - type + - attributes + type: object + AmsIntegrationAccountResponse: + description: Response containing a single web integration account. + properties: + data: + $ref: "#/components/schemas/AmsIntegrationAccountResponseData" + integration_name: + description: The name of the integration. + example: "twilio" + type: string + type: object + AmsIntegrationAccountResponseData: + description: Data object for a web integration account response. + properties: + attributes: + $ref: "#/components/schemas/AmsIntegrationAccountAttributes" + id: + description: The unique identifier for the account. + example: "abc123def456" + type: string + type: + $ref: "#/components/schemas/AmsIntegrationAccountType" + required: + - id + - type + - attributes + type: object + AmsIntegrationAccountSchemaResponse: + description: |- + Response containing the JSON schema for an integration's account configuration. + This schema defines the required and optional fields for both settings and secrets, + including field types, validation rules, and descriptions. + + The response is a standard [JSON Schema (draft-07)](https://json-schema.org/draft-07/schema#) document describing the account + configuration structure. Because this is a dynamic JSON Schema, the exact properties vary by integration. + example: + properties: + secrets: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseExampleSecrets" + settings: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseExampleSettings" + required: + - settings + - secrets + type: "object" + properties: + additionalProperties: + description: Whether additional properties are allowed at the root level (typically false). + example: false + type: boolean + properties: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseProperties" + required: + description: List of required top-level properties. + example: ["settings", "secrets"] + items: + type: string + type: array + type: + description: The root type of the schema (always "object"). + example: "object" + type: string + required: + - type + - properties + - required + type: object + AmsIntegrationAccountSchemaResponseExampleSecrets: + additionalProperties: false + description: Example secrets object for a Twilio integration account schema response. + properties: + api_key_token: + description: "The Twilio API Key Secret corresponding to the API Key SID." + example: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + minLength: 1 + type: "string" + required: + - api_key_token + type: "object" + AmsIntegrationAccountSchemaResponseExampleSettings: + additionalProperties: false + description: Example settings object for a Twilio integration account schema response. + properties: + account_sid: + description: "Twilio Account SID that uniquely identifies your Twilio account, found in your account info in the Twilio console." + example: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + minLength: 1 + type: "string" + alerts: + default: false + description: "Enable collection of Twilio Alert logs to monitor account alerts and notifications." + type: "boolean" + api_key: + description: "Twilio API Key SID for authentication. Create this API key in the Twilio console." + example: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + minLength: 1 + type: "string" + call_summaries: + default: false + description: "Enable collection of Twilio Voice call summaries to track voice call performance and metadata." + type: "boolean" + ccm_enabled: + default: false + description: "Enable Cloud Cost Management to monitor Twilio usage costs and identify optimization opportunities." + type: "boolean" + censor_logs: + default: false + description: "Enable censoring of sensitive data in logs. When true, phone numbers and SMS message bodies are censored for privacy." + type: "boolean" + events: + default: false + description: "Enable collection of Twilio Event logs to monitor account-level events and activities." + type: "boolean" + messages: + default: false + description: "Enable collection of Twilio Message logs to track SMS and messaging activity." + type: "boolean" + required: + - api_key + - account_sid + type: "object" + AmsIntegrationAccountSchemaResponseProperties: + description: |- + The properties object containing settings and secrets schema definitions. + Both are always present in every integration schema, but the fields within each + vary depending on the specific integration. + properties: + secrets: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseSecretsObject" + settings: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseSettingsObject" + required: + - settings + - secrets + type: object + AmsIntegrationAccountSchemaResponseSecretsObject: + description: |- + JSON Schema definition for the secrets object. + Contains sensitive credentials required for the integration such as API keys, + tokens, and passwords. These values are write-only and never returned in responses. + properties: + additionalProperties: + description: Whether additional properties are allowed (typically false). + example: false + type: boolean + properties: + additionalProperties: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseSettingsField" + description: |- + The individual secret fields for this integration. + Field names and types vary by integration. + type: object + required: + description: List of required secret field names. + items: + type: string + type: array + type: + description: Always "object" for the secrets container. + example: "object" + type: string + type: object + AmsIntegrationAccountSchemaResponseSettingsField: + description: |- + JSON Schema definition for a single field within settings or secrets. + The exact fields vary by integration. + properties: + additionalProperties: + description: Whether additional properties are allowed for this field. + example: false + type: boolean + default: + description: Default value for the field if not provided. + description: + description: Human-readable description of the field's purpose. + example: "API key for authentication" + type: string + items: + description: Schema for array items when type is "array". + type: object + minLength: + description: Minimum length for string fields. + example: 1 + format: int64 + type: integer + type: + description: The data type of the field (string, boolean, integer, array, object). + example: "string" + type: string + type: object + AmsIntegrationAccountSchemaResponseSettingsObject: + description: |- + JSON Schema definition for the settings object. + Contains integration-specific configuration fields such as account identifiers, + feature toggles, and non-sensitive configuration options. + properties: + additionalProperties: + description: Whether additional properties are allowed (typically false). + example: false + type: boolean + properties: + additionalProperties: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponseSettingsField" + description: |- + The individual setting fields for this integration. + Field names and types vary by integration. + type: object + required: + description: List of required setting field names. + items: + type: string + type: array + type: + description: Always "object" for the settings container. + example: "object" + type: string + type: object + AmsIntegrationAccountType: + default: Account + description: The JSON:API type for web integration accounts. + enum: + - Account + example: Account + type: string + x-enum-varnames: + - ACCOUNT + AmsIntegrationAccountUpdateRequest: + description: Payload for updating a web integration account. + properties: + data: + $ref: "#/components/schemas/AmsIntegrationAccountUpdateRequestData" + required: + - data + type: object + AmsIntegrationAccountUpdateRequestAttributes: + description: |- + Attributes for updating a web integration account. All fields are optional; + only provide the fields you want to update. + properties: + name: + description: The name of the account. + example: "My Production Account (Updated)" + type: string + secrets: + additionalProperties: {} + description: |- + Sensitive credentials to update. Only the secrets provided are updated. + These values are write-only and never returned in responses. + example: + api_key_token: "new_secret_token_value" + type: object + settings: + additionalProperties: {} + description: |- + Integration-specific settings to update. Only the fields provided are updated. + The structure varies by integration type. See the integration's schema for available fields. + example: + ccm_enabled: true + events: true + messages: false + type: object + type: object + AmsIntegrationAccountUpdateRequestData: + description: Data object for updating a web integration account. + properties: + attributes: + $ref: "#/components/schemas/AmsIntegrationAccountUpdateRequestAttributes" + type: + $ref: "#/components/schemas/AmsIntegrationAccountType" + required: + - type + type: object + AmsIntegrationAccountsResponse: + description: Response containing a list of web integration accounts. + properties: + data: + items: + $ref: "#/components/schemas/AmsIntegrationAccountResponseData" + type: array + integration_name: + description: The name of the integration. + example: "twilio" + type: string + type: object AnalysisEdit: description: A single edit operation within a fix suggestion for a rule violation. properties: @@ -77612,6 +78352,48 @@ components: page: $ref: "#/components/schemas/Pagination" type: object + ResponseSchema: + additionalProperties: false + description: Example JSON Schema document for an integration account configuration. + properties: + secrets: + $ref: "#/components/schemas/ResponseSchema139714313396896" + settings: + $ref: "#/components/schemas/ResponseSchema139714313396096" + required: + - settings + - secrets + type: "object" + ResponseSchema139714313396096: + additionalProperties: false + description: Example settings schema for an integration account configuration. + properties: + account_sid: + description: Twilio Account SID that uniquely identifies the Twilio account. + example: L + minLength: 1 + type: "string" + api_key: + description: Twilio API Key SID for authentication. + example: L + minLength: 1 + type: "string" + required: + - api_key + - account_sid + type: "object" + ResponseSchema139714313396896: + additionalProperties: false + description: Example secrets schema for an integration account configuration. + properties: + api_key_token: + description: The Twilio API Key Secret corresponding to the API Key SID. + example: L + minLength: 1 + type: "string" + required: + - api_key_token + type: "object" RestrictionPolicy: description: Restriction policy object. properties: @@ -143102,6 +143884,388 @@ paths: operator: OR permissions: - manage_integrations + /api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts: + get: + description: |- + Retrieve all configured accounts for a specific integration within your organization. + + Rate limit: 50 requests per user every 20 seconds. + operationId: ListAmsIntegrationAccounts + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + name: "My Production Account" + settings: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + id: "abc123def456" + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountsResponse" + description: "OK: List of all accounts for the specified integration." + "400": + $ref: "#/components/responses/WebIntegrationListAccountsBadRequestResponse" + "403": + $ref: "#/components/responses/WebIntegrationListAccountsForbiddenResponse" + "404": + $ref: "#/components/responses/WebIntegrationListAccountsNotFoundResponse" + "429": + $ref: "#/components/responses/WebIntegrationListAccountsTooManyRequestsResponse" + summary: List integration accounts + tags: + - Integration Accounts + x-permission: + operator: OR + permissions: + - integrations_read + post: + description: |- + Create a new account for a specific integration. The account configuration must conform + to the schema defined for the integration, which can be retrieved using the schema endpoint. + + Rate limit: 50 requests per user every 20 seconds. + operationId: CreateAmsIntegrationAccount + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "My Production Account" + secrets: + api_key_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + settings: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + alerts: true + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + call_summaries: true + ccm_enabled: true + censor_logs: true + events: true + messages: true + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "My Production Account" + settings: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + id: "abc123def456" + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountResponse" + description: "Created: The account was successfully created." + "400": + $ref: "#/components/responses/WebIntegrationCreateAccountBadRequestResponse" + "403": + $ref: "#/components/responses/WebIntegrationCreateAccountForbiddenResponse" + "404": + $ref: "#/components/responses/WebIntegrationCreateAccountNotFoundResponse" + "422": + $ref: "#/components/responses/WebIntegrationCreateAccountUnprocessableEntityResponse" + "429": + $ref: "#/components/responses/WebIntegrationCreateAccountTooManyRequestsResponse" + summary: Create integration account + tags: + - Integration Accounts + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations + /api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/schema: + get: + description: |- + Get the JSON schema that defines the structure and validation rules for account configuration + of a specific integration. This schema describes the required and optional fields for both + **settings** and **secrets** when creating or updating an account. + + The schema structure varies between integrations, so always retrieve the schema for your + specific integration before creating or updating accounts. + + Rate limit: 12000 requests per organization every 60 seconds. + operationId: GetAmsIntegrationAccountSchema + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + $ref: "#/components/schemas/ResponseSchema" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountSchemaResponse" + description: "OK: The JSON schema for the integration's account configuration." + "400": + $ref: "#/components/responses/AmsIntegrationAccountSchemaBadRequestResponse" + "403": + $ref: "#/components/responses/AmsIntegrationAccountSchemaForbiddenResponse" + "404": + $ref: "#/components/responses/AmsIntegrationAccountSchemaNotFoundResponse" + "429": + $ref: "#/components/responses/AmsIntegrationAccountSchemaTooManyRequestsResponse" + summary: Get account schema for an integration + tags: + - Integration Accounts + x-permission: + operator: OR + permissions: + - integrations_read + /api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/{account_id}: + delete: + description: |- + Delete a specific account by its ID for a given integration. This removes the + account configuration and stops any data collection associated with it. + + Rate limit: 50 requests per user every 20 seconds. + operationId: DeleteAmsIntegrationAccount + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + - description: The unique identifier of the account. + example: "abc123def456" + in: path + name: account_id + required: true + schema: + type: string + responses: + "200": + description: "OK: The account was successfully deleted." + "400": + $ref: "#/components/responses/WebIntegrationDeleteAccountBadRequestResponse" + "403": + $ref: "#/components/responses/WebIntegrationDeleteAccountForbiddenResponse" + "404": + $ref: "#/components/responses/WebIntegrationDeleteAccountNotFoundResponse" + "429": + $ref: "#/components/responses/WebIntegrationDeleteAccountTooManyRequestsResponse" + summary: Delete integration account + tags: + - Integration Accounts + x-permission: + operator: OR + permissions: + - manage_integrations + get: + description: |- + Retrieve a specific account by its ID for a given integration. The response includes + the account name and settings, but excludes sensitive secret values. + + Rate limit: 12000 requests per organization every 60 seconds. + operationId: GetAmsIntegrationAccount + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + - description: The unique identifier of the account. + example: "abc123def456" + in: path + name: account_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "My Production Account" + settings: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + id: "abc123def456" + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountResponse" + description: "OK: The account details for the specified integration." + "400": + $ref: "#/components/responses/WebIntegrationGetAccountBadRequestResponse" + "403": + $ref: "#/components/responses/WebIntegrationGetAccountForbiddenResponse" + "404": + $ref: "#/components/responses/WebIntegrationGetAccountNotFoundResponse" + "429": + $ref: "#/components/responses/WebIntegrationGetAccountTooManyRequestsResponse" + summary: Get integration account + tags: + - Integration Accounts + x-permission: + operator: OR + permissions: + - integrations_read + patch: + description: |- + Update an existing account for a specific integration. You can update the name, settings, + and secrets. Only the fields provided in the request are updated. + + Rate limit: 50 requests per user every 20 seconds. + operationId: UpdateAmsIntegrationAccount + parameters: + - description: The name of the integration. + example: "twilio" + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the interface. + example: "twilio.messaging" + in: path + name: interface_id + required: true + schema: + type: string + - description: The unique identifier of the account. + example: "abc123def456" + in: path + name: account_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "My Production Account (Updated)" + settings: + ccm_enabled: true + events: true + messages: false + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "My Production Account (Updated)" + settings: + account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + api_key: "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + id: "abc123def456" + type: "Account" + schema: + $ref: "#/components/schemas/AmsIntegrationAccountResponse" + description: "OK: The account was successfully updated." + "400": + $ref: "#/components/responses/WebIntegrationUpdateAccountBadRequestResponse" + "403": + $ref: "#/components/responses/WebIntegrationUpdateAccountForbiddenResponse" + "404": + $ref: "#/components/responses/WebIntegrationUpdateAccountNotFoundResponse" + "422": + $ref: "#/components/responses/WebIntegrationUpdateAccountUnprocessableEntityResponse" + "429": + $ref: "#/components/responses/WebIntegrationUpdateAccountTooManyRequestsResponse" + summary: Update integration account + tags: + - Integration Accounts + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations /api/v2/ip_allowlist: get: description: Returns the IP allowlist and its enabled or disabled state. @@ -193632,6 +194796,24 @@ tags: name: IP Allowlist - description: Manage incident response, as well as associated attachments, metadata, and todos. See the [Incident Management page](https://docs.datadoghq.com/service_management/incident_management/) for more information. name: Incidents + - description: |- + Configure and manage third-party integrations with Datadog. This API provides a unified + interface for managing integration accounts across various external services. + + Each integration has its own unique schema that defines the required settings and secrets. + Before creating or updating an account, use the schema endpoint to retrieve the specific + requirements, field types, validation rules, and available configuration options for your + integration. + + **Note**: This API manages integration account configurations only. It does not support + Grace Resources, Reference Tables, or Custom Queries CRUD operations. For those features, + refer to each integration's dedicated documentation. + + Supported Integrations: + - [Twilio](https://docs.datadoghq.com/integrations/twilio/) + - [Snowflake](https://docs.datadoghq.com/integrations/snowflake-web/) + - [Databricks](https://docs.datadoghq.com/integrations/databricks/) + name: Integration Accounts - description: |- The Integrations API is used to list available integrations and retrieve information about their installation status. diff --git a/api/datadogV2/api_integration_accounts.go b/api/datadogV2/api_integration_accounts.go new file mode 100644 index 00000000000..f53a2693c29 --- /dev/null +++ b/api/datadogV2/api_integration_accounts.go @@ -0,0 +1,517 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationAccountsApi service type +type IntegrationAccountsApi datadog.Service + +// CreateAmsIntegrationAccount Create integration account. +// Create a new account for a specific integration. The account configuration must conform +// to the schema defined for the integration, which can be retrieved using the schema endpoint. +// +// Rate limit: 50 requests per user every 20 seconds. +func (a *IntegrationAccountsApi) CreateAmsIntegrationAccount(ctx _context.Context, integrationName string, interfaceId string, body AmsIntegrationAccountCreateRequest) (AmsIntegrationAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AmsIntegrationAccountResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.CreateAmsIntegrationAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// DeleteAmsIntegrationAccount Delete integration account. +// Delete a specific account by its ID for a given integration. This removes the +// account configuration and stops any data collection associated with it. +// +// Rate limit: 50 requests per user every 20 seconds. +func (a *IntegrationAccountsApi) DeleteAmsIntegrationAccount(ctx _context.Context, integrationName string, interfaceId string, accountId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.DeleteAmsIntegrationAccount") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/{account_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{account_id}", _neturl.PathEscape(datadog.ParameterToString(accountId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetAmsIntegrationAccount Get integration account. +// Retrieve a specific account by its ID for a given integration. The response includes +// the account name and settings, but excludes sensitive secret values. +// +// Rate limit: 12000 requests per organization every 60 seconds. +func (a *IntegrationAccountsApi) GetAmsIntegrationAccount(ctx _context.Context, integrationName string, interfaceId string, accountId string) (AmsIntegrationAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AmsIntegrationAccountResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.GetAmsIntegrationAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/{account_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{account_id}", _neturl.PathEscape(datadog.ParameterToString(accountId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetAmsIntegrationAccountSchema Get account schema for an integration. +// Get the JSON schema that defines the structure and validation rules for account configuration +// of a specific integration. This schema describes the required and optional fields for both +// **settings** and **secrets** when creating or updating an account. +// +// The schema structure varies between integrations, so always retrieve the schema for your +// specific integration before creating or updating accounts. +// +// Rate limit: 12000 requests per organization every 60 seconds. +func (a *IntegrationAccountsApi) GetAmsIntegrationAccountSchema(ctx _context.Context, integrationName string, interfaceId string) (AmsIntegrationAccountSchemaResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AmsIntegrationAccountSchemaResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.GetAmsIntegrationAccountSchema") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/schema" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListAmsIntegrationAccounts List integration accounts. +// Retrieve all configured accounts for a specific integration within your organization. +// +// Rate limit: 50 requests per user every 20 seconds. +func (a *IntegrationAccountsApi) ListAmsIntegrationAccounts(ctx _context.Context, integrationName string, interfaceId string) (AmsIntegrationAccountsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AmsIntegrationAccountsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.ListAmsIntegrationAccounts") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateAmsIntegrationAccount Update integration account. +// Update an existing account for a specific integration. You can update the name, settings, +// and secrets. Only the fields provided in the request are updated. +// +// Rate limit: 50 requests per user every 20 seconds. +func (a *IntegrationAccountsApi) UpdateAmsIntegrationAccount(ctx _context.Context, integrationName string, interfaceId string, accountId string, body AmsIntegrationAccountUpdateRequest) (AmsIntegrationAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue AmsIntegrationAccountResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IntegrationAccountsApi.UpdateAmsIntegrationAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integrations/{integration_name}/interfaces/{interface_id}/accounts/{account_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_name}", _neturl.PathEscape(datadog.ParameterToString(integrationName, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{interface_id}", _neturl.PathEscape(datadog.ParameterToString(interfaceId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{account_id}", _neturl.PathEscape(datadog.ParameterToString(accountId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewIntegrationAccountsApi Returns NewIntegrationAccountsApi. +func NewIntegrationAccountsApi(client *datadog.APIClient) *IntegrationAccountsApi { + return &IntegrationAccountsApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index e213571ce71..6129008e282 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -542,6 +542,12 @@ // - [IncidentsApi.UpdateIncidentTodo] // - [IncidentsApi.UpdateIncidentType] // - [IncidentsApi.UpdateIncidentUserDefinedField] +// - [IntegrationAccountsApi.CreateAmsIntegrationAccount] +// - [IntegrationAccountsApi.DeleteAmsIntegrationAccount] +// - [IntegrationAccountsApi.GetAmsIntegrationAccount] +// - [IntegrationAccountsApi.GetAmsIntegrationAccountSchema] +// - [IntegrationAccountsApi.ListAmsIntegrationAccounts] +// - [IntegrationAccountsApi.UpdateAmsIntegrationAccount] // - [IntegrationsApi.ListIntegrations] // - [JiraIntegrationApi.CreateJiraIssueTemplate] // - [JiraIntegrationApi.DeleteJiraAccount] diff --git a/api/datadogV2/model_ams_integration_account_attributes.go b/api/datadogV2/model_ams_integration_account_attributes.go new file mode 100644 index 00000000000..7a7a581e71c --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_attributes.go @@ -0,0 +1,134 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountAttributes Attributes for a web integration account. +type AmsIntegrationAccountAttributes struct { + // The name of the account. + Name string `json:"name"` + // Integration-specific settings for the account. The structure and required fields vary by integration type. + // Use the schema endpoint to retrieve the specific requirements for each integration. + Settings map[string]interface{} `json:"settings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountAttributes instantiates a new AmsIntegrationAccountAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountAttributes(name string, settings map[string]interface{}) *AmsIntegrationAccountAttributes { + this := AmsIntegrationAccountAttributes{} + this.Name = name + this.Settings = settings + return &this +} + +// NewAmsIntegrationAccountAttributesWithDefaults instantiates a new AmsIntegrationAccountAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountAttributesWithDefaults() *AmsIntegrationAccountAttributes { + this := AmsIntegrationAccountAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *AmsIntegrationAccountAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *AmsIntegrationAccountAttributes) SetName(v string) { + o.Name = v +} + +// GetSettings returns the Settings field value. +func (o *AmsIntegrationAccountAttributes) GetSettings() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountAttributes) GetSettingsOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value. +func (o *AmsIntegrationAccountAttributes) SetSettings(v map[string]interface{}) { + o.Settings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["settings"] = o.Settings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Settings *map[string]interface{} `json:"settings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Settings == nil { + return fmt.Errorf("required field settings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "settings"}) + } else { + return err + } + o.Name = *all.Name + o.Settings = *all.Settings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_create_request.go b/api/datadogV2/model_ams_integration_account_create_request.go new file mode 100644 index 00000000000..68696c86d62 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountCreateRequest Payload for creating a web integration account. +type AmsIntegrationAccountCreateRequest struct { + // Data object for creating a web integration account. + Data AmsIntegrationAccountCreateRequestData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountCreateRequest instantiates a new AmsIntegrationAccountCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountCreateRequest(data AmsIntegrationAccountCreateRequestData) *AmsIntegrationAccountCreateRequest { + this := AmsIntegrationAccountCreateRequest{} + this.Data = data + return &this +} + +// NewAmsIntegrationAccountCreateRequestWithDefaults instantiates a new AmsIntegrationAccountCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountCreateRequestWithDefaults() *AmsIntegrationAccountCreateRequest { + this := AmsIntegrationAccountCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AmsIntegrationAccountCreateRequest) GetData() AmsIntegrationAccountCreateRequestData { + if o == nil { + var ret AmsIntegrationAccountCreateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequest) GetDataOk() (*AmsIntegrationAccountCreateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AmsIntegrationAccountCreateRequest) SetData(v AmsIntegrationAccountCreateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AmsIntegrationAccountCreateRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_create_request_attributes.go b/api/datadogV2/model_ams_integration_account_create_request_attributes.go new file mode 100644 index 00000000000..a0191bea7b2 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_create_request_attributes.go @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountCreateRequestAttributes Attributes for creating a web integration account. +type AmsIntegrationAccountCreateRequestAttributes struct { + // The name of the account. + Name string `json:"name"` + // Sensitive credentials for the account. The structure and required fields vary by integration type. + // These values are write-only and never returned in responses. + Secrets map[string]interface{} `json:"secrets"` + // Integration-specific settings for the account. The structure and required fields vary by integration type. + // Use the schema endpoint (GET /api/v2/integrations/{integration_name}/accounts/schema) to retrieve + // the specific requirements for your integration before creating an account. + Settings map[string]interface{} `json:"settings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountCreateRequestAttributes instantiates a new AmsIntegrationAccountCreateRequestAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountCreateRequestAttributes(name string, secrets map[string]interface{}, settings map[string]interface{}) *AmsIntegrationAccountCreateRequestAttributes { + this := AmsIntegrationAccountCreateRequestAttributes{} + this.Name = name + this.Secrets = secrets + this.Settings = settings + return &this +} + +// NewAmsIntegrationAccountCreateRequestAttributesWithDefaults instantiates a new AmsIntegrationAccountCreateRequestAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountCreateRequestAttributesWithDefaults() *AmsIntegrationAccountCreateRequestAttributes { + this := AmsIntegrationAccountCreateRequestAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) SetName(v string) { + o.Name = v +} + +// GetSecrets returns the Secrets field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetSecrets() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetSecretsOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Secrets, true +} + +// SetSecrets sets field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) SetSecrets(v map[string]interface{}) { + o.Secrets = v +} + +// GetSettings returns the Settings field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetSettings() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequestAttributes) GetSettingsOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value. +func (o *AmsIntegrationAccountCreateRequestAttributes) SetSettings(v map[string]interface{}) { + o.Settings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["secrets"] = o.Secrets + toSerialize["settings"] = o.Settings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Secrets *map[string]interface{} `json:"secrets"` + Settings *map[string]interface{} `json:"settings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Secrets == nil { + return fmt.Errorf("required field secrets missing") + } + if all.Settings == nil { + return fmt.Errorf("required field settings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "secrets", "settings"}) + } else { + return err + } + o.Name = *all.Name + o.Secrets = *all.Secrets + o.Settings = *all.Settings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_create_request_data.go b/api/datadogV2/model_ams_integration_account_create_request_data.go new file mode 100644 index 00000000000..3ea6dc3ce29 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_create_request_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountCreateRequestData Data object for creating a web integration account. +type AmsIntegrationAccountCreateRequestData struct { + // Attributes for creating a web integration account. + Attributes AmsIntegrationAccountCreateRequestAttributes `json:"attributes"` + // The JSON:API type for web integration accounts. + Type AmsIntegrationAccountType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountCreateRequestData instantiates a new AmsIntegrationAccountCreateRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountCreateRequestData(attributes AmsIntegrationAccountCreateRequestAttributes, typeVar AmsIntegrationAccountType) *AmsIntegrationAccountCreateRequestData { + this := AmsIntegrationAccountCreateRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAmsIntegrationAccountCreateRequestDataWithDefaults instantiates a new AmsIntegrationAccountCreateRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountCreateRequestDataWithDefaults() *AmsIntegrationAccountCreateRequestData { + this := AmsIntegrationAccountCreateRequestData{} + var typeVar AmsIntegrationAccountType = AMSINTEGRATIONACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AmsIntegrationAccountCreateRequestData) GetAttributes() AmsIntegrationAccountCreateRequestAttributes { + if o == nil { + var ret AmsIntegrationAccountCreateRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequestData) GetAttributesOk() (*AmsIntegrationAccountCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AmsIntegrationAccountCreateRequestData) SetAttributes(v AmsIntegrationAccountCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AmsIntegrationAccountCreateRequestData) GetType() AmsIntegrationAccountType { + if o == nil { + var ret AmsIntegrationAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountCreateRequestData) GetTypeOk() (*AmsIntegrationAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AmsIntegrationAccountCreateRequestData) SetType(v AmsIntegrationAccountType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountCreateRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AmsIntegrationAccountCreateRequestAttributes `json:"attributes"` + Type *AmsIntegrationAccountType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_response.go b/api/datadogV2/model_ams_integration_account_response.go new file mode 100644 index 00000000000..48aafd05911 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_response.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountResponse Response containing a single web integration account. +type AmsIntegrationAccountResponse struct { + // Data object for a web integration account response. + Data *AmsIntegrationAccountResponseData `json:"data,omitempty"` + // The name of the integration. + IntegrationName *string `json:"integration_name,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountResponse instantiates a new AmsIntegrationAccountResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountResponse() *AmsIntegrationAccountResponse { + this := AmsIntegrationAccountResponse{} + return &this +} + +// NewAmsIntegrationAccountResponseWithDefaults instantiates a new AmsIntegrationAccountResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountResponseWithDefaults() *AmsIntegrationAccountResponse { + this := AmsIntegrationAccountResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AmsIntegrationAccountResponse) GetData() AmsIntegrationAccountResponseData { + if o == nil || o.Data == nil { + var ret AmsIntegrationAccountResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountResponse) GetDataOk() (*AmsIntegrationAccountResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AmsIntegrationAccountResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AmsIntegrationAccountResponseData and assigns it to the Data field. +func (o *AmsIntegrationAccountResponse) SetData(v AmsIntegrationAccountResponseData) { + o.Data = &v +} + +// GetIntegrationName returns the IntegrationName field value if set, zero value otherwise. +func (o *AmsIntegrationAccountResponse) GetIntegrationName() string { + if o == nil || o.IntegrationName == nil { + var ret string + return ret + } + return *o.IntegrationName +} + +// GetIntegrationNameOk returns a tuple with the IntegrationName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountResponse) GetIntegrationNameOk() (*string, bool) { + if o == nil || o.IntegrationName == nil { + return nil, false + } + return o.IntegrationName, true +} + +// HasIntegrationName returns a boolean if a field has been set. +func (o *AmsIntegrationAccountResponse) HasIntegrationName() bool { + return o != nil && o.IntegrationName != nil +} + +// SetIntegrationName gets a reference to the given string and assigns it to the IntegrationName field. +func (o *AmsIntegrationAccountResponse) SetIntegrationName(v string) { + o.IntegrationName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.IntegrationName != nil { + toSerialize["integration_name"] = o.IntegrationName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AmsIntegrationAccountResponseData `json:"data,omitempty"` + IntegrationName *string `json:"integration_name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "integration_name"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + o.IntegrationName = all.IntegrationName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_response_data.go b/api/datadogV2/model_ams_integration_account_response_data.go new file mode 100644 index 00000000000..33c9d94a7ea --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_response_data.go @@ -0,0 +1,180 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountResponseData Data object for a web integration account response. +type AmsIntegrationAccountResponseData struct { + // Attributes for a web integration account. + Attributes AmsIntegrationAccountAttributes `json:"attributes"` + // The unique identifier for the account. + Id string `json:"id"` + // The JSON:API type for web integration accounts. + Type AmsIntegrationAccountType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountResponseData instantiates a new AmsIntegrationAccountResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountResponseData(attributes AmsIntegrationAccountAttributes, id string, typeVar AmsIntegrationAccountType) *AmsIntegrationAccountResponseData { + this := AmsIntegrationAccountResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAmsIntegrationAccountResponseDataWithDefaults instantiates a new AmsIntegrationAccountResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountResponseDataWithDefaults() *AmsIntegrationAccountResponseData { + this := AmsIntegrationAccountResponseData{} + var typeVar AmsIntegrationAccountType = AMSINTEGRATIONACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AmsIntegrationAccountResponseData) GetAttributes() AmsIntegrationAccountAttributes { + if o == nil { + var ret AmsIntegrationAccountAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountResponseData) GetAttributesOk() (*AmsIntegrationAccountAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AmsIntegrationAccountResponseData) SetAttributes(v AmsIntegrationAccountAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *AmsIntegrationAccountResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AmsIntegrationAccountResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AmsIntegrationAccountResponseData) GetType() AmsIntegrationAccountType { + if o == nil { + var ret AmsIntegrationAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountResponseData) GetTypeOk() (*AmsIntegrationAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AmsIntegrationAccountResponseData) SetType(v AmsIntegrationAccountType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AmsIntegrationAccountAttributes `json:"attributes"` + Id *string `json:"id"` + Type *AmsIntegrationAccountType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_schema_response.go b/api/datadogV2/model_ams_integration_account_schema_response.go new file mode 100644 index 00000000000..c935fcd789a --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_schema_response.go @@ -0,0 +1,216 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountSchemaResponse Response containing the JSON schema for an integration's account configuration. +// This schema defines the required and optional fields for both settings and secrets, +// including field types, validation rules, and descriptions. +// +// The response is a standard [JSON Schema (draft-07)](https://json-schema.org/draft-07/schema#) document describing the account +// configuration structure. Because this is a dynamic JSON Schema, the exact properties vary by integration. +type AmsIntegrationAccountSchemaResponse struct { + // Whether additional properties are allowed at the root level (typically false). + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + // The properties object containing settings and secrets schema definitions. + // Both are always present in every integration schema, but the fields within each + // vary depending on the specific integration. + Properties AmsIntegrationAccountSchemaResponseProperties `json:"properties"` + // List of required top-level properties. + Required []string `json:"required"` + // The root type of the schema (always "object"). + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountSchemaResponse instantiates a new AmsIntegrationAccountSchemaResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountSchemaResponse(properties AmsIntegrationAccountSchemaResponseProperties, required []string, typeVar string) *AmsIntegrationAccountSchemaResponse { + this := AmsIntegrationAccountSchemaResponse{} + this.Properties = properties + this.Required = required + this.Type = typeVar + return &this +} + +// NewAmsIntegrationAccountSchemaResponseWithDefaults instantiates a new AmsIntegrationAccountSchemaResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountSchemaResponseWithDefaults() *AmsIntegrationAccountSchemaResponse { + this := AmsIntegrationAccountSchemaResponse{} + return &this +} + +// GetAdditionalProperties returns the AdditionalProperties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponse) GetAdditionalProperties() bool { + if o == nil || o.AdditionalProperties == nil { + var ret bool + return ret + } + return *o.AdditionalProperties +} + +// GetAdditionalPropertiesOk returns a tuple with the AdditionalProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponse) GetAdditionalPropertiesOk() (*bool, bool) { + if o == nil || o.AdditionalProperties == nil { + return nil, false + } + return o.AdditionalProperties, true +} + +// HasAdditionalProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponse) HasAdditionalProperties() bool { + return o != nil && o.AdditionalProperties != nil +} + +// SetAdditionalProperties gets a reference to the given bool and assigns it to the AdditionalProperties field. +func (o *AmsIntegrationAccountSchemaResponse) SetAdditionalProperties(v bool) { + o.AdditionalProperties = &v +} + +// GetProperties returns the Properties field value. +func (o *AmsIntegrationAccountSchemaResponse) GetProperties() AmsIntegrationAccountSchemaResponseProperties { + if o == nil { + var ret AmsIntegrationAccountSchemaResponseProperties + return ret + } + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponse) GetPropertiesOk() (*AmsIntegrationAccountSchemaResponseProperties, bool) { + if o == nil { + return nil, false + } + return &o.Properties, true +} + +// SetProperties sets field value. +func (o *AmsIntegrationAccountSchemaResponse) SetProperties(v AmsIntegrationAccountSchemaResponseProperties) { + o.Properties = v +} + +// GetRequired returns the Required field value. +func (o *AmsIntegrationAccountSchemaResponse) GetRequired() []string { + if o == nil { + var ret []string + return ret + } + return o.Required +} + +// GetRequiredOk returns a tuple with the Required field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponse) GetRequiredOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Required, true +} + +// SetRequired sets field value. +func (o *AmsIntegrationAccountSchemaResponse) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value. +func (o *AmsIntegrationAccountSchemaResponse) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponse) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AmsIntegrationAccountSchemaResponse) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountSchemaResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AdditionalProperties != nil { + toSerialize["additionalProperties"] = o.AdditionalProperties + } + toSerialize["properties"] = o.Properties + toSerialize["required"] = o.Required + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountSchemaResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + Properties *AmsIntegrationAccountSchemaResponseProperties `json:"properties"` + Required *[]string `json:"required"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Properties == nil { + return fmt.Errorf("required field properties missing") + } + if all.Required == nil { + return fmt.Errorf("required field required missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"additionalProperties", "properties", "required", "type"}) + } else { + return err + } + + hasInvalidField := false + o.AdditionalProperties = all.AdditionalProperties + if all.Properties.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Properties = *all.Properties + o.Required = *all.Required + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_schema_response_properties.go b/api/datadogV2/model_ams_integration_account_schema_response_properties.go new file mode 100644 index 00000000000..f2f13fdf3c2 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_schema_response_properties.go @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountSchemaResponseProperties The properties object containing settings and secrets schema definitions. +// Both are always present in every integration schema, but the fields within each +// vary depending on the specific integration. +type AmsIntegrationAccountSchemaResponseProperties struct { + // JSON Schema definition for the secrets object. + // Contains sensitive credentials required for the integration such as API keys, + // tokens, and passwords. These values are write-only and never returned in responses. + Secrets AmsIntegrationAccountSchemaResponseSecretsObject `json:"secrets"` + // JSON Schema definition for the settings object. + // Contains integration-specific configuration fields such as account identifiers, + // feature toggles, and non-sensitive configuration options. + Settings AmsIntegrationAccountSchemaResponseSettingsObject `json:"settings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountSchemaResponseProperties instantiates a new AmsIntegrationAccountSchemaResponseProperties object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountSchemaResponseProperties(secrets AmsIntegrationAccountSchemaResponseSecretsObject, settings AmsIntegrationAccountSchemaResponseSettingsObject) *AmsIntegrationAccountSchemaResponseProperties { + this := AmsIntegrationAccountSchemaResponseProperties{} + this.Secrets = secrets + this.Settings = settings + return &this +} + +// NewAmsIntegrationAccountSchemaResponsePropertiesWithDefaults instantiates a new AmsIntegrationAccountSchemaResponseProperties object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountSchemaResponsePropertiesWithDefaults() *AmsIntegrationAccountSchemaResponseProperties { + this := AmsIntegrationAccountSchemaResponseProperties{} + return &this +} + +// GetSecrets returns the Secrets field value. +func (o *AmsIntegrationAccountSchemaResponseProperties) GetSecrets() AmsIntegrationAccountSchemaResponseSecretsObject { + if o == nil { + var ret AmsIntegrationAccountSchemaResponseSecretsObject + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseProperties) GetSecretsOk() (*AmsIntegrationAccountSchemaResponseSecretsObject, bool) { + if o == nil { + return nil, false + } + return &o.Secrets, true +} + +// SetSecrets sets field value. +func (o *AmsIntegrationAccountSchemaResponseProperties) SetSecrets(v AmsIntegrationAccountSchemaResponseSecretsObject) { + o.Secrets = v +} + +// GetSettings returns the Settings field value. +func (o *AmsIntegrationAccountSchemaResponseProperties) GetSettings() AmsIntegrationAccountSchemaResponseSettingsObject { + if o == nil { + var ret AmsIntegrationAccountSchemaResponseSettingsObject + return ret + } + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseProperties) GetSettingsOk() (*AmsIntegrationAccountSchemaResponseSettingsObject, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value. +func (o *AmsIntegrationAccountSchemaResponseProperties) SetSettings(v AmsIntegrationAccountSchemaResponseSettingsObject) { + o.Settings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountSchemaResponseProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["secrets"] = o.Secrets + toSerialize["settings"] = o.Settings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountSchemaResponseProperties) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Secrets *AmsIntegrationAccountSchemaResponseSecretsObject `json:"secrets"` + Settings *AmsIntegrationAccountSchemaResponseSettingsObject `json:"settings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Secrets == nil { + return fmt.Errorf("required field secrets missing") + } + if all.Settings == nil { + return fmt.Errorf("required field settings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"secrets", "settings"}) + } else { + return err + } + + hasInvalidField := false + if all.Secrets.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Secrets = *all.Secrets + if all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Settings = *all.Settings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_schema_response_secrets_object.go b/api/datadogV2/model_ams_integration_account_schema_response_secrets_object.go new file mode 100644 index 00000000000..a9a0ffd89fe --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_schema_response_secrets_object.go @@ -0,0 +1,210 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountSchemaResponseSecretsObject JSON Schema definition for the secrets object. +// Contains sensitive credentials required for the integration such as API keys, +// tokens, and passwords. These values are write-only and never returned in responses. +type AmsIntegrationAccountSchemaResponseSecretsObject struct { + // Whether additional properties are allowed (typically false). + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + // The individual secret fields for this integration. + // Field names and types vary by integration. + Properties map[string]AmsIntegrationAccountSchemaResponseSettingsField `json:"properties,omitempty"` + // List of required secret field names. + Required []string `json:"required,omitempty"` + // Always "object" for the secrets container. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountSchemaResponseSecretsObject instantiates a new AmsIntegrationAccountSchemaResponseSecretsObject object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountSchemaResponseSecretsObject() *AmsIntegrationAccountSchemaResponseSecretsObject { + this := AmsIntegrationAccountSchemaResponseSecretsObject{} + return &this +} + +// NewAmsIntegrationAccountSchemaResponseSecretsObjectWithDefaults instantiates a new AmsIntegrationAccountSchemaResponseSecretsObject object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountSchemaResponseSecretsObjectWithDefaults() *AmsIntegrationAccountSchemaResponseSecretsObject { + this := AmsIntegrationAccountSchemaResponseSecretsObject{} + return &this +} + +// GetAdditionalProperties returns the AdditionalProperties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetAdditionalProperties() bool { + if o == nil || o.AdditionalProperties == nil { + var ret bool + return ret + } + return *o.AdditionalProperties +} + +// GetAdditionalPropertiesOk returns a tuple with the AdditionalProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetAdditionalPropertiesOk() (*bool, bool) { + if o == nil || o.AdditionalProperties == nil { + return nil, false + } + return o.AdditionalProperties, true +} + +// HasAdditionalProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) HasAdditionalProperties() bool { + return o != nil && o.AdditionalProperties != nil +} + +// SetAdditionalProperties gets a reference to the given bool and assigns it to the AdditionalProperties field. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) SetAdditionalProperties(v bool) { + o.AdditionalProperties = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetProperties() map[string]AmsIntegrationAccountSchemaResponseSettingsField { + if o == nil || o.Properties == nil { + var ret map[string]AmsIntegrationAccountSchemaResponseSettingsField + return ret + } + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetPropertiesOk() (*map[string]AmsIntegrationAccountSchemaResponseSettingsField, bool) { + if o == nil || o.Properties == nil { + return nil, false + } + return &o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) HasProperties() bool { + return o != nil && o.Properties != nil +} + +// SetProperties gets a reference to the given map[string]AmsIntegrationAccountSchemaResponseSettingsField and assigns it to the Properties field. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) SetProperties(v map[string]AmsIntegrationAccountSchemaResponseSettingsField) { + o.Properties = v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetRequired() []string { + if o == nil || o.Required == nil { + var ret []string + return ret + } + return o.Required +} + +// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetRequiredOk() (*[]string, bool) { + if o == nil || o.Required == nil { + return nil, false + } + return &o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) HasRequired() bool { + return o != nil && o.Required != nil +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountSchemaResponseSecretsObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AdditionalProperties != nil { + toSerialize["additionalProperties"] = o.AdditionalProperties + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + if o.Required != nil { + toSerialize["required"] = o.Required + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountSchemaResponseSecretsObject) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + Properties map[string]AmsIntegrationAccountSchemaResponseSettingsField `json:"properties,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"additionalProperties", "properties", "required", "type"}) + } else { + return err + } + o.AdditionalProperties = all.AdditionalProperties + o.Properties = all.Properties + o.Required = all.Required + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_schema_response_settings_field.go b/api/datadogV2/model_ams_integration_account_schema_response_settings_field.go new file mode 100644 index 00000000000..9dcbc03d9d0 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_schema_response_settings_field.go @@ -0,0 +1,278 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountSchemaResponseSettingsField JSON Schema definition for a single field within settings or secrets. +// The exact fields vary by integration. +type AmsIntegrationAccountSchemaResponseSettingsField struct { + // Whether additional properties are allowed for this field. + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + // Default value for the field if not provided. + Default interface{} `json:"default,omitempty"` + // Human-readable description of the field's purpose. + Description *string `json:"description,omitempty"` + // Schema for array items when type is "array". + Items interface{} `json:"items,omitempty"` + // Minimum length for string fields. + MinLength *int64 `json:"minLength,omitempty"` + // The data type of the field (string, boolean, integer, array, object). + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountSchemaResponseSettingsField instantiates a new AmsIntegrationAccountSchemaResponseSettingsField object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountSchemaResponseSettingsField() *AmsIntegrationAccountSchemaResponseSettingsField { + this := AmsIntegrationAccountSchemaResponseSettingsField{} + return &this +} + +// NewAmsIntegrationAccountSchemaResponseSettingsFieldWithDefaults instantiates a new AmsIntegrationAccountSchemaResponseSettingsField object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountSchemaResponseSettingsFieldWithDefaults() *AmsIntegrationAccountSchemaResponseSettingsField { + this := AmsIntegrationAccountSchemaResponseSettingsField{} + return &this +} + +// GetAdditionalProperties returns the AdditionalProperties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetAdditionalProperties() bool { + if o == nil || o.AdditionalProperties == nil { + var ret bool + return ret + } + return *o.AdditionalProperties +} + +// GetAdditionalPropertiesOk returns a tuple with the AdditionalProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetAdditionalPropertiesOk() (*bool, bool) { + if o == nil || o.AdditionalProperties == nil { + return nil, false + } + return o.AdditionalProperties, true +} + +// HasAdditionalProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasAdditionalProperties() bool { + return o != nil && o.AdditionalProperties != nil +} + +// SetAdditionalProperties gets a reference to the given bool and assigns it to the AdditionalProperties field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetAdditionalProperties(v bool) { + o.AdditionalProperties = &v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetDefault() interface{} { + if o == nil || o.Default == nil { + var ret interface{} + return ret + } + return o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetDefaultOk() (*interface{}, bool) { + if o == nil || o.Default == nil { + return nil, false + } + return &o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasDefault() bool { + return o != nil && o.Default != nil +} + +// SetDefault gets a reference to the given interface{} and assigns it to the Default field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetDefault(v interface{}) { + o.Default = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetDescription(v string) { + o.Description = &v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetItems() interface{} { + if o == nil || o.Items == nil { + var ret interface{} + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetItemsOk() (*interface{}, bool) { + if o == nil || o.Items == nil { + return nil, false + } + return &o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasItems() bool { + return o != nil && o.Items != nil +} + +// SetItems gets a reference to the given interface{} and assigns it to the Items field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetItems(v interface{}) { + o.Items = v +} + +// GetMinLength returns the MinLength field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetMinLength() int64 { + if o == nil || o.MinLength == nil { + var ret int64 + return ret + } + return *o.MinLength +} + +// GetMinLengthOk returns a tuple with the MinLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetMinLengthOk() (*int64, bool) { + if o == nil || o.MinLength == nil { + return nil, false + } + return o.MinLength, true +} + +// HasMinLength returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasMinLength() bool { + return o != nil && o.MinLength != nil +} + +// SetMinLength gets a reference to the given int64 and assigns it to the MinLength field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetMinLength(v int64) { + o.MinLength = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountSchemaResponseSettingsField) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AdditionalProperties != nil { + toSerialize["additionalProperties"] = o.AdditionalProperties + } + if o.Default != nil { + toSerialize["default"] = o.Default + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Items != nil { + toSerialize["items"] = o.Items + } + if o.MinLength != nil { + toSerialize["minLength"] = o.MinLength + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountSchemaResponseSettingsField) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + Default interface{} `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + Items interface{} `json:"items,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"additionalProperties", "default", "description", "items", "minLength", "type"}) + } else { + return err + } + o.AdditionalProperties = all.AdditionalProperties + o.Default = all.Default + o.Description = all.Description + o.Items = all.Items + o.MinLength = all.MinLength + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_schema_response_settings_object.go b/api/datadogV2/model_ams_integration_account_schema_response_settings_object.go new file mode 100644 index 00000000000..fc10f08e947 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_schema_response_settings_object.go @@ -0,0 +1,210 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountSchemaResponseSettingsObject JSON Schema definition for the settings object. +// Contains integration-specific configuration fields such as account identifiers, +// feature toggles, and non-sensitive configuration options. +type AmsIntegrationAccountSchemaResponseSettingsObject struct { + // Whether additional properties are allowed (typically false). + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + // The individual setting fields for this integration. + // Field names and types vary by integration. + Properties map[string]AmsIntegrationAccountSchemaResponseSettingsField `json:"properties,omitempty"` + // List of required setting field names. + Required []string `json:"required,omitempty"` + // Always "object" for the settings container. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountSchemaResponseSettingsObject instantiates a new AmsIntegrationAccountSchemaResponseSettingsObject object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountSchemaResponseSettingsObject() *AmsIntegrationAccountSchemaResponseSettingsObject { + this := AmsIntegrationAccountSchemaResponseSettingsObject{} + return &this +} + +// NewAmsIntegrationAccountSchemaResponseSettingsObjectWithDefaults instantiates a new AmsIntegrationAccountSchemaResponseSettingsObject object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountSchemaResponseSettingsObjectWithDefaults() *AmsIntegrationAccountSchemaResponseSettingsObject { + this := AmsIntegrationAccountSchemaResponseSettingsObject{} + return &this +} + +// GetAdditionalProperties returns the AdditionalProperties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetAdditionalProperties() bool { + if o == nil || o.AdditionalProperties == nil { + var ret bool + return ret + } + return *o.AdditionalProperties +} + +// GetAdditionalPropertiesOk returns a tuple with the AdditionalProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetAdditionalPropertiesOk() (*bool, bool) { + if o == nil || o.AdditionalProperties == nil { + return nil, false + } + return o.AdditionalProperties, true +} + +// HasAdditionalProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) HasAdditionalProperties() bool { + return o != nil && o.AdditionalProperties != nil +} + +// SetAdditionalProperties gets a reference to the given bool and assigns it to the AdditionalProperties field. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) SetAdditionalProperties(v bool) { + o.AdditionalProperties = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetProperties() map[string]AmsIntegrationAccountSchemaResponseSettingsField { + if o == nil || o.Properties == nil { + var ret map[string]AmsIntegrationAccountSchemaResponseSettingsField + return ret + } + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetPropertiesOk() (*map[string]AmsIntegrationAccountSchemaResponseSettingsField, bool) { + if o == nil || o.Properties == nil { + return nil, false + } + return &o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) HasProperties() bool { + return o != nil && o.Properties != nil +} + +// SetProperties gets a reference to the given map[string]AmsIntegrationAccountSchemaResponseSettingsField and assigns it to the Properties field. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) SetProperties(v map[string]AmsIntegrationAccountSchemaResponseSettingsField) { + o.Properties = v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetRequired() []string { + if o == nil || o.Required == nil { + var ret []string + return ret + } + return o.Required +} + +// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetRequiredOk() (*[]string, bool) { + if o == nil || o.Required == nil { + return nil, false + } + return &o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) HasRequired() bool { + return o != nil && o.Required != nil +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountSchemaResponseSettingsObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AdditionalProperties != nil { + toSerialize["additionalProperties"] = o.AdditionalProperties + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + if o.Required != nil { + toSerialize["required"] = o.Required + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountSchemaResponseSettingsObject) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AdditionalProperties *bool `json:"additionalProperties,omitempty"` + Properties map[string]AmsIntegrationAccountSchemaResponseSettingsField `json:"properties,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"additionalProperties", "properties", "required", "type"}) + } else { + return err + } + o.AdditionalProperties = all.AdditionalProperties + o.Properties = all.Properties + o.Required = all.Required + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_type.go b/api/datadogV2/model_ams_integration_account_type.go new file mode 100644 index 00000000000..6e08e1636ff --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountType The JSON:API type for web integration accounts. +type AmsIntegrationAccountType string + +// List of AmsIntegrationAccountType. +const ( + AMSINTEGRATIONACCOUNTTYPE_ACCOUNT AmsIntegrationAccountType = "Account" +) + +var allowedAmsIntegrationAccountTypeEnumValues = []AmsIntegrationAccountType{ + AMSINTEGRATIONACCOUNTTYPE_ACCOUNT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AmsIntegrationAccountType) GetAllowedValues() []AmsIntegrationAccountType { + return allowedAmsIntegrationAccountTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AmsIntegrationAccountType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AmsIntegrationAccountType(value) + return nil +} + +// NewAmsIntegrationAccountTypeFromValue returns a pointer to a valid AmsIntegrationAccountType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAmsIntegrationAccountTypeFromValue(v string) (*AmsIntegrationAccountType, error) { + ev := AmsIntegrationAccountType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AmsIntegrationAccountType: valid values are %v", v, allowedAmsIntegrationAccountTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AmsIntegrationAccountType) IsValid() bool { + for _, existing := range allowedAmsIntegrationAccountTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AmsIntegrationAccountType value. +func (v AmsIntegrationAccountType) Ptr() *AmsIntegrationAccountType { + return &v +} diff --git a/api/datadogV2/model_ams_integration_account_update_request.go b/api/datadogV2/model_ams_integration_account_update_request.go new file mode 100644 index 00000000000..ba7b38623fb --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_update_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountUpdateRequest Payload for updating a web integration account. +type AmsIntegrationAccountUpdateRequest struct { + // Data object for updating a web integration account. + Data AmsIntegrationAccountUpdateRequestData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountUpdateRequest instantiates a new AmsIntegrationAccountUpdateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountUpdateRequest(data AmsIntegrationAccountUpdateRequestData) *AmsIntegrationAccountUpdateRequest { + this := AmsIntegrationAccountUpdateRequest{} + this.Data = data + return &this +} + +// NewAmsIntegrationAccountUpdateRequestWithDefaults instantiates a new AmsIntegrationAccountUpdateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountUpdateRequestWithDefaults() *AmsIntegrationAccountUpdateRequest { + this := AmsIntegrationAccountUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AmsIntegrationAccountUpdateRequest) GetData() AmsIntegrationAccountUpdateRequestData { + if o == nil { + var ret AmsIntegrationAccountUpdateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequest) GetDataOk() (*AmsIntegrationAccountUpdateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AmsIntegrationAccountUpdateRequest) SetData(v AmsIntegrationAccountUpdateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AmsIntegrationAccountUpdateRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_update_request_attributes.go b/api/datadogV2/model_ams_integration_account_update_request_attributes.go new file mode 100644 index 00000000000..dcbe1544f11 --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_update_request_attributes.go @@ -0,0 +1,175 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountUpdateRequestAttributes Attributes for updating a web integration account. All fields are optional; +// only provide the fields you want to update. +type AmsIntegrationAccountUpdateRequestAttributes struct { + // The name of the account. + Name *string `json:"name,omitempty"` + // Sensitive credentials to update. Only the secrets provided are updated. + // These values are write-only and never returned in responses. + Secrets map[string]interface{} `json:"secrets,omitempty"` + // Integration-specific settings to update. Only the fields provided are updated. + // The structure varies by integration type. See the integration's schema for available fields. + Settings map[string]interface{} `json:"settings,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountUpdateRequestAttributes instantiates a new AmsIntegrationAccountUpdateRequestAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountUpdateRequestAttributes() *AmsIntegrationAccountUpdateRequestAttributes { + this := AmsIntegrationAccountUpdateRequestAttributes{} + return &this +} + +// NewAmsIntegrationAccountUpdateRequestAttributesWithDefaults instantiates a new AmsIntegrationAccountUpdateRequestAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountUpdateRequestAttributesWithDefaults() *AmsIntegrationAccountUpdateRequestAttributes { + this := AmsIntegrationAccountUpdateRequestAttributes{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AmsIntegrationAccountUpdateRequestAttributes) SetName(v string) { + o.Name = &v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetSecrets() map[string]interface{} { + if o == nil || o.Secrets == nil { + var ret map[string]interface{} + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetSecretsOk() (*map[string]interface{}, bool) { + if o == nil || o.Secrets == nil { + return nil, false + } + return &o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) HasSecrets() bool { + return o != nil && o.Secrets != nil +} + +// SetSecrets gets a reference to the given map[string]interface{} and assigns it to the Secrets field. +func (o *AmsIntegrationAccountUpdateRequestAttributes) SetSecrets(v map[string]interface{}) { + o.Secrets = v +} + +// GetSettings returns the Settings field value if set, zero value otherwise. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetSettings() map[string]interface{} { + if o == nil || o.Settings == nil { + var ret map[string]interface{} + return ret + } + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) GetSettingsOk() (*map[string]interface{}, bool) { + if o == nil || o.Settings == nil { + return nil, false + } + return &o.Settings, true +} + +// HasSettings returns a boolean if a field has been set. +func (o *AmsIntegrationAccountUpdateRequestAttributes) HasSettings() bool { + return o != nil && o.Settings != nil +} + +// SetSettings gets a reference to the given map[string]interface{} and assigns it to the Settings field. +func (o *AmsIntegrationAccountUpdateRequestAttributes) SetSettings(v map[string]interface{}) { + o.Settings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Secrets != nil { + toSerialize["secrets"] = o.Secrets + } + if o.Settings != nil { + toSerialize["settings"] = o.Settings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + Secrets map[string]interface{} `json:"secrets,omitempty"` + Settings map[string]interface{} `json:"settings,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "secrets", "settings"}) + } else { + return err + } + o.Name = all.Name + o.Secrets = all.Secrets + o.Settings = all.Settings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_account_update_request_data.go b/api/datadogV2/model_ams_integration_account_update_request_data.go new file mode 100644 index 00000000000..0fa2cfeab1a --- /dev/null +++ b/api/datadogV2/model_ams_integration_account_update_request_data.go @@ -0,0 +1,152 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountUpdateRequestData Data object for updating a web integration account. +type AmsIntegrationAccountUpdateRequestData struct { + // Attributes for updating a web integration account. All fields are optional; + // only provide the fields you want to update. + Attributes *AmsIntegrationAccountUpdateRequestAttributes `json:"attributes,omitempty"` + // The JSON:API type for web integration accounts. + Type AmsIntegrationAccountType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountUpdateRequestData instantiates a new AmsIntegrationAccountUpdateRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountUpdateRequestData(typeVar AmsIntegrationAccountType) *AmsIntegrationAccountUpdateRequestData { + this := AmsIntegrationAccountUpdateRequestData{} + this.Type = typeVar + return &this +} + +// NewAmsIntegrationAccountUpdateRequestDataWithDefaults instantiates a new AmsIntegrationAccountUpdateRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountUpdateRequestDataWithDefaults() *AmsIntegrationAccountUpdateRequestData { + this := AmsIntegrationAccountUpdateRequestData{} + var typeVar AmsIntegrationAccountType = AMSINTEGRATIONACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AmsIntegrationAccountUpdateRequestData) GetAttributes() AmsIntegrationAccountUpdateRequestAttributes { + if o == nil || o.Attributes == nil { + var ret AmsIntegrationAccountUpdateRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequestData) GetAttributesOk() (*AmsIntegrationAccountUpdateRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AmsIntegrationAccountUpdateRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AmsIntegrationAccountUpdateRequestAttributes and assigns it to the Attributes field. +func (o *AmsIntegrationAccountUpdateRequestData) SetAttributes(v AmsIntegrationAccountUpdateRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *AmsIntegrationAccountUpdateRequestData) GetType() AmsIntegrationAccountType { + if o == nil { + var ret AmsIntegrationAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountUpdateRequestData) GetTypeOk() (*AmsIntegrationAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AmsIntegrationAccountUpdateRequestData) SetType(v AmsIntegrationAccountType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountUpdateRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AmsIntegrationAccountUpdateRequestAttributes `json:"attributes,omitempty"` + Type *AmsIntegrationAccountType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_ams_integration_accounts_response.go b/api/datadogV2/model_ams_integration_accounts_response.go new file mode 100644 index 00000000000..95305ceb919 --- /dev/null +++ b/api/datadogV2/model_ams_integration_accounts_response.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AmsIntegrationAccountsResponse Response containing a list of web integration accounts. +type AmsIntegrationAccountsResponse struct { + // + Data []AmsIntegrationAccountResponseData `json:"data,omitempty"` + // The name of the integration. + IntegrationName *string `json:"integration_name,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAmsIntegrationAccountsResponse instantiates a new AmsIntegrationAccountsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAmsIntegrationAccountsResponse() *AmsIntegrationAccountsResponse { + this := AmsIntegrationAccountsResponse{} + return &this +} + +// NewAmsIntegrationAccountsResponseWithDefaults instantiates a new AmsIntegrationAccountsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAmsIntegrationAccountsResponseWithDefaults() *AmsIntegrationAccountsResponse { + this := AmsIntegrationAccountsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AmsIntegrationAccountsResponse) GetData() []AmsIntegrationAccountResponseData { + if o == nil || o.Data == nil { + var ret []AmsIntegrationAccountResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountsResponse) GetDataOk() (*[]AmsIntegrationAccountResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AmsIntegrationAccountsResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []AmsIntegrationAccountResponseData and assigns it to the Data field. +func (o *AmsIntegrationAccountsResponse) SetData(v []AmsIntegrationAccountResponseData) { + o.Data = v +} + +// GetIntegrationName returns the IntegrationName field value if set, zero value otherwise. +func (o *AmsIntegrationAccountsResponse) GetIntegrationName() string { + if o == nil || o.IntegrationName == nil { + var ret string + return ret + } + return *o.IntegrationName +} + +// GetIntegrationNameOk returns a tuple with the IntegrationName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AmsIntegrationAccountsResponse) GetIntegrationNameOk() (*string, bool) { + if o == nil || o.IntegrationName == nil { + return nil, false + } + return o.IntegrationName, true +} + +// HasIntegrationName returns a boolean if a field has been set. +func (o *AmsIntegrationAccountsResponse) HasIntegrationName() bool { + return o != nil && o.IntegrationName != nil +} + +// SetIntegrationName gets a reference to the given string and assigns it to the IntegrationName field. +func (o *AmsIntegrationAccountsResponse) SetIntegrationName(v string) { + o.IntegrationName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AmsIntegrationAccountsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.IntegrationName != nil { + toSerialize["integration_name"] = o.IntegrationName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AmsIntegrationAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []AmsIntegrationAccountResponseData `json:"data,omitempty"` + IntegrationName *string `json:"integration_name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "integration_name"}) + } else { + return err + } + o.Data = all.Data + o.IntegrationName = all.IntegrationName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/integration-accounts/CreateAmsIntegrationAccount.go b/examples/v2/integration-accounts/CreateAmsIntegrationAccount.go new file mode 100644 index 00000000000..e59b1868079 --- /dev/null +++ b/examples/v2/integration-accounts/CreateAmsIntegrationAccount.go @@ -0,0 +1,50 @@ +// Create integration account returns "Created: The account was successfully created." response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AmsIntegrationAccountCreateRequest{ + Data: datadogV2.AmsIntegrationAccountCreateRequestData{ + Attributes: datadogV2.AmsIntegrationAccountCreateRequestAttributes{ + Name: "My Production Account", + Secrets: map[string]interface{}{ + "api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + }, + Settings: map[string]interface{}{ + "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "alerts": true, + "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "call_summaries": true, + "ccm_enabled": true, + "censor_logs": true, + "events": true, + "messages": true, + }, + }, + Type: datadogV2.AMSINTEGRATIONACCOUNTTYPE_ACCOUNT, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + resp, r, err := api.CreateAmsIntegrationAccount(ctx, "integration_name", "interface_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.CreateAmsIntegrationAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IntegrationAccountsApi.CreateAmsIntegrationAccount`:\n%s\n", responseContent) +} diff --git a/examples/v2/integration-accounts/DeleteAmsIntegrationAccount.go b/examples/v2/integration-accounts/DeleteAmsIntegrationAccount.go new file mode 100644 index 00000000000..79a37461ea8 --- /dev/null +++ b/examples/v2/integration-accounts/DeleteAmsIntegrationAccount.go @@ -0,0 +1,25 @@ +// Delete integration account returns "OK: The account was successfully deleted." response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + r, err := api.DeleteAmsIntegrationAccount(ctx, "integration_name", "interface_id", "account_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.DeleteAmsIntegrationAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/integration-accounts/GetAmsIntegrationAccount.go b/examples/v2/integration-accounts/GetAmsIntegrationAccount.go new file mode 100644 index 00000000000..2085a83bf9c --- /dev/null +++ b/examples/v2/integration-accounts/GetAmsIntegrationAccount.go @@ -0,0 +1,29 @@ +// Get integration account returns "OK: The account details for the specified integration." response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + resp, r, err := api.GetAmsIntegrationAccount(ctx, "integration_name", "interface_id", "account_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.GetAmsIntegrationAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IntegrationAccountsApi.GetAmsIntegrationAccount`:\n%s\n", responseContent) +} diff --git a/examples/v2/integration-accounts/GetAmsIntegrationAccountSchema.go b/examples/v2/integration-accounts/GetAmsIntegrationAccountSchema.go new file mode 100644 index 00000000000..fa9e8f1f2e1 --- /dev/null +++ b/examples/v2/integration-accounts/GetAmsIntegrationAccountSchema.go @@ -0,0 +1,30 @@ +// Get account schema for an integration returns "OK: The JSON schema for the integration's account configuration." +// response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + resp, r, err := api.GetAmsIntegrationAccountSchema(ctx, "integration_name", "interface_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.GetAmsIntegrationAccountSchema`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IntegrationAccountsApi.GetAmsIntegrationAccountSchema`:\n%s\n", responseContent) +} diff --git a/examples/v2/integration-accounts/ListAmsIntegrationAccounts.go b/examples/v2/integration-accounts/ListAmsIntegrationAccounts.go new file mode 100644 index 00000000000..d3f7e510727 --- /dev/null +++ b/examples/v2/integration-accounts/ListAmsIntegrationAccounts.go @@ -0,0 +1,29 @@ +// List integration accounts returns "OK: List of all accounts for the specified integration." response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + resp, r, err := api.ListAmsIntegrationAccounts(ctx, "integration_name", "interface_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.ListAmsIntegrationAccounts`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IntegrationAccountsApi.ListAmsIntegrationAccounts`:\n%s\n", responseContent) +} diff --git a/examples/v2/integration-accounts/UpdateAmsIntegrationAccount.go b/examples/v2/integration-accounts/UpdateAmsIntegrationAccount.go new file mode 100644 index 00000000000..d6b4e769512 --- /dev/null +++ b/examples/v2/integration-accounts/UpdateAmsIntegrationAccount.go @@ -0,0 +1,45 @@ +// Update integration account returns "OK: The account was successfully updated." response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AmsIntegrationAccountUpdateRequest{ + Data: datadogV2.AmsIntegrationAccountUpdateRequestData{ + Attributes: &datadogV2.AmsIntegrationAccountUpdateRequestAttributes{ + Name: datadog.PtrString("My Production Account (Updated)"), + Secrets: map[string]interface{}{ + "api_key_token": "new_secret_token_value", + }, + Settings: map[string]interface{}{ + "ccm_enabled": true, + "events": true, + "messages": false, + }, + }, + Type: datadogV2.AMSINTEGRATIONACCOUNTTYPE_ACCOUNT, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIntegrationAccountsApi(apiClient) + resp, r, err := api.UpdateAmsIntegrationAccount(ctx, "integration_name", "interface_id", "account_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IntegrationAccountsApi.UpdateAmsIntegrationAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IntegrationAccountsApi.UpdateAmsIntegrationAccount`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 22b5b865431..76a55a67d62 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -119,6 +119,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "ConfluentCloudApi": reflect.ValueOf(datadogV2.NewConfluentCloudApi), "FastlyIntegrationApi": reflect.ValueOf(datadogV2.NewFastlyIntegrationApi), "OktaIntegrationApi": reflect.ValueOf(datadogV2.NewOktaIntegrationApi), + "IntegrationAccountsApi": reflect.ValueOf(datadogV2.NewIntegrationAccountsApi), "IPAllowlistApi": reflect.ValueOf(datadogV2.NewIPAllowlistApi), "LogsApi": reflect.ValueOf(datadogV2.NewLogsApi), "LogsArchivesApi": reflect.ValueOf(datadogV2.NewLogsArchivesApi), diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 0f9de6d48a2..dab2215ce31 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -834,6 +834,26 @@ "tag": "Okta Integration", "operationId": "CreateOktaAccount" }, + { + "parameters": [ + { + "name": "integration_name", + "value": "\"twilio\"" + }, + { + "name": "interface_id", + "value": "\"twilio.messaging\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"Account\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"settings\": {\n \"api_key\": \"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n \"account_sid\": \"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n \"events\": true,\n \"messages\": true,\n \"alerts\": true,\n \"call_summaries\": true,\n \"ccm_enabled\": true,\n \"censor_logs\": true\n },\n \"secrets\": {\n \"api_key_token\": \"test_secret_token_value\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"web_integration_account\" in the system", + "key": "web_integration_account", + "tag": "Integration Accounts", + "operationId": "CreateAmsIntegrationAccount" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/integration_accounts.feature b/tests/scenarios/features/v2/integration_accounts.feature new file mode 100644 index 00000000000..c0d96602bda --- /dev/null +++ b/tests/scenarios/features/v2/integration_accounts.feature @@ -0,0 +1,199 @@ +@endpoint(integration-accounts) @endpoint(integration-accounts-v2) +Feature: Integration Accounts + Configure and manage third-party integrations with Datadog. This API + provides a unified interface for managing integration accounts across + various external services. Each integration has its own unique schema + that defines the required settings and secrets. Before creating or + updating an account, use the schema endpoint to retrieve the specific + requirements, field types, validation rules, and available configuration + options for your integration. **Note**: This API manages integration + account configurations only. It does not support Grace Resources, + Reference Tables, or Custom Queries CRUD operations. For those features, + refer to each integration's dedicated documentation. Supported + Integrations: - + [Twilio](https://docs.datadoghq.com/integrations/twilio/) - + [Snowflake](https://docs.datadoghq.com/integrations/snowflake-web/) - + [Databricks](https://docs.datadoghq.com/integrations/databricks/) + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "IntegrationAccounts" API + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create integration account returns "Bad Request: The request body is malformed or the integration name format is invalid." response + Given new "CreateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request: The request body is malformed or the integration name format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create integration account returns "Created: The account was successfully created." response + Given new "CreateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 201 Created: The account was successfully created. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create integration account returns "Not Found: The integration does not exist." response + Given new "CreateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found: The integration does not exist. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create integration account returns "Unprocessable Entity: The account configuration does not match the integration schema." response + Given new "CreateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 422 Unprocessable Entity: The account configuration does not match the integration schema. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Delete integration account returns "Bad Request: The integration name or account ID format is invalid." response + Given new "DeleteAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request: The integration name or account ID format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Delete integration account returns "Not Found: The integration or account does not exist." response + Given new "DeleteAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found: The integration or account does not exist. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Delete integration account returns "OK: The account was successfully deleted." response + Given new "DeleteAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK: The account was successfully deleted. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get account schema for an integration returns "Bad Request: The integration name format is invalid." response + Given new "GetAmsIntegrationAccountSchema" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request: The integration name format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get account schema for an integration returns "Not Found: The integration does not exist or has no schema available." response + Given new "GetAmsIntegrationAccountSchema" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found: The integration does not exist or has no schema available. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get account schema for an integration returns "OK: The JSON schema for the integration's account configuration." response + Given new "GetAmsIntegrationAccountSchema" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK: The JSON schema for the integration's account configuration. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get integration account returns "Bad Request: The integration name or account ID format is invalid." response + Given new "GetAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request: The integration name or account ID format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get integration account returns "Not Found: The integration or account does not exist." response + Given new "GetAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found: The integration or account does not exist. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get integration account returns "OK: The account details for the specified integration." response + Given new "GetAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK: The account details for the specified integration. + + @generated @skip @team:DataDog/saas-integrations + Scenario: List integration accounts returns "Bad Request: The integration name format is invalid." response + Given new "ListAmsIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request: The integration name format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: List integration accounts returns "Not Found: The integration does not exist." response + Given new "ListAmsIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found: The integration does not exist. + + @generated @skip @team:DataDog/saas-integrations + Scenario: List integration accounts returns "OK: List of all accounts for the specified integration." response + Given new "ListAmsIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK: List of all accounts for the specified integration. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update integration account returns "Bad Request: The request body is malformed or the integration name/account ID format is invalid." response + Given new "UpdateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request: The request body is malformed or the integration name/account ID format is invalid. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update integration account returns "Not Found: The integration or account does not exist." response + Given new "UpdateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found: The integration or account does not exist. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update integration account returns "OK: The account was successfully updated." response + Given new "UpdateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 200 OK: The account was successfully updated. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update integration account returns "Unprocessable Entity: The account configuration does not match the integration schema." response + Given new "UpdateAmsIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "interface_id" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 422 Unprocessable Entity: The account configuration does not match the integration schema. diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index a5c43f6c0f2..33e331e2b1a 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4191,6 +4191,57 @@ "type": "idempotent" } }, + "ListAmsIntegrationAccounts": { + "tag": "Integration Accounts", + "undo": { + "type": "safe" + } + }, + "CreateAmsIntegrationAccount": { + "tag": "Integration Accounts", + "undo": { + "operationId": "DeleteAmsIntegrationAccount", + "parameters": [ + { + "name": "integration_name", + "source": "integration_name" + }, + { + "name": "interface_id", + "source": "interface_id" + }, + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetAmsIntegrationAccountSchema": { + "tag": "Integration Accounts", + "undo": { + "type": "safe" + } + }, + "DeleteAmsIntegrationAccount": { + "tag": "Integration Accounts", + "undo": { + "type": "idempotent" + } + }, + "GetAmsIntegrationAccount": { + "tag": "Integration Accounts", + "undo": { + "type": "safe" + } + }, + "UpdateAmsIntegrationAccount": { + "tag": "Integration Accounts", + "undo": { + "type": "idempotent" + } + }, "GetIPAllowlist": { "tag": "IP Allowlist", "undo": {