Class: Azure::ARM::Resources::ResourceGroups

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

Overview

ResourceGroups

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ResourceGroups

Creates and initializes a new instance of the ResourceGroups class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/azure_mgmt_resources/resource_groups.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/azure_mgmt_resources/resource_groups.rb', line 23

def client
  @client
end

Instance Method Details

#begin_delete(resource_group_name, custom_headers = nil) ⇒ Object

Delete resource group.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

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

    A hash of custom headers that



363
364
365
366
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 363

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

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

Delete resource group.

deleted. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 392

def begin_delete_async(resource_group_name, 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}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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 == 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?

    result
  end

  promise.execute
end

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

Delete resource group.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



378
379
380
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 378

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

#check_existence(resource_group_name, custom_headers = nil) ⇒ Boolean

Checks whether resource group 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.

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

    A hash of custom headers that

Returns:

  • (Boolean)

    operation results.



137
138
139
140
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 137

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

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

Checks whether resource group exists.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to check.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 166

def check_existence_async(resource_group_name, 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}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether resource group 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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



152
153
154
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 152

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

#create_or_update(resource_group_name, parameters, custom_headers = nil) ⇒ ResourceGroup

Create a resource group.

created or updated. update resource group service operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the create or

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

    A hash of custom headers that

Returns:



221
222
223
224
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 221

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

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

Create a resource group.

created or updated. update resource group service operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the create or

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 254

def create_or_update_async(resource_group_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  parameters.validate unless 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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless parameters.nil?
    parameters = ResourceGroup.serialize_object(parameters)
  end
  request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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 == 201 || 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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          parsed_response = ResourceGroup.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          parsed_response = ResourceGroup.deserialize_object(parsed_response)
        end
        result.body = 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

#create_or_update_with_http_info(resource_group_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create a resource group.

created or updated. update resource group service operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the create or

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



238
239
240
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 238

def create_or_update_with_http_info(resource_group_name, parameters, custom_headers = nil)
  create_or_update_async(resource_group_name, parameters, custom_headers).value!
end

#delete(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Delete resource group.

deleted. The name is case insensitive. response.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 338

def delete(resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_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, parameters, custom_headers = nil) ⇒ ResourceGroupExportResult

Captures the specified resource group as a template.

created or updated. template resource group operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ExportTemplateRequest)

    Parameters supplied to the export

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

    A hash of custom headers that

Returns:



657
658
659
660
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 657

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

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

Captures the specified resource group as a template.

created or updated. template resource group operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ExportTemplateRequest)

    Parameters supplied to the export

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 690

def export_template_async(resource_group_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  parameters.validate unless 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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless parameters.nil?
    parameters = ExportTemplateRequest.serialize_object(parameters)
  end
  request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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
      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)
        unless parsed_response.nil?
          parsed_response = ResourceGroupExportResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Captures the specified resource group as a template.

created or updated. template resource group operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ExportTemplateRequest)

    Parameters supplied to the export

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



674
675
676
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 674

def export_template_with_http_info(resource_group_name, parameters, custom_headers = nil)
  export_template_async(resource_group_name, parameters, custom_headers).value!
end

#get(resource_group_name, custom_headers = nil) ⇒ ResourceGroup

Get a resource group.

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.

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

    A hash of custom headers that

Returns:



444
445
446
447
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 444

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

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

Get a resource group.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 473

def get_async(resource_group_name, 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}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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)
        unless parsed_response.nil?
          parsed_response = ResourceGroup.deserialize_object(parsed_response)
        end
        result.body = 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, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get a resource group.

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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



459
460
461
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 459

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

#list(filter = nil, top = nil, custom_headers = nil) ⇒ ResourceGroupListResult

Gets a collection of resource groups.

resource groups. will be added to the HTTP request.

Parameters:

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



765
766
767
768
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 765

def list(filter = nil, top = nil, custom_headers = nil)
  response = list_async(filter, top, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a collection of resource groups.

resource groups. to the HTTP request.

Parameters:

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



796
797
798
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
840
841
842
843
844
845
846
847
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 796

def list_async(filter = nil, top = nil, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  request_headers = {}

  # 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'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  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)
        unless parsed_response.nil?
          parsed_response = ResourceGroupListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next(next_page_link, custom_headers = nil) ⇒ ResourceGroupListResult

Gets a collection of resource groups.

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:



949
950
951
952
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 949

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

Gets a collection of resource groups.

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.



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
1026
1027
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 978

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)
        unless parsed_response.nil?
          parsed_response = ResourceGroupListResult.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Gets a collection of resource groups.

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.



964
965
966
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 964

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

#list_resources(resource_group_name, filter = nil, top = nil, custom_headers = nil) ⇒ ResourceListResult

Get all of the resources under a subscription.

returns all resource groups. resource groups. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Query parameters. If null is passed

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



38
39
40
41
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 38

def list_resources(resource_group_name, filter = nil, top = nil, custom_headers = nil)
  response = list_resources_async(resource_group_name, filter, top, custom_headers).value!
  response.body unless response.nil?
end

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

Get all of the resources under a subscription.

returns all resource groups. resource groups. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Query parameters. If null is passed

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



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 73

def list_resources_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}/resources'
  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)
        unless parsed_response.nil?
          parsed_response = ResourceListResult.deserialize_object(parsed_response)
        end
        result.body = 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_resources_next(next_page_link, custom_headers = nil) ⇒ ResourceListResult

Get all of the resources under a subscription.

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:



859
860
861
862
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 859

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

#list_resources_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get all of the resources under a subscription.

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.



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
936
937
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 888

def list_resources_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)
        unless parsed_response.nil?
          parsed_response = ResourceListResult.deserialize_object(parsed_response)
        end
        result.body = 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_resources_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all of the resources under a subscription.

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.



874
875
876
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 874

def list_resources_next_with_http_info(next_page_link, custom_headers = nil)
  list_resources_next_async(next_page_link, custom_headers).value!
end

#list_resources_with_http_info(resource_group_name, filter = nil, top = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all of the resources under a subscription.

returns all resource groups. resource groups. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Query parameters. If null is passed

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



56
57
58
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 56

def list_resources_with_http_info(resource_group_name, filter = nil, top = nil, custom_headers = nil)
  list_resources_async(resource_group_name, filter, top, custom_headers).value!
end

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

Gets a collection of resource groups.

resource groups. will be added to the HTTP request.

Parameters:

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



781
782
783
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 781

def list_with_http_info(filter = nil, top = nil, custom_headers = nil)
  list_async(filter, top, custom_headers).value!
end

#patch(resource_group_name, parameters, custom_headers = nil) ⇒ ResourceGroup

Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over.

created or updated. The name is case insensitive. resource group service operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the update state

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

    A hash of custom headers that

Returns:



542
543
544
545
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 542

def patch(resource_group_name, parameters, custom_headers = nil)
  response = patch_async(resource_group_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#patch_async(resource_group_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over.

created or updated. The name is case insensitive. resource group service operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the update state

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 581

def patch_async(resource_group_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  parameters.validate unless 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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless parameters.nil?
    parameters = ResourceGroup.serialize_object(parameters)
  end
  request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_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, :patch, 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)
        unless parsed_response.nil?
          parsed_response = ResourceGroup.deserialize_object(parsed_response)
        end
        result.body = 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

#patch_with_http_info(resource_group_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over.

created or updated. The name is case insensitive. resource group service operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to be

  • parameters (ResourceGroup)

    Parameters supplied to the update state

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



562
563
564
# File 'lib/azure_mgmt_resources/resource_groups.rb', line 562

def patch_with_http_info(resource_group_name, parameters, custom_headers = nil)
  patch_async(resource_group_name, parameters, custom_headers).value!
end