Class: Azure::Resources::Mgmt::V2019_05_10::Deployments

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb

Overview

Provides operations for working with resources and resource groups.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Deployments

Creates and initializes a new instance of the Deployments class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.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-05-10/generated/azure_mgmt_resources/deployments.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, deployment_name, parameters, custom_headers: nil) ⇒ DeploymentExtended

Deploys resources to a resource group.

You can provide the template and parameters directly in the request or link to JSON files.

the resources to. The name is case insensitive. The resource group must already exist. operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to deploy

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



2884
2885
2886
2887
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2884

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

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

Deploys resources to a resource group.

You can provide the template and parameters directly in the request or link to JSON files.

the resources to. The name is case insensitive. The resource group must already exist. operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to deploy

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2927

def begin_create_or_update_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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_05_10::Models::Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

Deploys resources at management group scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



2388
2389
2390
2391
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2388

def begin_create_or_update_at_management_group_scope(group_id, deployment_name, parameters, custom_headers:nil)
  response = begin_create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Deploys resources at management group scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2427

def begin_create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:nil)
  fail ArgumentError, 'group_id is nil' if group_id.nil?
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MaxLength': '90'" if !group_id.nil? && group_id.length > 90
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MinLength': '1'" if !group_id.nil? && group_id.length < 1
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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?


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

  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201
      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_05_10::Models::DeploymentExtended.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentExtended.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_at_management_group_scope_with_http_info(group_id, deployment_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deploys resources at management group scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2408
2409
2410
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2408

def begin_create_or_update_at_management_group_scope_with_http_info(group_id, deployment_name, parameters, custom_headers:nil)
  begin_create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:custom_headers).value!
end

#begin_create_or_update_at_subscription_scope(deployment_name, parameters, custom_headers: nil) ⇒ DeploymentExtended

Deploys resources at subscription scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



2630
2631
2632
2633
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2630

def begin_create_or_update_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
  response = begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Deploys resources at subscription scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2667

def begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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_05_10::Models::Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

Deploys resources at subscription scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2649
2650
2651
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2649

def begin_create_or_update_at_subscription_scope_with_http_info(deployment_name, parameters, custom_headers:nil)
  begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
end

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

Deploys resources to a resource group.

You can provide the template and parameters directly in the request or link to JSON files.

the resources to. The name is case insensitive. The resource group must already exist. operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to deploy

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2906
2907
2908
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2906

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

#begin_delete(resource_group_name, deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

deployment to delete. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



2763
2764
2765
2766
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2763

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

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

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

deployment to delete. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2816

def begin_delete_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_at_management_group_scope(group_id, deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



2275
2276
2277
2278
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2275

def begin_delete_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = begin_delete_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2324

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2300
2301
2302
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2300

def begin_delete_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers:nil)
  begin_delete_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
end

#begin_delete_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



2522
2523
2524
2525
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2522

def begin_delete_at_subscription_scope(deployment_name, custom_headers:nil)
  response = begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2569

def begin_delete_at_subscription_scope_async(deployment_name, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_at_subscription_scope_with_http_info(deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2546
2547
2548
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2546

def begin_delete_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
  begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
end

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

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

deployment to delete. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2790
2791
2792
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2790

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

#calculate_template_hash(template, custom_headers: nil) ⇒ TemplateHashResult

Calculate the hash of the given template.

will be added to the HTTP request.

Parameters:

  • template

    The template provided to calculate hash.

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

    A hash of custom headers that

Returns:

  • (TemplateHashResult)

    operation results.



2163
2164
2165
2166
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2163

def calculate_template_hash(template, custom_headers:nil)
  response = calculate_template_hash_async(template, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#calculate_template_hash_async(template, custom_headers: nil) ⇒ Concurrent::Promise

Calculate the hash of the given template.

to the HTTP request.

Parameters:

  • template

    The template provided to calculate hash.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
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
2254
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2190

def calculate_template_hash_async(template, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'template is nil' if template.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 = {
    client_side_validation: true,
    required: true,
    serialized_name: 'template',
    type: {
      name: 'Object'
    }
  }
  request_content = @client.serialize(request_mapper,  template)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.Resources/calculateTemplateHash'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # 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_05_10::Models::TemplateHashResult.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

#calculate_template_hash_with_http_info(template, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Calculate the hash of the given template.

will be added to the HTTP request.

Parameters:

  • template

    The template provided to calculate hash.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2177
2178
2179
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2177

def calculate_template_hash_with_http_info(template, custom_headers:nil)
  calculate_template_hash_async(template, custom_headers:custom_headers).value!
end

#cancel(resource_group_name, deployment_name, custom_headers: nil) ⇒ Object

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



1724
1725
1726
1727
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1724

def cancel(resource_group_name, deployment_name, custom_headers:nil)
  response = cancel_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
  nil
end

#cancel_async(resource_group_name, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1765

def cancel_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 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

#cancel_at_management_group_scope(group_id, deployment_name, custom_headers: nil) ⇒ Object

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



322
323
324
325
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 322

def cancel_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = cancel_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  nil
end

#cancel_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 361

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 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

#cancel_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



342
343
344
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 342

def cancel_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers:nil)
  cancel_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
end

#cancel_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ Object

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



1016
1017
1018
1019
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1016

def cancel_at_subscription_scope(deployment_name, custom_headers:nil)
  response = cancel_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  nil
end

#cancel_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1053

def cancel_at_subscription_scope_async(deployment_name, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 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

#cancel_at_subscription_scope_with_http_info(deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1035
1036
1037
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1035

def cancel_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
  cancel_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
end

#cancel_with_http_info(resource_group_name, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Cancels a currently running template deployment.

You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1745
1746
1747
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1745

def cancel_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
  cancel_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
end

#check_existence(resource_group_name, deployment_name, custom_headers: nil) ⇒ Boolean

Checks whether the deployment exists.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



1470
1471
1472
1473
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1470

def check_existence(resource_group_name, deployment_name, custom_headers:nil)
  response = check_existence_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_existence_async(resource_group_name, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Checks whether the deployment exists.

deployment to check. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1501

def check_existence_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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_at_management_group_scope(group_id, deployment_name, custom_headers: nil) ⇒ Boolean

Checks whether the deployment exists.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



82
83
84
85
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 82

def check_existence_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = check_existence_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_existence_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Checks whether the deployment exists.

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 111

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'groupId' => group_id,'deploymentName' => deployment_name},
      query_params: {'api-version' => @client.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_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether the deployment exists.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



97
98
99
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 97

def check_existence_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers:nil)
  check_existence_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
end

#check_existence_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ Boolean

Checks whether the deployment exists.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



788
789
790
791
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 788

def check_existence_at_subscription_scope(deployment_name, custom_headers:nil)
  response = check_existence_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_existence_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Checks whether the deployment exists.

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 815

def check_existence_at_subscription_scope_async(deployment_name, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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_at_subscription_scope_with_http_info(deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether the deployment exists.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



802
803
804
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 802

def check_existence_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
  check_existence_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
end

#check_existence_with_http_info(resource_group_name, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether the deployment exists.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1486
1487
1488
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1486

def check_existence_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
  check_existence_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, deployment_name, parameters, custom_headers: nil) ⇒ DeploymentExtended

Deploys resources to a resource group.

You can provide the template and parameters directly in the request or link to JSON files.

the resources to. The name is case insensitive. The resource group must already exist. operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to deploy

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



1570
1571
1572
1573
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1570

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

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

the resources to. The name is case insensitive. The resource group must already exist. operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group to deploy

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to 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



1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1588

def create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, deployment_name, 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_05_10::Models::DeploymentExtended.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_at_management_group_scope(group_id, deployment_name, parameters, custom_headers: nil) ⇒ DeploymentExtended

Deploys resources at management group scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



176
177
178
179
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 176

def create_or_update_at_management_group_scope(group_id, deployment_name, parameters, custom_headers:nil)
  response = create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

operation. will be added to the HTTP request.

response.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to 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



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 192

def create_or_update_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_at_management_group_scope_async(group_id, deployment_name, 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_05_10::Models::DeploymentExtended.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_at_subscription_scope(deployment_name, parameters, custom_headers: nil) ⇒ DeploymentExtended

Deploys resources at subscription scope.

You can provide the template and parameters directly in the request or link to JSON files.

operation. will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



877
878
879
880
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 877

def create_or_update_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
  response = create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

operation. will be added to the HTTP request.

response.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Additional parameters supplied to 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



892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 892

def create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_at_subscription_scope_async(deployment_name, 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_05_10::Models::DeploymentExtended.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, deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

deployment to delete. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



1428
1429
1430
1431
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1428

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

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

deployment to delete. The name is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1443

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

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

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

  promise
end

#delete_at_management_group_scope(group_id, deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



42
43
44
45
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 42

def delete_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = delete_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  nil
end

#delete_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 56

def delete_at_management_group_scope_async(group_id, deployment_name, custom_headers:nil)
  # Send request
  promise = begin_delete_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers)

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

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

  promise
end

#delete_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ Object

Deletes a deployment from the deployment history.

A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that



750
751
752
753
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 750

def delete_at_subscription_scope(deployment_name, custom_headers:nil)
  response = delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  nil
end

#delete_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 763

def delete_at_subscription_scope_async(deployment_name, custom_headers:nil)
  # Send request
  promise = begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers)

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

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

  promise
end

#export_template(resource_group_name, deployment_name, custom_headers: nil) ⇒ DeploymentExportResult

Exports the template used for specified deployment.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExportResult)

    operation results.



1954
1955
1956
1957
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1954

def export_template(resource_group_name, deployment_name, custom_headers:nil)
  response = export_template_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#export_template_async(resource_group_name, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Exports the template used for specified deployment.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
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
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1985

def export_template_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      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_05_10::Models::DeploymentExportResult.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

#export_template_at_management_group_scope(group_id, deployment_name, custom_headers: nil) ⇒ DeploymentExportResult

Exports the template used for specified deployment.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExportResult)

    operation results.



542
543
544
545
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 542

def export_template_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = export_template_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#export_template_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Exports the template used for specified deployment.

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 571

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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_05_10::Models::DeploymentExportResult.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

#export_template_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Exports the template used for specified deployment.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



557
558
559
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 557

def export_template_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers:nil)
  export_template_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
end

#export_template_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ DeploymentExportResult

Exports the template used for specified deployment.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExportResult)

    operation results.



1226
1227
1228
1229
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1226

def export_template_at_subscription_scope(deployment_name, custom_headers:nil)
  response = export_template_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#export_template_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Exports the template used for specified deployment.

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1253

def export_template_at_subscription_scope_async(deployment_name, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      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_05_10::Models::DeploymentExportResult.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

#export_template_at_subscription_scope_with_http_info(deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Exports the template used for specified deployment.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1240
1241
1242
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1240

def export_template_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
  export_template_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
end

#export_template_with_http_info(resource_group_name, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Exports the template used for specified deployment.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1970
1971
1972
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1970

def export_template_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
  export_template_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, deployment_name, custom_headers: nil) ⇒ DeploymentExtended

Gets a deployment.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



1617
1618
1619
1620
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1617

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

#get_async(resource_group_name, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a deployment.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1648

def get_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

Gets a deployment.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



220
221
222
223
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 220

def get_at_management_group_scope(group_id, deployment_name, custom_headers:nil)
  response = get_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_at_management_group_scope_async(group_id, deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a deployment.

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 249

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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_05_10::Models::DeploymentExtended.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_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a deployment.

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



235
236
237
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 235

def get_at_management_group_scope_with_http_info(group_id, deployment_name, custom_headers:nil)
  get_at_management_group_scope_async(group_id, deployment_name, custom_headers:custom_headers).value!
end

#get_at_subscription_scope(deployment_name, custom_headers: nil) ⇒ DeploymentExtended

Gets a deployment.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (DeploymentExtended)

    operation results.



919
920
921
922
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 919

def get_at_subscription_scope(deployment_name, custom_headers:nil)
  response = get_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_at_subscription_scope_async(deployment_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a deployment.

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 946

def get_at_subscription_scope_async(deployment_name, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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}/providers/Microsoft.Resources/deployments/{deploymentName}'

  request_url = @base_url || @client.base_url

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

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

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

Gets a deployment.

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



933
934
935
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 933

def get_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
  get_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
end

#get_with_http_info(resource_group_name, deployment_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a deployment.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1633
1634
1635
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1633

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

#list_at_management_group_scope(group_id, filter: nil, top: nil, custom_headers: nil) ⇒ Array<DeploymentExtended>

Get all the deployments for a management group.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (Array<DeploymentExtended>)

    operation results.



643
644
645
646
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 643

def list_at_management_group_scope(group_id, filter:nil, top:nil, custom_headers:nil)
  first_page = list_at_management_group_scope_as_lazy(group_id, filter:filter, top:top, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_management_group_scope_as_lazy(group_id, filter: nil, top: nil, custom_headers: nil) ⇒ DeploymentListResult

Get all the deployments for a management group.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

response.

Parameters:

  • group_id (String)

    The management group ID.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (DeploymentListResult)

    which provide lazy access to pages of the



3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3290

def list_at_management_group_scope_as_lazy(group_id, filter:nil, top:nil, custom_headers:nil)
  response = list_at_management_group_scope_async(group_id, filter:filter, top:top, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_management_group_scope_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_management_group_scope_async(group_id, filter: nil, top: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get all the deployments for a management group.

can use $filter=provisioningState eq ‘state’. all deployments. to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 678

def list_at_management_group_scope_async(group_id, filter:nil, top:nil, custom_headers:nil)
  fail ArgumentError, 'group_id is nil' if group_id.nil?
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MaxLength': '90'" if !group_id.nil? && group_id.length > 90
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MinLength': '1'" if !group_id.nil? && group_id.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'groupId' => group_id},
      query_params: {'$filter' => filter,'$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_05_10::Models::DeploymentListResult.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_at_management_group_scope_next(next_page_link, custom_headers: nil) ⇒ DeploymentListResult

Get all the deployments for a management 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:

  • (DeploymentListResult)

    operation results.



3016
3017
3018
3019
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3016

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

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

Get all the deployments for a management 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.



3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3045

def list_at_management_group_scope_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_05_10::Models::DeploymentListResult.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_at_management_group_scope_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the deployments for a management 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.



3031
3032
3033
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3031

def list_at_management_group_scope_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_management_group_scope_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_management_group_scope_with_http_info(group_id, filter: nil, top: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the deployments for a management group.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



661
662
663
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 661

def list_at_management_group_scope_with_http_info(group_id, filter:nil, top:nil, custom_headers:nil)
  list_at_management_group_scope_async(group_id, filter:filter, top:top, custom_headers:custom_headers).value!
end

#list_at_subscription_scope(filter: nil, top: nil, custom_headers: nil) ⇒ Array<DeploymentExtended>

Get all the deployments for a subscription.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (Array<DeploymentExtended>)

    operation results.



1322
1323
1324
1325
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1322

def list_at_subscription_scope(filter:nil, top:nil, custom_headers:nil)
  first_page = list_at_subscription_scope_as_lazy(filter:filter, top:top, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_subscription_scope_as_lazy(filter: nil, top: nil, custom_headers: nil) ⇒ DeploymentListResult

Get all the deployments for a subscription.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (DeploymentListResult)

    which provide lazy access to pages of the



3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3314

def list_at_subscription_scope_as_lazy(filter:nil, top:nil, custom_headers:nil)
  response = list_at_subscription_scope_async(filter:filter, top:top, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_subscription_scope_async(filter: nil, top: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get all the deployments for a subscription.

can use $filter=provisioningState eq ‘state’. all deployments. to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1355

def list_at_subscription_scope_async(filter: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}/providers/Microsoft.Resources/deployments/'

  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,'$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_05_10::Models::DeploymentListResult.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_at_subscription_scope_next(next_page_link, custom_headers: nil) ⇒ DeploymentListResult

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

  • (DeploymentListResult)

    operation results.



3106
3107
3108
3109
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3106

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

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

Get all the deployments for 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.



3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3135

def list_at_subscription_scope_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_05_10::Models::DeploymentListResult.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_at_subscription_scope_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the deployments for 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.



3121
3122
3123
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3121

def list_at_subscription_scope_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_subscription_scope_with_http_info(filter: nil, top: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the deployments for a subscription.

can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1339
1340
1341
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1339

def list_at_subscription_scope_with_http_info(filter:nil, top:nil, custom_headers:nil)
  list_at_subscription_scope_async(filter:filter, top:top, custom_headers:custom_headers).value!
end

#list_by_resource_group(resource_group_name, filter: nil, top: nil, custom_headers: nil) ⇒ Array<DeploymentExtended>

Get all the deployments for a resource group.

deployments to get. The name is case insensitive. can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (Array<DeploymentExtended>)

    operation results.



2060
2061
2062
2063
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2060

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

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

Get all the deployments for a resource group.

deployments to get. The name is case insensitive. can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (DeploymentListResult)

    which provide lazy access to pages of the



3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3340

def list_by_resource_group_as_lazy(resource_group_name, filter:nil, top:nil, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, filter:filter, 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, top: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get all the deployments for a resource group.

deployments to get. The name is case insensitive. can use $filter=provisioningState eq ‘state’. all deployments. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2097

def list_by_resource_group_async(resource_group_name, filter: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}/providers/Microsoft.Resources/deployments/'

  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,'$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_05_10::Models::DeploymentListResult.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) ⇒ DeploymentListResult

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

  • (DeploymentListResult)

    operation results.



3196
3197
3198
3199
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3196

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



3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3225

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_05_10::Models::DeploymentListResult.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 deployments 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.



3211
3212
3213
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 3211

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

Get all the deployments for a resource group.

deployments to get. The name is case insensitive. can use $filter=provisioningState eq ‘state’. all deployments. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group with the

  • filter (String) (defaults to: nil)

    The filter to apply on the operation. For example, you

  • top (Integer) (defaults to: nil)

    The number of results to get. If null is passed, returns

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2079
2080
2081
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 2079

def list_by_resource_group_with_http_info(resource_group_name, filter:nil, top:nil, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, filter:filter, top:top, custom_headers:custom_headers).value!
end

#validate(resource_group_name, deployment_name, parameters, custom_headers: nil) ⇒ DeploymentValidateResult

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

template will be deployed to. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group the

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (DeploymentValidateResult)

    operation results.



1829
1830
1831
1832
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1829

def validate(resource_group_name, deployment_name, parameters, custom_headers:nil)
  response = validate_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#validate_async(resource_group_name, deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

template will be deployed to. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group the

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
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
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1864

def validate_async(resource_group_name, deployment_name, 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, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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_05_10::Models::Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 400
      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_05_10::Models::DeploymentValidateResult.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 == 400
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentValidateResult.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

#validate_at_management_group_scope(group_id, deployment_name, parameters, custom_headers: nil) ⇒ DeploymentValidateResult

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (DeploymentValidateResult)

    operation results.



422
423
424
425
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 422

def validate_at_management_group_scope(group_id, deployment_name, parameters, custom_headers:nil)
  response = validate_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#validate_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
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
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 455

def validate_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:nil)
  fail ArgumentError, 'group_id is nil' if group_id.nil?
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MaxLength': '90'" if !group_id.nil? && group_id.length > 90
  fail ArgumentError, "'group_id' should satisfy the constraint - 'MinLength': '1'" if !group_id.nil? && group_id.length < 1
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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?


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

  path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 400
      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_05_10::Models::DeploymentValidateResult.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 == 400
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentValidateResult.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

#validate_at_management_group_scope_with_http_info(group_id, deployment_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

will be added to the HTTP request.

Parameters:

  • group_id (String)

    The management group ID.

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



439
440
441
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 439

def validate_at_management_group_scope_with_http_info(group_id, deployment_name, parameters, custom_headers:nil)
  validate_at_management_group_scope_async(group_id, deployment_name, parameters, custom_headers:custom_headers).value!
end

#validate_at_subscription_scope(deployment_name, parameters, custom_headers: nil) ⇒ DeploymentValidateResult

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (DeploymentValidateResult)

    operation results.



1111
1112
1113
1114
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1111

def validate_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
  response = validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#validate_at_subscription_scope_async(deployment_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1142

def validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
  fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_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_05_10::Models::Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 400
      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_05_10::Models::DeploymentValidateResult.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 == 400
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Resources::Mgmt::V2019_05_10::Models::DeploymentValidateResult.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

#validate_at_subscription_scope_with_http_info(deployment_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

will be added to the HTTP request.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1127
1128
1129
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1127

def validate_at_subscription_scope_with_http_info(deployment_name, parameters, custom_headers:nil)
  validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
end

#validate_with_http_info(resource_group_name, deployment_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager..

template will be deployed to. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group the

  • deployment_name (String)

    The name of the deployment.

  • parameters (Deployment)

    Parameters to validate.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1847
1848
1849
# File 'lib/2019-05-10/generated/azure_mgmt_resources/deployments.rb', line 1847

def validate_with_http_info(resource_group_name, deployment_name, parameters, custom_headers:nil)
  validate_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
end