Class: Azure::Cosmosdb::Mgmt::V2019_08_01::DatabaseAccounts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb

Overview

Azure Cosmos DB Database Service Resource Provider REST API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ DatabaseAccounts

Creates and initializes a new instance of the DatabaseAccounts class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCosmosDBManagementClient (readonly)

Returns reference to the CosmosDBManagementClient.

Returns:



22
23
24
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, account_name, create_update_parameters, custom_headers: nil) ⇒ DatabaseAccountGetResults

Creates or updates an Azure Cosmos DB database account. The “Update” method is preferred when performing updates on an account.

parameters to provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • create_update_parameters (DatabaseAccountCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountGetResults)

    operation results.



1563
1564
1565
1566
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1563

def begin_create_or_update(resource_group_name, , create_update_parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, , create_update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates an Azure Cosmos DB database account. The “Update” method is preferred when performing updates on an account.

parameters to provide for the current database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • create_update_parameters (DatabaseAccountCreateUpdateParameters)

    The

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1598

def begin_create_or_update_async(resource_group_name, , create_update_parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'create_update_parameters is nil' if create_update_parameters.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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountCreateUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  create_update_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'

  request_url = @base_url || @client.base_url

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

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

Creates or updates an Azure Cosmos DB database account. The “Update” method is preferred when performing updates on an account.

parameters to provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • create_update_parameters (DatabaseAccountCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1581
1582
1583
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1581

def begin_create_or_update_with_http_info(resource_group_name, , create_update_parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, , create_update_parameters, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, account_name, custom_headers: nil) ⇒ Object

Deletes an existing Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that



1676
1677
1678
1679
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1676

def begin_delete(resource_group_name, , custom_headers:nil)
  response = begin_delete_async(resource_group_name, , custom_headers:custom_headers).value!
  nil
end

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

Deletes an existing Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1705

def begin_delete_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 == 202 || status_code == 204
      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?

    result
  end

  promise.execute
end

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

Deletes an existing Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1691
1692
1693
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1691

def begin_delete_with_http_info(resource_group_name, , custom_headers:nil)
  begin_delete_async(resource_group_name, , custom_headers:custom_headers).value!
end

#begin_failover_priority_change(resource_group_name, account_name, failover_parameters, custom_headers: nil) ⇒ Object

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • failover_parameters (FailoverPolicies)

    The new failover policies for

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

    A hash of custom headers that



1770
1771
1772
1773
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1770

def begin_failover_priority_change(resource_group_name, , failover_parameters, custom_headers:nil)
  response = begin_failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:custom_headers).value!
  nil
end

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

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • failover_parameters (FailoverPolicies)

    The new failover policies for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1809

def begin_failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'failover_parameters is nil' if failover_parameters.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::Cosmosdb::Mgmt::V2019_08_01::Models::FailoverPolicies.mapper()
  request_content = @client.serialize(request_mapper,  failover_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      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(:post, 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 == 202 || status_code == 204
      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?

    result
  end

  promise.execute
end

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

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • failover_parameters (FailoverPolicies)

    The new failover policies for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1790
1791
1792
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1790

def begin_failover_priority_change_with_http_info(resource_group_name, , failover_parameters, custom_headers:nil)
  begin_failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:custom_headers).value!
end

#begin_offline_region(resource_group_name, account_name, region_parameter_for_offline, custom_headers: nil) ⇒ Object

Offline the specified region for the specified Azure Cosmos DB database account.

to offline for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_offline (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that



1880
1881
1882
1883
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1880

def begin_offline_region(resource_group_name, , region_parameter_for_offline, custom_headers:nil)
  response = begin_offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:custom_headers).value!
  nil
end

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

Offline the specified region for the specified Azure Cosmos DB database account.

to offline for the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_offline (RegionForOnlineOffline)

    Cosmos DB region

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1915

def begin_offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'region_parameter_for_offline is nil' if region_parameter_for_offline.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::Cosmosdb::Mgmt::V2019_08_01::Models::RegionForOnlineOffline.mapper()
  request_content = @client.serialize(request_mapper,  region_parameter_for_offline)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      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(:post, 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 || status_code == 202
      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

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

Offline the specified region for the specified Azure Cosmos DB database account.

to offline for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_offline (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1898
1899
1900
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1898

def begin_offline_region_with_http_info(resource_group_name, , region_parameter_for_offline, custom_headers:nil)
  begin_offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:custom_headers).value!
end

#begin_online_region(resource_group_name, account_name, region_parameter_for_online, custom_headers: nil) ⇒ Object

Online the specified region for the specified Azure Cosmos DB database account.

to online for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_online (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that



1986
1987
1988
1989
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1986

def begin_online_region(resource_group_name, , region_parameter_for_online, custom_headers:nil)
  response = begin_online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:custom_headers).value!
  nil
end

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

Online the specified region for the specified Azure Cosmos DB database account.

to online for the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_online (RegionForOnlineOffline)

    Cosmos DB region

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2021

def begin_online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'region_parameter_for_online is nil' if region_parameter_for_online.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::Cosmosdb::Mgmt::V2019_08_01::Models::RegionForOnlineOffline.mapper()
  request_content = @client.serialize(request_mapper,  region_parameter_for_online)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      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(:post, 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 || status_code == 202
      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

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

Online the specified region for the specified Azure Cosmos DB database account.

to online for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_online (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2004
2005
2006
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2004

def begin_online_region_with_http_info(resource_group_name, , region_parameter_for_online, custom_headers:nil)
  begin_online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:custom_headers).value!
end

#begin_regenerate_key(resource_group_name, account_name, key_to_regenerate, custom_headers: nil) ⇒ Object

Regenerates an access key for the specified Azure Cosmos DB database account.

the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • key_to_regenerate (DatabaseAccountRegenerateKeyParameters)

    The name of

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

    A hash of custom headers that



2091
2092
2093
2094
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2091

def begin_regenerate_key(resource_group_name, , key_to_regenerate, custom_headers:nil)
  response = begin_regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:custom_headers).value!
  nil
end

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

Regenerates an access key for the specified Azure Cosmos DB database account.

the key to regenerate. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • key_to_regenerate (DatabaseAccountRegenerateKeyParameters)

    The name of

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2124

def begin_regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'key_to_regenerate is nil' if key_to_regenerate.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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountRegenerateKeyParameters.mapper()
  request_content = @client.serialize(request_mapper,  key_to_regenerate)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      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(:post, 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 || status_code == 202
      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?

    result
  end

  promise.execute
end

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

Regenerates an access key for the specified Azure Cosmos DB database account.

the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • key_to_regenerate (DatabaseAccountRegenerateKeyParameters)

    The name of

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2108
2109
2110
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2108

def begin_regenerate_key_with_http_info(resource_group_name, , key_to_regenerate, custom_headers:nil)
  begin_regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, account_name, update_parameters, custom_headers: nil) ⇒ DatabaseAccountGetResults

Updates the properties of an existing Azure Cosmos DB database account.

provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • update_parameters (DatabaseAccountUpdateParameters)

    The parameters to

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountGetResults)

    operation results.



1448
1449
1450
1451
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1448

def begin_update(resource_group_name, , update_parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, , update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Updates the properties of an existing Azure Cosmos DB database account.

provide for the current database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • update_parameters (DatabaseAccountUpdateParameters)

    The parameters to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1481

def begin_update_async(resource_group_name, , update_parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'update_parameters is nil' if update_parameters.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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  update_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'

  request_url = @base_url || @client.base_url

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

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

Updates the properties of an existing Azure Cosmos DB database account.

provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • update_parameters (DatabaseAccountUpdateParameters)

    The parameters to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1465
1466
1467
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1465

def begin_update_with_http_info(resource_group_name, , update_parameters, custom_headers:nil)
  begin_update_async(resource_group_name, , update_parameters, custom_headers:custom_headers).value!
end

#check_name_exists(account_name, custom_headers: nil) ⇒ Boolean

Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the ‘-’ character, and must be between 3 and 50 characters.

will be added to the HTTP request.

Parameters:

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



1033
1034
1035
1036
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1033

def check_name_exists(, custom_headers:nil)
  response = check_name_exists_async(, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_name_exists_async(account_name, custom_headers: nil) ⇒ Concurrent::Promise

Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the ‘-’ character, and must be between 3 and 50 characters.

to the HTTP request.

Parameters:

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1064

def check_name_exists_async(, custom_headers:nil)
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'accountName' => },
      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 || status_code == 404
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.body = (status_code == 200)
    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

#check_name_exists_with_http_info(account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the ‘-’ character, and must be between 3 and 50 characters.

will be added to the HTTP request.

Parameters:

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1049
1050
1051
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1049

def check_name_exists_with_http_info(, custom_headers:nil)
  check_name_exists_async(, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, account_name, create_update_parameters, custom_headers: nil) ⇒ DatabaseAccountGetResults

Creates or updates an Azure Cosmos DB database account. The “Update” method is preferred when performing updates on an account.

parameters to provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • create_update_parameters (DatabaseAccountCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountGetResults)

    operation results.



183
184
185
186
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 183

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

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

parameters to provide for the current database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • create_update_parameters (DatabaseAccountCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 199

def create_or_update_async(resource_group_name, , create_update_parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, , create_update_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, account_name, custom_headers: nil) ⇒ Object

Deletes an existing Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that



225
226
227
228
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 225

def delete(resource_group_name, , custom_headers:nil)
  response = delete_async(resource_group_name, , custom_headers:custom_headers).value!
  nil
end

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 239

def delete_async(resource_group_name, , custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, , custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#failover_priority_change(resource_group_name, account_name, failover_parameters, custom_headers: nil) ⇒ Object

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • failover_parameters (FailoverPolicies)

    The new failover policies for

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

    A hash of custom headers that



268
269
270
271
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 268

def failover_priority_change(resource_group_name, , failover_parameters, custom_headers:nil)
  response = failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:custom_headers).value!
  nil
end

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

the database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • failover_parameters (FailoverPolicies)

    The new failover policies for

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 284

def failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:nil)
  # Send request
  promise = begin_failover_priority_change_async(resource_group_name, , failover_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#get(resource_group_name, account_name, custom_headers: nil) ⇒ DatabaseAccountGetResults

Retrieves the properties of an existing Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountGetResults)

    operation results.



34
35
36
37
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 34

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

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

Retrieves the properties of an existing Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 63

def get_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.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_read_only_keys(resource_group_name, account_name, custom_headers: nil) ⇒ DatabaseAccountListReadOnlyKeysResult

Lists the read-only access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountListReadOnlyKeysResult)

    operation results.



785
786
787
788
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 785

def get_read_only_keys(resource_group_name, , custom_headers:nil)
  response = get_read_only_keys_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Lists the read-only access keys for the specified Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 816

def get_read_only_keys_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/readonlykeys'

  request_url = @base_url || @client.base_url

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

Lists the read-only access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



801
802
803
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 801

def get_read_only_keys_with_http_info(resource_group_name, , custom_headers:nil)
  get_read_only_keys_async(resource_group_name, , custom_headers:custom_headers).value!
end

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

Retrieves the properties of an existing Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



49
50
51
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 49

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

#list(custom_headers: nil) ⇒ DatabaseAccountsListResult

Lists all the Azure Cosmos DB database accounts available under the subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountsListResult)

    operation results.



309
310
311
312
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 309

def list(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Lists all the Azure Cosmos DB database accounts available under the subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
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
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 336

def list_async(custom_headers: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}/providers/Microsoft.DocumentDB/databaseAccounts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountsListResult.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_by_resource_group(resource_group_name, custom_headers: nil) ⇒ DatabaseAccountsListResult

Lists all the Azure Cosmos DB database accounts available under the given resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountsListResult)

    operation results.



399
400
401
402
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 399

def list_by_resource_group(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists all the Azure Cosmos DB database accounts available under the given resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 428

def list_by_resource_group_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, '@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.DocumentDB/databaseAccounts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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 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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountsListResult.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_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the Azure Cosmos DB database accounts available under the given resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



414
415
416
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 414

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_connection_strings(resource_group_name, account_name, custom_headers: nil) ⇒ DatabaseAccountListConnectionStringsResult

Lists the connection strings for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountListConnectionStringsResult)

    operation results.



596
597
598
599
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 596

def list_connection_strings(resource_group_name, , custom_headers:nil)
  response = list_connection_strings_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Lists the connection strings for the specified Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 627

def list_connection_strings_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListConnectionStringsResult.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_connection_strings_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the connection strings for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



612
613
614
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 612

def list_connection_strings_with_http_info(resource_group_name, , custom_headers:nil)
  list_connection_strings_async(resource_group_name, , custom_headers:custom_headers).value!
end

#list_keys(resource_group_name, account_name, custom_headers: nil) ⇒ DatabaseAccountListKeysResult

Lists the access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountListKeysResult)

    operation results.



495
496
497
498
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 495

def list_keys(resource_group_name, , custom_headers:nil)
  response = list_keys_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Lists the access keys for the specified Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 524

def list_keys_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/listKeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListKeysResult.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_keys_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



510
511
512
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 510

def list_keys_with_http_info(resource_group_name, , custom_headers:nil)
  list_keys_async(resource_group_name, , custom_headers:custom_headers).value!
end

#list_metric_definitions(resource_group_name, account_name, custom_headers: nil) ⇒ MetricDefinitionsListResult

Retrieves metric definitions for the given database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MetricDefinitionsListResult)

    operation results.



1346
1347
1348
1349
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1346

def list_metric_definitions(resource_group_name, , custom_headers:nil)
  response = list_metric_definitions_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Retrieves metric definitions for the given database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1375

def list_metric_definitions_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'

  request_url = @base_url || @client.base_url

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

Retrieves metric definitions for the given database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1361
1362
1363
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1361

def list_metric_definitions_with_http_info(resource_group_name, , custom_headers:nil)
  list_metric_definitions_async(resource_group_name, , custom_headers:custom_headers).value!
end

#list_metrics(resource_group_name, account_name, filter, custom_headers: nil) ⇒ MetricListResult

Retrieves the metrics determined by the given filter for the given database account.

metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String)

    An OData filter expression that describes a subset of

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

    A hash of custom headers that

Returns:

  • (MetricListResult)

    operation results.



1126
1127
1128
1129
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1126

def list_metrics(resource_group_name, , filter, custom_headers:nil)
  response = list_metrics_async(resource_group_name, , filter, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Retrieves the metrics determined by the given filter for the given database account.

metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String)

    An OData filter expression that describes a subset of

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1165

def list_metrics_async(resource_group_name, , filter, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'filter is nil' if filter.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.DocumentDB/databaseAccounts/{accountName}/metrics'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version,'$filter' => filter},
      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::Cosmosdb::Mgmt::V2019_08_01::Models::MetricListResult.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_metrics_with_http_info(resource_group_name, account_name, filter, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves the metrics determined by the given filter for the given database account.

metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String)

    An OData filter expression that describes a subset of

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1146
1147
1148
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1146

def list_metrics_with_http_info(resource_group_name, , filter, custom_headers:nil)
  list_metrics_async(resource_group_name, , filter, custom_headers:custom_headers).value!
end

#list_read_only_keys(resource_group_name, account_name, custom_headers: nil) ⇒ DatabaseAccountListReadOnlyKeysResult

Lists the read-only access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountListReadOnlyKeysResult)

    operation results.



888
889
890
891
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 888

def list_read_only_keys(resource_group_name, , custom_headers:nil)
  response = list_read_only_keys_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Lists the read-only access keys for the specified Azure Cosmos DB database account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 919

def list_read_only_keys_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/readonlykeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListReadOnlyKeysResult.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_read_only_keys_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the read-only access keys for the specified Azure Cosmos DB database account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



904
905
906
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 904

def list_read_only_keys_with_http_info(resource_group_name, , custom_headers:nil)
  list_read_only_keys_async(resource_group_name, , custom_headers:custom_headers).value!
end

#list_usages(resource_group_name, account_name, filter: nil, custom_headers: nil) ⇒ UsagesResult

Retrieves the usages (most recent data) for the given database account.

usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String) (defaults to: nil)

    An OData filter expression that describes a subset of

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

    A hash of custom headers that

Returns:

  • (UsagesResult)

    operation results.



1240
1241
1242
1243
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1240

def list_usages(resource_group_name, , filter:nil, custom_headers:nil)
  response = list_usages_async(resource_group_name, , filter:filter, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Retrieves the usages (most recent data) for the given database account.

usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String) (defaults to: nil)

    An OData filter expression that describes a subset of

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1275

def list_usages_async(resource_group_name, , filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DocumentDB/databaseAccounts/{accountName}/usages'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => },
      query_params: {'api-version' => @client.api_version,'$filter' => filter},
      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::Cosmosdb::Mgmt::V2019_08_01::Models::UsagesResult.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_usages_with_http_info(resource_group_name, account_name, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves the usages (most recent data) for the given database account.

usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • filter (String) (defaults to: nil)

    An OData filter expression that describes a subset of

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1258
1259
1260
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1258

def list_usages_with_http_info(resource_group_name, , filter:nil, custom_headers:nil)
  list_usages_async(resource_group_name, , filter:filter, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the Azure Cosmos DB database accounts available under the subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



323
324
325
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 323

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

#offline_region(resource_group_name, account_name, region_parameter_for_offline, custom_headers: nil) ⇒ Object

Offline the specified region for the specified Azure Cosmos DB database account.

to offline for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_offline (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that



699
700
701
702
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 699

def offline_region(resource_group_name, , region_parameter_for_offline, custom_headers:nil)
  response = offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:custom_headers).value!
  nil
end

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

to offline for the database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_offline (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 715

def offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:nil)
  # Send request
  promise = begin_offline_region_async(resource_group_name, , region_parameter_for_offline, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#online_region(resource_group_name, account_name, region_parameter_for_online, custom_headers: nil) ⇒ Object

Online the specified region for the specified Azure Cosmos DB database account.

to online for the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_online (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that



742
743
744
745
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 742

def online_region(resource_group_name, , region_parameter_for_online, custom_headers:nil)
  response = online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:custom_headers).value!
  nil
end

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

to online for the database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • region_parameter_for_online (RegionForOnlineOffline)

    Cosmos DB region

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 758

def online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:nil)
  # Send request
  promise = begin_online_region_async(resource_group_name, , region_parameter_for_online, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#regenerate_key(resource_group_name, account_name, key_to_regenerate, custom_headers: nil) ⇒ Object

Regenerates an access key for the specified Azure Cosmos DB database account.

the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • key_to_regenerate (DatabaseAccountRegenerateKeyParameters)

    The name of

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

    A hash of custom headers that



990
991
992
993
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 990

def regenerate_key(resource_group_name, , key_to_regenerate, custom_headers:nil)
  response = regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:custom_headers).value!
  nil
end

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

the key to regenerate. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • key_to_regenerate (DatabaseAccountRegenerateKeyParameters)

    The name of

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1006

def regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:nil)
  # Send request
  promise = begin_regenerate_key_async(resource_group_name, , key_to_regenerate, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#update(resource_group_name, account_name, update_parameters, custom_headers: nil) ⇒ DatabaseAccountGetResults

Updates the properties of an existing Azure Cosmos DB database account.

provide for the current database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • update_parameters (DatabaseAccountUpdateParameters)

    The parameters to

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountGetResults)

    operation results.



136
137
138
139
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 136

def update(resource_group_name, , update_parameters, custom_headers:nil)
  response = update_async(resource_group_name, , update_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

provide for the current database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of an Azure resource group.

  • account_name (String)

    Cosmos DB database account name.

  • update_parameters (DatabaseAccountUpdateParameters)

    The parameters to

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 152

def update_async(resource_group_name, , update_parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, , update_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end