Class: Azure::Resources::Mgmt::V2016_09_01::Resources

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-09-01/generated/azure_mgmt_resources/resources.rb

Overview

Provides operations for working with resources and resource groups.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resources

Creates and initializes a new instance of the Resources class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientResourceManagementClient (readonly)

Returns reference to the ResourceManagementClient.

Returns:



22
23
24
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Creates a resource.

resource. The name is case insensitive. provider. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1129
1130
1131
1132
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1129

def begin_create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates a resource.

resource. The name is case insensitive. provider. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1174

def begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'api_version is nil' if api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2016_09_01::Models::GenericResource.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_by_id(resource_id, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Create a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1484
1485
1486
1487
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1484

def begin_create_or_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
  response = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Create a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1519

def begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'api_version is nil' if api_version.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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2016_09_01::Models::GenericResource.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_by_id_with_http_info(resource_id, api_version, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1502
1503
1504
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1502

def begin_create_or_update_by_id_with_http_info(resource_id, api_version, parameters, custom_headers:nil)
  begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
end

#begin_create_or_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a resource.

resource. The name is case insensitive. provider. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1152
1153
1154
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1152

def begin_create_or_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Object

Deletes a resource.

contains the resource to delete. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that



1018
1019
1020
1021
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1018

def begin_delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  response = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a resource.

contains the resource to delete. The name is case insensitive. provider. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'api_version is nil' if api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_delete_by_id(resource_id, api_version, custom_headers: nil) ⇒ Object

Deletes a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that



1395
1396
1397
1398
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1395

def begin_delete_by_id(resource_id, api_version, custom_headers:nil)
  response = begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
  nil
end

#begin_delete_by_id_async(resource_id, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1468
1469
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1428

def begin_delete_by_id_async(resource_id, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'api_version is nil' if 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 = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_by_id_with_http_info(resource_id, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1412
1413
1414
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1412

def begin_delete_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
  begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
end

#begin_delete_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a resource.

contains the resource to delete. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1039
1040
1041
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1039

def begin_delete_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
end

#begin_move_resources(source_resource_group_name, parameters, custom_headers: nil) ⇒ Object

Moves resources from one resource group to another resource group.

The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.

containing the resources to move. will be added to the HTTP request.

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

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

    A hash of custom headers that



905
906
907
908
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 905

def begin_move_resources(source_resource_group_name, parameters, custom_headers:nil)
  response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
  nil
end

#begin_move_resources_async(source_resource_group_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Moves resources from one resource group to another resource group.

The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.

containing the resources to move. to the HTTP request.

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1001
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 948

def begin_move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
  fail ArgumentError, 'source_resource_group_name is nil' if source_resource_group_name.nil?
  fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !source_resource_group_name.nil? && source_resource_group_name.length > 90
  fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !source_resource_group_name.nil? && source_resource_group_name.length < 1
  fail ArgumentError, "'source_resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !source_resource_group_name.nil? && source_resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  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::Resources::Mgmt::V2016_09_01::Models::ResourcesMoveInfo.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/{sourceResourceGroupName}/moveResources'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Moves resources from one resource group to another resource group.

The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.

containing the resources to move. will be added to the HTTP request.

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



927
928
929
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 927

def begin_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers:nil)
  begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Updates a resource.

resource. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to update.

  • resource_name (String)

    The name of the resource to update.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for updating the resource.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1271
1272
1273
1274
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1271

def begin_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Updates a resource.

resource. The name is case insensitive. provider. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to update.

  • resource_name (String)

    The name of the resource to update.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for updating the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1314

def begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'api_version is nil' if api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Resources::Mgmt::V2016_09_01::Models::GenericResource.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_by_id(resource_id, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Updates a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1603
1604
1605
1606
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1603

def begin_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
  response = begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_by_id_async(resource_id, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Updates a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1638

def begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'api_version is nil' if api_version.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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

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

Updates a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1621
1622
1623
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1621

def begin_update_by_id_with_http_info(resource_id, api_version, parameters, custom_headers:nil)
  begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
end

#begin_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a resource.

resource. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to update.

  • resource_name (String)

    The name of the resource to update.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for updating the resource.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1293
1294
1295
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1293

def begin_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
end

#check_existence(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Boolean

Checks whether a resource exists.

the resource to check. The name is case insensitive. resource to check. exists. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider of the

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to check whether it

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



185
186
187
188
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 185

def check_existence(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  response = check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Checks whether a resource exists.

the resource to check. The name is case insensitive. resource to check. exists. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider of the

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to check whether it

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 228

def check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'api_version is nil' if api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:head, path_template, options)

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

    result.body = (status_code == 204)
    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

#check_existence_by_id(resource_id, api_version, custom_headers: nil) ⇒ Boolean

Checks by ID whether a resource exists.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



576
577
578
579
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 576

def check_existence_by_id(resource_id, api_version, custom_headers:nil)
  response = check_existence_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_existence_by_id_async(resource_id, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Checks by ID whether a resource exists.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 609

def check_existence_by_id_async(resource_id, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'api_version is nil' if 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 = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

    result.body = (status_code == 204)
    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

#check_existence_by_id_with_http_info(resource_id, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks by ID whether a resource exists.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



593
594
595
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 593

def check_existence_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
  check_existence_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
end

#check_existence_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether a resource exists.

the resource to check. The name is case insensitive. resource to check. exists. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider of the

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to check whether it

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



207
208
209
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 207

def check_existence_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Creates a resource.

resource. The name is case insensitive. provider. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



349
350
351
352
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 349

def create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  response = create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

resource. The name is case insensitive. provider. resource. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 371

def create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers)

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

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

  promise
end

#create_or_update_by_id(resource_id, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Create a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



708
709
710
711
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 708

def create_or_update_by_id(resource_id, api_version, parameters, custom_headers:nil)
  response = create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

response.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 725

def create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers)

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

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

  promise
end

#delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Object

Deletes a resource.

contains the resource to delete. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that



295
296
297
298
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 295

def delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  response = delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
  nil
end

#delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource to delete. The name is case insensitive. provider. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 315

def delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, 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

#delete_by_id(resource_id, api_version, custom_headers: nil) ⇒ Object

Deletes a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that



663
664
665
666
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 663

def delete_by_id(resource_id, api_version, custom_headers:nil)
  response = delete_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
  nil
end

#delete_by_id_async(resource_id, api_version, custom_headers: nil) ⇒ Concurrent::Promise

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

response.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 679

def delete_by_id_async(resource_id, api_version, custom_headers:nil)
  # Send request
  promise = begin_delete_by_id_async(resource_id, api_version, custom_headers:custom_headers)

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

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

  promise
end

#get(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ GenericResource

Gets a resource.

the resource to get. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



461
462
463
464
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 461

def get(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  response = get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Gets a resource.

the resource to get. The name is case insensitive. provider. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get.

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 502

def get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'api_version is nil' if api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_by_id(resource_id, api_version, custom_headers: nil) ⇒ GenericResource

Gets a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



803
804
805
806
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 803

def get_by_id(resource_id, api_version, custom_headers:nil)
  response = get_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_id_async(resource_id, api_version, custom_headers: nil) ⇒ Concurrent::Promise

Gets a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 836

def get_by_id_async(resource_id, api_version, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'api_version is nil' if 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 = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Resources::Mgmt::V2016_09_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_by_id_with_http_info(resource_id, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



820
821
822
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 820

def get_by_id_with_http_info(resource_id, api_version, custom_headers:nil)
  get_by_id_async(resource_id, api_version, custom_headers:custom_headers).value!
end

#get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a resource.

the resource to get. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource.

  • resource_name (String)

    The name of the resource to get.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



482
483
484
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 482

def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
  get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
end

#list(filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ Array<GenericResource>

Get all the resources in a subscription.

returns all resource groups. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • expand (String) (defaults to: nil)

    The $expand query parameter.

  • top (Integer) (defaults to: nil)

    The number of results to return. If null is passed,

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

    A hash of custom headers that

Returns:

  • (Array<GenericResource>)

    operation results.



82
83
84
85
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 82

def list(filter:nil, expand:nil, top:nil, custom_headers:nil)
  first_page = list_as_lazy(filter:filter, expand:expand, top:top, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ ResourceListResult

Get all the resources in a subscription.

returns all resource groups. will be added to the HTTP request.

response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • expand (String) (defaults to: nil)

    The $expand query parameter.

  • top (Integer) (defaults to: nil)

    The number of results to return. If null is passed,

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

    A hash of custom headers that

Returns:

  • (ResourceListResult)

    which provide lazy access to pages of the



1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1802

def list_as_lazy(filter:nil, expand:nil, top:nil, custom_headers:nil)
  response = list_async(filter:filter, expand:expand, top:top, 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(filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get all the resources in a subscription.

returns all resource groups. to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • expand (String) (defaults to: nil)

    The $expand query parameter.

  • top (Integer) (defaults to: nil)

    The number of results to return. If null is passed,

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 115

def list_async(filter:nil, expand:nil, top:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  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}/resources'

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

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

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

Get all the 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:

  • (ResourceListResult)

    operation results.



1709
1710
1711
1712
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1709

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



1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1738

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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

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



1724
1725
1726
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 1724

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_with_http_info(filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the resources in a subscription.

returns all resource groups. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • expand (String) (defaults to: nil)

    The $expand query parameter.

  • top (Integer) (defaults to: nil)

    The number of results to return. If null is passed,

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



99
100
101
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 99

def list_with_http_info(filter:nil, expand:nil, top:nil, custom_headers:nil)
  list_async(filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
end

#move_resources(source_resource_group_name, parameters, custom_headers: nil) ⇒ Object

Moves resources from one resource group to another resource group.

The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.

containing the resources to move. will be added to the HTTP request.

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

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

    A hash of custom headers that



39
40
41
42
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 39

def move_resources(source_resource_group_name, parameters, custom_headers:nil)
  response = move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
  nil
end

#move_resources_async(source_resource_group_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

containing the resources to move. will be added to the HTTP request.

response.

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 54

def move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers)

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

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

  promise
end

#update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Updates a resource.

resource. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to update.

  • resource_name (String)

    The name of the resource to update.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for updating the resource.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



406
407
408
409
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 406

def update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  response = update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

resource. The name is case insensitive. provider. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to update.

  • resource_name (String)

    The name of the resource to update.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for updating the resource.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 427

def update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers)

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

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

  promise
end

#update_by_id(resource_id, api_version, parameters, custom_headers: nil) ⇒ GenericResource

Updates a resource by ID.

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



756
757
758
759
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 756

def update_by_id(resource_id, api_version, parameters, custom_headers:nil)
  response = update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_by_id_async(resource_id, api_version, parameters, custom_headers: nil) ⇒ Concurrent::Promise

the resource name and resource type. Use the format, /subscriptions/guid/resourceGroups/resource-group-name/resource-provider-namespace/resource-type/resource-name will be added to the HTTP request.

response.

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
# File 'lib/2016-09-01/generated/azure_mgmt_resources/resources.rb', line 773

def update_by_id_async(resource_id, api_version, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_by_id_async(resource_id, api_version, parameters, custom_headers:custom_headers)

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