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.



3718
3719
3720
3721
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3718

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.



3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3759

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.



3739
3740
3741
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3739

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.



4336
4337
4338
4339
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4336

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.



4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4377

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_long_term_retention_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ BackupLongTermRetentionPolicy

Creates or updates a database backup long term retention policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. update a backup long term retention policy 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

  • parameters (BackupLongTermRetentionPolicy)

    The required parameters to

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

    A hash of custom headers that

Returns:

  • (BackupLongTermRetentionPolicy)

    operation results.



3476
3477
3478
3479
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3476

def begin_create_or_update_long_term_retention_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = begin_create_or_update_long_term_retention_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a database backup long term retention policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. update a backup long term retention policy 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

  • parameters (BackupLongTermRetentionPolicy)

    The required parameters to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3515

def begin_create_or_update_long_term_retention_policy_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?
  backup_long_term_retention_policy_name = 'Default'
  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::BackupLongTermRetentionPolicy.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}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'

  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,'backupLongTermRetentionPolicyName' => backup_long_term_retention_policy_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::BackupLongTermRetentionPolicy.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::BackupLongTermRetentionPolicy.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_long_term_retention_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database backup long term retention policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. update a backup long term retention policy 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

  • parameters (BackupLongTermRetentionPolicy)

    The required parameters to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3496
3497
3498
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3496

def begin_create_or_update_long_term_retention_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  begin_create_or_update_long_term_retention_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
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.



4357
4358
4359
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4357

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.



3838
3839
3840
3841
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3838

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.



3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3877

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.



3858
3859
3860
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3858

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

Sets which replica database is primary by failing over from the current primary replica database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that



3955
3956
3957
3958
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3955

def begin_failover_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  nil
end

Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that



4055
4056
4057
4058
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4055

def begin_failover_replication_link_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  nil
end

Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4096

def begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, 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, 'link_id is nil' if link_id.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}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'

  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,'linkId' => link_id},
      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 == 204 || 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

Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



4076
4077
4078
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4076

def begin_failover_replication_link_allow_data_loss_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
end

Sets which replica database is primary by failing over from the current primary replica database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3996

def begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, 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, 'link_id is nil' if link_id.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}/replicationLinks/{linkId}/failover'

  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,'linkId' => link_id},
      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 == 204 || 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

Sets which replica database is primary by failing over from the current primary replica database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3976
3977
3978
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3976

def begin_failover_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, 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.



3603
3604
3605
3606
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3603

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.



3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3640

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.



3622
3623
3624
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3622

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



4152
4153
4154
4155
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4152

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.



4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4187

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.



4170
4171
4172
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4170

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



4242
4243
4244
4245
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4242

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.



4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4277

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.



4260
4261
4262
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4260

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.



4465
4466
4467
4468
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4465

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.



4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4504

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.



4485
4486
4487
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 4485

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.



1372
1373
1374
1375
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1372

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



1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1391

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.



2175
2176
2177
2178
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2175

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



2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2195

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

#create_or_update_blob_auditing_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ DatabaseBlobAuditingPolicy

Creates or updates a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. auditing policy will be defined. policy. 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 for which the blob

  • parameters (DatabaseBlobAuditingPolicy)

    The database blob auditing

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

    A hash of custom headers that

Returns:

  • (DatabaseBlobAuditingPolicy)

    operation results.



3346
3347
3348
3349
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3346

def create_or_update_blob_auditing_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_blob_auditing_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. auditing policy will be defined. policy. 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 for which the blob

  • parameters (DatabaseBlobAuditingPolicy)

    The database blob auditing

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3387

def create_or_update_blob_auditing_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers = 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?
  blob_auditing_policy_name = 'default'
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  api_version = '2015-05-01-preview'


  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::DatabaseBlobAuditingPolicy.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}/auditingSettings/{blobAuditingPolicyName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'blobAuditingPolicyName' => blob_auditing_policy_name,'subscriptionId' => @client.subscription_id},
      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
      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::DatabaseBlobAuditingPolicy.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::DatabaseBlobAuditingPolicy.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

#create_or_update_blob_auditing_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. auditing policy will be defined. policy. 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 for which the blob

  • parameters (DatabaseBlobAuditingPolicy)

    The database blob auditing

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3367
3368
3369
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3367

def create_or_update_blob_auditing_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  create_or_update_blob_auditing_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
end

#create_or_update_data_masking_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ DataMaskingPolicy

Creates or updates a database data masking policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. data masking policy. 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.

  • parameters (DataMaskingPolicy)

    Parameters for creating or updating a

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

    A hash of custom headers that

Returns:

  • (DataMaskingPolicy)

    operation results.



536
537
538
539
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 536

def create_or_update_data_masking_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_data_masking_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a database data masking policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. data masking policy. 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.

  • parameters (DataMaskingPolicy)

    Parameters for creating or updating a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 575

def create_or_update_data_masking_policy_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?
  data_masking_policy_name = 'Default'
  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::DataMaskingPolicy.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}/dataMaskingPolicies/{dataMaskingPolicyName}'

  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,'dataMaskingPolicyName' => data_masking_policy_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
      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::DataMaskingPolicy.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

#create_or_update_data_masking_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database data masking policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. data masking policy. 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.

  • parameters (DataMaskingPolicy)

    Parameters for creating or updating a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



556
557
558
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 556

def create_or_update_data_masking_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  create_or_update_data_masking_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
end

#create_or_update_data_masking_rule(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil) ⇒ DataMaskingRule

Creates or updates a database data masking rule.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a data masking rule. 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.

  • data_masking_rule_name (String)

    The name of the data masking rule.

  • parameters (DataMaskingRule)

    The required parameters for creating or

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

    A hash of custom headers that

Returns:

  • (DataMaskingRule)

    operation results.



757
758
759
760
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 757

def create_or_update_data_masking_rule(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil)
  response = create_or_update_data_masking_rule_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_data_masking_rule_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Creates or updates a database data masking rule.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a data masking rule. 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.

  • data_masking_rule_name (String)

    The name of the data masking rule.

  • parameters (DataMaskingRule)

    The required parameters for creating or

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 798

def create_or_update_data_masking_rule_async(resource_group_name, server_name, database_name, data_masking_rule_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?
  data_masking_policy_name = 'Default'
  fail ArgumentError, 'data_masking_rule_name is nil' if data_masking_rule_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::DataMaskingRule.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}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'

  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,'dataMaskingPolicyName' => data_masking_policy_name,'dataMaskingRuleName' => data_masking_rule_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
      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::DataMaskingRule.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::DataMaskingRule.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

#create_or_update_data_masking_rule_with_http_info(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database data masking rule.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating a data masking rule. 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.

  • data_masking_rule_name (String)

    The name of the data masking rule.

  • parameters (DataMaskingRule)

    The required parameters for creating or

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



778
779
780
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 778

def create_or_update_data_masking_rule_with_http_info(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil)
  create_or_update_data_masking_rule_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers).value!
end

#create_or_update_geo_backup_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ GeoBackupPolicy

Updates a database geo backup policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating the geo backup policy. 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.

  • parameters (GeoBackupPolicy)

    The required parameters for creating or

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

    A hash of custom headers that

Returns:

  • (GeoBackupPolicy)

    operation results.



990
991
992
993
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 990

def create_or_update_geo_backup_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_geo_backup_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Updates a database geo backup policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating the geo backup policy. 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.

  • parameters (GeoBackupPolicy)

    The required parameters for creating or

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
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
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1029

def create_or_update_geo_backup_policy_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?
  geo_backup_policy_name = 'Default'
  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::GeoBackupPolicy.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}/geoBackupPolicies/{geoBackupPolicyName}'

  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,'geoBackupPolicyName' => geo_backup_policy_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 == 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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::Models::GeoBackupPolicy.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::SQL::Models::GeoBackupPolicy.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

#create_or_update_geo_backup_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a database geo backup policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. updating the geo backup policy. 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.

  • parameters (GeoBackupPolicy)

    The required parameters for creating or

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1010
1011
1012
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1010

def create_or_update_geo_backup_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  create_or_update_geo_backup_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
end

#create_or_update_long_term_retention_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ BackupLongTermRetentionPolicy

Creates or updates a database backup long term retention policy

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. update a backup long term retention policy 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

  • parameters (BackupLongTermRetentionPolicy)

    The required parameters to

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

    A hash of custom headers that

Returns:

  • (BackupLongTermRetentionPolicy)

    operation results.



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

def create_or_update_long_term_retention_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_long_term_retention_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_long_term_retention_policy_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. update a backup long term retention policy 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

  • parameters (BackupLongTermRetentionPolicy)

    The required parameters to

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



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

def create_or_update_long_term_retention_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_create_or_update_long_term_retention_policy_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::BackupLongTermRetentionPolicy.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_threat_detection_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ DatabaseSecurityAlertPolicy

Creates or updates a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. policy. 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 for which database

  • parameters (DatabaseSecurityAlertPolicy)

    The database Threat Detection

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

    A hash of custom headers that

Returns:

  • (DatabaseSecurityAlertPolicy)

    operation results.



406
407
408
409
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 406

def create_or_update_threat_detection_policy(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_threat_detection_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. policy. 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 for which database

  • parameters (DatabaseSecurityAlertPolicy)

    The database Threat Detection

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 447

def create_or_update_threat_detection_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  security_alert_policy_name = 'default'
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  api_version = '2014-04-01'


  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::DatabaseSecurityAlertPolicy.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}/securityAlertPolicies/{securityAlertPolicyName}'

  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,'securityAlertPolicyName' => security_alert_policy_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
      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::DatabaseSecurityAlertPolicy.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::DatabaseSecurityAlertPolicy.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

#create_or_update_threat_detection_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. policy. 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 for which database

  • parameters (DatabaseSecurityAlertPolicy)

    The database Threat Detection

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



427
428
429
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 427

def create_or_update_threat_detection_policy_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  create_or_update_threat_detection_policy_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
end

#create_or_update_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ TransparentDataEncryption

Creates or updates a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. creating or updating transparent data encryption. 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 for which setting the

  • parameters (TransparentDataEncryption)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (TransparentDataEncryption)

    operation results.



2799
2800
2801
2802
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2799

def create_or_update_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  response = create_or_update_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. creating or updating transparent data encryption. 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 for which setting the

  • parameters (TransparentDataEncryption)

    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.



2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2840

def create_or_update_transparent_data_encryption_configuration_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?
  transparent_data_encryption_name = 'current'
  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::TransparentDataEncryption.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}/transparentDataEncryption/{transparentDataEncryptionName}'

  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,'transparentDataEncryptionName' => transparent_data_encryption_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
      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::TransparentDataEncryption.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::TransparentDataEncryption.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

#create_or_update_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. creating or updating transparent data encryption. 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 for which setting the

  • parameters (TransparentDataEncryption)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2820
2821
2822
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2820

def create_or_update_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
  create_or_update_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
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



2277
2278
2279
2280
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2277

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.



2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2312

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

Deletes a database replication link. Cannot be done during failover.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be dropped. 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 that has the

  • link_id (String)

    The ID of the replication link to be deleted.

  • 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 delete_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = delete_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  nil
end

Deletes a database replication link. Cannot be done during failover.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be dropped. 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 that has the

  • link_id (String)

    The ID of the replication link 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.



1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1723

def delete_replication_link_async(resource_group_name, server_name, database_name, link_id, 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, 'link_id is nil' if link_id.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}/replicationLinks/{linkId}'

  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,'linkId' => link_id},
      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

Deletes a database replication link. Cannot be done during failover.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be dropped. 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 that has the

  • link_id (String)

    The ID of the replication link to be deleted.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1704
1705
1706
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1704

def delete_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  delete_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
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.



2295
2296
2297
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2295

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.



1424
1425
1426
1427
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1424

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



1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1443

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

Sets which replica database is primary by failing over from the current primary replica database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that



1886
1887
1888
1889
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1886

def failover_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  nil
end

Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that



1935
1936
1937
1938
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1935

def failover_replication_link_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  nil
end

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1954

def failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  # Send request
  promise = begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, 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

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. replication link to be failed over. 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 that has the

  • link_id (String)

    The ID of the replication link to be failed over.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1905

def failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  # Send request
  promise = begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers)

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

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

  promise
end

#get(resource_group_name, 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.



2371
2372
2373
2374
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2371

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.



2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2412

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_backup_long_term_retention_policy(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ BackupLongTermRetentionPolicy

Returns a database backup long term retention policy

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:

  • (BackupLongTermRetentionPolicy)

    operation results.



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

def get_backup_long_term_retention_policy(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_backup_long_term_retention_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Returns a database backup long term retention policy

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.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 75

def get_backup_long_term_retention_policy_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?
  backup_long_term_retention_policy_name = 'Default'


  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}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'

  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,'backupLongTermRetentionPolicyName' => backup_long_term_retention_policy_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::BackupLongTermRetentionPolicy.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_backup_long_term_retention_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a database backup long term retention policy

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.



58
59
60
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 58

def get_backup_long_term_retention_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_backup_long_term_retention_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#get_blob_auditing_policy(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ DatabaseBlobAuditingPolicy

Gets a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. audit policy is defined. 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 for which the blob

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

    A hash of custom headers that

Returns:

  • (DatabaseBlobAuditingPolicy)

    operation results.



3239
3240
3241
3242
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3239

def get_blob_auditing_policy(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_blob_auditing_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. audit policy is defined. 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 for which the blob

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3276

def get_blob_auditing_policy_async(resource_group_name, server_name, database_name, custom_headers = 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?
  blob_auditing_policy_name = 'default'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  api_version = '2015-05-01-preview'


  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}/auditingSettings/{blobAuditingPolicyName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'blobAuditingPolicyName' => blob_auditing_policy_name,'subscriptionId' => @client.subscription_id},
      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::DatabaseBlobAuditingPolicy.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_blob_auditing_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database’s blob auditing policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. audit policy is defined. 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 for which the blob

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3258
3259
3260
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3258

def get_blob_auditing_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_blob_auditing_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#get_data_masking_policy(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ DataMaskingPolicy

Gets a database data masking policy.

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:

  • (DataMaskingPolicy)

    operation results.



652
653
654
655
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 652

def get_data_masking_policy(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_data_masking_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a database data masking policy.

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.



687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 687

def get_data_masking_policy_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?
  data_masking_policy_name = 'Default'


  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}/dataMaskingPolicies/{dataMaskingPolicyName}'

  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,'dataMaskingPolicyName' => data_masking_policy_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::DataMaskingPolicy.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_data_masking_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database data masking policy.

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.



670
671
672
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 670

def get_data_masking_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_data_masking_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#get_geo_backup_policy(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ GeoBackupPolicy

Gets a geo backup policy.

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:

  • (GeoBackupPolicy)

    operation results.



1116
1117
1118
1119
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1116

def get_geo_backup_policy(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_geo_backup_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a geo backup policy.

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.



1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
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
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1151

def get_geo_backup_policy_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?
  geo_backup_policy_name = 'Default'


  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}/geoBackupPolicies/{geoBackupPolicyName}'

  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,'geoBackupPolicyName' => geo_backup_policy_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::GeoBackupPolicy.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_geo_backup_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a geo backup policy.

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.



1134
1135
1136
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1134

def get_geo_backup_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_geo_backup_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
end

Gets a database replication link.

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 get the link for.

  • link_id (String)

    The replication link ID to be retrieved.

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

    A hash of custom headers that

Returns:

  • (ReplicationLink)

    operation results.



1781
1782
1783
1784
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1781

def get_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  response = get_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
  response.body unless response.nil?
end

Gets a database replication link.

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 get the link for.

  • link_id (String)

    The replication link ID 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.



1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1818

def get_replication_link_async(resource_group_name, server_name, database_name, link_id, 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, 'link_id is nil' if link_id.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}/replicationLinks/{linkId}'

  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,'linkId' => link_id},
      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::ReplicationLink.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 replication link.

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 get the link for.

  • link_id (String)

    The replication link ID to be retrieved.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1800
1801
1802
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1800

def get_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
  get_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
end

#get_service_tier_advisor(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil) ⇒ ServiceTierAdvisor

Gets a service tier advisor.

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

  • service_tier_advisor_name (String)

    The name of service tier advisor.

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

    A hash of custom headers that

Returns:

  • (ServiceTierAdvisor)

    operation results.



2591
2592
2593
2594
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2591

def get_service_tier_advisor(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil)
  response = get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers).value!
  response.body unless response.nil?
end

#get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets a service tier advisor.

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

  • service_tier_advisor_name (String)

    The name of service tier advisor.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2628

def get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_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?
  fail ArgumentError, 'service_tier_advisor_name is nil' if service_tier_advisor_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}/serviceTierAdvisors/{serviceTierAdvisorName}'

  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,'serviceTierAdvisorName' => service_tier_advisor_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::ServiceTierAdvisor.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_service_tier_advisor_with_http_info(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a service tier advisor.

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

  • service_tier_advisor_name (String)

    The name of service tier advisor.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2610
2611
2612
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2610

def get_service_tier_advisor_with_http_info(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil)
  get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers).value!
end

#get_threat_detection_policy(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ DatabaseSecurityAlertPolicy

Gets a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. 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 for which database

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

    A hash of custom headers that

Returns:

  • (DatabaseSecurityAlertPolicy)

    operation results.



299
300
301
302
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 299

def get_threat_detection_policy(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_threat_detection_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. 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 for which database

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def get_threat_detection_policy_async(resource_group_name, server_name, database_name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'database_name is nil' if database_name.nil?
  security_alert_policy_name = 'default'
  api_version = '2014-04-01'


  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}/securityAlertPolicies/{securityAlertPolicyName}'

  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,'securityAlertPolicyName' => security_alert_policy_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::DatabaseSecurityAlertPolicy.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_threat_detection_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database’s threat detection policy.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Threat Detection policy is defined. 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 for which database

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



318
319
320
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 318

def get_threat_detection_policy_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_threat_detection_policy_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#get_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ TransparentDataEncryption

Gets a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

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

    A hash of custom headers that

Returns:

  • (TransparentDataEncryption)

    operation results.



2928
2929
2930
2931
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2928

def get_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, custom_headers = nil)
  response = get_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2965

def get_transparent_data_encryption_configuration_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?
  transparent_data_encryption_name = 'current'


  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}/transparentDataEncryption/{transparentDataEncryptionName}'

  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,'transparentDataEncryptionName' => transparent_data_encryption_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::TransparentDataEncryption.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_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a database’s transparent data encryption configuration.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2947
2948
2949
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2947

def get_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  get_transparent_data_encryption_configuration_async(resource_group_name, server_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.



2392
2393
2394
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2392

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.



1320
1321
1322
1323
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1320

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



1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1338

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



2482
2483
2484
2485
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2482

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.



2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2525

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.



2504
2505
2506
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2504

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_data_masking_rules(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ DataMaskingRuleListResult

Gets a list of database data masking rules.

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:

  • (DataMaskingRuleListResult)

    operation results.



886
887
888
889
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 886

def list_data_masking_rules(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_data_masking_rules_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a list of database data masking rules.

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.



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

def list_data_masking_rules_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?
  data_masking_policy_name = 'Default'


  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}/dataMaskingPolicies/{dataMaskingPolicyName}/rules'

  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,'dataMaskingPolicyName' => data_masking_policy_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::DataMaskingRuleListResult.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_data_masking_rules_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of database data masking rules.

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.



904
905
906
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 904

def list_data_masking_rules_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_data_masking_rules_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#list_geo_backup_policies(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ GeoBackupPolicyListResult

Returns a list of geo backup policies.

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:

  • (GeoBackupPolicyListResult)

    operation results.



1218
1219
1220
1221
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1218

def list_geo_backup_policies(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_geo_backup_policies_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Returns a list of geo backup policies.

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.



1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
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
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1253

def list_geo_backup_policies_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}/geoBackupPolicies'

  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::GeoBackupPolicyListResult.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_geo_backup_policies_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a list of geo backup policies.

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.



1236
1237
1238
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1236

def list_geo_backup_policies_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_geo_backup_policies_async(resource_group_name, server_name, database_name, 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.



1582
1583
1584
1585
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1582

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.



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

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.



1600
1601
1602
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1600

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.



1476
1477
1478
1479
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1476

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.



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
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1515

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.



1496
1497
1498
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1496

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

Lists a database’s replication links.

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 retrieve links for.

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

    A hash of custom headers that

Returns:

  • (ReplicationLinkListResult)

    operation results.



1983
1984
1985
1986
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 1983

def list_replication_links(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_replication_links_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

Lists a database’s replication links.

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 retrieve links for.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2018

def list_replication_links_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}/replicationLinks'

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

Lists a database’s replication links.

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 retrieve links for.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2001
2002
2003
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2001

def list_replication_links_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_replication_links_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#list_restore_points(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ RestorePointListResult

Gets a list of database restore points.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. restore points. 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 get available

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

    A hash of custom headers that

Returns:

  • (RestorePointListResult)

    operation results.



195
196
197
198
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 195

def list_restore_points(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_restore_points_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a list of database restore points.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. restore points. 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 get available

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def list_restore_points_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}/restorePoints'

  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::RestorePointListResult.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_restore_points_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of database restore points.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. restore points. 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 get available

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



214
215
216
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 214

def list_restore_points_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_restore_points_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#list_service_tier_advisors(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ ServiceTierAdvisorListResult

Returns service tier advisors for specified 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 database.

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

    A hash of custom headers that

Returns:

  • (ServiceTierAdvisorListResult)

    operation results.



2695
2696
2697
2698
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2695

def list_service_tier_advisors(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_service_tier_advisors_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Returns service tier advisors for specified 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 database.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2730

def list_service_tier_advisors_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}/serviceTierAdvisors'

  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::ServiceTierAdvisorListResult.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_service_tier_advisors_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns service tier advisors for specified 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 database.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2713
2714
2715
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2713

def list_service_tier_advisors_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_service_tier_advisors_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#list_transparent_data_encryption_activity(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ TransparentDataEncryptionActivityListResult

Returns a database’s transparent data encryption operation result.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

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

    A hash of custom headers that

Returns:

  • (TransparentDataEncryptionActivityListResult)

    operation results.



3033
3034
3035
3036
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3033

def list_transparent_data_encryption_activity(resource_group_name, server_name, database_name, custom_headers = nil)
  response = list_transparent_data_encryption_activity_async(resource_group_name, server_name, database_name, custom_headers).value!
  response.body unless response.nil?
end

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

Returns a database’s transparent data encryption operation result.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3070

def list_transparent_data_encryption_activity_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?
  transparent_data_encryption_name = 'current'


  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}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults'

  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,'transparentDataEncryptionName' => transparent_data_encryption_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::TransparentDataEncryptionActivityListResult.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_transparent_data_encryption_activity_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a database’s transparent data encryption operation result.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. transparent data encryption applies. 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 for which the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3052
3053
3054
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3052

def list_transparent_data_encryption_activity_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_transparent_data_encryption_activity_async(resource_group_name, server_name, database_name, custom_headers).value!
end

#list_usages(resource_group_name, server_name, database_name, custom_headers = nil) ⇒ DatabaseUsageListResult

Returns database usages.

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:

  • (DatabaseUsageListResult)

    operation results.



3137
3138
3139
3140
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3137

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

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

Returns database usages.

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.



3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3172

def list_usages_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}/usages'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'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::DatabaseUsageListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Returns database usages.

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.



3155
3156
3157
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 3155

def list_usages_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
  list_usages_async(resource_group_name, server_name, database_name, 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



2082
2083
2084
2085
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2082

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



2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2099

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



2126
2127
2128
2129
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2126

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



2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2143

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.



2228
2229
2230
2231
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2228

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



2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
# File 'lib/generated/azure_mgmt_sql/databases.rb', line 2247

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