Class: Azure::DeploymentManager::Mgmt::V2019_11_01_preview::ServiceUnits

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb

Overview

REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ServiceUnits

Creates and initializes a new instance of the ServiceUnits class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientAzureDeploymentManager (readonly)

Returns reference to the AzureDeploymentManager.

Returns:



25
26
27
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 25

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers: nil) ⇒ ServiceUnitResource

Creates or updates a service unit under the service in the service topology.

This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • service_unit_info (ServiceUnitResource)

    The service unit resource

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

    A hash of custom headers that

Returns:

  • (ServiceUnitResource)

    operation results.



425
426
427
428
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 425

def begin_create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a service unit under the service in the service topology.

This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation.

is case insensitive. object. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • service_unit_info (ServiceUnitResource)

    The service unit resource

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 470

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


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

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

  # Serialize Request
  request_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
  request_content = @client.serialize(request_mapper,  service_unit_info)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a service unit under the service in the service topology.

This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • service_unit_info (ServiceUnitResource)

    The service unit resource

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



448
449
450
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 448

def begin_create_or_update_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers: nil) ⇒ ServiceUnitResource

Creates or updates a service unit under the service in the service topology.

This is an asynchronous operation and can be polled to completion using the operation resource returned by this operation.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • service_unit_info (ServiceUnitResource)

    The service unit resource

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

    A hash of custom headers that

Returns:

  • (ServiceUnitResource)

    operation results.



45
46
47
48
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 45

def create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
  response = create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers: nil) ⇒ Concurrent::Promise

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • service_unit_info (ServiceUnitResource)

    The service unit resource

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 64

def create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end

#delete(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ Object

Deletes the service unit.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

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

    A hash of custom headers that



202
203
204
205
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 202

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

#delete_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the service unit.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 237

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#delete_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the service unit.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



220
221
222
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 220

def delete_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
  delete_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ ServiceUnitResource

Gets the service unit.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

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

    A hash of custom headers that

Returns:

  • (ServiceUnitResource)

    operation results.



95
96
97
98
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 95

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

#get_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the service unit.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 130

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#get_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the service unit.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • service_unit_name (String)

    The name of the service unit resource.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



113
114
115
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 113

def get_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
  get_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
end

#list(resource_group_name, service_topology_name, service_name, custom_headers: nil) ⇒ Array

Lists the service units under a service in the service topology.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

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

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



299
300
301
302
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 299

def list(resource_group_name, service_topology_name, service_name, custom_headers:nil)
  response = list_async(resource_group_name, service_topology_name, service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(resource_group_name, service_topology_name, service_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists the service units under a service in the service topology.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



332
333
334
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
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 332

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceUnitResourceElementType',
                type: {
                  name: 'Composite',
                  class_name: 'ServiceUnitResource'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_with_http_info(resource_group_name, service_topology_name, service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the service units under a service in the service topology.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • service_topology_name (String)

    The name of the service topology .

  • service_name (String)

    The name of the service resource.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



316
317
318
# File 'lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb', line 316

def list_with_http_info(resource_group_name, service_topology_name, service_name, custom_headers:nil)
  list_async(resource_group_name, service_topology_name, service_name, custom_headers:custom_headers).value!
end