Class: Azure::Storage::Mgmt::V2019_06_01::EncryptionScopes

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb

Overview

The Azure Storage Management API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ EncryptionScopes

Creates and initializes a new instance of the EncryptionScopes class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientStorageManagementClient (readonly)

Returns reference to the StorageManagementClient.

Returns:



22
23
24
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 22

def client
  @client
end

Instance Method Details

#get(resource_group_name, account_name, encryption_scope_name, custom_headers: nil) ⇒ EncryptionScope

Returns the properties for the specified encryption scope.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

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

    A hash of custom headers that

Returns:

  • (EncryptionScope)

    operation results.



348
349
350
351
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 348

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

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

Returns the properties for the specified encryption scope.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 393

def get_async(resource_group_name, , encryption_scope_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'encryption_scope_name is nil' if encryption_scope_name.nil?
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MaxLength': '63'" if !encryption_scope_name.nil? && encryption_scope_name.length > 63
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MinLength': '3'" if !encryption_scope_name.nil? && encryption_scope_name.length < 3


  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.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id,'encryptionScopeName' => encryption_scope_name},
      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::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.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_with_http_info(resource_group_name, account_name, encryption_scope_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns the properties for the specified encryption scope.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



371
372
373
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 371

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

#list(resource_group_name, account_name, custom_headers: nil) ⇒ Array<EncryptionScope>

Lists all the encryption scopes available under the specified storage account.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

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

    A hash of custom headers that

Returns:

  • (Array<EncryptionScope>)

    operation results.



472
473
474
475
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 472

def list(resource_group_name, , custom_headers:nil)
  first_page = list_as_lazy(resource_group_name, , custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(resource_group_name, account_name, custom_headers: nil) ⇒ EncryptionScopeListResult

Lists all the encryption scopes available under the specified storage account.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

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

    A hash of custom headers that

Returns:

  • (EncryptionScopeListResult)

    which provide lazy access to pages of the



679
680
681
682
683
684
685
686
687
688
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 679

def list_as_lazy(resource_group_name, , custom_headers:nil)
  response = list_async(resource_group_name, , custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, account_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists all the encryption scopes available under the specified storage account.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 509

def list_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1


  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.Storage/storageAccounts/{accountName}/encryptionScopes'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'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 MsRestAzure::AzureOperationError.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::Storage::Mgmt::V2019_06_01::Models::EncryptionScopeListResult.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

#list_next(next_page_link, custom_headers: nil) ⇒ EncryptionScopeListResult

Lists all the encryption scopes available under the specified storage account.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (EncryptionScopeListResult)

    operation results.



582
583
584
585
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 582

def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists all the encryption scopes available under the specified storage account.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 613

def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      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 MsRestAzure::AzureOperationError.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::Storage::Mgmt::V2019_06_01::Models::EncryptionScopeListResult.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

#list_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the encryption scopes available under the specified storage account.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



598
599
600
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 598

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the encryption scopes available under the specified storage account.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



491
492
493
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 491

def list_with_http_info(resource_group_name, , custom_headers:nil)
  list_async(resource_group_name, , custom_headers:custom_headers).value!
end

#patch(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ EncryptionScope

Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

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

    A hash of custom headers that

Returns:

  • (EncryptionScope)

    operation results.



206
207
208
209
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 206

def patch(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  response = patch_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#patch_async(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ Concurrent::Promise

Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the update. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

  • 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 257

def patch_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'encryption_scope_name is nil' if encryption_scope_name.nil?
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MaxLength': '63'" if !encryption_scope_name.nil? && encryption_scope_name.length > 63
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MinLength': '3'" if !encryption_scope_name.nil? && encryption_scope_name.length < 3
  fail ArgumentError, 'encryption_scope is nil' if encryption_scope.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?

  # Serialize Request
  request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.mapper()
  request_content = @client.serialize(request_mapper,  encryption_scope)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id,'encryptionScopeName' => encryption_scope_name},
      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 == 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::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.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

#patch_with_http_info(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



232
233
234
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 232

def patch_with_http_info(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  patch_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:custom_headers).value!
end

#put(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ EncryptionScope

Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the create or update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

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

    A hash of custom headers that

Returns:

  • (EncryptionScope)

    operation results.



47
48
49
50
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 47

def put(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  response = put_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#put_async(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ Concurrent::Promise

Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the create or update. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



102
103
104
105
106
107
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 102

def put_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !.nil? && .length > 24
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'encryption_scope_name is nil' if encryption_scope_name.nil?
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MaxLength': '63'" if !encryption_scope_name.nil? && encryption_scope_name.length > 63
  fail ArgumentError, "'encryption_scope_name' should satisfy the constraint - 'MinLength': '3'" if !encryption_scope_name.nil? && encryption_scope_name.length < 3
  fail ArgumentError, 'encryption_scope is nil' if encryption_scope.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?

  # Serialize Request
  request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.mapper()
  request_content = @client.serialize(request_mapper,  encryption_scope)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id,'encryptionScopeName' => encryption_scope_name},
      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 == 201 || 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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.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
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::EncryptionScope.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

#put_with_http_info(resource_group_name, account_name, encryption_scope_name, encryption_scope, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request.

user’s subscription. The name is case insensitive. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. used for the create or update. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of the storage account within the

  • encryption_scope_name (String)

    The name of the encryption scope within

  • encryption_scope (EncryptionScope)

    Encryption scope properties to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



75
76
77
# File 'lib/2019-06-01/generated/azure_mgmt_storage/encryption_scopes.rb', line 75

def put_with_http_info(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:nil)
  put_async(resource_group_name, , encryption_scope_name, encryption_scope, custom_headers:custom_headers).value!
end