From 48366912af1f7ed2b9b2a8d0fd6a279aa46a9832 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 9 Jun 2026 15:58:46 +0000 Subject: [PATCH] Regenerate client from commit b1982e5 of spec repo --- .generator/schemas/v2/openapi.yaml | 76 +++++++++++ .../ListSlackUserBindings.rb | 5 + features/scenarios_model_mapping.rb | 3 + features/v2/slack_integration.feature | 23 ++++ features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 4 + .../v2/api/slack_integration_api.rb | 92 +++++++++++++ .../v2/models/slack_user_binding_data.rb | 115 ++++++++++++++++ .../v2/models/slack_user_binding_type.rb | 26 ++++ .../v2/models/slack_user_bindings_response.rb | 125 ++++++++++++++++++ 10 files changed, 475 insertions(+) create mode 100644 examples/v2/slack-integration/ListSlackUserBindings.rb create mode 100644 features/v2/slack_integration.feature create mode 100644 lib/datadog_api_client/v2/api/slack_integration_api.rb create mode 100644 lib/datadog_api_client/v2/models/slack_user_binding_data.rb create mode 100644 lib/datadog_api_client/v2/models/slack_user_binding_type.rb create mode 100644 lib/datadog_api_client/v2/models/slack_user_bindings_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2d470c8f2f02..1e960b60bb1d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1772,6 +1772,14 @@ components: required: false schema: type: boolean + SlackUserUuidQueryParameter: + description: The UUID of the Datadog user to list Slack bindings for. + in: query + name: user_uuid + required: true + schema: + format: uuid + type: string SloID: description: The ID of the SLO. in: path @@ -86535,6 +86543,37 @@ components: required: - slackTrigger type: object + SlackUserBindingData: + description: Slack team ID data from a response. + properties: + id: + description: The Slack team ID. + example: "T01234567" + type: string + type: + $ref: "#/components/schemas/SlackUserBindingType" + type: object + SlackUserBindingType: + default: team_id + description: Slack user binding resource type. + enum: + - team_id + example: team_id + type: string + x-enum-varnames: + - TEAM_ID + SlackUserBindingsResponse: + description: Response with a list of Slack user bindings. + properties: + data: + description: An array of Slack user bindings. + example: [{"id": "T01234567", "type": "team_id"}, {"id": "T09876543", "type": "team_id"}] + items: + $ref: "#/components/schemas/SlackUserBindingData" + type: array + required: + - data + type: object SloDataSource: default: slo description: A data source for SLO queries. @@ -132237,6 +132276,36 @@ paths: summary: List ServiceNow users tags: - ServiceNow Integration + /api/v2/integration/slack/user-bindings: + get: + description: List all Slack user bindings for a given Datadog user from the Datadog Slack integration. + operationId: ListSlackUserBindings + parameters: + - $ref: "#/components/parameters/SlackUserUuidQueryParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: T01234567 + type: team_id + - id: T09876543 + type: team_id + schema: + $ref: "#/components/schemas/SlackUserBindingsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List Slack user bindings + tags: + - Slack Integration /api/v2/integration/statuspage/account: delete: description: Delete the Statuspage account configured for your organization. @@ -181539,6 +181608,13 @@ tags: name: Service Level Objectives - description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations. name: ServiceNow Integration + - description: |- + Configure your [Datadog Slack integration](https://docs.datadoghq.com/integrations/slack/) + directly through the Datadog API. + externalDocs: + description: For more information about the Datadog Slack integration, see the integration page. + url: https://docs.datadoghq.com/integrations/slack/ + name: Slack Integration - description: |- API to create, update, retrieve, and delete Software Catalog entities. externalDocs: diff --git a/examples/v2/slack-integration/ListSlackUserBindings.rb b/examples/v2/slack-integration/ListSlackUserBindings.rb new file mode 100644 index 000000000000..c08456b5fa5e --- /dev/null +++ b/examples/v2/slack-integration/ListSlackUserBindings.rb @@ -0,0 +1,5 @@ +# List Slack user bindings returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SlackIntegrationAPI.new +p api_instance.list_slack_user_bindings("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f9c320310581..772da69ecc30 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3562,6 +3562,9 @@ "v2.ListServiceNowUsers" => { "instance_id" => "UUID", }, + "v2.ListSlackUserBindings" => { + "user_uuid" => "UUID", + }, "v2.UpdateStatuspageAccount" => { "body" => "StatuspageAccountUpdateRequest", }, diff --git a/features/v2/slack_integration.feature b/features/v2/slack_integration.feature new file mode 100644 index 000000000000..0ef645a642a9 --- /dev/null +++ b/features/v2/slack_integration.feature @@ -0,0 +1,23 @@ +@endpoint(slack-integration) @endpoint(slack-integration-v2) +Feature: Slack Integration + Configure your [Datadog Slack + integration](https://docs.datadoghq.com/integrations/slack/) directly + through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "SlackIntegration" API + And new "ListSlackUserBindings" request + + @generated @skip @team:DataDog/chat-integrations + Scenario: List Slack user bindings returns "Bad Request" response + Given request contains "user_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: List Slack user bindings returns "OK" response + Given request contains "user_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 9101d0155cbe..7588d4d2d323 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3634,6 +3634,12 @@ "type": "safe" } }, + "ListSlackUserBindings": { + "tag": "Slack Integration", + "undo": { + "type": "safe" + } + }, "DeleteStatuspageAccount": { "tag": "Statuspage Integration", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6bcb0f8a7651..f8409a4a454a 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -6433,6 +6433,9 @@ def overrides "v2.slack_integration_metadata" => "SlackIntegrationMetadata", "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", "v2.slack_trigger_wrapper" => "SlackTriggerWrapper", + "v2.slack_user_binding_data" => "SlackUserBindingData", + "v2.slack_user_bindings_response" => "SlackUserBindingsResponse", + "v2.slack_user_binding_type" => "SlackUserBindingType", "v2.slo_data_source" => "SloDataSource", "v2.slo_query" => "SloQuery", "v2.slo_report_create_request" => "SloReportCreateRequest", @@ -7558,6 +7561,7 @@ def overrides "v2.service_definition_api" => "ServiceDefinitionAPI", "v2.service_level_objectives_api" => "ServiceLevelObjectivesAPI", "v2.service_now_integration_api" => "ServiceNowIntegrationAPI", + "v2.slack_integration_api" => "SlackIntegrationAPI", "v2.software_catalog_api" => "SoftwareCatalogAPI", "v2.spa_api" => "SpaAPI", "v2.spans_api" => "SpansAPI", diff --git a/lib/datadog_api_client/v2/api/slack_integration_api.rb b/lib/datadog_api_client/v2/api/slack_integration_api.rb new file mode 100644 index 000000000000..0ca9bfa45889 --- /dev/null +++ b/lib/datadog_api_client/v2/api/slack_integration_api.rb @@ -0,0 +1,92 @@ +=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 'cgi' + +module DatadogAPIClient::V2 + class SlackIntegrationAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List Slack user bindings. + # + # @see #list_slack_user_bindings_with_http_info + def list_slack_user_bindings(user_uuid, opts = {}) + data, _status_code, _headers = list_slack_user_bindings_with_http_info(user_uuid, opts) + data + end + + # List Slack user bindings. + # + # List all Slack user bindings for a given Datadog user from the Datadog Slack integration. + # + # @param user_uuid [UUID] The UUID of the Datadog user to list Slack bindings for. + # @param opts [Hash] the optional parameters + # @return [Array<(SlackUserBindingsResponse, Integer, Hash)>] SlackUserBindingsResponse data, response status code and response headers + def list_slack_user_bindings_with_http_info(user_uuid, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SlackIntegrationAPI.list_slack_user_bindings ...' + end + # verify the required parameter 'user_uuid' is set + if @api_client.config.client_side_validation && user_uuid.nil? + fail ArgumentError, "Missing the required parameter 'user_uuid' when calling SlackIntegrationAPI.list_slack_user_bindings" + end + # resource path + local_var_path = '/api/v2/integration/slack/user-bindings' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'user_uuid'] = user_uuid + + # 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] || 'SlackUserBindingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_slack_user_bindings, + :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: SlackIntegrationAPI#list_slack_user_bindings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/slack_user_binding_data.rb b/lib/datadog_api_client/v2/models/slack_user_binding_data.rb new file mode 100644 index 000000000000..d3d74216353e --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_user_binding_data.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 + # Slack team ID data from a response. + class SlackUserBindingData + include BaseGenericModel + + # The Slack team ID. + attr_accessor :id + + # Slack user binding resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'SlackUserBindingType' + } + 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::SlackUserBindingData` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 && + 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 + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slack_user_binding_type.rb b/lib/datadog_api_client/v2/models/slack_user_binding_type.rb new file mode 100644 index 000000000000..a713ad98b70d --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_user_binding_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 + # Slack user binding resource type. + class SlackUserBindingType + include BaseEnumModel + + TEAM_ID = "team_id".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/slack_user_bindings_response.rb b/lib/datadog_api_client/v2/models/slack_user_bindings_response.rb new file mode 100644 index 000000000000..c2891677da39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_user_bindings_response.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 + # Response with a list of Slack user bindings. + class SlackUserBindingsResponse + include BaseGenericModel + + # An array of Slack user bindings. + 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::SlackUserBindingsResponse` 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