Class: Azure::SQL::Mgmt::V2014_04_01::Databases

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2014-04-01/generated/azure_mgmt_sql/databases.rb

Overview

The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Databases

Creates and initializes a new instance of the Databases class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSqlManagementClient (readonly)

Returns reference to the SqlManagementClient.

Returns:



25
26
27
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 25

def client
  @client
end

Instance Method Details

#begin_create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. importing a Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to import into

  • parameters (ImportExtensionRequest)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



1913
1914
1915
1916
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1913

def begin_create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  response = begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. importing a Bacpac into a database. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to import into

  • parameters (ImportExtensionRequest)

    The required parameters for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1954

def begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  extension_name = 'import'
  fail ArgumentError, 'parameters is nil' if 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::SQL::Mgmt::V2014_04_01::Models::ImportExtensionRequest.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}'

  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,'serverName' => server_name,'databaseName' => database_name,'extensionName' => extension_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201 || status_code == 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?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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_import_operation_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. importing a Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to import into

  • parameters (ImportExtensionRequest)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1934
1935
1936
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1934

def begin_create_import_operation_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
end

#begin_create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Database

Creates a new database or updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. (updated or created). a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be operated on

  • parameters (Database)

    The required parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



1550
1551
1552
1553
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1550

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

#begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates a new database or updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. (updated or created). a database. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be operated on

  • parameters (Database)

    The required parameters for creating or updating

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1591

def begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'parameters is nil' if 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::SQL::Mgmt::V2014_04_01::Models::Database.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'

  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,'serverName' => server_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201 || 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::Database.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::Database.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, server_name, database_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a new database or updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. (updated or created). a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be operated on

  • parameters (Database)

    The required parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1571
1572
1573
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1571

def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
end

#begin_export(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Exports a database to a bacpac.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be exported.

  • parameters (ExportRequest)

    The required parameters for exporting a

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



2034
2035
2036
2037
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 2034

def begin_export(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  response = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Exports a database to a bacpac.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be exported.

  • parameters (ExportRequest)

    The required parameters for exporting a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
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
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 2073

def begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'parameters is nil' if 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::SQL::Mgmt::V2014_04_01::Models::ExportRequest.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export'

  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,'serverName' => server_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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_export_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Exports a database to a bacpac.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be exported.

  • parameters (ExportRequest)

    The required parameters for exporting a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2054
2055
2056
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 2054

def begin_export_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
end

#begin_import(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Imports a bacpac into a new database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • parameters (ImportRequest)

    The required parameters for importing a

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



1797
1798
1799
1800
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1797

def begin_import(resource_group_name, server_name, parameters, custom_headers:nil)
  response = begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_import_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Imports a bacpac into a new database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Bacpac into a database. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • parameters (ImportRequest)

    The required parameters for importing a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1834

def begin_import_async(resource_group_name, server_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'parameters is nil' if 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::SQL::Mgmt::V2014_04_01::Models::ImportRequest.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import'

  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,'serverName' => server_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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_import_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Imports a bacpac into a new database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • parameters (ImportRequest)

    The required parameters for importing a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1816
1817
1818
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1816

def begin_import_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
  begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
end

#begin_pause(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Object

Pauses a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to pause.

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

    A hash of custom headers that



1360
1361
1362
1363
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1360

def begin_pause(resource_group_name, server_name, database_name, custom_headers:nil)
  response = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  nil
end

#begin_pause_async(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Concurrent::Promise

Pauses a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to pause.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1395

def begin_pause_async(resource_group_name, server_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/databases/{databaseName}/pause'

  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,'serverName' => server_name,'databaseName' => database_name},
      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 || 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_pause_with_http_info(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Pauses a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to pause.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1378
1379
1380
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1378

def begin_pause_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
  begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end

#begin_resume(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Object

Resumes a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to resume.

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

    A hash of custom headers that



1453
1454
1455
1456
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1453

def begin_resume(resource_group_name, server_name, database_name, custom_headers:nil)
  response = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  nil
end

#begin_resume_async(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Concurrent::Promise

Resumes a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to resume.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1488

def begin_resume_async(resource_group_name, server_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/databases/{databaseName}/resume'

  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,'serverName' => server_name,'databaseName' => database_name},
      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 == 202 || 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?

    result
  end

  promise.execute
end

#begin_resume_with_http_info(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Resumes a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to resume.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1471
1472
1473
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1471

def begin_resume_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
  begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Database

Updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be updated.

  • parameters (DatabaseUpdate)

    The required parameters for updating a

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



1680
1681
1682
1683
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1680

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

#begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be updated.

  • parameters (DatabaseUpdate)

    The required parameters for updating a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1719

def begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'parameters is nil' if 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::SQL::Mgmt::V2014_04_01::Models::DatabaseUpdate.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'

  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,'serverName' => server_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::Database.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, server_name, database_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be updated.

  • parameters (DatabaseUpdate)

    The required parameters for updating a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1700
1701
1702
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1700

def begin_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
end

#create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. importing a Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to import into

  • parameters (ImportExtensionRequest)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



1044
1045
1046
1047
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1044

def create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  response = create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. importing a Bacpac into a database. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to import into

  • parameters (ImportExtensionRequest)

    The required parameters 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



1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1063

def create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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

#create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Database

Creates a new database or updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. (updated or created). a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be operated on

  • parameters (Database)

    The required parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



131
132
133
134
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 131

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

#create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. (updated or created). a database. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be operated on

  • parameters (Database)

    The required parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 151

def create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::Database.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, server_name, database_name, custom_headers: nil) ⇒ Object

Deletes a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be deleted.

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

    A hash of custom headers that



233
234
235
236
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 233

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

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

Deletes a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be deleted.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 268

def delete_async(resource_group_name, server_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/databases/{databaseName}'

  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,'serverName' => server_name,'databaseName' => database_name},
      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 == 200 || 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

#delete_with_http_info(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be deleted.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



251
252
253
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 251

def delete_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
  delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end

#export(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Exports a database to a bacpac.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be exported.

  • parameters (ExportRequest)

    The required parameters for exporting a

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



1096
1097
1098
1099
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1096

def export(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  response = export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#export_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be exported.

  • parameters (ExportRequest)

    The required parameters for exporting a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1115

def export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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

#get(resource_group_name, server_name, database_name, expand: nil, custom_headers: nil) ⇒ Database

Gets a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be retrieved.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



330
331
332
333
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 330

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

#get_async(resource_group_name, server_name, database_name, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be retrieved.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 371

def get_async(resource_group_name, server_name, database_name, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/databases/{databaseName}'

  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,'serverName' => server_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version,'$expand' => expand},
      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::SQL::Mgmt::V2014_04_01::Models::Database.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_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers: nil) ⇒ Database

Gets a database inside of an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

  • database_name (String)

    The name of the database to be retrieved.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



557
558
559
560
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 557

def get_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
  response = get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a database inside of an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

  • database_name (String)

    The name of the database to be retrieved.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 596

def get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}'

  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,'serverName' => server_name,'elasticPoolName' => elastic_pool_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::SQL::Mgmt::V2014_04_01::Models::Database.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_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database inside of an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

  • database_name (String)

    The name of the database to be retrieved.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



577
578
579
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 577

def get_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
  get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
end

Gets a database inside of a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. be retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the elastic pool to

  • database_name (String)

    The name of the database to be retrieved.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



775
776
777
778
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 775

def get_by_recommended_elastic_pool(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
  response = get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

Gets a database inside of a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. be retrieved. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the elastic pool to

  • database_name (String)

    The name of the database to be retrieved.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'recommended_elastic_pool_name is nil' if recommended_elastic_pool_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}'

  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,'serverName' => server_name,'recommendedElasticPoolName' => recommended_elastic_pool_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::SQL::Mgmt::V2014_04_01::Models::Database.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

Gets a database inside of a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. be retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the elastic pool to

  • database_name (String)

    The name of the database to be retrieved.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



795
796
797
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 795

def get_by_recommended_elastic_pool_with_http_info(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
  get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
end

#get_with_http_info(resource_group_name, server_name, database_name, expand: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be retrieved.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



351
352
353
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 351

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

#import(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ ImportExportResponse

Imports a bacpac into a new database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Bacpac into a database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • parameters (ImportRequest)

    The required parameters for importing a

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

    A hash of custom headers that

Returns:

  • (ImportExportResponse)

    operation results.



992
993
994
995
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 992

def import(resource_group_name, server_name, parameters, custom_headers:nil)
  response = import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#import_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Bacpac into a database. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • parameters (ImportRequest)

    The required parameters for importing a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1010

def import_async(resource_group_name, server_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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

#list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers: nil) ⇒ DatabaseListResult

Returns a list of databases in an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    operation results.



667
668
669
670
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 667

def list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
  response = list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers: nil) ⇒ Concurrent::Promise

Returns a list of databases in an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 704

def list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'

  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,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::SQL::Mgmt::V2014_04_01::Models::DatabaseListResult.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_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a list of databases in an elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



686
687
688
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 686

def list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
  list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
end

Returns a list of databases inside a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. elastic pool to be retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the recommended

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    operation results.



885
886
887
888
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 885

def list_by_recommended_elastic_pool(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers:nil)
  response = list_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

Returns a list of databases inside a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. elastic pool to be retrieved. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the recommended

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def list_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'recommended_elastic_pool_name is nil' if recommended_elastic_pool_name.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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases'

  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,'serverName' => server_name,'recommendedElasticPoolName' => recommended_elastic_pool_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::SQL::Mgmt::V2014_04_01::Models::DatabaseListResult.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

Returns a list of databases inside a recommended elastic pool.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. elastic pool to be retrieved. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • recommended_elastic_pool_name (String)

    The name of the recommended

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



904
905
906
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 904

def list_by_recommended_elastic_pool_with_http_info(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers:nil)
  list_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers:custom_headers).value!
end

#list_by_server(resource_group_name, server_name, expand: nil, filter: nil, custom_headers: nil) ⇒ DatabaseListResult

Returns a list of databases in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. databases to return. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

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

  • (DatabaseListResult)

    operation results.



444
445
446
447
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 444

def list_by_server(resource_group_name, server_name, expand:nil, filter:nil, custom_headers:nil)
  response = list_by_server_async(resource_group_name, server_name, expand:expand, filter:filter, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_server_async(resource_group_name, server_name, expand: nil, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Returns a list of databases in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. databases to return. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

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



487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 487

def list_by_server_async(resource_group_name, server_name, expand:nil, filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.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.Sql/servers/{serverName}/databases'

  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,'serverName' => server_name},
      query_params: {'api-version' => @client.api_version,'$expand' => expand,'$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::SQL::Mgmt::V2014_04_01::Models::DatabaseListResult.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_server_with_http_info(resource_group_name, server_name, expand: nil, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a list of databases in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. databases to return. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • expand (String) (defaults to: nil)

    A comma separated list of child objects to expand in

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



466
467
468
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 466

def list_by_server_with_http_info(resource_group_name, server_name, expand:nil, filter:nil, custom_headers:nil)
  list_by_server_async(resource_group_name, server_name, expand:expand, filter:filter, custom_headers:custom_headers).value!
end

#list_metric_definitions(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MetricDefinitionListResult

Returns database metric definitions.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

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

    A hash of custom headers that

Returns:

  • (MetricDefinitionListResult)

    operation results.



1257
1258
1259
1260
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1257

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

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

Returns database metric definitions.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1292

def list_metric_definitions_async(resource_group_name, server_name, database_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.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.Sql/servers/{serverName}/databases/{databaseName}/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,'serverName' => server_name,'databaseName' => database_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::SQL::Mgmt::V2014_04_01::Models::MetricDefinitionListResult.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, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns database metric definitions.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1275
1276
1277
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1275

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

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

Returns database metrics.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. metrics to return. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

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



1148
1149
1150
1151
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1148

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

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

Returns database metrics.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. metrics to return. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

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



1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1187

def list_metrics_async(resource_group_name, server_name, database_name, filter, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'filter is nil' if filter.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/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,'serverName' => server_name,'databaseName' => database_name},
      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::SQL::Mgmt::V2014_04_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, server_name, database_name, filter, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns database metrics.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. metrics to return. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database.

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



1168
1169
1170
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 1168

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

#pause(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Object

Pauses a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to pause.

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

    A hash of custom headers that



38
39
40
41
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 38

def pause(resource_group_name, server_name, database_name, custom_headers:nil)
  response = pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  nil
end

#pause_async(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to pause.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 55

def pause_async(resource_group_name, server_name, database_name, custom_headers:nil)
  # Send request
  promise = begin_pause_async(resource_group_name, server_name, database_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

#resume(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Object

Resumes a data warehouse.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to resume.

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

    A hash of custom headers that



82
83
84
85
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 82

def resume(resource_group_name, server_name, database_name, custom_headers:nil)
  response = resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  nil
end

#resume_async(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the data warehouse to resume.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 99

def resume_async(resource_group_name, server_name, database_name, custom_headers:nil)
  # Send request
  promise = begin_resume_async(resource_group_name, server_name, database_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

#update(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Database

Updates an existing database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be updated.

  • parameters (DatabaseUpdate)

    The required parameters for updating a

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



184
185
186
187
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 184

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

#update_async(resource_group_name, server_name, database_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. database. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • database_name (String)

    The name of the database to be updated.

  • parameters (DatabaseUpdate)

    The required parameters for updating a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/2014-04-01/generated/azure_mgmt_sql/databases.rb', line 203

def update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::Database.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