diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b8661d93ff71..5171427b1d05 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -35189,6 +35189,49 @@ components: - ms_channel_name - redirect_url type: object + MaxSessionDurationUpdateAttributes: + description: Attributes for updating maximum session duration. + properties: + max_session_duration: + description: 'Maximum session duration in seconds. Must not exceed 30 days + (2592000 seconds). + + Note: Government cloud environments are limited to 24 hours (86400 seconds).' + example: 60 + format: int64 + maximum: 2592000 + minimum: 1 + type: integer + required: + - max_session_duration + type: object + MaxSessionDurationUpdateRequest: + description: Request to update the maximum session duration. + properties: + data: + $ref: '#/components/schemas/MaxSessionDurationUpdateRequestData' + required: + - data + type: object + MaxSessionDurationUpdateRequestData: + description: Data wrapper for maximum session duration update. + properties: + attributes: + $ref: '#/components/schemas/MaxSessionDurationUpdateAttributes' + type: + $ref: '#/components/schemas/MaxSessionDurationUpdateRequestDataType' + required: + - type + - attributes + type: object + MaxSessionDurationUpdateRequestDataType: + description: Type of the resource. + enum: + - max_session_duration + example: max_session_duration + type: string + x-enum-varnames: + - MAX_SESSION_DURATION MemberTeam: description: A member team properties: @@ -51260,6 +51303,65 @@ components: example: report_id type: string type: object + SamlConfigurationsUpdateAttributes: + description: Attributes for updating SAML preferences. + properties: + default_role_uuids: + description: List of role UUIDs to assign to JIT-provisioned users. Exactly + 1 role is required. + example: + - 19fcc38b-b651-46a0-b463-1f8f56c6a862 + items: + format: uuid + type: string + maxItems: 1 + minItems: 1 + type: array + jit_domains: + description: 'List of domains for Just-In-Time user provisioning. Maximum + 50 domains. + + Each domain must be between 1 and 256 characters.' + example: + - example1.com + - example2.com + items: + maxLength: 256 + minLength: 1 + type: string + maxItems: 50 + type: array + required: + - jit_domains + - default_role_uuids + type: object + SamlConfigurationsUpdateRequest: + description: Request to update organization SAML preferences. + properties: + data: + $ref: '#/components/schemas/SamlConfigurationsUpdateRequestData' + required: + - data + type: object + SamlConfigurationsUpdateRequestData: + description: Data wrapper for SAML preferences update. + properties: + attributes: + $ref: '#/components/schemas/SamlConfigurationsUpdateAttributes' + type: + $ref: '#/components/schemas/SamlConfigurationsUpdateRequestDataType' + required: + - type + - attributes + type: object + SamlConfigurationsUpdateRequestDataType: + description: Type of the resource. + enum: + - saml_preferences + example: saml_preferences + type: string + x-enum-varnames: + - SAML_PREFERENCES ScaRequest: properties: data: @@ -82887,6 +82989,61 @@ paths: operator: OR permissions: - org_management + /api/v2/login/org_configs/max_session_duration: + put: + description: 'Updates the maximum session duration for an organization. This + controls how long user sessions + + can remain active before requiring re-authentication. The value must not exceed + 30 days (2592000 seconds). + + Note: Government cloud environments are limited to 24 hours (86400 seconds). + + + Requires `org_management` permission and a session that has been active within + the last 12 hours.' + operationId: UpdateLoginOrgConfigMaxSessionDuration + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MaxSessionDurationUpdateRequest' + required: true + responses: + '204': + description: No Content - The maximum session duration was successfully + updated. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: Update maximum session duration + tags: + - Organizations + x-unstable: This endpoint is in public beta. If you have any feedback, contact + [Datadog support](https://docs.datadoghq.com/help/). /api/v2/logs: post: description: 'Send your logs to your Datadog platform over HTTP. Limits per @@ -87801,6 +87958,64 @@ paths: operator: OR permissions: - on_call_read + /api/v2/org/saml_configurations: + patch: + description: 'Updates SAML preferences for an organization, including JIT provisioning + domains and default role assignments. + + + This endpoint allows you to configure: + + - `jit_domains`: List of domains for Just-In-Time user provisioning (up to + 50 domains, 1-256 characters each) + + - `default_role_uuids`: List of role UUIDs to assign to JIT-provisioned users + (exactly 1 role required) + + + Requires `org_management` permission. This endpoint is gated by the `org-saml-preferences-api-gate` + experiment.' + operationId: UpdateOrgSamlConfigurations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SamlConfigurationsUpdateRequest' + required: true + responses: + '204': + description: No Content - The SAML preferences were successfully updated. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: Update organization SAML preferences + tags: + - Organizations + x-unstable: This endpoint is in public beta. If you have any feedback, contact + [Datadog support](https://docs.datadoghq.com/help/). /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). diff --git a/examples/v2/organizations/UpdateLoginOrgConfigMaxSessionDuration.rb b/examples/v2/organizations/UpdateLoginOrgConfigMaxSessionDuration.rb new file mode 100644 index 000000000000..184ed011e76e --- /dev/null +++ b/examples/v2/organizations/UpdateLoginOrgConfigMaxSessionDuration.rb @@ -0,0 +1,17 @@ +# Update maximum session duration returns "No Content - The maximum session duration was successfully updated." response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_login_org_config_max_session_duration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OrganizationsAPI.new + +body = DatadogAPIClient::V2::MaxSessionDurationUpdateRequest.new({ + data: DatadogAPIClient::V2::MaxSessionDurationUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::MaxSessionDurationUpdateAttributes.new({ + max_session_duration: 60, + }), + type: DatadogAPIClient::V2::MaxSessionDurationUpdateRequestDataType::MAX_SESSION_DURATION, + }), +}) +api_instance.update_login_org_config_max_session_duration(body) diff --git a/examples/v2/organizations/UpdateOrgSamlConfigurations.rb b/examples/v2/organizations/UpdateOrgSamlConfigurations.rb new file mode 100644 index 000000000000..fc1ad7f25a90 --- /dev/null +++ b/examples/v2/organizations/UpdateOrgSamlConfigurations.rb @@ -0,0 +1,23 @@ +# Update organization SAML preferences returns "No Content - The SAML preferences were successfully updated." response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_org_saml_configurations".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OrganizationsAPI.new + +body = DatadogAPIClient::V2::SamlConfigurationsUpdateRequest.new({ + data: DatadogAPIClient::V2::SamlConfigurationsUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::SamlConfigurationsUpdateAttributes.new({ + default_role_uuids: [ + "19fcc38b-b651-46a0-b463-1f8f56c6a862", + ], + jit_domains: [ + "example1.com", + "example2.com", + ], + }), + type: DatadogAPIClient::V2::SamlConfigurationsUpdateRequestDataType::SAML_PREFERENCES, + }), +}) +api_instance.update_org_saml_configurations(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 47cf73e30458..2b61a718be4f 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2538,6 +2538,22 @@ "v2.UpdateIPAllowlist" => { "body" => "IPAllowlistUpdateRequest", }, + "v2.UpdateLoginOrgConfigMaxSessionDuration" => { + "body" => "MaxSessionDurationUpdateRequest", + }, + "v2.UpdateOrgSamlConfigurations" => { + "body" => "SamlConfigurationsUpdateRequest", + }, + "v2.GetOrgConfig" => { + "org_config_name" => "String", + }, + "v2.UpdateOrgConfig" => { + "org_config_name" => "String", + "body" => "OrgConfigWriteRequest", + }, + "v2.UploadIdPMetadata" => { + "idp_file" => "File", + }, "v2.SubmitLog" => { "content_encoding" => "ContentEncoding", "ddtags" => "String", @@ -2933,16 +2949,6 @@ "v2.ResolveOnCallPage" => { "page_id" => "UUID", }, - "v2.GetOrgConfig" => { - "org_config_name" => "String", - }, - "v2.UpdateOrgConfig" => { - "org_config_name" => "String", - "body" => "OrgConfigWriteRequest", - }, - "v2.UploadIdPMetadata" => { - "idp_file" => "File", - }, "v2.ListOrgConnections" => { "sink_org_id" => "String", "source_org_id" => "String", diff --git a/features/v2/organizations.feature b/features/v2/organizations.feature index ddec7484e764..3c8445d660d2 100644 --- a/features/v2/organizations.feature +++ b/features/v2/organizations.feature @@ -65,6 +65,38 @@ Feature: Organizations When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Update maximum session duration returns "Bad Request" response + Given operation "UpdateLoginOrgConfigMaxSessionDuration" enabled + And new "UpdateLoginOrgConfigMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 60}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Update maximum session duration returns "No Content - The maximum session duration was successfully updated." response + Given operation "UpdateLoginOrgConfigMaxSessionDuration" enabled + And new "UpdateLoginOrgConfigMaxSessionDuration" request + And body with value {"data": {"attributes": {"max_session_duration": 60}, "type": "max_session_duration"}} + When the request is sent + Then the response status is 204 No Content - The maximum session duration was successfully updated. + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Update organization SAML preferences returns "Bad Request" response + Given operation "UpdateOrgSamlConfigurations" enabled + And new "UpdateOrgSamlConfigurations" request + And body with value {"data": {"attributes": {"default_role_uuids": ["19fcc38b-b651-46a0-b463-1f8f56c6a862"], "jit_domains": ["example1.com", "example2.com"]}, "type": "saml_preferences"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Update organization SAML preferences returns "No Content - The SAML preferences were successfully updated." response + Given operation "UpdateOrgSamlConfigurations" enabled + And new "UpdateOrgSamlConfigurations" request + And body with value {"data": {"attributes": {"default_role_uuids": ["19fcc38b-b651-46a0-b463-1f8f56c6a862"], "jit_domains": ["example1.com", "example2.com"]}, "type": "saml_preferences"}} + When the request is sent + Then the response status is 204 No Content - The SAML preferences were successfully updated. + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/team-aaa-identity 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 5727d36b9564..d3ad35820fca 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2696,6 +2696,12 @@ "type": "idempotent" } }, + "UpdateLoginOrgConfigMaxSessionDuration": { + "tag": "Organizations", + "undo": { + "type": "idempotent" + } + }, "SubmitLog": { "tag": "Logs", "undo": { @@ -3419,6 +3425,12 @@ "type": "safe" } }, + "UpdateOrgSamlConfigurations": { + "tag": "Organizations", + "undo": { + "type": "idempotent" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index c974274efe3a..4c4684a48f12 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -321,6 +321,8 @@ def initialize "v2.list_service_now_templates": false, "v2.list_service_now_users": false, "v2.update_service_now_template": false, + "v2.update_login_org_config_max_session_duration": false, + "v2.update_org_saml_configurations": false, "v2.add_role_to_restriction_query": false, "v2.create_restriction_query": false, "v2.delete_restriction_query": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4ee5a6461c44..f260d418e1fd 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3137,6 +3137,10 @@ def overrides "v2.logs_storage_tier" => "LogsStorageTier", "v2.logs_warning" => "LogsWarning", "v2.log_type" => "LogType", + "v2.max_session_duration_update_attributes" => "MaxSessionDurationUpdateAttributes", + "v2.max_session_duration_update_request" => "MaxSessionDurationUpdateRequest", + "v2.max_session_duration_update_request_data" => "MaxSessionDurationUpdateRequestData", + "v2.max_session_duration_update_request_data_type" => "MaxSessionDurationUpdateRequestDataType", "v2.member_team" => "MemberTeam", "v2.member_team_type" => "MemberTeamType", "v2.metadata" => "Metadata", @@ -4177,6 +4181,10 @@ def overrides "v2.saml_assertion_attribute" => "SAMLAssertionAttribute", "v2.saml_assertion_attribute_attributes" => "SAMLAssertionAttributeAttributes", "v2.saml_assertion_attributes_type" => "SAMLAssertionAttributesType", + "v2.saml_configurations_update_attributes" => "SamlConfigurationsUpdateAttributes", + "v2.saml_configurations_update_request" => "SamlConfigurationsUpdateRequest", + "v2.saml_configurations_update_request_data" => "SamlConfigurationsUpdateRequestData", + "v2.saml_configurations_update_request_data_type" => "SamlConfigurationsUpdateRequestDataType", "v2.sbom" => "SBOM", "v2.sbom_attributes" => "SBOMAttributes", "v2.sbom_component" => "SBOMComponent", diff --git a/lib/datadog_api_client/v2/api/organizations_api.rb b/lib/datadog_api_client/v2/api/organizations_api.rb index 81c96e3eb18d..a715ec218221 100644 --- a/lib/datadog_api_client/v2/api/organizations_api.rb +++ b/lib/datadog_api_client/v2/api/organizations_api.rb @@ -148,6 +148,83 @@ def list_org_configs_with_http_info(opts = {}) return data, status_code, headers end + # Update maximum session duration. + # + # @see #update_login_org_config_max_session_duration_with_http_info + def update_login_org_config_max_session_duration(body, opts = {}) + update_login_org_config_max_session_duration_with_http_info(body, opts) + nil + end + + # Update maximum session duration. + # + # Updates the maximum session duration for an organization. This controls how long user sessions + # can remain active before requiring re-authentication. The value must not exceed 30 days (2592000 seconds). + # Note: Government cloud environments are limited to 24 hours (86400 seconds). + # + # Requires `org_management` permission and a session that has been active within the last 12 hours. + # + # @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_config_max_session_duration_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_login_org_config_max_session_duration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_login_org_config_max_session_duration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_login_org_config_max_session_duration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsAPI.update_login_org_config_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_config_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] + + new_options = opts.merge( + :operation => :update_login_org_config_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_config_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 @@ -220,6 +297,85 @@ def update_org_config_with_http_info(org_config_name, body, opts = {}) return data, status_code, headers end + # Update organization SAML preferences. + # + # @see #update_org_saml_configurations_with_http_info + def update_org_saml_configurations(body, opts = {}) + update_org_saml_configurations_with_http_info(body, opts) + nil + end + + # Update organization SAML preferences. + # + # Updates SAML preferences for an organization, including JIT provisioning domains and default role assignments. + # + # This endpoint allows you to configure: + # - `jit_domains`: List of domains for Just-In-Time user provisioning (up to 50 domains, 1-256 characters each) + # - `default_role_uuids`: List of role UUIDs to assign to JIT-provisioned users (exactly 1 role required) + # + # Requires `org_management` permission. This endpoint is gated by the `org-saml-preferences-api-gate` experiment. + # + # @param body [SamlConfigurationsUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_org_saml_configurations_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_org_saml_configurations".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_org_saml_configurations") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_org_saml_configurations")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsAPI.update_org_saml_configurations ...' + 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_org_saml_configurations" + end + # resource path + local_var_path = '/api/v2/org/saml_configurations' + + # 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] + + new_options = opts.merge( + :operation => :update_org_saml_configurations, + :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::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsAPI#update_org_saml_configurations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Upload IdP metadata. # # @see #upload_idp_metadata_with_http_info 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..8fc9475fcae2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_attributes.rb @@ -0,0 +1,132 @@ +=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 updating maximum session duration. + class MaxSessionDurationUpdateAttributes + include BaseGenericModel + + # Maximum session duration in seconds. Must not exceed 30 days (2592000 seconds). + # Note: Government cloud environments are limited to 24 hours (86400 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 > 2592000 + 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 > 2592000 + fail ArgumentError, 'invalid value for "max_session_duration", must be smaller than or equal to 2592000.' + 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_request.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_request.rb new file mode 100644 index 000000000000..e5a655b061aa --- /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 + # Request to update the maximum session duration. + class MaxSessionDurationUpdateRequest + include BaseGenericModel + + # Data wrapper for maximum session duration update. + 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' => :'MaxSessionDurationUpdateRequestData' + } + 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 diff --git a/lib/datadog_api_client/v2/models/max_session_duration_update_request_data.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_request_data.rb new file mode 100644 index 000000000000..df28a88a6bfb --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_request_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 wrapper for maximum session duration update. + class MaxSessionDurationUpdateRequestData + include BaseGenericModel + + # Attributes for updating maximum session duration. + attr_reader :attributes + + # Type of the resource. + 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' => :'MaxSessionDurationUpdateRequestDataType' + } + 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::MaxSessionDurationUpdateRequestData` 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_data_type.rb b/lib/datadog_api_client/v2/models/max_session_duration_update_request_data_type.rb new file mode 100644 index 000000000000..cde65adc162a --- /dev/null +++ b/lib/datadog_api_client/v2/models/max_session_duration_update_request_data_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 + # Type of the resource. + class MaxSessionDurationUpdateRequestDataType + include BaseEnumModel + + MAX_SESSION_DURATION = "max_session_duration".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/saml_configurations_update_attributes.rb b/lib/datadog_api_client/v2/models/saml_configurations_update_attributes.rb new file mode 100644 index 000000000000..e4468073b431 --- /dev/null +++ b/lib/datadog_api_client/v2/models/saml_configurations_update_attributes.rb @@ -0,0 +1,161 @@ +=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 updating SAML preferences. + class SamlConfigurationsUpdateAttributes + include BaseGenericModel + + # List of role UUIDs to assign to JIT-provisioned users. Exactly 1 role is required. + attr_reader :default_role_uuids + + # List of domains for Just-In-Time user provisioning. Maximum 50 domains. + # Each domain must be between 1 and 256 characters. + attr_reader :jit_domains + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'default_role_uuids' => :'default_role_uuids', + :'jit_domains' => :'jit_domains' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'default_role_uuids' => :'Array', + :'jit_domains' => :'Array' + } + 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::SamlConfigurationsUpdateAttributes` 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?(:'default_role_uuids') + if (value = attributes[:'default_role_uuids']).is_a?(Array) + self.default_role_uuids = value + end + end + + if attributes.key?(:'jit_domains') + if (value = attributes[:'jit_domains']).is_a?(Array) + self.jit_domains = value + end + 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 @default_role_uuids.nil? + return false if @default_role_uuids.length > 1 + return false if @default_role_uuids.length < 1 + return false if @jit_domains.nil? + return false if @jit_domains.length > 50 + true + end + + # Custom attribute writer method with validation + # @param default_role_uuids [Object] Object to be assigned + # @!visibility private + def default_role_uuids=(default_role_uuids) + if default_role_uuids.nil? + fail ArgumentError, 'invalid value for "default_role_uuids", default_role_uuids cannot be nil.' + end + if default_role_uuids.length > 1 + fail ArgumentError, 'invalid value for "default_role_uuids", number of items must be less than or equal to 1.' + end + if default_role_uuids.length < 1 + fail ArgumentError, 'invalid value for "default_role_uuids", number of items must be greater than or equal to 1.' + end + @default_role_uuids = default_role_uuids + end + + # Custom attribute writer method with validation + # @param jit_domains [Object] Object to be assigned + # @!visibility private + def jit_domains=(jit_domains) + if jit_domains.nil? + fail ArgumentError, 'invalid value for "jit_domains", jit_domains cannot be nil.' + end + if jit_domains.length > 50 + fail ArgumentError, 'invalid value for "jit_domains", number of items must be less than or equal to 50.' + end + @jit_domains = jit_domains + 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 && + default_role_uuids == o.default_role_uuids && + jit_domains == o.jit_domains && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [default_role_uuids, jit_domains, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/saml_configurations_update_request.rb b/lib/datadog_api_client/v2/models/saml_configurations_update_request.rb new file mode 100644 index 000000000000..20a55e958273 --- /dev/null +++ b/lib/datadog_api_client/v2/models/saml_configurations_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 + # Request to update organization SAML preferences. + class SamlConfigurationsUpdateRequest + include BaseGenericModel + + # Data wrapper for SAML preferences update. + 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' => :'SamlConfigurationsUpdateRequestData' + } + 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::SamlConfigurationsUpdateRequest` 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/saml_configurations_update_request_data.rb b/lib/datadog_api_client/v2/models/saml_configurations_update_request_data.rb new file mode 100644 index 000000000000..5826c47e8633 --- /dev/null +++ b/lib/datadog_api_client/v2/models/saml_configurations_update_request_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 wrapper for SAML preferences update. + class SamlConfigurationsUpdateRequestData + include BaseGenericModel + + # Attributes for updating SAML preferences. + attr_reader :attributes + + # Type of the resource. + 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' => :'SamlConfigurationsUpdateAttributes', + :'type' => :'SamlConfigurationsUpdateRequestDataType' + } + 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::SamlConfigurationsUpdateRequestData` 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/saml_configurations_update_request_data_type.rb b/lib/datadog_api_client/v2/models/saml_configurations_update_request_data_type.rb new file mode 100644 index 000000000000..98b2e6a23f6a --- /dev/null +++ b/lib/datadog_api_client/v2/models/saml_configurations_update_request_data_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 + # Type of the resource. + class SamlConfigurationsUpdateRequestDataType + include BaseEnumModel + + SAML_PREFERENCES = "saml_preferences".freeze + end +end