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

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_resources/deployments.rb

Overview

Deployments

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

#clientObject (readonly)

Returns reference to the ResourceManagementClient.

Returns:

  • reference to the ResourceManagementClient



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

Create a named template deployment using a template.

is case insensitive. operation. 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.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:



300
301
302
303
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 300

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

Create a named template deployment using a template.

is case insensitive. operation. 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.

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



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
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/generated/azure_mgmt_resources/deployments.rb', line 335

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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

Create a named template deployment using a template.

is case insensitive. operation. 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.

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



318
319
320
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 318

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

Delete 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 be deleted.

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

    A hash of custom headers that



75
76
77
78
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 75

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

Delete 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 be deleted.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 106

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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

Delete 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 be deleted.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



91
92
93
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 91

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

Cancel a currently running template 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



517
518
519
520
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 517

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

Cancel a currently running template 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.



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 548

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'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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

Cancel a currently running template 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.



533
534
535
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 533

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 deployment exists.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to check.

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



162
163
164
165
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 162

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 deployment exists.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to check.

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



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 193

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :head, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 deployment exists.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to check.

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



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

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

Create a named template deployment using a template.

is case insensitive. operation. 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.

  • parameters (Deployment)

    Additional parameters supplied to the

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

    A hash of custom headers that

Returns:



252
253
254
255
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 252

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • 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



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 269

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

Delete 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 be deleted.

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

    A hash of custom headers that



34
35
36
37
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 34

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • deployment_name (String)

    The name of the deployment to be deleted.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 49

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 a deployment template.

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:



724
725
726
727
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 724

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 a deployment template.

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.



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

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'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 a deployment template.

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.



740
741
742
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 740

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

Get a deployment.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • deployment_name (String)

    The name of the deployment.

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

    A hash of custom headers that

Returns:



421
422
423
424
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 421

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

Get a deployment.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

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



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

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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

Get a deployment.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

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



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

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 a list of deployments.

by. The name is case insensitive. deployments. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to filter

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    Query parameters. If null is passed returns all

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

    A hash of custom headers that

Returns:



848
849
850
851
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 848

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 a list of deployments.

by. The name is case insensitive. deployments. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group to filter

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    Query parameters. If null is passed returns all

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

    A hash of custom headers that

Returns:



824
825
826
827
828
829
830
831
832
833
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 824

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_link|
      list_next_async(next_link, custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, filter = nil, top = nil, custom_headers = nil) ⇒ Concurrent::Promise

Get a list of deployments.

by. The name is case insensitive. deployments. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to filter

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    Query parameters. If null is passed returns all

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
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
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 883

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/'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 a list of deployments.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:



947
948
949
950
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 947

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 a list of deployments.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 976

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 a list of deployments.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



962
963
964
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 962

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 a list of deployments.

by. The name is case insensitive. deployments. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to filter

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    Query parameters. If null is passed returns all

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



866
867
868
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 866

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

Validate a deployment template.

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.

  • parameters (Deployment)

    Deployment to validate.

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

    A hash of custom headers that

Returns:



605
606
607
608
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 605

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

Validate a deployment template.

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.

  • parameters (Deployment)

    Deployment to validate.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 638

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'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_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(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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

Validate a deployment template.

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.

  • parameters (Deployment)

    Deployment to validate.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



622
623
624
# File 'lib/generated/azure_mgmt_resources/deployments.rb', line 622

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