Class: Azure::ARM::Resources::Deployments

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



18
19
20
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientResourceManagementClient (readonly)

Returns reference to the ResourceManagementClient.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 23

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:



858
859
860
861
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 858

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



901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 901

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, 'deployment_name is nil' if deployment_name.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 = {}

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

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

  # Serialize Request
  request_mapper = Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters, '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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentExtended.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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 = DeploymentExtended.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(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.



880
881
882
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 880

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).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 to delete.

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

    A hash of custom headers that



746
747
748
749
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 746

def begin_delete(resource_group_name, deployment_name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, deployment_name, 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 to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
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
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 799

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, 'deployment_name is nil' if deployment_name.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 = {}

  # 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
  end

  promise.execute
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 to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



773
774
775
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 773

def begin_delete_with_http_info(resource_group_name, deployment_name, custom_headers = nil)
  begin_delete_async(resource_group_name, deployment_name, 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 to cancel.

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

    A hash of custom headers that



323
324
325
326
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 323

def cancel(resource_group_name, deployment_name, custom_headers = nil)
  response = cancel_async(resource_group_name, deployment_name, 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 to cancel.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 364

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, 'deployment_name is nil' if deployment_name.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 = {}

  # 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
  end

  promise.execute
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 to cancel.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



344
345
346
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 344

def cancel_with_http_info(resource_group_name, deployment_name, custom_headers = nil)
  cancel_async(resource_group_name, deployment_name, 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 to check.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



87
88
89
90
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 87

def check_existence(resource_group_name, deployment_name, custom_headers = nil)
  response = check_existence_async(resource_group_name, deployment_name, 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 to check.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/generated/azure_mgmt_resources/deployments.rb', line 118

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, 'deployment_name is nil' if deployment_name.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 = {}

  # 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
  end

  promise.execute
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 to check.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



103
104
105
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 103

def check_existence_with_http_info(resource_group_name, deployment_name, custom_headers = nil)
  check_existence_async(resource_group_name, deployment_name, 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:



178
179
180
181
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 178

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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 196

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)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = DeploymentExtended.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, '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 to delete.

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

    A hash of custom headers that



45
46
47
48
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 45

def delete(resource_group_name, deployment_name, custom_headers = nil)
  response = delete_async(resource_group_name, deployment_name, 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 to delete.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 60

def delete_async(resource_group_name, deployment_name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_name, deployment_name, 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. the template. 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 from which to get

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

    A hash of custom headers that

Returns:



538
539
540
541
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 538

def export_template(resource_group_name, deployment_name, custom_headers = nil)
  response = export_template_async(resource_group_name, deployment_name, 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. the template. 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 from which to get

  • 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
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 571

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, 'deployment_name is nil' if deployment_name.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 = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentExportResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_with_http_info(resource_group_name, deployment_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Exports the template used for specified deployment.

is case insensitive. the template. 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 from which to get

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



555
556
557
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 555

def export_template_with_http_info(resource_group_name, deployment_name, custom_headers = nil)
  export_template_async(resource_group_name, deployment_name, 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 to get.

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

    A hash of custom headers that

Returns:



225
226
227
228
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 225

def get(resource_group_name, deployment_name, custom_headers = nil)
  response = get_async(resource_group_name, deployment_name, 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 to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/generated/azure_mgmt_resources/deployments.rb', line 256

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, 'deployment_name is nil' if deployment_name.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 = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentExtended.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(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 to get.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



241
242
243
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 241

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

#list(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:



637
638
639
640
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 637

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

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



1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 1075

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

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



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 674

def list_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, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next(next_page_link, custom_headers = nil) ⇒ 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:



983
984
985
986
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 983

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

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



1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 1012

def list_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

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



998
999
1000
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 998

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

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



656
657
658
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 656

def list_with_http_info(resource_group_name, filter = nil, top = nil, custom_headers = nil)
  list_async(resource_group_name, filter, top, 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:



419
420
421
422
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 419

def validate(resource_group_name, deployment_name, parameters, custom_headers = nil)
  response = validate_async(resource_group_name, deployment_name, parameters, 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.



454
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
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 454

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, 'deployment_name is nil' if deployment_name.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 = {}

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

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

  # Serialize Request
  request_mapper = Deployment.mapper()
  request_content = @client.serialize(request_mapper,  parameters, '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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = DeploymentValidateResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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 = DeploymentValidateResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_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.



437
438
439
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 437

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