Class: Azure::Resources::Mgmt::V2019_07_01::Resources

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

Overview

Provides operations for working with resources and resource groups.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resources

Creates and initializes a new instance of the Resources class.

Parameters:

  • client

    service class for accessing basic functionality.



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

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientResourceManagementClient (readonly)

Returns reference to the ResourceManagementClient.

Returns:



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

def client
  @client
end

Instance Method Details

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

Creates a resource.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group for the

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to create.

  • resource_name (String)

    The name of the resource to create.

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Parameters for creating or updating the

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1505
1506
1507
1508
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1505

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.



1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
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
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1550

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::V2019_07_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Create a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1860
1861
1862
1863
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1860

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.



1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
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
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1895

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::V2019_07_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Create a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1878
1879
1880
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1878

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.



1528
1529
1530
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1528

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



1394
1395
1396
1397
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1394

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.



1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1435

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



1771
1772
1773
1774
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1771

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.



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
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1804

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.



1788
1789
1790
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1788

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.



1415
1416
1417
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1415

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



1158
1159
1160
1161
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1158

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.



1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1201

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::V2019_07_01::Models::ResourcesMoveInfo.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Moves resources from one resource group to another resource group.

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

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

Parameters:

  • source_resource_group_name (String)

    The name of the resource group

  • parameters (ResourcesMoveInfo)

    Parameters for moving resources.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1180
1181
1182
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1180

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.



1647
1648
1649
1650
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1647

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.



1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
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
1750
1751
1752
1753
1754
1755
1756
1757
1758
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1690

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::V2019_07_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Updates a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1979
1980
1981
1982
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1979

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.



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

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::V2019_07_01::Models::GenericResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{resourceId}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Updates a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1997
1998
1999
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1997

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.



1669
1670
1671
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1669

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



1275
1276
1277
1278
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1275

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.



1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1324

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::V2019_07_01::Models::ResourcesMoveInfo.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/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
      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.



1300
1301
1302
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1300

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.



438
439
440
441
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 438

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.



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 481

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.



829
830
831
832
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 829

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.



862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 862

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.



846
847
848
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 846

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.



460
461
462
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 460

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.



602
603
604
605
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 602

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



624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 624

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::V2019_07_01::Models::GenericResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end

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

Create a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Create or update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



961
962
963
964
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 961

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



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 978

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::V2019_07_01::Models::GenericResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end

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

Deletes a resource.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type.

  • resource_name (String)

    The name of the resource to delete.

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that



548
549
550
551
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 548

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



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 568

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



916
917
918
919
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 916

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



932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 932

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.



714
715
716
717
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 714

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.



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 755

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::V2019_07_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Gets a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1056
1057
1058
1059
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1056

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.



1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1089

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::V2019_07_01::Models::GenericResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Gets a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1073
1074
1075
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1073

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.



735
736
737
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 735

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.

properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime returns all resource groups. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



303
304
305
306
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 303

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.

properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime 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.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

  • 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



2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2326

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.

properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime returns all resource groups. to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
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
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 368

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::V2019_07_01::Models::ResourceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_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. properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime 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.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



54
55
56
57
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 54

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. properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime 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.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

  • 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



2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2286

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. properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime 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.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 123

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::V2019_07_01::Models::ResourceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_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.



2085
2086
2087
2088
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2085

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.



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
2158
2159
2160
2161
2162
2163
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2114

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::V2019_07_01::Models::ResourceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_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.



2100
2101
2102
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2100

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. properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime 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.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



89
90
91
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 89

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.



2175
2176
2177
2178
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2175

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.



2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2204

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::V2019_07_01::Models::ResourceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Get all the resources in a subscription.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2190
2191
2192
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 2190

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.

properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.
For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'
You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.
For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)
You can link more than one substringof together by adding and/or operators.
You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime returns all resource groups. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.
    The

  • expand (String) (defaults to: nil)

    The $expand query parameter. You can expand

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



336
337
338
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 336

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



195
196
197
198
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 195

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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 210

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.



659
660
661
662
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 659

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



680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 680

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::V2019_07_01::Models::GenericResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end

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

Updates a resource by ID.

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

Parameters:

  • resource_id (String)

    The fully qualified ID of the resource, including

  • api_version (String)

    The API version to use for the operation.

  • parameters (GenericResource)

    Update resource parameters.

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

    A hash of custom headers that

Returns:

  • (GenericResource)

    operation results.



1009
1010
1011
1012
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1009

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



1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 1026

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::V2019_07_01::Models::GenericResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end

#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



244
245
246
247
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 244

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



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/2019-07-01/generated/azure_mgmt_resources/resources.rb', line 259

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