Class: Azure::DataMigration::Mgmt::V2018_04_19::Services

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb

Overview

Data Migration Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Services

Creates and initializes a new instance of the Services class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientDataMigrationServiceClient (readonly)

Returns reference to the DataMigrationServiceClient.

Returns:



22
23
24
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(parameters, group_name, service_name, custom_headers: nil) ⇒ DataMigrationService

Create or update DMS Instance

The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, “vm”, which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationService)

    operation results.



1024
1025
1026
1027
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1024

def begin_create_or_update(parameters, group_name, service_name, custom_headers:nil)
  response = begin_create_or_update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(parameters, group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Create or update DMS Instance

The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, “vm”, which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.

to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
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
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1077

def begin_create_or_update_async(parameters, group_name, service_name, custom_headers:nil)
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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::DataMigration::Mgmt::V2018_04_19::Models::DataMigrationService.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

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

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

Create or update DMS Instance

The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, “vm”, which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1051
1052
1053
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1051

def begin_create_or_update_with_http_info(parameters, group_name, service_name, custom_headers:nil)
  begin_create_or_update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
end

#begin_delete(group_name, service_name, delete_running_tasks: nil, custom_headers: nil) ⇒ Object

Delete DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled.

running tasks will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • delete_running_tasks (Boolean) (defaults to: nil)

    Delete the resource even if it contains

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

    A hash of custom headers that



1165
1166
1167
1168
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1165

def begin_delete(group_name, service_name, delete_running_tasks:nil, custom_headers:nil)
  response = begin_delete_async(group_name, service_name, delete_running_tasks:delete_running_tasks, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(group_name, service_name, delete_running_tasks: nil, custom_headers: nil) ⇒ Concurrent::Promise

Delete DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled.

running tasks to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • delete_running_tasks (Boolean) (defaults to: nil)

    Delete the resource even if it contains

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1206

def begin_delete_async(group_name, service_name, delete_running_tasks:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'deleteRunningTasks' => delete_running_tasks,'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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

    result
  end

  promise.execute
end

#begin_delete_with_http_info(group_name, service_name, delete_running_tasks: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Delete DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled.

running tasks will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • delete_running_tasks (Boolean) (defaults to: nil)

    Delete the resource even if it contains

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1186
1187
1188
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1186

def begin_delete_with_http_info(group_name, service_name, delete_running_tasks:nil, custom_headers:nil)
  begin_delete_async(group_name, service_name, delete_running_tasks:delete_running_tasks, custom_headers:custom_headers).value!
end

#begin_start(group_name, service_name, custom_headers: nil) ⇒ Object

Start service

The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that



1387
1388
1389
1390
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1387

def begin_start(group_name, service_name, custom_headers:nil)
  response = begin_start_async(group_name, service_name, custom_headers:custom_headers).value!
  nil
end

#begin_start_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Start service

The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1424

def begin_start_async(group_name, service_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/start'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_start_with_http_info(group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Start service

The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1406
1407
1408
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1406

def begin_start_with_http_info(group_name, service_name, custom_headers:nil)
  begin_start_async(group_name, service_name, custom_headers:custom_headers).value!
end

#begin_stop(group_name, service_name, custom_headers: nil) ⇒ Object

Stop service

The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won’t be billed when the service is stopped.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that



1483
1484
1485
1486
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1483

def begin_stop(group_name, service_name, custom_headers:nil)
  response = begin_stop_async(group_name, service_name, custom_headers:custom_headers).value!
  nil
end

#begin_stop_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Stop service

The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won’t be billed when the service is stopped.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1522

def begin_stop_async(group_name, service_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/stop'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_stop_with_http_info(group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Stop service

The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won’t be billed when the service is stopped.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1503
1504
1505
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1503

def begin_stop_with_http_info(group_name, service_name, custom_headers:nil)
  begin_stop_async(group_name, service_name, custom_headers:custom_headers).value!
end

#begin_update(parameters, group_name, service_name, custom_headers: nil) ⇒ DataMigrationService

Create or update DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”).

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationService)

    operation results.



1268
1269
1270
1271
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1268

def begin_update(parameters, group_name, service_name, custom_headers:nil)
  response = begin_update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(parameters, group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Create or update DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”).

to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1311

def begin_update_async(parameters, group_name, service_name, custom_headers:nil)
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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::DataMigration::Mgmt::V2018_04_19::Models::DataMigrationService.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

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

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

Create or update DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”).

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1290
1291
1292
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1290

def begin_update_with_http_info(parameters, group_name, service_name, custom_headers:nil)
  begin_update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
end

#check_name_availability(location, parameters, custom_headers: nil) ⇒ NameAvailabilityResponse

Check name validity and availability

This method checks whether a proposed top-level resource name is valid and available.

will be added to the HTTP request.

Parameters:

  • location (String)

    The Azure region of the operation

  • parameters (NameAvailabilityRequest)

    Requested name to validate

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

    A hash of custom headers that

Returns:

  • (NameAvailabilityResponse)

    operation results.



905
906
907
908
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 905

def check_name_availability(location, parameters, custom_headers:nil)
  response = check_name_availability_async(location, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_name_availability_async(location, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Check name validity and availability

This method checks whether a proposed top-level resource name is valid and available.

to the HTTP request.

Parameters:

  • location (String)

    The Azure region of the operation

  • parameters (NameAvailabilityRequest)

    Requested name to validate

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 940

def check_name_availability_async(location, parameters, custom_headers: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?
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?


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

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

  # Serialize Request
  request_mapper = Azure::DataMigration::Mgmt::V2018_04_19::Models::NameAvailabilityRequest.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}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
      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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

#check_name_availability_with_http_info(location, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Check name validity and availability

This method checks whether a proposed top-level resource name is valid and available.

will be added to the HTTP request.

Parameters:

  • location (String)

    The Azure region of the operation

  • parameters (NameAvailabilityRequest)

    Requested name to validate

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



923
924
925
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 923

def check_name_availability_with_http_info(location, parameters, custom_headers:nil)
  check_name_availability_async(location, parameters, custom_headers:custom_headers).value!
end

#check_status(group_name, service_name, custom_headers: nil) ⇒ DataMigrationServiceStatusResponse

Check service health status

The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationServiceStatusResponse)

    operation results.



295
296
297
298
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 295

def check_status(group_name, service_name, custom_headers:nil)
  response = check_status_async(group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_status_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Check service health status

The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



332
333
334
335
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
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 332

def check_status_async(group_name, service_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkStatus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

#check_status_with_http_info(group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Check service health status

The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



314
315
316
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 314

def check_status_with_http_info(group_name, service_name, custom_headers:nil)
  check_status_async(group_name, service_name, custom_headers:custom_headers).value!
end

#create_or_update(parameters, group_name, service_name, custom_headers: nil) ⇒ DataMigrationService

Create or update DMS Instance

The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, “vm”, which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationService)

    operation results.



46
47
48
49
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 46

def create_or_update(parameters, group_name, service_name, custom_headers:nil)
  response = create_or_update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(parameters, group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 61

def create_or_update_async(parameters, group_name, service_name, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(parameters, group_name, service_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::DataMigration::Mgmt::V2018_04_19::Models::DataMigrationService.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(group_name, service_name, delete_running_tasks: nil, custom_headers: nil) ⇒ Object

Delete DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled.

running tasks will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • delete_running_tasks (Boolean) (defaults to: nil)

    Delete the resource even if it contains

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

    A hash of custom headers that



199
200
201
202
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 199

def delete(group_name, service_name, delete_running_tasks:nil, custom_headers:nil)
  response = delete_async(group_name, service_name, delete_running_tasks:delete_running_tasks, custom_headers:custom_headers).value!
  nil
end

#delete_async(group_name, service_name, delete_running_tasks: nil, custom_headers: nil) ⇒ Concurrent::Promise

running tasks will be added to the HTTP request.

response.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • delete_running_tasks (Boolean) (defaults to: nil)

    Delete the resource even if it contains

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 215

def delete_async(group_name, service_name, delete_running_tasks:nil, custom_headers:nil)
  # Send request
  promise = begin_delete_async(group_name, service_name, delete_running_tasks:delete_running_tasks, 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(group_name, service_name, custom_headers: nil) ⇒ DataMigrationService

Get DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationService)

    operation results.



93
94
95
96
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 93

def get(group_name, service_name, custom_headers:nil)
  response = get_async(group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Get DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 130

def get_async(group_name, service_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}'

  request_url = @base_url || @client.base_url

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

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

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

Get DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



112
113
114
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 112

def get_with_http_info(group_name, service_name, custom_headers:nil)
  get_async(group_name, service_name, custom_headers:custom_headers).value!
end

#list(custom_headers: nil) ⇒ Array<DataMigrationService>

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<DataMigrationService>)

    operation results.



806
807
808
809
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 806

def list(custom_headers:nil)
  first_page = list_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers: nil) ⇒ DataMigrationServiceList

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

will be added to the HTTP request.

response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (DataMigrationServiceList)

    which provide lazy access to pages of the



1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1936

def list_as_lazy(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 839

def list_async(custom_headers: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}/providers/Microsoft.DataMigration/services'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#list_by_resource_group(group_name, custom_headers: nil) ⇒ Array<DataMigrationService>

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

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

    A hash of custom headers that

Returns:

  • (Array<DataMigrationService>)

    operation results.



705
706
707
708
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 705

def list_by_resource_group(group_name, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(group_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_as_lazy(group_name, custom_headers: nil) ⇒ DataMigrationServiceList

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

will be added to the HTTP request.

response.

Parameters:

  • group_name (String)

    Name of the resource group

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

    A hash of custom headers that

Returns:

  • (DataMigrationServiceList)

    which provide lazy access to pages of the



1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1912

def list_by_resource_group_as_lazy(group_name, custom_headers:nil)
  response = list_by_resource_group_async(group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(group_name, custom_headers: nil) ⇒ Concurrent::Promise

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 740

def list_by_resource_group_async(group_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.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/{groupName}/providers/Microsoft.DataMigration/services'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#list_by_resource_group_next(next_page_link, custom_headers: nil) ⇒ DataMigrationServiceList

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

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:

  • (DataMigrationServiceList)

    operation results.



1683
1684
1685
1686
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1683

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

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

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

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.



1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1720

def list_by_resource_group_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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

    result
  end

  promise.execute
end

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

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

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.



1702
1703
1704
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1702

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_with_http_info(group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get services in resource group

The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



723
724
725
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 723

def list_by_resource_group_with_http_info(group_name, custom_headers:nil)
  list_by_resource_group_async(group_name, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ DataMigrationServiceList

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

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:

  • (DataMigrationServiceList)

    operation results.



1785
1786
1787
1788
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1785

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

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

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

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.



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
1871
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1822

def list_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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

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.



1804
1805
1806
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1804

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_skus(group_name, service_name, custom_headers: nil) ⇒ Array<AvailableServiceSku>

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (Array<AvailableServiceSku>)

    operation results.



486
487
488
489
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 486

def list_skus(group_name, service_name, custom_headers:nil)
  first_page = list_skus_as_lazy(group_name, service_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_skus_as_lazy(group_name, service_name, custom_headers: nil) ⇒ ServiceSkuList

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (ServiceSkuList)

    which provide lazy access to pages of the response.



1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1887

def list_skus_as_lazy(group_name, service_name, custom_headers:nil)
  response = list_skus_async(group_name, service_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_skus_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_skus_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 523

def list_skus_async(group_name, service_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, 'service_name is nil' if service_name.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/skus'

  request_url = @base_url || @client.base_url

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

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

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

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

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:

  • (ServiceSkuList)

    operation results.



1581
1582
1583
1584
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1581

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

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

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

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.



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
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1618

def list_skus_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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

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.



1600
1601
1602
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 1600

def list_skus_next_with_http_info(next_page_link, custom_headers:nil)
  list_skus_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_skus_with_http_info(group_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get compatible SKUs

The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



505
506
507
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 505

def list_skus_with_http_info(group_name, service_name, custom_headers:nil)
  list_skus_async(group_name, service_name, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get services in subscription

The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



823
824
825
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 823

def list_with_http_info(custom_headers:nil)
  list_async(custom_headers:custom_headers).value!
end

#nested_check_name_availability(group_name, service_name, parameters, custom_headers: nil) ⇒ NameAvailabilityResponse

Check nested resource name validity and availability

This method checks whether a proposed nested resource name is valid and available.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • parameters (NameAvailabilityRequest)

    Requested name to validate

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

    A hash of custom headers that

Returns:

  • (NameAvailabilityResponse)

    operation results.



592
593
594
595
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 592

def nested_check_name_availability(group_name, service_name, parameters, custom_headers:nil)
  response = nested_check_name_availability_async(group_name, service_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#nested_check_name_availability_async(group_name, service_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Check nested resource name validity and availability

This method checks whether a proposed nested resource name is valid and available.

to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • parameters (NameAvailabilityRequest)

    Requested name to validate

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 629

def nested_check_name_availability_async(group_name, service_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'group_name is nil' if group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'service_name is nil' if service_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?


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

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

  # Serialize Request
  request_mapper = Azure::DataMigration::Mgmt::V2018_04_19::Models::NameAvailabilityRequest.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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkNameAvailability'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'groupName' => group_name,'serviceName' => service_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

#nested_check_name_availability_with_http_info(group_name, service_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Check nested resource name validity and availability

This method checks whether a proposed nested resource name is valid and available.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • parameters (NameAvailabilityRequest)

    Requested name to validate

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



611
612
613
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 611

def nested_check_name_availability_with_http_info(group_name, service_name, parameters, custom_headers:nil)
  nested_check_name_availability_async(group_name, service_name, parameters, custom_headers:custom_headers).value!
end

#start(group_name, service_name, custom_headers: nil) ⇒ Object

Start service

The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that



399
400
401
402
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 399

def start(group_name, service_name, custom_headers:nil)
  response = start_async(group_name, service_name, custom_headers:custom_headers).value!
  nil
end

#start_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 413

def start_async(group_name, service_name, custom_headers:nil)
  # Send request
  promise = begin_start_async(group_name, service_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

#stop(group_name, service_name, custom_headers: nil) ⇒ Object

Stop service

The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won’t be billed when the service is stopped.

will be added to the HTTP request.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that



442
443
444
445
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 442

def stop(group_name, service_name, custom_headers:nil)
  response = stop_async(group_name, service_name, custom_headers:custom_headers).value!
  nil
end

#stop_async(group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 456

def stop_async(group_name, service_name, custom_headers:nil)
  # Send request
  promise = begin_stop_async(group_name, service_name, custom_headers:custom_headers)

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

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

  promise
end

#update(parameters, group_name, service_name, custom_headers: nil) ⇒ DataMigrationService

Create or update DMS Service Instance

The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (“ServiceIsBusy”).

will be added to the HTTP request.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

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

    A hash of custom headers that

Returns:

  • (DataMigrationService)

    operation results.



248
249
250
251
# File 'lib/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 248

def update(parameters, group_name, service_name, custom_headers:nil)
  response = update_async(parameters, group_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(parameters, group_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • parameters (DataMigrationService)

    Information about the service

  • group_name (String)

    Name of the resource group

  • service_name (String)

    Name of the service

  • 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/2018-04-19/generated/azure_mgmt_data_migration/services.rb', line 263

def update_async(parameters, group_name, service_name, custom_headers:nil)
  # Send request
  promise = begin_update_async(parameters, group_name, service_name, custom_headers:custom_headers)

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