Class: Azure::Resources::Mgmt::V2017_05_10::Resources

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



1409
1410
1411
1412
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1409

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.



1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1454

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



1764
1765
1766
1767
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1764

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.



1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1799

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



1782
1783
1784
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1782

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.



1432
1433
1434
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1432

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



1298
1299
1300
1301
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1298

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.



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
1383
1384
1385
1386
1387
1388
1389
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1339

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



1675
1676
1677
1678
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1675

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.



1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1708

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.



1692
1693
1694
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1692

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.



1319
1320
1321
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1319

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



1062
1063
1064
1065
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1062

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.



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

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



1084
1085
1086
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1084

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.



1551
1552
1553
1554
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1551

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.



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1594

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



1883
1884
1885
1886
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1883

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.



1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1918

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



1901
1902
1903
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1901

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.



1573
1574
1575
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1573

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

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

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.

containing the resources to validate for 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



1179
1180
1181
1182
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1179

def begin_validate_move_resources(source_resource_group_name, parameters, custom_headers:nil)
  response = begin_validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
  nil
end

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

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.

containing the resources to validate for 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.



1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1228

def begin_validate_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::V2017_05_10::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}/validateMoveResources'

  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 || status_code == 409
      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_validate_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.

containing the resources to validate for 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.



1204
1205
1206
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1204

def begin_validate_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers:nil)
  begin_validate_move_resources_async(source_resource_group_name, 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.



342
343
344
345
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 342

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.



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 385

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.



733
734
735
736
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 733

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.



766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 766

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.



750
751
752
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 750

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.



364
365
366
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 364

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.



506
507
508
509
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 506

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



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 528

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



865
866
867
868
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 865

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



882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 882

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::V2017_05_10::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



452
453
454
455
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 452

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



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 472

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



820
821
822
823
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 820

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



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 836

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.



618
619
620
621
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 618

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.



659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 659

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



960
961
962
963
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 960

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.



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 993

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



977
978
979
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 977

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.



639
640
641
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 639

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.



239
240
241
242
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 239

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



2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2198

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.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 272

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::V2017_05_10::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_by_resource_group(resource_group_name, filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ Array<GenericResource>

Get all the resources for a resource group.

get. returns all resources. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group with the resources to

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



38
39
40
41
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 38

def list_by_resource_group(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, filter:filter, expand:expand, top:top, custom_headers:custom_headers)
  first_page.get_all_items
end

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

Get all the resources for a resource group.

get. returns all resources. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group with the resources to

  • 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



2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2174

def list_by_resource_group_as_lazy(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, 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_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get all the resources for a resource group.

get. returns all resources. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group with the resources to

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



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

def list_by_resource_group_async(resource_group_name, filter:nil, expand:nil, top:nil, 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, '@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}/resourceGroups/{resourceGroupName}/resources'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'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::V2017_05_10::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_by_resource_group_next(next_page_link, custom_headers: nil) ⇒ ResourceListResult

Get all the resources for a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (ResourceListResult)

    operation results.



1989
1990
1991
1992
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 1989

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

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

Get all the resources for a resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

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


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

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

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::V2017_05_10::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_by_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the resources for a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2004
2005
2006
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2004

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

#list_by_resource_group_with_http_info(resource_group_name, filter: nil, expand: nil, top: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the resources for a resource group.

get. returns all resources. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group with the resources to

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



57
58
59
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 57

def list_by_resource_group_with_http_info(resource_group_name, filter:nil, expand:nil, top:nil, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, filter:filter, expand:expand, top:top, custom_headers:custom_headers).value!
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.



2079
2080
2081
2082
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2079

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.



2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2108

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



2094
2095
2096
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 2094

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.



256
257
258
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 256

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



147
148
149
150
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 147

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



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 162

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.



563
564
565
566
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 563

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



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 584

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



913
914
915
916
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 913

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



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 930

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::V2017_05_10::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

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

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.

containing the resources to validate for 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



196
197
198
199
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 196

def validate_move_resources(source_resource_group_name, parameters, custom_headers:nil)
  response = validate_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
  nil
end

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

containing the resources to validate for 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



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/2017-05-10/generated/azure_mgmt_resources/resources.rb', line 211

def validate_move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_validate_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