From 6686e7a2ebe44029031a24d72554f966dd45cab6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 25 Feb 2026 08:11:52 +0000 Subject: [PATCH] Regenerate client from commit fc31fb4 of spec repo --- .generator/schemas/v2/openapi.yaml | 159 +++++++++++++ .../CreateAWSCloudAuthPersonaMapping.rb | 18 ++ .../DeleteAWSCloudAuthPersonaMapping.rb | 8 + .../GetAWSCloudAuthPersonaMapping.rb | 8 + features/scenarios_model_mapping.rb | 9 + features/v2/cloud_authentication.feature | 62 ++++- features/v2/undo.json | 25 ++ lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 4 + .../v2/api/cloud_authentication_api.rb | 215 ++++++++++++++++++ ..._auth_persona_mapping_create_attributes.rb | 144 ++++++++++++ ..._cloud_auth_persona_mapping_create_data.rb | 144 ++++++++++++ ...oud_auth_persona_mapping_create_request.rb | 123 ++++++++++ ...aws_cloud_auth_persona_mapping_response.rb | 123 ++++++++++ 14 files changed, 1043 insertions(+), 2 deletions(-) create mode 100644 examples/v2/cloud-authentication/CreateAWSCloudAuthPersonaMapping.rb create mode 100644 examples/v2/cloud-authentication/DeleteAWSCloudAuthPersonaMapping.rb create mode 100644 examples/v2/cloud-authentication/GetAWSCloudAuthPersonaMapping.rb create mode 100644 lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 170293cea738..4857ca25ab3d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -929,6 +929,14 @@ components: example: 10 format: int64 type: integer + PersonaMappingID: + description: The ID of the persona mapping + example: c5c758c6-18c2-4484-ae3f-46b84128404a + in: path + name: persona_mapping_id + required: true + schema: + type: string ProductName: description: Name of the product to be deleted, either `logs` or `rum`. in: path @@ -1910,6 +1918,41 @@ components: - account_identifier - account_uuid type: object + AWSCloudAuthPersonaMappingCreateAttributes: + description: Attributes for creating an AWS cloud authentication persona mapping + properties: + account_identifier: + description: Datadog account identifier (email or handle) mapped to the + AWS principal + example: test@test.com + type: string + arn_pattern: + description: AWS IAM ARN pattern to match for authentication + example: arn:aws:iam::123456789012:user/testuser + type: string + required: + - arn_pattern + - account_identifier + type: object + AWSCloudAuthPersonaMappingCreateData: + description: Data for creating an AWS cloud authentication persona mapping + properties: + attributes: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingCreateAttributes' + type: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingType' + required: + - type + - attributes + type: object + AWSCloudAuthPersonaMappingCreateRequest: + description: Request used to create an AWS cloud authentication persona mapping + properties: + data: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingCreateData' + required: + - data + type: object AWSCloudAuthPersonaMappingDataResponse: description: Data for AWS cloud authentication persona mapping response properties: @@ -1926,6 +1969,14 @@ components: - type - attributes type: object + AWSCloudAuthPersonaMappingResponse: + description: Response containing a single AWS cloud authentication persona mapping + properties: + data: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingDataResponse' + required: + - data + type: object AWSCloudAuthPersonaMappingType: description: Type identifier for AWS cloud authentication persona mapping enum: @@ -77100,6 +77151,114 @@ paths: x-unstable: '**Note**: This endpoint is in public beta and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create an AWS cloud authentication persona mapping. This endpoint + associates an AWS IAM principal with a Datadog user. + operationId: CreateAWSCloudAuthPersonaMapping + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create an AWS cloud authentication persona mapping + tags: + - Cloud Authentication + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/cloud_auth/aws/persona_mapping/{persona_mapping_id}: + delete: + description: Delete an AWS cloud authentication persona mapping by ID. This + removes the association between an AWS IAM principal and a Datadog user. + operationId: DeleteAWSCloudAuthPersonaMapping + parameters: + - $ref: '#/components/parameters/PersonaMappingID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an AWS cloud authentication persona mapping + tags: + - Cloud Authentication + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a specific AWS cloud authentication persona mapping by ID. + This endpoint retrieves a single configured persona mapping that associates + an AWS IAM principal with a Datadog user. + operationId: GetAWSCloudAuthPersonaMapping + parameters: + - $ref: '#/components/parameters/PersonaMappingID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCloudAuthPersonaMappingResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get an AWS cloud authentication persona mapping + tags: + - Cloud Authentication + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/cloud_security_management/custom_frameworks: post: description: Create a custom framework. diff --git a/examples/v2/cloud-authentication/CreateAWSCloudAuthPersonaMapping.rb b/examples/v2/cloud-authentication/CreateAWSCloudAuthPersonaMapping.rb new file mode 100644 index 000000000000..a64fe8dfad8c --- /dev/null +++ b/examples/v2/cloud-authentication/CreateAWSCloudAuthPersonaMapping.rb @@ -0,0 +1,18 @@ +# Create an AWS cloud authentication persona mapping returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_aws_cloud_auth_persona_mapping".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudAuthenticationAPI.new + +body = DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateRequest.new({ + data: DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateData.new({ + attributes: DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateAttributes.new({ + account_identifier: "test@test.com", + arn_pattern: "arn:aws:iam::123456789012:user/testuser", + }), + type: DatadogAPIClient::V2::AWSCloudAuthPersonaMappingType::AWS_CLOUD_AUTH_CONFIG, + }), +}) +p api_instance.create_aws_cloud_auth_persona_mapping(body) diff --git a/examples/v2/cloud-authentication/DeleteAWSCloudAuthPersonaMapping.rb b/examples/v2/cloud-authentication/DeleteAWSCloudAuthPersonaMapping.rb new file mode 100644 index 000000000000..c13fd9a0ac59 --- /dev/null +++ b/examples/v2/cloud-authentication/DeleteAWSCloudAuthPersonaMapping.rb @@ -0,0 +1,8 @@ +# Delete an AWS cloud authentication persona mapping returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_aws_cloud_auth_persona_mapping".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudAuthenticationAPI.new +api_instance.delete_aws_cloud_auth_persona_mapping("persona_mapping_id") diff --git a/examples/v2/cloud-authentication/GetAWSCloudAuthPersonaMapping.rb b/examples/v2/cloud-authentication/GetAWSCloudAuthPersonaMapping.rb new file mode 100644 index 000000000000..7cf946962f10 --- /dev/null +++ b/examples/v2/cloud-authentication/GetAWSCloudAuthPersonaMapping.rb @@ -0,0 +1,8 @@ +# Get an AWS cloud authentication persona mapping returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_aws_cloud_auth_persona_mapping".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudAuthenticationAPI.new +p api_instance.get_aws_cloud_auth_persona_mapping("persona_mapping_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index cba0763550fb..a3adeb7f1492 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1411,6 +1411,15 @@ "v2.SearchCIAppTestEvents" => { "body" => "CIAppTestEventsRequest", }, + "v2.CreateAWSCloudAuthPersonaMapping" => { + "body" => "AWSCloudAuthPersonaMappingCreateRequest", + }, + "v2.DeleteAWSCloudAuthPersonaMapping" => { + "persona_mapping_id" => "String", + }, + "v2.GetAWSCloudAuthPersonaMapping" => { + "persona_mapping_id" => "String", + }, "v2.CreateCustomFramework" => { "body" => "CreateCustomFrameworkRequest", }, diff --git a/features/v2/cloud_authentication.feature b/features/v2/cloud_authentication.feature index fe9eb594a733..c444f1469c23 100644 --- a/features/v2/cloud_authentication.feature +++ b/features/v2/cloud_authentication.feature @@ -7,15 +7,73 @@ Feature: Cloud Authentication Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "CloudAuthentication" API - And operation "ListAWSCloudAuthPersonaMappings" enabled - And new "ListAWSCloudAuthPersonaMappings" request + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Create an AWS cloud authentication persona mapping returns "Bad Request" response + Given operation "CreateAWSCloudAuthPersonaMapping" enabled + And new "CreateAWSCloudAuthPersonaMapping" request + And body with value {"data": {"attributes": {"account_identifier": "test@test.com", "arn_pattern": "arn:aws:iam::123456789012:user/testuser"}, "type": "aws_cloud_auth_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Create an AWS cloud authentication persona mapping returns "Conflict" response + Given operation "CreateAWSCloudAuthPersonaMapping" enabled + And new "CreateAWSCloudAuthPersonaMapping" request + And body with value {"data": {"attributes": {"account_identifier": "test@test.com", "arn_pattern": "arn:aws:iam::123456789012:user/testuser"}, "type": "aws_cloud_auth_config"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Create an AWS cloud authentication persona mapping returns "Created" response + Given operation "CreateAWSCloudAuthPersonaMapping" enabled + And new "CreateAWSCloudAuthPersonaMapping" request + And body with value {"data": {"attributes": {"account_identifier": "test@test.com", "arn_pattern": "arn:aws:iam::123456789012:user/testuser"}, "type": "aws_cloud_auth_config"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Delete an AWS cloud authentication persona mapping returns "No Content" response + Given operation "DeleteAWSCloudAuthPersonaMapping" enabled + And new "DeleteAWSCloudAuthPersonaMapping" request + And request contains "persona_mapping_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Delete an AWS cloud authentication persona mapping returns "Not Found" response + Given operation "DeleteAWSCloudAuthPersonaMapping" enabled + And new "DeleteAWSCloudAuthPersonaMapping" request + And request contains "persona_mapping_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Get an AWS cloud authentication persona mapping returns "Not Found" response + Given operation "GetAWSCloudAuthPersonaMapping" enabled + And new "GetAWSCloudAuthPersonaMapping" request + And request contains "persona_mapping_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/team-aaaauthn + Scenario: Get an AWS cloud authentication persona mapping returns "OK" response + Given operation "GetAWSCloudAuthPersonaMapping" enabled + And new "GetAWSCloudAuthPersonaMapping" request + And request contains "persona_mapping_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK @generated @skip @team:DataDog/team-aaaauthn Scenario: List AWS cloud authentication persona mappings returns "Bad Request" response + Given operation "ListAWSCloudAuthPersonaMappings" enabled + And new "ListAWSCloudAuthPersonaMappings" request When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/team-aaaauthn Scenario: List AWS cloud authentication persona mappings returns "OK" response + Given operation "ListAWSCloudAuthPersonaMappings" enabled + And new "ListAWSCloudAuthPersonaMappings" request When the request is sent Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 6bcb5be0aecb..3b052977c20b 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1060,6 +1060,31 @@ "type": "safe" } }, + "CreateAWSCloudAuthPersonaMapping": { + "tag": "Cloud Authentication", + "undo": { + "operationId": "DeleteAWSCloudAuthPersonaMapping", + "parameters": [ + { + "name": "persona_mapping_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteAWSCloudAuthPersonaMapping": { + "tag": "Cloud Authentication", + "undo": { + "type": "idempotent" + } + }, + "GetAWSCloudAuthPersonaMapping": { + "tag": "Cloud Authentication", + "undo": { + "type": "safe" + } + }, "CreateCustomFramework": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 93efe2688a3c..c505a45a5b17 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -221,6 +221,9 @@ def initialize "v2.get_change_request": false, "v2.update_change_request": false, "v2.update_change_request_decision": false, + "v2.create_aws_cloud_auth_persona_mapping": false, + "v2.delete_aws_cloud_auth_persona_mapping": false, + "v2.get_aws_cloud_auth_persona_mapping": false, "v2.list_aws_cloud_auth_persona_mappings": false, "v2.activate_content_pack": false, "v2.cancel_threat_hunting_job": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 938494f8610d..ce85a5f7467f 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1235,7 +1235,11 @@ def overrides "v2.aws_auth_config_keys" => "AWSAuthConfigKeys", "v2.aws_auth_config_role" => "AWSAuthConfigRole", "v2.aws_cloud_auth_persona_mapping_attributes_response" => "AWSCloudAuthPersonaMappingAttributesResponse", + "v2.aws_cloud_auth_persona_mapping_create_attributes" => "AWSCloudAuthPersonaMappingCreateAttributes", + "v2.aws_cloud_auth_persona_mapping_create_data" => "AWSCloudAuthPersonaMappingCreateData", + "v2.aws_cloud_auth_persona_mapping_create_request" => "AWSCloudAuthPersonaMappingCreateRequest", "v2.aws_cloud_auth_persona_mapping_data_response" => "AWSCloudAuthPersonaMappingDataResponse", + "v2.aws_cloud_auth_persona_mapping_response" => "AWSCloudAuthPersonaMappingResponse", "v2.aws_cloud_auth_persona_mappings_response" => "AWSCloudAuthPersonaMappingsResponse", "v2.aws_cloud_auth_persona_mapping_type" => "AWSCloudAuthPersonaMappingType", "v2.aws_credentials" => "AWSCredentials", diff --git a/lib/datadog_api_client/v2/api/cloud_authentication_api.rb b/lib/datadog_api_client/v2/api/cloud_authentication_api.rb index 4cee6a79cf89..477397facab7 100644 --- a/lib/datadog_api_client/v2/api/cloud_authentication_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_authentication_api.rb @@ -23,6 +23,221 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Create an AWS cloud authentication persona mapping. + # + # @see #create_aws_cloud_auth_persona_mapping_with_http_info + def create_aws_cloud_auth_persona_mapping(body, opts = {}) + data, _status_code, _headers = create_aws_cloud_auth_persona_mapping_with_http_info(body, opts) + data + end + + # Create an AWS cloud authentication persona mapping. + # + # Create an AWS cloud authentication persona mapping. This endpoint associates an AWS IAM principal with a Datadog user. + # + # @param body [AWSCloudAuthPersonaMappingCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(AWSCloudAuthPersonaMappingResponse, Integer, Hash)>] AWSCloudAuthPersonaMappingResponse data, response status code and response headers + def create_aws_cloud_auth_persona_mapping_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_aws_cloud_auth_persona_mapping".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_aws_cloud_auth_persona_mapping") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_aws_cloud_auth_persona_mapping")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudAuthenticationAPI.create_aws_cloud_auth_persona_mapping ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CloudAuthenticationAPI.create_aws_cloud_auth_persona_mapping" + end + # resource path + local_var_path = '/api/v2/cloud_auth/aws/persona_mapping' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AWSCloudAuthPersonaMappingResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_aws_cloud_auth_persona_mapping, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudAuthenticationAPI#create_aws_cloud_auth_persona_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an AWS cloud authentication persona mapping. + # + # @see #delete_aws_cloud_auth_persona_mapping_with_http_info + def delete_aws_cloud_auth_persona_mapping(persona_mapping_id, opts = {}) + delete_aws_cloud_auth_persona_mapping_with_http_info(persona_mapping_id, opts) + nil + end + + # Delete an AWS cloud authentication persona mapping. + # + # Delete an AWS cloud authentication persona mapping by ID. This removes the association between an AWS IAM principal and a Datadog user. + # + # @param persona_mapping_id [String] The ID of the persona mapping + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_aws_cloud_auth_persona_mapping_with_http_info(persona_mapping_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_aws_cloud_auth_persona_mapping".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_aws_cloud_auth_persona_mapping") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_aws_cloud_auth_persona_mapping")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudAuthenticationAPI.delete_aws_cloud_auth_persona_mapping ...' + end + # verify the required parameter 'persona_mapping_id' is set + if @api_client.config.client_side_validation && persona_mapping_id.nil? + fail ArgumentError, "Missing the required parameter 'persona_mapping_id' when calling CloudAuthenticationAPI.delete_aws_cloud_auth_persona_mapping" + end + # resource path + local_var_path = '/api/v2/cloud_auth/aws/persona_mapping/{persona_mapping_id}'.sub('{persona_mapping_id}', CGI.escape(persona_mapping_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_aws_cloud_auth_persona_mapping, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudAuthenticationAPI#delete_aws_cloud_auth_persona_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an AWS cloud authentication persona mapping. + # + # @see #get_aws_cloud_auth_persona_mapping_with_http_info + def get_aws_cloud_auth_persona_mapping(persona_mapping_id, opts = {}) + data, _status_code, _headers = get_aws_cloud_auth_persona_mapping_with_http_info(persona_mapping_id, opts) + data + end + + # Get an AWS cloud authentication persona mapping. + # + # Get a specific AWS cloud authentication persona mapping by ID. This endpoint retrieves a single configured persona mapping that associates an AWS IAM principal with a Datadog user. + # + # @param persona_mapping_id [String] The ID of the persona mapping + # @param opts [Hash] the optional parameters + # @return [Array<(AWSCloudAuthPersonaMappingResponse, Integer, Hash)>] AWSCloudAuthPersonaMappingResponse data, response status code and response headers + def get_aws_cloud_auth_persona_mapping_with_http_info(persona_mapping_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_aws_cloud_auth_persona_mapping".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_aws_cloud_auth_persona_mapping") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_aws_cloud_auth_persona_mapping")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudAuthenticationAPI.get_aws_cloud_auth_persona_mapping ...' + end + # verify the required parameter 'persona_mapping_id' is set + if @api_client.config.client_side_validation && persona_mapping_id.nil? + fail ArgumentError, "Missing the required parameter 'persona_mapping_id' when calling CloudAuthenticationAPI.get_aws_cloud_auth_persona_mapping" + end + # resource path + local_var_path = '/api/v2/cloud_auth/aws/persona_mapping/{persona_mapping_id}'.sub('{persona_mapping_id}', CGI.escape(persona_mapping_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AWSCloudAuthPersonaMappingResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_aws_cloud_auth_persona_mapping, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudAuthenticationAPI#get_aws_cloud_auth_persona_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List AWS cloud authentication persona mappings. # # @see #list_aws_cloud_auth_persona_mappings_with_http_info diff --git a/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_attributes.rb b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_attributes.rb new file mode 100644 index 000000000000..de60c4b699c6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_attributes.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating an AWS cloud authentication persona mapping + class AWSCloudAuthPersonaMappingCreateAttributes + include BaseGenericModel + + # Datadog account identifier (email or handle) mapped to the AWS principal + attr_reader :account_identifier + + # AWS IAM ARN pattern to match for authentication + attr_reader :arn_pattern + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_identifier' => :'account_identifier', + :'arn_pattern' => :'arn_pattern' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_identifier' => :'String', + :'arn_pattern' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account_identifier') + self.account_identifier = attributes[:'account_identifier'] + end + + if attributes.key?(:'arn_pattern') + self.arn_pattern = attributes[:'arn_pattern'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account_identifier.nil? + return false if @arn_pattern.nil? + true + end + + # Custom attribute writer method with validation + # @param account_identifier [Object] Object to be assigned + # @!visibility private + def account_identifier=(account_identifier) + if account_identifier.nil? + fail ArgumentError, 'invalid value for "account_identifier", account_identifier cannot be nil.' + end + @account_identifier = account_identifier + end + + # Custom attribute writer method with validation + # @param arn_pattern [Object] Object to be assigned + # @!visibility private + def arn_pattern=(arn_pattern) + if arn_pattern.nil? + fail ArgumentError, 'invalid value for "arn_pattern", arn_pattern cannot be nil.' + end + @arn_pattern = arn_pattern + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_identifier == o.account_identifier && + arn_pattern == o.arn_pattern && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_identifier, arn_pattern, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_data.rb b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_data.rb new file mode 100644 index 000000000000..2e1f02c76241 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating an AWS cloud authentication persona mapping + class AWSCloudAuthPersonaMappingCreateData + include BaseGenericModel + + # Attributes for creating an AWS cloud authentication persona mapping + attr_reader :attributes + + # Type identifier for AWS cloud authentication persona mapping + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AWSCloudAuthPersonaMappingCreateAttributes', + :'type' => :'AWSCloudAuthPersonaMappingType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_request.rb b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_request.rb new file mode 100644 index 000000000000..9c8d383e622e --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request used to create an AWS cloud authentication persona mapping + class AWSCloudAuthPersonaMappingCreateRequest + include BaseGenericModel + + # Data for creating an AWS cloud authentication persona mapping + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AWSCloudAuthPersonaMappingCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSCloudAuthPersonaMappingCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_response.rb b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_response.rb new file mode 100644 index 000000000000..cb87d22b3bd4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_cloud_auth_persona_mapping_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single AWS cloud authentication persona mapping + class AWSCloudAuthPersonaMappingResponse + include BaseGenericModel + + # Data for AWS cloud authentication persona mapping response + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AWSCloudAuthPersonaMappingDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSCloudAuthPersonaMappingResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end