Class: Azure::SQL::Mgmt::V2017_10_01_preview::Databases

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-10-01-preview/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/2017-10-01-preview/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/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 25

def client
  @client
end

Instance Method Details

#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. 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 (Database)

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



740
741
742
743
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 740

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

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

Creates a new database or updates an existing database.

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

    The requested database resource state.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
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
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 777

def begin_create_or_update_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?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::Models::Database.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::Models::Database.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Creates a new database or updates an existing database.

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

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



759
760
761
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 759

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

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

Deletes the 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.

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

    A hash of custom headers that



863
864
865
866
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 863

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

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

Deletes the 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.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 898

def begin_delete_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?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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 == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

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

Deletes the 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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



881
882
883
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 881

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

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

Pauses 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 paused.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



1072
1073
1074
1075
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1072

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

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

Pauses 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 paused.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1107

def begin_pause_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?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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_pause_with_http_info(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Pauses 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 paused.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1090
1091
1092
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1090

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

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

Resumes 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 resumed.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



1176
1177
1178
1179
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1176

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

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

Resumes 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 resumed.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1211

def begin_resume_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?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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_resume_with_http_info(resource_group_name, server_name, database_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Resumes 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 resumed.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1194
1195
1196
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1194

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

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

Updates an existing database.

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

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



958
959
960
961
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 958

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

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

Updates an existing database.

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

    The requested database resource state.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
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
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 995

def begin_update_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?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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. 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 (DatabaseUpdate)

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



977
978
979
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 977

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

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

Upgrades 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 database to be upgraded.

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

    A hash of custom headers that



1279
1280
1281
1282
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1279

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

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

Upgrades 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 database to be upgraded.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1314

def begin_upgrade_data_warehouse_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?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse'

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

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

Upgrades 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 database to be upgraded.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1297
1298
1299
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1297

def begin_upgrade_data_warehouse_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
  begin_upgrade_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
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. 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 (Database)

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



245
246
247
248
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 245

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

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

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

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 263

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

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

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

  promise
end

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

Deletes the 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.

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

    A hash of custom headers that



292
293
294
295
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 292

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

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

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

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 309

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

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

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

  promise
end

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

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

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



140
141
142
143
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 140

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

#get_async(resource_group_name, server_name, database_name, 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. 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.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 175

def get_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?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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_with_http_info(resource_group_name, server_name, database_name, 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. 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.



158
159
160
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 158

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

#list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers: nil) ⇒ Array<Database>

Gets a list of databases in an elastic pool.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool.

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

    A hash of custom headers that

Returns:

  • (Array<Database>)

    operation results.



388
389
390
391
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 388

def list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
  first_page = list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers)
  first_page.get_all_items
end

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

Gets a list of databases in an elastic pool.

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

  • elastic_pool_name (String)

    The name of the elastic pool.

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    which provide lazy access to pages of the



1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1578

def list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
  response = list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

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

Gets a list of databases in an elastic pool.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 423

def list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_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, 'elastic_pool_name is nil' if elastic_pool_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::Models::DatabaseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_elastic_pool_next(next_page_link, custom_headers: nil) ⇒ DatabaseListResult

Gets a list of databases in an elastic pool.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    operation results.



1460
1461
1462
1463
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1460

def list_by_elastic_pool_next(next_page_link, custom_headers:nil)
  response = list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_elastic_pool_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of databases in an elastic pool.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def list_by_elastic_pool_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::Models::DatabaseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_elastic_pool_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of databases in an elastic pool.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1475
1476
1477
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1475

def list_by_elastic_pool_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of databases in an elastic pool.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server.

  • elastic_pool_name (String)

    The name of the elastic pool.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



406
407
408
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 406

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

#list_by_server(resource_group_name, server_name, custom_headers: nil) ⇒ Array<Database>

Gets a list of databases.

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.

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

    A hash of custom headers that

Returns:

  • (Array<Database>)

    operation results.



39
40
41
42
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 39

def list_by_server(resource_group_name, server_name, custom_headers:nil)
  first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_server_as_lazy(resource_group_name, server_name, custom_headers: nil) ⇒ DatabaseListResult

Gets a list of databases.

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.

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    which provide lazy access to pages of the



1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1553

def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
  response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_server_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

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

Gets a list of databases.

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.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def list_by_server_async(resource_group_name, server_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, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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_next(next_page_link, custom_headers: nil) ⇒ DatabaseListResult

Gets a list of databases.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (DatabaseListResult)

    operation results.



1370
1371
1372
1373
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1370

def list_by_server_next(next_page_link, custom_headers:nil)
  response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_server_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of databases.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1399

def list_by_server_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::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_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of databases.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1385
1386
1387
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 1385

def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
end

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

Gets a list of databases.

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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



56
57
58
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 56

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

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

Pauses 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 paused.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



492
493
494
495
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 492

def pause(resource_group_name, server_name, database_name, custom_headers:nil)
  response = pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  response.body unless response.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 database to be paused.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 509

def pause_async(resource_group_name, server_name, database_name, custom_headers:nil)
  # Send request
  promise = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)

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

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

Renames a database.

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

  • parameters (ResourceMoveDefinition)

    The resource move definition for

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

    A hash of custom headers that



633
634
635
636
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 633

def rename(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  response = rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
  nil
end

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

Renames a database.

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

  • parameters (ResourceMoveDefinition)

    The resource move definition for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 672

def rename_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?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::SQL::Mgmt::V2017_10_01_preview::Models::ResourceMoveDefinition.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}/move'

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

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

Renames a database.

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

  • parameters (ResourceMoveDefinition)

    The resource move definition for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



653
654
655
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 653

def rename_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
  rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
end

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

Resumes 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 resumed.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



540
541
542
543
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 540

def resume(resource_group_name, server_name, database_name, custom_headers:nil)
  response = resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  response.body unless response.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 database to be resumed.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 557

def resume_async(resource_group_name, server_name, database_name, custom_headers:nil)
  # Send request
  promise = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)

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

#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. 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 (DatabaseUpdate)

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Database)

    operation results.



339
340
341
342
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 339

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

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

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

    The requested database resource state.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 357

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

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

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

Upgrades 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 database to be upgraded.

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

    A hash of custom headers that



586
587
588
589
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 586

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

#upgrade_data_warehouse_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 database to be upgraded.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/databases.rb', line 603

def upgrade_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers:nil)
  # Send request
  promise = begin_upgrade_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)

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

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

  promise
end