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

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

Overview

Azure DevTest Labs REST API.

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



947
948
949
950
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 947

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.



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
1028
1029
1030
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 980

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'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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



964
965
966
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 964

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.



751
752
753
754
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 751

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.



784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
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
848
849
850
851
852
853
854
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 784

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.



768
769
770
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 768

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



865
866
867
868
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 865

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.



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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 894

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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



880
881
882
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 880

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



513
514
515
516
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 513

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



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 528

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.



328
329
330
331
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 328

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



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 343

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



369
370
371
372
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 369

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



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 383

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:



555
556
557
558
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 555

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.



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
644
645
646
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 586

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'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.



571
572
573
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 571

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.



235
236
237
238
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 235

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.



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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 264

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # 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.



250
251
252
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 250

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

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

    A hash of custom headers that

Returns:

  • (Array<Lab>)

    operation results.



137
138
139
140
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 137

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

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

    A hash of custom headers that

Returns:



1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1333

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_page_link|
      list_by_resource_group_next_async(next_page_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. 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 OData

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 174

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'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:



1129
1130
1131
1132
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1129

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.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1158

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



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

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

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



156
157
158
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 156

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

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

    A hash of custom headers that

Returns:

  • (Array<Lab>)

    operation results.



38
39
40
41
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 38

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

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

    A hash of custom headers that

Returns:



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1307

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_page_link|
      list_by_subscription_next_async(next_page_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. 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 OData

  • 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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 73

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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:



1042
1043
1044
1045
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1042

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.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1071
1072
1073
1074
1075
1076
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1071

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1057
1058
1059
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1057

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

  • 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/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 56

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.



658
659
660
661
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 658

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:



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1355

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_page_link|
      list_vhds_next_async(next_page_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.



687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 687

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'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:



1216
1217
1218
1219
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1216

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.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
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
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 1245

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



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

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.



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

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.



410
411
412
413
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 410

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.



441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 441

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = 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.



426
427
428
# File 'lib/generated/azure_mgmt_devtestlabs/lab_operations.rb', line 426

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