Class: Azure::ARM::SQL::Databases

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



1450
1451
1452
1453
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1450

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



1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1491

def begin_create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::ARM::SQL::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' => 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?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



1471
1472
1473
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1471

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



1868
1869
1870
1871
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1868

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



1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
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
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1909

def begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::ARM::SQL::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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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::ARM::SQL::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.



1889
1890
1891
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1889

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



1570
1571
1572
1573
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1570

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



1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1609

def begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::ARM::SQL::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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



1590
1591
1592
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1590

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



1335
1336
1337
1338
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1335

def begin_import(resource_group_name, server_name, parameters, custom_headers = nil)
  response = begin_import_async(resource_group_name, server_name, parameters, 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.



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

def begin_import_async(resource_group_name, server_name, parameters, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::ARM::SQL::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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



1354
1355
1356
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1354

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



1684
1685
1686
1687
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1684

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



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
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1719

def begin_pause_async(resource_group_name, server_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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
  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.



1702
1703
1704
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1702

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



1774
1775
1776
1777
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1774

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



1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1809

def begin_resume_async(resource_group_name, server_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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
  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.



1792
1793
1794
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1792

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



1997
1998
1999
2000
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1997

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



2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2036

def begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::ARM::SQL::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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



2017
2018
2019
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2017

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



93
94
95
96
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 93

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



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 112

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)

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



495
496
497
498
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 495

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



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 515

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)

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



597
598
599
600
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 597

def delete(resource_group_name, server_name, database_name, custom_headers = nil)
  response = delete_async(resource_group_name, server_name, database_name, 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.



632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 632

def delete_async(resource_group_name, server_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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
  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.



615
616
617
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 615

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



145
146
147
148
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 145

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



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 164

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)

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



691
692
693
694
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 691

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



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
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 732

def get_async(resource_group_name, server_name, database_name, expand = nil, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



912
913
914
915
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 912

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



951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 951

def get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



932
933
934
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 932

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).value!
end

Gets a database inside of a recommented 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.



1124
1125
1126
1127
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1124

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).value!
  response.body unless response.nil?
end

Gets a database inside of a recommented 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.



1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1163

def get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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 recommented 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.



1144
1145
1146
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1144

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



712
713
714
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 712

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



41
42
43
44
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 41

def import(resource_group_name, server_name, parameters, custom_headers = nil)
  response = import_async(resource_group_name, server_name, parameters, 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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 59

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)

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



1019
1020
1021
1022
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1019

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



1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1056

def list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



1038
1039
1040
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1038

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).value!
end

Returns a list of databases inside a recommented 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.



1231
1232
1233
1234
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1231

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).value!
  response.body unless response.nil?
end

Returns a list of databases inside a recommented 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.



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1268

def list_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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 recommented 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.



1250
1251
1252
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1250

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



802
803
804
805
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 802

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, filter, 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.



845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 845

def list_by_server_async(resource_group_name, server_name, expand = nil, filter = nil, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



824
825
826
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 824

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, filter, 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.



303
304
305
306
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 303

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



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 338

def list_metric_definitions_async(resource_group_name, server_name, database_name, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



321
322
323
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 321

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



197
198
199
200
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 197

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



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 236

def list_metrics_async(resource_group_name, server_name, database_name, filter, custom_headers = nil)
  api_version = '2014-04-01'
  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 = {}

  # 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' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::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.



217
218
219
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 217

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



402
403
404
405
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 402

def pause(resource_group_name, server_name, database_name, custom_headers = nil)
  response = pause_async(resource_group_name, server_name, database_name, 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



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 419

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)

  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



446
447
448
449
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 446

def resume(resource_group_name, server_name, database_name, custom_headers = nil)
  response = resume_async(resource_group_name, server_name, database_name, 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



463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 463

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)

  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.



548
549
550
551
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 548

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



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 567

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)

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