Skip to content

Commit 83c7329

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit fc1fa35 of spec repo (DataDog#3470)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 30c6012 commit 83c7329

10 files changed

Lines changed: 475 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,14 @@ components:
17801780
required: false
17811781
schema:
17821782
type: boolean
1783+
SlackUserUuidQueryParameter:
1784+
description: The UUID of the Datadog user to list Slack bindings for.
1785+
in: query
1786+
name: user_uuid
1787+
required: true
1788+
schema:
1789+
format: uuid
1790+
type: string
17831791
SloID:
17841792
description: The ID of the SLO.
17851793
in: path
@@ -89039,6 +89047,37 @@ components:
8903989047
required:
8904089048
- slackTrigger
8904189049
type: object
89050+
SlackUserBindingData:
89051+
description: Slack team ID data from a response.
89052+
properties:
89053+
id:
89054+
description: The Slack team ID.
89055+
example: "T01234567"
89056+
type: string
89057+
type:
89058+
$ref: "#/components/schemas/SlackUserBindingType"
89059+
type: object
89060+
SlackUserBindingType:
89061+
default: team_id
89062+
description: Slack user binding resource type.
89063+
enum:
89064+
- team_id
89065+
example: team_id
89066+
type: string
89067+
x-enum-varnames:
89068+
- TEAM_ID
89069+
SlackUserBindingsResponse:
89070+
description: Response with a list of Slack user bindings.
89071+
properties:
89072+
data:
89073+
description: An array of Slack user bindings.
89074+
example: [{"id": "T01234567", "type": "team_id"}, {"id": "T09876543", "type": "team_id"}]
89075+
items:
89076+
$ref: "#/components/schemas/SlackUserBindingData"
89077+
type: array
89078+
required:
89079+
- data
89080+
type: object
8904289081
SloDataSource:
8904389082
default: slo
8904489083
description: A data source for SLO queries.
@@ -136401,6 +136440,36 @@ paths:
136401136440
summary: List ServiceNow users
136402136441
tags:
136403136442
- ServiceNow Integration
136443+
/api/v2/integration/slack/user-bindings:
136444+
get:
136445+
description: List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
136446+
operationId: ListSlackUserBindings
136447+
parameters:
136448+
- $ref: "#/components/parameters/SlackUserUuidQueryParameter"
136449+
responses:
136450+
"200":
136451+
content:
136452+
application/json:
136453+
examples:
136454+
default:
136455+
value:
136456+
data:
136457+
- id: T01234567
136458+
type: team_id
136459+
- id: T09876543
136460+
type: team_id
136461+
schema:
136462+
$ref: "#/components/schemas/SlackUserBindingsResponse"
136463+
description: OK
136464+
"400":
136465+
$ref: "#/components/responses/BadRequestResponse"
136466+
"403":
136467+
$ref: "#/components/responses/ForbiddenResponse"
136468+
"429":
136469+
$ref: "#/components/responses/TooManyRequestsResponse"
136470+
summary: List Slack user bindings
136471+
tags:
136472+
- Slack Integration
136404136473
/api/v2/integration/statuspage/account:
136405136474
delete:
136406136475
description: Delete the Statuspage account configured for your organization.
@@ -186271,6 +186340,13 @@ tags:
186271186340
name: Service Level Objectives
186272186341
- description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations.
186273186342
name: ServiceNow Integration
186343+
- description: |-
186344+
Configure your [Datadog Slack integration](https://docs.datadoghq.com/integrations/slack/)
186345+
directly through the Datadog API.
186346+
externalDocs:
186347+
description: For more information about the Datadog Slack integration, see the integration page.
186348+
url: https://docs.datadoghq.com/integrations/slack/
186349+
name: Slack Integration
186274186350
- description: |-
186275186351
API to create, update, retrieve, and delete Software Catalog entities.
186276186352
externalDocs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# List Slack user bindings returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::SlackIntegrationAPI.new
5+
p api_instance.list_slack_user_bindings("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d")

features/scenarios_model_mapping.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,6 +3645,9 @@
36453645
"v2.ListServiceNowUsers" => {
36463646
"instance_id" => "UUID",
36473647
},
3648+
"v2.ListSlackUserBindings" => {
3649+
"user_uuid" => "UUID",
3650+
},
36483651
"v2.UpdateStatuspageAccount" => {
36493652
"body" => "StatuspageAccountUpdateRequest",
36503653
},
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@endpoint(slack-integration) @endpoint(slack-integration-v2)
2+
Feature: Slack Integration
3+
Configure your [Datadog Slack
4+
integration](https://docs.datadoghq.com/integrations/slack/) directly
5+
through the Datadog API.
6+
7+
Background:
8+
Given a valid "apiKeyAuth" key in the system
9+
And a valid "appKeyAuth" key in the system
10+
And an instance of "SlackIntegration" API
11+
And new "ListSlackUserBindings" request
12+
13+
@generated @skip @team:DataDog/chat-integrations
14+
Scenario: List Slack user bindings returns "Bad Request" response
15+
Given request contains "user_uuid" parameter from "REPLACE.ME"
16+
When the request is sent
17+
Then the response status is 400 Bad Request
18+
19+
@generated @skip @team:DataDog/chat-integrations
20+
Scenario: List Slack user bindings returns "OK" response
21+
Given request contains "user_uuid" parameter from "REPLACE.ME"
22+
When the request is sent
23+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3781,6 +3781,12 @@
37813781
"type": "safe"
37823782
}
37833783
},
3784+
"ListSlackUserBindings": {
3785+
"tag": "Slack Integration",
3786+
"undo": {
3787+
"type": "safe"
3788+
}
3789+
},
37843790
"DeleteStatuspageAccount": {
37853791
"tag": "Statuspage Integration",
37863792
"undo": {

lib/datadog_api_client/inflector.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6572,6 +6572,9 @@ def overrides
65726572
"v2.slack_integration_metadata" => "SlackIntegrationMetadata",
65736573
"v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem",
65746574
"v2.slack_trigger_wrapper" => "SlackTriggerWrapper",
6575+
"v2.slack_user_binding_data" => "SlackUserBindingData",
6576+
"v2.slack_user_bindings_response" => "SlackUserBindingsResponse",
6577+
"v2.slack_user_binding_type" => "SlackUserBindingType",
65756578
"v2.slo_data_source" => "SloDataSource",
65766579
"v2.slo_query" => "SloQuery",
65776580
"v2.slo_report_create_request" => "SloReportCreateRequest",
@@ -7714,6 +7717,7 @@ def overrides
77147717
"v2.service_definition_api" => "ServiceDefinitionAPI",
77157718
"v2.service_level_objectives_api" => "ServiceLevelObjectivesAPI",
77167719
"v2.service_now_integration_api" => "ServiceNowIntegrationAPI",
7720+
"v2.slack_integration_api" => "SlackIntegrationAPI",
77177721
"v2.software_catalog_api" => "SoftwareCatalogAPI",
77187722
"v2.spa_api" => "SpaAPI",
77197723
"v2.spans_api" => "SpansAPI",
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'cgi'
17+
18+
module DatadogAPIClient::V2
19+
class SlackIntegrationAPI
20+
attr_accessor :api_client
21+
22+
def initialize(api_client = DatadogAPIClient::APIClient.default)
23+
@api_client = api_client
24+
end
25+
26+
# List Slack user bindings.
27+
#
28+
# @see #list_slack_user_bindings_with_http_info
29+
def list_slack_user_bindings(user_uuid, opts = {})
30+
data, _status_code, _headers = list_slack_user_bindings_with_http_info(user_uuid, opts)
31+
data
32+
end
33+
34+
# List Slack user bindings.
35+
#
36+
# List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
37+
#
38+
# @param user_uuid [UUID] The UUID of the Datadog user to list Slack bindings for.
39+
# @param opts [Hash] the optional parameters
40+
# @return [Array<(SlackUserBindingsResponse, Integer, Hash)>] SlackUserBindingsResponse data, response status code and response headers
41+
def list_slack_user_bindings_with_http_info(user_uuid, opts = {})
42+
43+
if @api_client.config.debugging
44+
@api_client.config.logger.debug 'Calling API: SlackIntegrationAPI.list_slack_user_bindings ...'
45+
end
46+
# verify the required parameter 'user_uuid' is set
47+
if @api_client.config.client_side_validation && user_uuid.nil?
48+
fail ArgumentError, "Missing the required parameter 'user_uuid' when calling SlackIntegrationAPI.list_slack_user_bindings"
49+
end
50+
# resource path
51+
local_var_path = '/api/v2/integration/slack/user-bindings'
52+
53+
# query parameters
54+
query_params = opts[:query_params] || {}
55+
query_params[:'user_uuid'] = user_uuid
56+
57+
# header parameters
58+
header_params = opts[:header_params] || {}
59+
# HTTP header 'Accept' (if needed)
60+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61+
62+
# form parameters
63+
form_params = opts[:form_params] || {}
64+
65+
# http body (model)
66+
post_body = opts[:debug_body]
67+
68+
# return_type
69+
return_type = opts[:debug_return_type] || 'SlackUserBindingsResponse'
70+
71+
# auth_names
72+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
73+
74+
new_options = opts.merge(
75+
:operation => :list_slack_user_bindings,
76+
:header_params => header_params,
77+
:query_params => query_params,
78+
:form_params => form_params,
79+
:body => post_body,
80+
:auth_names => auth_names,
81+
:return_type => return_type,
82+
:api_version => "V2"
83+
)
84+
85+
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
86+
if @api_client.config.debugging
87+
@api_client.config.logger.debug "API called: SlackIntegrationAPI#list_slack_user_bindings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88+
end
89+
return data, status_code, headers
90+
end
91+
end
92+
end
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Slack team ID data from a response.
21+
class SlackUserBindingData
22+
include BaseGenericModel
23+
24+
# The Slack team ID.
25+
attr_accessor :id
26+
27+
# Slack user binding resource type.
28+
attr_accessor :type
29+
30+
attr_accessor :additional_properties
31+
32+
# Attribute mapping from ruby-style variable name to JSON key.
33+
# @!visibility private
34+
def self.attribute_map
35+
{
36+
:'id' => :'id',
37+
:'type' => :'type'
38+
}
39+
end
40+
41+
# Attribute type mapping.
42+
# @!visibility private
43+
def self.openapi_types
44+
{
45+
:'id' => :'String',
46+
:'type' => :'SlackUserBindingType'
47+
}
48+
end
49+
50+
# Initializes the object
51+
# @param attributes [Hash] Model attributes in the form of hash
52+
# @!visibility private
53+
def initialize(attributes = {})
54+
if (!attributes.is_a?(Hash))
55+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SlackUserBindingData` initialize method"
56+
end
57+
58+
self.additional_properties = {}
59+
# check to see if the attribute exists and convert string to symbol for hash key
60+
attributes = attributes.each_with_object({}) { |(k, v), h|
61+
if (!self.class.attribute_map.key?(k.to_sym))
62+
self.additional_properties[k.to_sym] = v
63+
else
64+
h[k.to_sym] = v
65+
end
66+
}
67+
68+
if attributes.key?(:'id')
69+
self.id = attributes[:'id']
70+
end
71+
72+
if attributes.key?(:'type')
73+
self.type = attributes[:'type']
74+
end
75+
end
76+
77+
# Returns the object in the form of hash, with additionalProperties support.
78+
# @return [Hash] Returns the object in the form of hash
79+
# @!visibility private
80+
def to_hash
81+
hash = {}
82+
self.class.attribute_map.each_pair do |attr, param|
83+
value = self.send(attr)
84+
if value.nil?
85+
is_nullable = self.class.openapi_nullable.include?(attr)
86+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
87+
end
88+
89+
hash[param] = _to_hash(value)
90+
end
91+
self.additional_properties.each_pair do |attr, value|
92+
hash[attr] = value
93+
end
94+
hash
95+
end
96+
97+
# Checks equality by comparing each attribute.
98+
# @param o [Object] Object to be compared
99+
# @!visibility private
100+
def ==(o)
101+
return true if self.equal?(o)
102+
self.class == o.class &&
103+
id == o.id &&
104+
type == o.type &&
105+
additional_properties == o.additional_properties
106+
end
107+
108+
# Calculates hash code according to all attributes.
109+
# @return [Integer] Hash code
110+
# @!visibility private
111+
def hash
112+
[id, type, additional_properties].hash
113+
end
114+
end
115+
end

0 commit comments

Comments
 (0)