Class: DatadogAPIClient::V2::TeamConnectionsAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/team_connections_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ TeamConnectionsAPI

Returns a new instance of TeamConnectionsAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 22

def initialize(api_client = DatadogAPIClient::APIClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#create_team_connections(body, opts = {}) ⇒ Object

Create team connections.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 29

def create_team_connections(body, opts = {})
  data, _status_code, _headers = create_team_connections_with_http_info(body, opts)
  data
end

#create_team_connections_with_http_info(body, opts = {}) ⇒ Array<(TeamConnectionsResponse, Integer, Hash)>

Create team connections.

Create multiple team connections.

Parameters:

Returns:

  • (Array<(TeamConnectionsResponse, Integer, Hash)>)

    TeamConnectionsResponse data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 41

def create_team_connections_with_http_info(body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.create_team_connections".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_team_connections")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_team_connections"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamConnectionsAPI.create_team_connections ...'
  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 TeamConnectionsAPI.create_team_connections"
  end
  # resource path
  local_var_path = '/api/v2/team/connections'

  # 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'])
  # 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] || 'TeamConnectionsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

  new_options = opts.merge(
    :operation => :create_team_connections,
    :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::Post, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamConnectionsAPI#create_team_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_team_connections(body, opts = {}) ⇒ Object

Delete team connections.



102
103
104
105
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 102

def delete_team_connections(body, opts = {})
  delete_team_connections_with_http_info(body, opts)
  nil
end

#delete_team_connections_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete team connections.

Delete multiple team connections.

Parameters:

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 114

def delete_team_connections_with_http_info(body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.delete_team_connections".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_team_connections")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_team_connections"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamConnectionsAPI.delete_team_connections ...'
  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 TeamConnectionsAPI.delete_team_connections"
  end
  # resource path
  local_var_path = '/api/v2/team/connections'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

  new_options = opts.merge(
    :operation => :delete_team_connections,
    :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::Delete, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamConnectionsAPI#delete_team_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_team_connections(opts = {}) ⇒ Object

List team connections.



175
176
177
178
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 175

def list_team_connections(opts = {})
  data, _status_code, _headers = list_team_connections_with_http_info(opts)
  data
end

#list_team_connections_with_http_info(opts = {}) ⇒ Array<(TeamConnectionsResponse, Integer, Hash)>

List team connections.

Returns all team connections.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    Size for a given page. The maximum allowed value is 100.

  • :page_number (Integer)

    Specific page number to return.

  • :filter_sources (Array<String>)

    Filter team connections by external source systems.

  • :filter_team_ids (Array<String>)

    Filter team connections by Datadog team IDs.

  • :filter_connected_team_ids (Array<String>)

    Filter team connections by connected team IDs from external systems.

  • :filter_connection_ids (Array<String>)

    Filter team connections by connection IDs.

Returns:

  • (Array<(TeamConnectionsResponse, Integer, Hash)>)

    TeamConnectionsResponse data, response status code and response headers



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 192

def list_team_connections_with_http_info(opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_team_connections".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_team_connections")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_team_connections"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamConnectionsAPI.list_team_connections ...'
  end
  # resource path
  local_var_path = '/api/v2/team/connections'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'filter[sources]'] = @api_client.build_collection_param(opts[:'filter_sources'], :csv) if !opts[:'filter_sources'].nil?
  query_params[:'filter[team_ids]'] = @api_client.build_collection_param(opts[:'filter_team_ids'], :csv) if !opts[:'filter_team_ids'].nil?
  query_params[:'filter[connected_team_ids]'] = @api_client.build_collection_param(opts[:'filter_connected_team_ids'], :csv) if !opts[:'filter_connected_team_ids'].nil?
  query_params[:'filter[connection_ids]'] = @api_client.build_collection_param(opts[:'filter_connection_ids'], :csv) if !opts[:'filter_connection_ids'].nil?

  # 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] || 'TeamConnectionsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

  new_options = opts.merge(
    :operation => :list_team_connections,
    :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: TeamConnectionsAPI#list_team_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_team_connections_with_pagination(opts = {}) {|TeamConnection| ... } ⇒ Object

List team connections.

Provide a paginated version of #list_team_connections, returning all items.

To use it you need to use a block: list_team_connections_with_pagination { |item| p item }

Yields:



257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/datadog_api_client/v2/api/team_connections_api.rb', line 257

def list_team_connections_with_pagination(opts = {})
    api_version = "V2"
    page_size = @api_client.get_attribute_from_path(opts, "page_size", 10)
    @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size)
    @api_client.set_attribute_from_path(api_version, opts, "page_number", Integer, 0)
    while true do
        response = list_team_connections(opts)
        @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) }
        if @api_client.get_attribute_from_path(response, "data").length < page_size
          break
        end
        @api_client.set_attribute_from_path(api_version, opts, "page_number", Integer, @api_client.get_attribute_from_path(opts, "page_number", 0) + 1)
    end
end