Class: Azure::ApiManagement::Mgmt::V2019_12_01::SignInSettings

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb

Overview

ApiManagement Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SignInSettings

Creates and initializes a new instance of the SignInSettings class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientApiManagementClient (readonly)

Returns reference to the ApiManagementClient.

Returns:



22
23
24
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 22

def client
  @client
end

Instance Method Details

#create_or_update(resource_group_name, service_name, parameters, if_match: nil, custom_headers: nil) ⇒ PortalSigninSettings

Create or Update Sign-In settings.

entity, but required when updating an entity. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Create or update parameters.

  • if_match (String) (defaults to: nil)

    ETag of the Entity. Not required when creating an

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PortalSigninSettings)

    operation results.



328
329
330
331
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 328

def create_or_update(resource_group_name, service_name, parameters, if_match:nil, custom_headers:nil)
  response = create_or_update_async(resource_group_name, service_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, service_name, parameters, if_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

Create or Update Sign-In settings.

entity, but required when updating an entity. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Create or update parameters.

  • if_match (String) (defaults to: nil)

    ETag of the Entity. Not required when creating an

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 363

def create_or_update_async(resource_group_name, service_name, parameters, if_match:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.nil?
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
  fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['If-Match'] = if_match unless if_match.nil?
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::ApiManagement::Mgmt::V2019_12_01::Models::PortalSigninSettings.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ApiManagement::Mgmt::V2019_12_01::Models::PortalSigninSettings.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#create_or_update_with_http_info(resource_group_name, service_name, parameters, if_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or Update Sign-In settings.

entity, but required when updating an entity. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Create or update parameters.

  • if_match (String) (defaults to: nil)

    ETag of the Entity. Not required when creating an

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



346
347
348
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 346

def create_or_update_with_http_info(resource_group_name, service_name, parameters, if_match:nil, custom_headers:nil)
  create_or_update_async(resource_group_name, service_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
end

#get(resource_group_name, service_name, custom_headers: nil) ⇒ PortalSigninSettings

Get Sign In Settings for the Portal

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PortalSigninSettings)

    operation results.



120
121
122
123
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 120

def get(resource_group_name, service_name, custom_headers:nil)
  response = get_async(resource_group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Get Sign In Settings for the Portal

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 149

def get_async(resource_group_name, service_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.nil?
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
  fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ApiManagement::Mgmt::V2019_12_01::Models::PortalSigninSettings.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_entity_tag(resource_group_name, service_name, custom_headers: nil) ⇒ Object

Gets the entity state (Etag) version of the SignInSettings.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



33
34
35
36
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 33

def get_entity_tag(resource_group_name, service_name, custom_headers:nil)
  response = get_entity_tag_async(resource_group_name, service_name, custom_headers:custom_headers).value!
  nil
end

#get_entity_tag_async(resource_group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the entity state (Etag) version of the SignInSettings.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 62

def get_entity_tag_async(resource_group_name, service_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.nil?
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
  fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:head, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#get_entity_tag_with_http_info(resource_group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the entity state (Etag) version of the SignInSettings.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



48
49
50
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 48

def get_entity_tag_with_http_info(resource_group_name, service_name, custom_headers:nil)
  get_entity_tag_async(resource_group_name, service_name, custom_headers:custom_headers).value!
end

#get_with_http_info(resource_group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get Sign In Settings for the Portal

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



135
136
137
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 135

def get_with_http_info(resource_group_name, service_name, custom_headers:nil)
  get_async(resource_group_name, service_name, custom_headers:custom_headers).value!
end

#update(resource_group_name, service_name, parameters, if_match, custom_headers: nil) ⇒ Object

Update Sign-In settings.

entity state from the header response of the GET request or it should be * for unconditional update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Update Sign-In settings.

  • if_match (String)

    ETag of the Entity. ETag should match the current

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



220
221
222
223
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 220

def update(resource_group_name, service_name, parameters, if_match, custom_headers:nil)
  response = update_async(resource_group_name, service_name, parameters, if_match, custom_headers:custom_headers).value!
  nil
end

#update_async(resource_group_name, service_name, parameters, if_match, custom_headers: nil) ⇒ Concurrent::Promise

Update Sign-In settings.

entity state from the header response of the GET request or it should be * for unconditional update. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Update Sign-In settings.

  • if_match (String)

    ETag of the Entity. ETag should match the current

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 257

def update_async(resource_group_name, service_name, parameters, if_match, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.nil?
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
  fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
  fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, 'if_match is nil' if if_match.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['If-Match'] = if_match unless if_match.nil?
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::ApiManagement::Mgmt::V2019_12_01::Models::PortalSigninSettings.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#update_with_http_info(resource_group_name, service_name, parameters, if_match, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update Sign-In settings.

entity state from the header response of the GET request or it should be * for unconditional update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • service_name (String)

    The name of the API Management service.

  • parameters (PortalSigninSettings)

    Update Sign-In settings.

  • if_match (String)

    ETag of the Entity. ETag should match the current

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



239
240
241
# File 'lib/2019-12-01/generated/azure_mgmt_api_management/sign_in_settings.rb', line 239

def update_with_http_info(resource_group_name, service_name, parameters, if_match, custom_headers:nil)
  update_async(resource_group_name, service_name, parameters, if_match, custom_headers:custom_headers).value!
end