diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5c3583f640a4..3c5f7289ed39 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -55468,6 +55468,40 @@ components: type: string x-enum-varnames: - MANAGED_ORGS + MaxSessionDurationType: + description: Data type of a maximum session duration update. + enum: [max_session_duration] + example: max_session_duration + type: string + x-enum-varnames: + - MAX_SESSION_DURATION + MaxSessionDurationUpdateAttributes: + description: Attributes for the maximum session duration update request. + properties: + max_session_duration: + description: The maximum session duration, in seconds. + example: 604800 + format: int64 + minimum: 1 + type: integer + required: [max_session_duration] + type: object + MaxSessionDurationUpdateData: + description: The data object for a maximum session duration update request. + properties: + attributes: + $ref: "#/components/schemas/MaxSessionDurationUpdateAttributes" + type: + $ref: "#/components/schemas/MaxSessionDurationType" + required: [type, attributes] + type: object + MaxSessionDurationUpdateRequest: + description: A request to update the maximum session duration for an organization. + properties: + data: + $ref: "#/components/schemas/MaxSessionDurationUpdateData" + required: [data] + type: object McpScanRequest: description: The top-level request object for submitting an MCP SCA dependency scan. properties: @@ -143303,6 +143337,47 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/login/org_configs/max_session_duration: + put: + description: |- + Update the maximum session duration for the current organization. + The duration is specified in seconds. + operationId: UpdateLoginOrgConfigsMaxSessionDuration + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + max_session_duration: 604800 + type: max_session_duration + schema: + $ref: "#/components/schemas/MaxSessionDurationUpdateRequest" + required: true + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Update the maximum session duration + tags: [Organizations] + "x-permission": + operator: OR + permissions: + - org_management /api/v2/logs: post: description: |- diff --git a/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.rb b/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.rb new file mode 100644 index 000000000000..31e916298798 --- /dev/null +++ b/examples/v2/organizations/UpdateLoginOrgConfigsMaxSessionDuration.rb @@ -0,0 +1,14 @@ +# Update the maximum session duration returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OrganizationsAPI.new + +body = DatadogAPIClient::V2::MaxSessionDurationUpdateRequest.new({ + data: DatadogAPIClient::V2::MaxSessionDurationUpdateData.new({ + attributes: DatadogAPIClient::V2::MaxSessionDurationUpdateAttributes.new({ + max_session_duration: 604800, + }), + type: DatadogAPIClient::V2::MaxSessionDurationType::MAX_SESSION_DURATION, + }), +}) +api_instance.update_login_org_configs_max_session_duration(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e7a9cabb15f7..33fda534113e 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3220,6 +3220,9 @@ "page_limit" => "Integer", "page_cursor" => "String", }, + "v2.UpdateLoginOrgConfigsMaxSessionDuration" => { + "body" => "MaxSessionDurationUpdateRequest", + }, "v2.ListOrgs" => { "filter_name" => "String", }, diff --git a/features/v2/organizations.feature b/features/v2/organizations.feature index 217e7bd2e259..a8ed63ab7e61 100644 --- a/features/v2/organizations.feature +++ b/features/v2/organizations.feature @@ -168,6 +168,20 @@ Feature: Organizations When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Update the maximum session duration returns "Bad Request" response + Given new "UpdateLoginOrgConfigsMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 604800}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Update the maximum session duration returns "No Content" response + Given new "UpdateLoginOrgConfigsMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 604800}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 204 No Content + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/delegated-auth-login Scenario: Upload IdP metadata returns "Bad Request - caused by either malformed XML or invalid SAML IdP metadata" response Given new "UploadIdPMetadata" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 7b182ad052fe..54f20db64607 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4560,6 +4560,12 @@ "type": "safe" } }, + "UpdateLoginOrgConfigsMaxSessionDuration": { + "tag": "Organizations", + "undo": { + "type": "idempotent" + } + }, "SubmitLog": { "tag": "Logs", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 01075bebd96d..3f257b7d4490 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4416,6 +4416,10 @@ def overrides "v2.managed_orgs_relationship_to_orgs" => "ManagedOrgsRelationshipToOrgs", "v2.managed_orgs_response" => "ManagedOrgsResponse", "v2.managed_orgs_type" => "ManagedOrgsType", + "v2.max_session_duration_type" => "MaxSessionDurationType", + "v2.max_session_duration_update_attributes" => "MaxSessionDurationUpdateAttributes", + "v2.max_session_duration_update_data" => "MaxSessionDurationUpdateData", + "v2.max_session_duration_update_request" => "MaxSessionDurationUpdateRequest", "v2.mcp_scan_request" => "McpScanRequest", "v2.mcp_scan_request_data" => "McpScanRequestData", "v2.mcp_scan_request_data_attributes" => "McpScanRequestDataAttributes", diff --git a/lib/datadog_api_client/v2/api/organizations_api.rb b/lib/datadog_api_client/v2/api/organizations_api.rb index c23657cac9b4..899b509d65a4 100644 --- a/lib/datadog_api_client/v2/api/organizations_api.rb +++ b/lib/datadog_api_client/v2/api/organizations_api.rb @@ -432,6 +432,74 @@ def list_saml_configurations_with_http_info(opts = {}) return data, status_code, headers end + # Update the maximum session duration. + # + # @see #update_login_org_configs_max_session_duration_with_http_info + def update_login_org_configs_max_session_duration(body, opts = {}) + update_login_org_configs_max_session_duration_with_http_info(body, opts) + nil + end + + # Update the maximum session duration. + # + # Update the maximum session duration for the current organization. + # The duration is specified in seconds. + # + # @param body [MaxSessionDurationUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_login_org_configs_max_session_duration_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsAPI.update_login_org_configs_max_session_duration ...' + 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 OrganizationsAPI.update_login_org_configs_max_session_duration" + end + # resource path + local_var_path = '/api/v2/login/org_configs/max_session_duration' + + # 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(['*/*']) + # 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] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_login_org_configs_max_session_duration, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsAPI#update_login_org_configs_max_session_duration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a specific Org Config. # # @see #update_org_config_with_http_info diff --git a/lib/datadog_api_client/v2/models/max_session_duration_type.rb b/lib/datadog_api_client/v2/models/max_session_duration_type.rb new file mode 100644 index 000000000000..0dea559b866e --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_type.rb @@ -0,0 +1,26 @@ +=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 type of a maximum session duration update. + class MaxSessionDurationType + include BaseEnumModel + + MAX_SESSION_DURATION = "max_session_duration".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/max_session_duration_update_attributes.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_attributes.rb new file mode 100644 index 000000000000..ef8564ead394 --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_attributes.rb @@ -0,0 +1,127 @@ +=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 the maximum session duration update request. + class MaxSessionDurationUpdateAttributes + include BaseGenericModel + + # The maximum session duration, in seconds. + attr_reader :max_session_duration + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'max_session_duration' => :'max_session_duration' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'max_session_duration' => :'Integer' + } + 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::MaxSessionDurationUpdateAttributes` 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?(:'max_session_duration') + self.max_session_duration = attributes[:'max_session_duration'] + 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 @max_session_duration.nil? + return false if @max_session_duration < 1 + true + end + + # Custom attribute writer method with validation + # @param max_session_duration [Object] Object to be assigned + # @!visibility private + def max_session_duration=(max_session_duration) + if max_session_duration.nil? + fail ArgumentError, 'invalid value for "max_session_duration", max_session_duration cannot be nil.' + end + if max_session_duration < 1 + fail ArgumentError, 'invalid value for "max_session_duration", must be greater than or equal to 1.' + end + @max_session_duration = max_session_duration + 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 && + max_session_duration == o.max_session_duration && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [max_session_duration, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/max_session_duration_update_data.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_data.rb new file mode 100644 index 000000000000..94f73ef3755b --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_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 + # The data object for a maximum session duration update request. + class MaxSessionDurationUpdateData + include BaseGenericModel + + # Attributes for the maximum session duration update request. + attr_reader :attributes + + # Data type of a maximum session duration update. + 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' => :'MaxSessionDurationUpdateAttributes', + :'type' => :'MaxSessionDurationType' + } + 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::MaxSessionDurationUpdateData` 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/max_session_duration_update_request.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_request.rb new file mode 100644 index 000000000000..a2b3cd6025b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_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 + # A request to update the maximum session duration for an organization. + class MaxSessionDurationUpdateRequest + include BaseGenericModel + + # The data object for a maximum session duration update request. + 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' => :'MaxSessionDurationUpdateData' + } + 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::MaxSessionDurationUpdateRequest` 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