Class: IbmCloudIam::AccountSettingsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ibm_cloud_iam/api/account_settings_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AccountSettingsApi

Returns a new instance of AccountSettingsApi.



19
20
21
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_account_settings(account_id, authorization, opts = {}) ⇒ AccountSettingsResponse

Get account configurations Returns the details of an account's configuration.

Parameters:

  • account_id (String)

    Unique ID of the account.

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

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

    the optional parameters

Options Hash (opts):

  • :include_history (Boolean)

    Defines if the entity history is included in the response. (default to false)

  • :resolve_user_mfa (Boolean)

    Enrich MFA exemptions with user PI. (default to false)

Returns:



30
31
32
33
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 30

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

#get_account_settings_with_http_info(account_id, authorization, opts = {}) ⇒ Array<(AccountSettingsResponse, Integer, Hash)>

Get account configurations Returns the details of an account's configuration.

Parameters:

  • account_id (String)

    Unique ID of the account.

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

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

    the optional parameters

Options Hash (opts):

  • :include_history (Boolean)

    Defines if the entity history is included in the response. (default to false)

  • :resolve_user_mfa (Boolean)

    Enrich MFA exemptions with user PI. (default to false)

Returns:

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

    AccountSettingsResponse data, response status code and response headers



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
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 43

def (, authorization, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountSettingsApi.get_account_settings ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountSettingsApi.get_account_settings"
  end
  # verify the required parameter 'authorization' is set
  if @api_client.config.client_side_validation && authorization.nil?
    fail ArgumentError, "Missing the required parameter 'authorization' when calling AccountSettingsApi.get_account_settings"
  end
  # resource path
  local_var_path = '/v1/accounts/{account_id}/settings/identity'.sub('{account_id}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_history'] = opts[:'include_history'] if !opts[:'include_history'].nil?
  query_params[:'resolve_user_mfa'] = opts[:'resolve_user_mfa'] if !opts[:'resolve_user_mfa'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'Authorization'] = authorization

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AccountSettingsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AccountSettingsApi.get_account_settings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccountSettingsApi#get_account_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_effective_account_settings(account_id, authorization, opts = {}) ⇒ EffectiveAccountSettingsResponse

Get effective account settings configuration Returns effective account settings for given account ID

Parameters:

  • account_id (String)

    Unique ID of the account.

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

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

    the optional parameters

Options Hash (opts):

  • :include_history (Boolean)

    Defines if the entity history is included in the response. (default to false)

  • :resolve_user_mfa (Boolean)

    Enrich MFA exemptions with user information. (default to false)

Returns:



106
107
108
109
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 106

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

#get_effective_account_settings_with_http_info(account_id, authorization, opts = {}) ⇒ Array<(EffectiveAccountSettingsResponse, Integer, Hash)>

Get effective account settings configuration Returns effective account settings for given account ID

Parameters:

  • account_id (String)

    Unique ID of the account.

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

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

    the optional parameters

Options Hash (opts):

  • :include_history (Boolean)

    Defines if the entity history is included in the response. (default to false)

  • :resolve_user_mfa (Boolean)

    Enrich MFA exemptions with user information. (default to false)

Returns:



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
171
172
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 119

def (, authorization, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountSettingsApi.get_effective_account_settings ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountSettingsApi.get_effective_account_settings"
  end
  # verify the required parameter 'authorization' is set
  if @api_client.config.client_side_validation && authorization.nil?
    fail ArgumentError, "Missing the required parameter 'authorization' when calling AccountSettingsApi.get_effective_account_settings"
  end
  # resource path
  local_var_path = '/v1/accounts/{account_id}/effective_settings/identity'.sub('{account_id}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_history'] = opts[:'include_history'] if !opts[:'include_history'].nil?
  query_params[:'resolve_user_mfa'] = opts[:'resolve_user_mfa'] if !opts[:'resolve_user_mfa'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'Authorization'] = authorization

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'EffectiveAccountSettingsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AccountSettingsApi.get_effective_account_settings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccountSettingsApi#get_effective_account_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_account_settings(authorization, if_match, account_id, account_settings_request, opts = {}) ⇒ AccountSettingsResponse

Update account configurations Allows a user to configure settings on their account with regards to MFA, MFA excemption list, session lifetimes, access control for creating new identities, and enforcing IP restrictions on token creation.

Parameters:

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

  • if_match (String)

    Version of the account settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the account. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

  • account_id (String)

    The id of the account to update the settings for.

  • account_settings_request (AccountSettingsRequest)

    Request to update an account's settings.

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/ibm_cloud_iam/api/account_settings_api.rb', line 182

def (authorization, if_match, , , opts = {})
  data, _status_code, _headers = (authorization, if_match, , , opts)
  data
end

#update_account_settings_with_http_info(authorization, if_match, account_id, account_settings_request, opts = {}) ⇒ Array<(AccountSettingsResponse, Integer, Hash)>

Update account configurations Allows a user to configure settings on their account with regards to MFA, MFA excemption list, session lifetimes, access control for creating new identities, and enforcing IP restrictions on token creation.

Parameters:

  • authorization (String)

    Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Make sure that the provided token has the required authority for the request.

  • if_match (String)

    Version of the account settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the account. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.

  • account_id (String)

    The id of the account to update the settings for.

  • account_settings_request (AccountSettingsRequest)

    Request to update an account's settings.

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

    the optional parameters

Returns:

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

    AccountSettingsResponse data, response status code and response headers



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

def (authorization, if_match, , , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountSettingsApi.update_account_settings ...'
  end
  # verify the required parameter 'authorization' is set
  if @api_client.config.client_side_validation && authorization.nil?
    fail ArgumentError, "Missing the required parameter 'authorization' when calling AccountSettingsApi.update_account_settings"
  end
  # verify the required parameter 'if_match' is set
  if @api_client.config.client_side_validation && if_match.nil?
    fail ArgumentError, "Missing the required parameter 'if_match' when calling AccountSettingsApi.update_account_settings"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountSettingsApi.update_account_settings"
  end
  # verify the required parameter 'account_settings_request' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_settings_request' when calling AccountSettingsApi.update_account_settings"
  end
  # resource path
  local_var_path = '/v1/accounts/{account_id}/settings/identity'.sub('{account_id}', CGI.escape(.to_s))

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Authorization'] = authorization
  header_params[:'If-Match'] = if_match

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'AccountSettingsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AccountSettingsApi.update_account_settings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccountSettingsApi#update_account_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end