Class: DatadogAPIClient::V2::IdentityProvidersAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of IdentityProvidersAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/identity_providers_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/identity_providers_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#list_identity_provider_users(idp_id, opts = {}) ⇒ Object

List users with an identity provider override.



89
90
91
92
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 89

def list_identity_provider_users(idp_id, opts = {})
  data, _status_code, _headers = list_identity_provider_users_with_http_info(idp_id, opts)
  data
end

#list_identity_provider_users_with_http_info(idp_id, opts = {}) ⇒ Array<(UsersResponse, Integer, Hash)>

List users with an identity provider override.

Get all users in the organization whose login method has been overridden to use the specified identity provider.

Parameters:

  • idp_id (String)

    The ID of the identity provider.

  • 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.

  • :sort (String)

    User attribute to order results by. Options include email and name.

  • :sort_dir (QuerySortOrder)

    Direction of sort. Options: asc, desc.

  • :filter (String)

    Filter users by the given string. Defaults to no filtering.

  • :filter_status (String)

    Filter on status attribute. Comma-separated list, with possible values Active, Pending, and Disabled. Defaults to no filtering.

Returns:

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

    UsersResponse data, response status code and response headers



108
109
110
111
112
113
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
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 108

def list_identity_provider_users_with_http_info(idp_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdentityProvidersAPI.list_identity_provider_users ...'
  end
  # verify the required parameter 'idp_id' is set
  if @api_client.config.client_side_validation && idp_id.nil?
    fail ArgumentError, "Missing the required parameter 'idp_id' when calling IdentityProvidersAPI.list_identity_provider_users"
  end
  allowable_values = ['asc', 'desc']
  if @api_client.config.client_side_validation && opts[:'sort_dir'] && !allowable_values.include?(opts[:'sort_dir'])
    fail ArgumentError, "invalid value for \"sort_dir\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/identity_providers/{idp_id}/users'.sub('{idp_id}', CGI.escape(idp_id.to_s).gsub('%2F', '/'))

  # 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[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].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] || 'UsersResponse'

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

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

#list_identity_provider_users_with_pagination(idp_id, opts = {}) {|User| ... } ⇒ Object

List users with an identity provider override.

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

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

Yields:

  • (User)

    Paginated items



175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 175

def list_identity_provider_users_with_pagination(idp_id, 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_identity_provider_users(idp_id, 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

#list_identity_providers(opts = {}) ⇒ Object

List identity providers.



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

def list_identity_providers(opts = {})
  data, _status_code, _headers = list_identity_providers_with_http_info(opts)
  data
end

#list_identity_providers_with_http_info(opts = {}) ⇒ Array<(IdentityProvidersResponse, Integer, Hash)>

List identity providers.

Get all identity providers available for the current organization.

Parameters:

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

    the optional parameters

Returns:

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

    IdentityProvidersResponse data, response status code and response headers



40
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
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 40

def list_identity_providers_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdentityProvidersAPI.list_identity_providers ...'
  end
  # resource path
  local_var_path = '/api/v2/identity_providers'

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

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

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

#update_identity_provider(idp_id, body, opts = {}) ⇒ Object

Update an identity provider.



193
194
195
196
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 193

def update_identity_provider(idp_id, body, opts = {})
  data, _status_code, _headers = update_identity_provider_with_http_info(idp_id, body, opts)
  data
end

#update_identity_provider_with_http_info(idp_id, body, opts = {}) ⇒ Array<(IdentityProviderResponse, Integer, Hash)>

Update an identity provider.

Enable or disable an identity provider for the current organization.

Parameters:

  • idp_id (String)

    The ID of the identity provider.

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

    the optional parameters

Returns:

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

    IdentityProviderResponse data, response status code and response headers



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
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/datadog_api_client/v2/api/identity_providers_api.rb', line 206

def update_identity_provider_with_http_info(idp_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdentityProvidersAPI.update_identity_provider ...'
  end
  # verify the required parameter 'idp_id' is set
  if @api_client.config.client_side_validation && idp_id.nil?
    fail ArgumentError, "Missing the required parameter 'idp_id' when calling IdentityProvidersAPI.update_identity_provider"
  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 IdentityProvidersAPI.update_identity_provider"
  end
  # resource path
  local_var_path = '/api/v2/identity_providers/{idp_id}'.sub('{idp_id}', CGI.escape(idp_id.to_s).gsub('%2F', '/'))

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

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

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