Class: Azure::Cosmosdb::Mgmt::V2020_03_01::DatabaseAccounts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-03-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/2020-03-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/2020-03-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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1631
1632
1633
1634
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1631

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.

is case insensitive. parameters to provide for the current database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
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
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1668

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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::V2020_03_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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1650
1651
1652
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1650

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that



1749
1750
1751
1752
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1749

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1780

def begin_delete_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, '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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1765
1766
1767
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1765

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.

is case insensitive. the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



1848
1849
1850
1851
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1848

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.

is case insensitive. the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
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
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1889

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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.

is case insensitive. the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1869
1870
1871
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1869

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



1963
1964
1965
1966
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1963

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.

is case insensitive. to offline for the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
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
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2000

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1982
1983
1984
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1982

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



2074
2075
2076
2077
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2074

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.

is case insensitive. to online for the database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
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
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2111

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



2093
2094
2095
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2093

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.

is case insensitive. the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



2184
2185
2186
2187
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2184

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.

is case insensitive. the key to regenerate. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2219

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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.

is case insensitive. the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



2202
2203
2204
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 2202

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1511
1512
1513
1514
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1511

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.

is case insensitive. provide for the current database account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1546

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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::V2020_03_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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1529
1530
1531
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1529

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.



1079
1080
1081
1082
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1079

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.



1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1110

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?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '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.



1095
1096
1097
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1095

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



191
192
193
194
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 191

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 208

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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that



235
236
237
238
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 235

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

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 250

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.

is case insensitive. the database account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



280
281
282
283
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 280

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

is case insensitive. the database account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 297

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



35
36
37
38
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 35

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



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
123
124
125
126
127
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 66

def get_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, '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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



820
821
822
823
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 820

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 853

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



837
838
839
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 837

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



51
52
53
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 51

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.



322
323
324
325
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 322

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.



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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 349

def list_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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

    A hash of custom headers that

Returns:

  • (DatabaseAccountsListResult)

    operation results.



415
416
417
418
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 415

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 446

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.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



431
432
433
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 431

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



622
623
624
625
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 622

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



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
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 655

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



639
640
641
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 639

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



516
517
518
519
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 516

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 547

def list_keys_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, '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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



532
533
534
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 532

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1404
1405
1406
1407
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1404

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1435

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



1420
1421
1422
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1420

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.

is case insensitive. 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)

    The name of the resource group. The name

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



1174
1175
1176
1177
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1174

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.

is case insensitive. 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)

    The name of the resource group. The name

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



1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1215

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  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::V2020_03_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.

is case insensitive. 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)

    The name of the resource group. The name

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



1195
1196
1197
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1195

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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



928
929
930
931
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 928

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.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 961

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



945
946
947
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 945

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.

is case insensitive. 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)

    The name of the resource group. The name

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



1293
1294
1295
1296
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1293

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.

is case insensitive. 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)

    The name of the resource group. The name

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



1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1330

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, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  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, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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::V2020_03_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.

is case insensitive. 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)

    The name of the resource group. The name

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



1312
1313
1314
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1312

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.



336
337
338
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 336

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



730
731
732
733
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 730

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 747

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



775
776
777
778
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 775

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 792

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.

is case insensitive. the key to regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



1035
1036
1037
1038
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1035

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

is case insensitive. the key to regenerate. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 1052

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.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

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



142
143
144
145
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 142

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/database_accounts.rb', line 159

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::V2020_03_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