From 1fd8312cbd0a1fc066beedac63a038fd0c8dd785 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 2 Oct 2025 17:07:37 +0000 Subject: [PATCH] Regenerate client from commit 44dea02 of spec repo --- .generator/schemas/v2/openapi.yaml | 65 ++++++++ examples/v2/roles/ListRoleTemplates.rb | 8 + features/v2/roles.feature | 7 + features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 4 + lib/datadog_api_client/v2/api/roles_api.rb | 66 ++++++++ .../v2/models/role_template_array.rb | 125 +++++++++++++++ .../v2/models/role_template_data.rb | 143 ++++++++++++++++++ .../models/role_template_data_attributes.rb | 115 ++++++++++++++ .../v2/models/role_template_data_type.rb | 26 ++++ 11 files changed, 566 insertions(+) create mode 100644 examples/v2/roles/ListRoleTemplates.rb create mode 100644 lib/datadog_api_client/v2/models/role_template_array.rb create mode 100644 lib/datadog_api_client/v2/models/role_template_data.rb create mode 100644 lib/datadog_api_client/v2/models/role_template_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/role_template_data_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 72f8cd458145..3d27f6798ca1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38435,6 +38435,49 @@ components: permissions: $ref: '#/components/schemas/RelationshipToPermissions' type: object + RoleTemplateArray: + description: The definition of `RoleTemplateArray` object. + properties: + data: + description: The `RoleTemplateArray` `data`. + items: + $ref: '#/components/schemas/RoleTemplateData' + type: array + required: + - data + type: object + RoleTemplateData: + description: The definition of `RoleTemplateData` object. + properties: + attributes: + $ref: '#/components/schemas/RoleTemplateDataAttributes' + id: + description: The `RoleTemplateData` `id`. + type: string + type: + $ref: '#/components/schemas/RoleTemplateDataType' + required: + - type + type: object + RoleTemplateDataAttributes: + description: The definition of `RoleTemplateDataAttributes` object. + properties: + description: + description: The `attributes` `description`. + type: string + name: + description: The `attributes` `name`. + type: string + type: object + RoleTemplateDataType: + default: roles + description: Roles resource type. + enum: + - roles + example: roles + type: string + x-enum-varnames: + - ROLES RoleUpdateAttributes: description: Attributes of the role. properties: @@ -67658,6 +67701,28 @@ paths: operator: OR permissions: - user_access_manage + /api/v2/roles/templates: + get: + description: List all role templates + operationId: ListRoleTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RoleTemplateArray' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_read + summary: List role templates + tags: + - Roles + x-unstable: '**Note**: This endpoint may be subject to changes.' /api/v2/roles/{role_id}: delete: description: Disables a role. diff --git a/examples/v2/roles/ListRoleTemplates.rb b/examples/v2/roles/ListRoleTemplates.rb new file mode 100644 index 000000000000..6d07658e578c --- /dev/null +++ b/examples/v2/roles/ListRoleTemplates.rb @@ -0,0 +1,8 @@ +# List role templates returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_role_templates".to_sym] = true +end +api_instance = DatadogAPIClient::V2::RolesAPI.new +p api_instance.list_role_templates() diff --git a/features/v2/roles.feature b/features/v2/roles.feature index bc82e0b07eca..4c62839977e8 100644 --- a/features/v2/roles.feature +++ b/features/v2/roles.feature @@ -216,6 +216,13 @@ Feature: Roles And the response "data" has item with field "attributes.restricted" with value false And the response "data" has item with field "attributes.name" with value "admin" + @generated @skip @team:DataDog/aaa-core-access + Scenario: List role templates returns "OK" response + Given operation "ListRoleTemplates" enabled + And new "ListRoleTemplates" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/aaa-core-access Scenario: List roles returns "OK" response Given there is a valid "role" in the system diff --git a/features/v2/undo.json b/features/v2/undo.json index 6fcf52fcedc9..95d8a19dcbd2 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2869,6 +2869,12 @@ "type": "unsafe" } }, + "ListRoleTemplates": { + "tag": "Roles", + "undo": { + "type": "safe" + } + }, "DeleteRole": { "tag": "Roles", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 7754333a417e..f6cb0bb0f1ad 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -263,6 +263,7 @@ def initialize "v2.update_monitor_user_template": false, "v2.validate_existing_monitor_user_template": false, "v2.validate_monitor_user_template": false, + "v2.list_role_templates": false, "v2.create_pipeline": false, "v2.delete_pipeline": false, "v2.get_pipeline": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 9abbf586d9ee..f092fe16fdb9 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3302,6 +3302,10 @@ def overrides "v2.roles_response" => "RolesResponse", "v2.roles_sort" => "RolesSort", "v2.roles_type" => "RolesType", + "v2.role_template_array" => "RoleTemplateArray", + "v2.role_template_data" => "RoleTemplateData", + "v2.role_template_data_attributes" => "RoleTemplateDataAttributes", + "v2.role_template_data_type" => "RoleTemplateDataType", "v2.role_update_attributes" => "RoleUpdateAttributes", "v2.role_update_data" => "RoleUpdateData", "v2.role_update_request" => "RoleUpdateRequest", diff --git a/lib/datadog_api_client/v2/api/roles_api.rb b/lib/datadog_api_client/v2/api/roles_api.rb index 54cfdf1823e9..d0e0d8e4c65b 100644 --- a/lib/datadog_api_client/v2/api/roles_api.rb +++ b/lib/datadog_api_client/v2/api/roles_api.rb @@ -635,6 +635,72 @@ def list_roles_with_http_info(opts = {}) return data, status_code, headers end + # List role templates. + # + # @see #list_role_templates_with_http_info + def list_role_templates(opts = {}) + data, _status_code, _headers = list_role_templates_with_http_info(opts) + data + end + + # List role templates. + # + # List all role templates + # + # @param opts [Hash] the optional parameters + # @return [Array<(RoleTemplateArray, Integer, Hash)>] RoleTemplateArray data, response status code and response headers + def list_role_templates_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_role_templates".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_role_templates") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_role_templates")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RolesAPI.list_role_templates ...' + end + # resource path + local_var_path = '/api/v2/roles/templates' + + # 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] || 'RoleTemplateArray' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_role_templates, + :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: RolesAPI#list_role_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get all users of a role. # # @see #list_role_users_with_http_info diff --git a/lib/datadog_api_client/v2/models/role_template_array.rb b/lib/datadog_api_client/v2/models/role_template_array.rb new file mode 100644 index 000000000000..d31a0383fd75 --- /dev/null +++ b/lib/datadog_api_client/v2/models/role_template_array.rb @@ -0,0 +1,125 @@ +=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 definition of `RoleTemplateArray` object. + class RoleTemplateArray + include BaseGenericModel + + # The `RoleTemplateArray` `data`. + 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' => :'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::RoleTemplateArray` 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = 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 @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/role_template_data.rb b/lib/datadog_api_client/v2/models/role_template_data.rb new file mode 100644 index 000000000000..386f47ba372d --- /dev/null +++ b/lib/datadog_api_client/v2/models/role_template_data.rb @@ -0,0 +1,143 @@ +=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 definition of `RoleTemplateData` object. + class RoleTemplateData + include BaseGenericModel + + # The definition of `RoleTemplateDataAttributes` object. + attr_accessor :attributes + + # The `RoleTemplateData` `id`. + attr_accessor :id + + # Roles resource type. + 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', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RoleTemplateDataAttributes', + :'id' => :'String', + :'type' => :'RoleTemplateDataType' + } + 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::RoleTemplateData` 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?(:'id') + self.id = attributes[:'id'] + 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 @type.nil? + true + 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 && + id == o.id && + 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, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/role_template_data_attributes.rb b/lib/datadog_api_client/v2/models/role_template_data_attributes.rb new file mode 100644 index 000000000000..727115f8c81f --- /dev/null +++ b/lib/datadog_api_client/v2/models/role_template_data_attributes.rb @@ -0,0 +1,115 @@ +=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 definition of `RoleTemplateDataAttributes` object. + class RoleTemplateDataAttributes + include BaseGenericModel + + # The `attributes` `description`. + attr_accessor :description + + # The `attributes` `name`. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'name' => :'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::RoleTemplateDataAttributes` 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + 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 && + description == o.description && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/role_template_data_type.rb b/lib/datadog_api_client/v2/models/role_template_data_type.rb new file mode 100644 index 000000000000..7158681600e3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/role_template_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 + # Roles resource type. + class RoleTemplateDataType + include BaseEnumModel + + ROLES = "roles".freeze + end +end