Class: Azure::ARM::DevTestLabs::LabOperations

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

Overview

The DevTest Labs Client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ LabOperations

Creates and initializes a new instance of the LabOperations class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientDevTestLabsClient (readonly)

Returns reference to the DevTestLabsClient.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 23

def client
  @client
end

Instance Method Details

#begin_create_environment(resource_group_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Object

Create virtual machines in a Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that



821
822
823
824
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 821

def begin_create_environment(resource_group_name, name, lab_virtual_machine, custom_headers = nil)
  response = begin_create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers).value!
  nil
end

#begin_create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Concurrent::Promise

Create virtual machines in a Lab. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • lab_virtual_machine (LabVirtualMachine)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 854

def begin_create_environment_async(resource_group_name, name, lab_virtual_machine, 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, 'name is nil' if name.nil?
  fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = LabVirtualMachine.mapper()
  request_content = @client.serialize(request_mapper,  lab_virtual_machine, 'lab_virtual_machine')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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 == 202
      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_create_environment_with_http_info(resource_group_name, name, lab_virtual_machine, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create virtual machines in a Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



838
839
840
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 838

def begin_create_environment_with_http_info(resource_group_name, name, lab_virtual_machine, custom_headers = nil)
  begin_create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers).value!
end

#begin_create_or_update_resource(resource_group_name, name, lab, custom_headers = nil) ⇒ Lab

Create or replace an existing Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Lab)

    operation results.



433
434
435
436
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 433

def begin_create_or_update_resource(resource_group_name, name, lab, custom_headers = nil)
  response = begin_create_or_update_resource_async(resource_group_name, name, lab, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_resource_async(resource_group_name, name, lab, custom_headers = nil) ⇒ Concurrent::Promise

Create or replace an existing Lab. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • lab (Lab)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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

def begin_create_or_update_resource_async(resource_group_name, name, lab, 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, 'name is nil' if name.nil?
  fail ArgumentError, 'lab is nil' if lab.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = Lab.mapper()
  request_content = @client.serialize(request_mapper,  lab, 'lab')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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 = Lab.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 = Lab.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_resource_with_http_info(resource_group_name, name, lab, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create or replace an existing Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



450
451
452
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 450

def begin_create_or_update_resource_with_http_info(resource_group_name, name, lab, custom_headers = nil)
  begin_create_or_update_resource_async(resource_group_name, name, lab, custom_headers).value!
end

#begin_delete_resource(resource_group_name, name, custom_headers = nil) ⇒ Object

Delete lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that



588
589
590
591
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 588

def begin_delete_resource(resource_group_name, name, custom_headers = nil)
  response = begin_delete_resource_async(resource_group_name, name, custom_headers).value!
  nil
end

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

Delete lab. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 617

def begin_delete_resource_async(resource_group_name, 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, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DevTestLab/labs/{name}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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_resource_with_http_info(resource_group_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



603
604
605
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 603

def begin_delete_resource_with_http_info(resource_group_name, name, custom_headers = nil)
  begin_delete_resource_async(resource_group_name, name, custom_headers).value!
end

#create_environment(resource_group_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Object

Create virtual machines in a Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that



779
780
781
782
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 779

def create_environment(resource_group_name, name, lab_virtual_machine, custom_headers = nil)
  response = create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers).value!
  nil
end

#create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 794

def create_environment_async(resource_group_name, name, lab_virtual_machine, custom_headers = nil)
  # Send request
  promise = begin_create_environment_async(resource_group_name, name, lab_virtual_machine, 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

#create_or_update_resource(resource_group_name, name, lab, custom_headers = nil) ⇒ Lab

Create or replace an existing Lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Lab)

    operation results.



388
389
390
391
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 388

def create_or_update_resource(resource_group_name, name, lab, custom_headers = nil)
  response = create_or_update_resource_async(resource_group_name, name, lab, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_resource_async(resource_group_name, name, lab, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 403

def create_or_update_resource_async(resource_group_name, name, lab, custom_headers = nil)
  # Send request
  promise = begin_create_or_update_resource_async(resource_group_name, name, lab, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Lab.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(resource_group_name, name, custom_headers = nil) ⇒ Object

Delete lab. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that



549
550
551
552
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 549

def delete_resource(resource_group_name, name, custom_headers = nil)
  response = delete_resource_async(resource_group_name, name, custom_headers).value!
  nil
end

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 563

def delete_resource_async(resource_group_name, name, custom_headers = nil)
  # Send request
  promise = begin_delete_resource_async(resource_group_name, 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

#generate_upload_uri(resource_group_name, name, generate_upload_uri_parameter, custom_headers = nil) ⇒ GenerateUploadUriResponse

Generate a URI for uploading custom disk images to a Lab.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:



920
921
922
923
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 920

def generate_upload_uri(resource_group_name, name, generate_upload_uri_parameter, custom_headers = nil)
  response = generate_upload_uri_async(resource_group_name, name, generate_upload_uri_parameter, custom_headers).value!
  response.body unless response.nil?
end

#generate_upload_uri_async(resource_group_name, name, generate_upload_uri_parameter, custom_headers = nil) ⇒ Concurrent::Promise

Generate a URI for uploading custom disk images to a Lab.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • generate_upload_uri_parameter (GenerateUploadUriParameter)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 951

def generate_upload_uri_async(resource_group_name, name, generate_upload_uri_parameter, 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, 'name is nil' if name.nil?
  fail ArgumentError, 'generate_upload_uri_parameter is nil' if generate_upload_uri_parameter.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = GenerateUploadUriParameter.mapper()
  request_content = @client.serialize(request_mapper,  generate_upload_uri_parameter, 'generate_upload_uri_parameter')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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)
        result_mapper = GenerateUploadUriResponse.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

#generate_upload_uri_with_http_info(resource_group_name, name, generate_upload_uri_parameter, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Generate a URI for uploading custom disk images to a Lab.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



936
937
938
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 936

def generate_upload_uri_with_http_info(resource_group_name, name, generate_upload_uri_parameter, custom_headers = nil)
  generate_upload_uri_async(resource_group_name, name, generate_upload_uri_parameter, custom_headers).value!
end

#get_resource(resource_group_name, name, custom_headers = nil) ⇒ Lab

Get lab.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Lab)

    operation results.



292
293
294
295
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 292

def get_resource(resource_group_name, name, custom_headers = nil)
  response = get_resource_async(resource_group_name, name, custom_headers).value!
  response.body unless response.nil?
end

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

Get lab.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



321
322
323
324
325
326
327
328
329
330
331
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 321

def get_resource_async(resource_group_name, 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, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DevTestLab/labs/{name}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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 = Lab.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_resource_with_http_info(resource_group_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get lab.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



307
308
309
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 307

def get_resource_with_http_info(resource_group_name, name, custom_headers = nil)
  get_resource_async(resource_group_name, name, custom_headers).value!
end

#list_by_resource_group(resource_group_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ Array<Lab>

List labs in a resource group.

operation. OData notation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:

  • (Array<Lab>)

    operation results.



191
192
193
194
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 191

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

#list_by_resource_group_as_lazy(resource_group_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ ResponseWithContinuationLab

List labs in a resource group.

operation. OData notation. will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:



166
167
168
169
170
171
172
173
174
175
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 166

def list_by_resource_group_as_lazy(resource_group_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, filter, top, order_by, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_by_resource_group_next_async(next_link, custom_headers)
    end
    page
  end
end

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

List labs in a resource group.

operation. OData notation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



228
229
230
231
232
233
234
235
236
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 228

def list_by_resource_group_async(resource_group_name, filter = nil, top = nil, order_by = nil, 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, '@client.api_version is nil' if @client.api_version.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.DevTestLab/labs'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'$filter' => filter,'$top' => top,'$orderBy' => order_by,'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 = ResponseWithContinuationLab.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_by_resource_group_next(next_page_link, custom_headers = nil) ⇒ ResponseWithContinuationLab

List labs in a resource group.

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:



1232
1233
1234
1235
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1232

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

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

List labs in a resource group.

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.



1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1261

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


  request_headers = {}

  # 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 = ResponseWithContinuationLab.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_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List labs in a resource group.

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.



1247
1248
1249
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1247

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
  list_by_resource_group_next_async(next_page_link, custom_headers).value!
end

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

List labs in a resource group.

operation. OData notation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



210
211
212
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 210

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

#list_by_subscription(filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ Array<Lab>

List labs in a subscription.

operation. OData notation. 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)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:

  • (Array<Lab>)

    operation results.



63
64
65
66
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 63

def list_by_subscription(filter = nil, top = nil, order_by = nil, custom_headers = nil)
  first_page = list_by_subscription_as_lazy(filter, top, order_by, custom_headers)
  first_page.get_all_items
end

#list_by_subscription_as_lazy(filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ ResponseWithContinuationLab

List labs in a subscription.

operation. OData notation. will be added to the HTTP request.

the response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:



39
40
41
42
43
44
45
46
47
48
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 39

def list_by_subscription_as_lazy(filter = nil, top = nil, order_by = nil, custom_headers = nil)
  response = list_by_subscription_async(filter, top, order_by, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_by_subscription_next_async(next_link, custom_headers)
    end
    page
  end
end

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

List labs in a subscription.

operation. OData notation. to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
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_devtestlabs/lab_operations.rb', line 98

def list_by_subscription_async(filter = nil, top = nil, order_by = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/providers/Microsoft.DevTestLab/labs'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'$filter' => filter,'$top' => top,'$orderBy' => order_by,'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 = ResponseWithContinuationLab.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_by_subscription_next(next_page_link, custom_headers = nil) ⇒ ResponseWithContinuationLab

List labs in 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:



1142
1143
1144
1145
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1142

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

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

List labs in 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.



1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1171

def list_by_subscription_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 = ResponseWithContinuationLab.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_by_subscription_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List labs in 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.



1157
1158
1159
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1157

def list_by_subscription_next_with_http_info(next_page_link, custom_headers = nil)
  list_by_subscription_next_async(next_page_link, custom_headers).value!
end

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

List labs in a subscription.

operation. OData notation. 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)

    The maximum number of resources to return from the

  • order_by (String) (defaults to: nil)

    The ordering expression for the results, using

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



81
82
83
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 81

def list_by_subscription_with_http_info(filter = nil, top = nil, order_by = nil, custom_headers = nil)
  list_by_subscription_async(filter, top, order_by, custom_headers).value!
end

#list_vhds(resource_group_name, name, custom_headers = nil) ⇒ Array<LabVhd>

List disk images available for custom image creation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Array<LabVhd>)

    operation results.



1048
1049
1050
1051
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1048

def list_vhds(resource_group_name, name, custom_headers = nil)
  first_page = list_vhds_as_lazy(resource_group_name, name, custom_headers)
  first_page.get_all_items
end

#list_vhds_as_lazy(resource_group_name, name, custom_headers = nil) ⇒ ResponseWithContinuationLabVhd

List disk images available for custom image creation.

will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:



1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1027

def list_vhds_as_lazy(resource_group_name, name, custom_headers = nil)
  response = list_vhds_async(resource_group_name, name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_vhds_next_async(next_link, custom_headers)
    end
    page
  end
end

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

List disk images available for custom image creation.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1077

def list_vhds_async(resource_group_name, 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, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.DevTestLab/labs/{name}/listVhds'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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 = ResponseWithContinuationLabVhd.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_vhds_next(next_page_link, custom_headers = nil) ⇒ ResponseWithContinuationLabVhd

List disk images available for custom image creation.

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:



1322
1323
1324
1325
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1322

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

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

List disk images available for custom image creation.

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.



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1351

def list_vhds_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, :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 = ResponseWithContinuationLabVhd.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_vhds_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List disk images available for custom image creation.

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.



1337
1338
1339
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1337

def list_vhds_next_with_http_info(next_page_link, custom_headers = nil)
  list_vhds_next_async(next_page_link, custom_headers).value!
end

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

List disk images available for custom image creation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1063
1064
1065
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1063

def list_vhds_with_http_info(resource_group_name, name, custom_headers = nil)
  list_vhds_async(resource_group_name, name, custom_headers).value!
end

#patch_resource(resource_group_name, name, lab, custom_headers = nil) ⇒ Lab

Modify properties of labs.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (Lab)

    operation results.



673
674
675
676
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 673

def patch_resource(resource_group_name, name, lab, custom_headers = nil)
  response = patch_resource_async(resource_group_name, name, lab, custom_headers).value!
  response.body unless response.nil?
end

#patch_resource_async(resource_group_name, name, lab, custom_headers = nil) ⇒ Concurrent::Promise

Modify properties of labs.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

  • lab (Lab)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 704

def patch_resource_async(resource_group_name, name, lab, 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, 'name is nil' if name.nil?
  fail ArgumentError, 'lab is nil' if lab.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = Lab.mapper()
  request_content = @client.serialize(request_mapper,  lab, 'lab')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'name' => name},
      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)
        result_mapper = Lab.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

#patch_resource_with_http_info(resource_group_name, name, lab, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Modify properties of labs.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the lab.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



689
690
691
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 689

def patch_resource_with_http_info(resource_group_name, name, lab, custom_headers = nil)
  patch_resource_async(resource_group_name, name, lab, custom_headers).value!
end