azure_mgmt_compute 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-15/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  3. data/lib/2016-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  4. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  5. data/lib/2017-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  6. data/lib/2017-09-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  7. data/lib/2017-12-01/generated/azure_mgmt_compute.rb +66 -60
  8. data/lib/2017-12-01/generated/azure_mgmt_compute/availability_sets.rb +106 -0
  9. data/lib/2017-12-01/generated/azure_mgmt_compute/compute_management_client.rb +5 -1
  10. data/lib/2017-12-01/generated/azure_mgmt_compute/images.rb +162 -0
  11. data/lib/2017-12-01/generated/azure_mgmt_compute/models/availability_set_update.rb +137 -0
  12. data/lib/2017-12-01/generated/azure_mgmt_compute/models/compute_operation_list_result.rb +56 -0
  13. data/lib/2017-12-01/generated/azure_mgmt_compute/models/compute_operation_value.rb +108 -0
  14. data/lib/2017-12-01/generated/azure_mgmt_compute/models/data_disk.rb +1 -2
  15. data/lib/2017-12-01/generated/azure_mgmt_compute/models/hardware_profile.rb +24 -24
  16. data/lib/2017-12-01/generated/azure_mgmt_compute/models/image_data_disk.rb +1 -2
  17. data/lib/2017-12-01/generated/azure_mgmt_compute/models/image_osdisk.rb +1 -2
  18. data/lib/2017-12-01/generated/azure_mgmt_compute/models/image_storage_profile.rb +14 -1
  19. data/lib/2017-12-01/generated/azure_mgmt_compute/models/image_update.rb +91 -0
  20. data/lib/2017-12-01/generated/azure_mgmt_compute/models/managed_disk_parameters.rb +1 -2
  21. data/lib/2017-12-01/generated/azure_mgmt_compute/models/osdisk.rb +1 -2
  22. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set.rb +23 -0
  23. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +1 -2
  24. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +1 -2
  25. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +1 -2
  26. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +13 -0
  27. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_update.rb +247 -0
  28. data/lib/2017-12-01/generated/azure_mgmt_compute/operations.rb +107 -0
  29. data/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +280 -0
  30. data/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb +302 -0
  31. data/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machines.rb +162 -0
  32. data/lib/profiles/latest/modules/compute_profile_module.rb +214 -192
  33. data/lib/version.rb +1 -1
  34. metadata +8 -2
@@ -679,6 +679,94 @@ module Azure::Compute::Mgmt::V2017_12_01
679
679
  promise
680
680
  end
681
681
 
682
+ #
683
+ # Redeploys a virtual machine in a VM scale set.
684
+ #
685
+ # @param resource_group_name [String] The name of the resource group.
686
+ # @param vm_scale_set_name [String] The name of the VM scale set.
687
+ # @param instance_id [String] The instance ID of the virtual machine.
688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
689
+ # will be added to the HTTP request.
690
+ #
691
+ # @return [OperationStatusResponse] operation results.
692
+ #
693
+ def redeploy(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
694
+ response = redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
695
+ response.body unless response.nil?
696
+ end
697
+
698
+ #
699
+ # @param resource_group_name [String] The name of the resource group.
700
+ # @param vm_scale_set_name [String] The name of the VM scale set.
701
+ # @param instance_id [String] The instance ID of the virtual machine.
702
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
703
+ # will be added to the HTTP request.
704
+ #
705
+ # @return [Concurrent::Promise] promise which provides async access to http
706
+ # response.
707
+ #
708
+ def redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
709
+ # Send request
710
+ promise = begin_redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers)
711
+
712
+ promise = promise.then do |response|
713
+ # Defining deserialization method.
714
+ deserialize_method = lambda do |parsed_response|
715
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
716
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
717
+ end
718
+
719
+ # Waiting for response.
720
+ @client.get_long_running_operation_result(response, deserialize_method)
721
+ end
722
+
723
+ promise
724
+ end
725
+
726
+ #
727
+ # Performs maintenance on a virtual machine in a VM scale set.
728
+ #
729
+ # @param resource_group_name [String] The name of the resource group.
730
+ # @param vm_scale_set_name [String] The name of the VM scale set.
731
+ # @param instance_id [String] The instance ID of the virtual machine.
732
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
733
+ # will be added to the HTTP request.
734
+ #
735
+ # @return [OperationStatusResponse] operation results.
736
+ #
737
+ def perform_maintenance(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
738
+ response = perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
739
+ response.body unless response.nil?
740
+ end
741
+
742
+ #
743
+ # @param resource_group_name [String] The name of the resource group.
744
+ # @param vm_scale_set_name [String] The name of the VM scale set.
745
+ # @param instance_id [String] The instance ID of the virtual machine.
746
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
747
+ # will be added to the HTTP request.
748
+ #
749
+ # @return [Concurrent::Promise] promise which provides async access to http
750
+ # response.
751
+ #
752
+ def perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
753
+ # Send request
754
+ promise = begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers)
755
+
756
+ promise = promise.then do |response|
757
+ # Defining deserialization method.
758
+ deserialize_method = lambda do |parsed_response|
759
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
760
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
761
+ end
762
+
763
+ # Waiting for response.
764
+ @client.get_long_running_operation_result(response, deserialize_method)
765
+ end
766
+
767
+ promise
768
+ end
769
+
682
770
  #
683
771
  # Reimages (upgrade the operating system) a specific virtual machine in a VM
684
772
  # scale set.
@@ -1495,6 +1583,198 @@ module Azure::Compute::Mgmt::V2017_12_01
1495
1583
  promise.execute
1496
1584
  end
1497
1585
 
1586
+ #
1587
+ # Redeploys a virtual machine in a VM scale set.
1588
+ #
1589
+ # @param resource_group_name [String] The name of the resource group.
1590
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1591
+ # @param instance_id [String] The instance ID of the virtual machine.
1592
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1593
+ # will be added to the HTTP request.
1594
+ #
1595
+ # @return [OperationStatusResponse] operation results.
1596
+ #
1597
+ def begin_redeploy(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1598
+ response = begin_redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
1599
+ response.body unless response.nil?
1600
+ end
1601
+
1602
+ #
1603
+ # Redeploys a virtual machine in a VM scale set.
1604
+ #
1605
+ # @param resource_group_name [String] The name of the resource group.
1606
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1607
+ # @param instance_id [String] The instance ID of the virtual machine.
1608
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1609
+ # will be added to the HTTP request.
1610
+ #
1611
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1612
+ #
1613
+ def begin_redeploy_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1614
+ begin_redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
1615
+ end
1616
+
1617
+ #
1618
+ # Redeploys a virtual machine in a VM scale set.
1619
+ #
1620
+ # @param resource_group_name [String] The name of the resource group.
1621
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1622
+ # @param instance_id [String] The instance ID of the virtual machine.
1623
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1624
+ # to the HTTP request.
1625
+ #
1626
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1627
+ #
1628
+ def begin_redeploy_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1629
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1630
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
1631
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
1632
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1633
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1634
+
1635
+
1636
+ request_headers = {}
1637
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1638
+
1639
+ # Set Headers
1640
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1641
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1642
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'
1643
+
1644
+ request_url = @base_url || @client.base_url
1645
+
1646
+ options = {
1647
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1648
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
1649
+ query_params: {'api-version' => @client.api_version},
1650
+ headers: request_headers.merge(custom_headers || {}),
1651
+ base_url: request_url
1652
+ }
1653
+ promise = @client.make_request_async(:post, path_template, options)
1654
+
1655
+ promise = promise.then do |result|
1656
+ http_response = result.response
1657
+ status_code = http_response.status
1658
+ response_content = http_response.body
1659
+ unless status_code == 200 || status_code == 202
1660
+ error_model = JSON.load(response_content)
1661
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1662
+ end
1663
+
1664
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1665
+ # Deserialize Response
1666
+ if status_code == 200
1667
+ begin
1668
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1669
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
1670
+ result.body = @client.deserialize(result_mapper, parsed_response)
1671
+ rescue Exception => e
1672
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1673
+ end
1674
+ end
1675
+
1676
+ result
1677
+ end
1678
+
1679
+ promise.execute
1680
+ end
1681
+
1682
+ #
1683
+ # Performs maintenance on a virtual machine in a VM scale set.
1684
+ #
1685
+ # @param resource_group_name [String] The name of the resource group.
1686
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1687
+ # @param instance_id [String] The instance ID of the virtual machine.
1688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1689
+ # will be added to the HTTP request.
1690
+ #
1691
+ # @return [OperationStatusResponse] operation results.
1692
+ #
1693
+ def begin_perform_maintenance(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1694
+ response = begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
1695
+ response.body unless response.nil?
1696
+ end
1697
+
1698
+ #
1699
+ # Performs maintenance on a virtual machine in a VM scale set.
1700
+ #
1701
+ # @param resource_group_name [String] The name of the resource group.
1702
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1703
+ # @param instance_id [String] The instance ID of the virtual machine.
1704
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1705
+ # will be added to the HTTP request.
1706
+ #
1707
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1708
+ #
1709
+ def begin_perform_maintenance_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1710
+ begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
1711
+ end
1712
+
1713
+ #
1714
+ # Performs maintenance on a virtual machine in a VM scale set.
1715
+ #
1716
+ # @param resource_group_name [String] The name of the resource group.
1717
+ # @param vm_scale_set_name [String] The name of the VM scale set.
1718
+ # @param instance_id [String] The instance ID of the virtual machine.
1719
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1720
+ # to the HTTP request.
1721
+ #
1722
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1723
+ #
1724
+ def begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
1725
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1726
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
1727
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
1728
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1729
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1730
+
1731
+
1732
+ request_headers = {}
1733
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1734
+
1735
+ # Set Headers
1736
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1737
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1738
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'
1739
+
1740
+ request_url = @base_url || @client.base_url
1741
+
1742
+ options = {
1743
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1744
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
1745
+ query_params: {'api-version' => @client.api_version},
1746
+ headers: request_headers.merge(custom_headers || {}),
1747
+ base_url: request_url
1748
+ }
1749
+ promise = @client.make_request_async(:post, path_template, options)
1750
+
1751
+ promise = promise.then do |result|
1752
+ http_response = result.response
1753
+ status_code = http_response.status
1754
+ response_content = http_response.body
1755
+ unless status_code == 200 || status_code == 202
1756
+ error_model = JSON.load(response_content)
1757
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1758
+ end
1759
+
1760
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1761
+ # Deserialize Response
1762
+ if status_code == 200
1763
+ begin
1764
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1765
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
1766
+ result.body = @client.deserialize(result_mapper, parsed_response)
1767
+ rescue Exception => e
1768
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1769
+ end
1770
+ end
1771
+
1772
+ result
1773
+ end
1774
+
1775
+ promise.execute
1776
+ end
1777
+
1498
1778
  #
1499
1779
  # Gets a list of all virtual machines in a VM scale sets.
1500
1780
  #
@@ -849,6 +849,98 @@ module Azure::Compute::Mgmt::V2017_12_01
849
849
  promise
850
850
  end
851
851
 
852
+ #
853
+ # Redeploy one or more virtual machines in a VM scale set.
854
+ #
855
+ # @param resource_group_name [String] The name of the resource group.
856
+ # @param vm_scale_set_name [String] The name of the VM scale set.
857
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
858
+ # virtual machine instance IDs from the VM scale set.
859
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
860
+ # will be added to the HTTP request.
861
+ #
862
+ # @return [OperationStatusResponse] operation results.
863
+ #
864
+ def redeploy(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
865
+ response = redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
866
+ response.body unless response.nil?
867
+ end
868
+
869
+ #
870
+ # @param resource_group_name [String] The name of the resource group.
871
+ # @param vm_scale_set_name [String] The name of the VM scale set.
872
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
873
+ # virtual machine instance IDs from the VM scale set.
874
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
875
+ # will be added to the HTTP request.
876
+ #
877
+ # @return [Concurrent::Promise] promise which provides async access to http
878
+ # response.
879
+ #
880
+ def redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
881
+ # Send request
882
+ promise = begin_redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers)
883
+
884
+ promise = promise.then do |response|
885
+ # Defining deserialization method.
886
+ deserialize_method = lambda do |parsed_response|
887
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
888
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
889
+ end
890
+
891
+ # Waiting for response.
892
+ @client.get_long_running_operation_result(response, deserialize_method)
893
+ end
894
+
895
+ promise
896
+ end
897
+
898
+ #
899
+ # Perform maintenance on one or more virtual machines in a VM scale set.
900
+ #
901
+ # @param resource_group_name [String] The name of the resource group.
902
+ # @param vm_scale_set_name [String] The name of the VM scale set.
903
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
904
+ # virtual machine instance IDs from the VM scale set.
905
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
906
+ # will be added to the HTTP request.
907
+ #
908
+ # @return [OperationStatusResponse] operation results.
909
+ #
910
+ def perform_maintenance(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
911
+ response = perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
912
+ response.body unless response.nil?
913
+ end
914
+
915
+ #
916
+ # @param resource_group_name [String] The name of the resource group.
917
+ # @param vm_scale_set_name [String] The name of the VM scale set.
918
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
919
+ # virtual machine instance IDs from the VM scale set.
920
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
921
+ # will be added to the HTTP request.
922
+ #
923
+ # @return [Concurrent::Promise] promise which provides async access to http
924
+ # response.
925
+ #
926
+ def perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
927
+ # Send request
928
+ promise = begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers)
929
+
930
+ promise = promise.then do |response|
931
+ # Defining deserialization method.
932
+ deserialize_method = lambda do |parsed_response|
933
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
934
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
935
+ end
936
+
937
+ # Waiting for response.
938
+ @client.get_long_running_operation_result(response, deserialize_method)
939
+ end
940
+
941
+ promise
942
+ end
943
+
852
944
  #
853
945
  # Upgrades one or more virtual machines to the latest SKU set in the VM scale
854
946
  # set model.
@@ -1944,6 +2036,216 @@ module Azure::Compute::Mgmt::V2017_12_01
1944
2036
  promise.execute
1945
2037
  end
1946
2038
 
2039
+ #
2040
+ # Redeploy one or more virtual machines in a VM scale set.
2041
+ #
2042
+ # @param resource_group_name [String] The name of the resource group.
2043
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2044
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2045
+ # virtual machine instance IDs from the VM scale set.
2046
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2047
+ # will be added to the HTTP request.
2048
+ #
2049
+ # @return [OperationStatusResponse] operation results.
2050
+ #
2051
+ def begin_redeploy(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2052
+ response = begin_redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
2053
+ response.body unless response.nil?
2054
+ end
2055
+
2056
+ #
2057
+ # Redeploy one or more virtual machines in a VM scale set.
2058
+ #
2059
+ # @param resource_group_name [String] The name of the resource group.
2060
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2061
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2062
+ # virtual machine instance IDs from the VM scale set.
2063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2064
+ # will be added to the HTTP request.
2065
+ #
2066
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2067
+ #
2068
+ def begin_redeploy_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2069
+ begin_redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
2070
+ end
2071
+
2072
+ #
2073
+ # Redeploy one or more virtual machines in a VM scale set.
2074
+ #
2075
+ # @param resource_group_name [String] The name of the resource group.
2076
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2077
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2078
+ # virtual machine instance IDs from the VM scale set.
2079
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2080
+ # to the HTTP request.
2081
+ #
2082
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2083
+ #
2084
+ def begin_redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2085
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2086
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
2087
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2088
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2089
+
2090
+
2091
+ request_headers = {}
2092
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2093
+
2094
+ # Set Headers
2095
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2096
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2097
+
2098
+ # Serialize Request
2099
+ request_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::VirtualMachineScaleSetVMInstanceIDs.mapper()
2100
+ request_content = @client.serialize(request_mapper, vm_instance_ids)
2101
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2102
+
2103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'
2104
+
2105
+ request_url = @base_url || @client.base_url
2106
+
2107
+ options = {
2108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2109
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
2110
+ query_params: {'api-version' => @client.api_version},
2111
+ body: request_content,
2112
+ headers: request_headers.merge(custom_headers || {}),
2113
+ base_url: request_url
2114
+ }
2115
+ promise = @client.make_request_async(:post, path_template, options)
2116
+
2117
+ promise = promise.then do |result|
2118
+ http_response = result.response
2119
+ status_code = http_response.status
2120
+ response_content = http_response.body
2121
+ unless status_code == 200 || status_code == 202
2122
+ error_model = JSON.load(response_content)
2123
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2124
+ end
2125
+
2126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2127
+ # Deserialize Response
2128
+ if status_code == 200
2129
+ begin
2130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2131
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
2132
+ result.body = @client.deserialize(result_mapper, parsed_response)
2133
+ rescue Exception => e
2134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2135
+ end
2136
+ end
2137
+
2138
+ result
2139
+ end
2140
+
2141
+ promise.execute
2142
+ end
2143
+
2144
+ #
2145
+ # Perform maintenance on one or more virtual machines in a VM scale set.
2146
+ #
2147
+ # @param resource_group_name [String] The name of the resource group.
2148
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2149
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2150
+ # virtual machine instance IDs from the VM scale set.
2151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2152
+ # will be added to the HTTP request.
2153
+ #
2154
+ # @return [OperationStatusResponse] operation results.
2155
+ #
2156
+ def begin_perform_maintenance(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2157
+ response = begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
2158
+ response.body unless response.nil?
2159
+ end
2160
+
2161
+ #
2162
+ # Perform maintenance on one or more virtual machines in a VM scale set.
2163
+ #
2164
+ # @param resource_group_name [String] The name of the resource group.
2165
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2166
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2167
+ # virtual machine instance IDs from the VM scale set.
2168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2169
+ # will be added to the HTTP request.
2170
+ #
2171
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2172
+ #
2173
+ def begin_perform_maintenance_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2174
+ begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
2175
+ end
2176
+
2177
+ #
2178
+ # Perform maintenance on one or more virtual machines in a VM scale set.
2179
+ #
2180
+ # @param resource_group_name [String] The name of the resource group.
2181
+ # @param vm_scale_set_name [String] The name of the VM scale set.
2182
+ # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
2183
+ # virtual machine instance IDs from the VM scale set.
2184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2185
+ # to the HTTP request.
2186
+ #
2187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2188
+ #
2189
+ def begin_perform_maintenance_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
2190
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2191
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
2192
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2193
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2194
+
2195
+
2196
+ request_headers = {}
2197
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2198
+
2199
+ # Set Headers
2200
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2201
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2202
+
2203
+ # Serialize Request
2204
+ request_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::VirtualMachineScaleSetVMInstanceIDs.mapper()
2205
+ request_content = @client.serialize(request_mapper, vm_instance_ids)
2206
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2207
+
2208
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'
2209
+
2210
+ request_url = @base_url || @client.base_url
2211
+
2212
+ options = {
2213
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2214
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
2215
+ query_params: {'api-version' => @client.api_version},
2216
+ body: request_content,
2217
+ headers: request_headers.merge(custom_headers || {}),
2218
+ base_url: request_url
2219
+ }
2220
+ promise = @client.make_request_async(:post, path_template, options)
2221
+
2222
+ promise = promise.then do |result|
2223
+ http_response = result.response
2224
+ status_code = http_response.status
2225
+ response_content = http_response.body
2226
+ unless status_code == 200 || status_code == 202
2227
+ error_model = JSON.load(response_content)
2228
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2229
+ end
2230
+
2231
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2232
+ # Deserialize Response
2233
+ if status_code == 200
2234
+ begin
2235
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2236
+ result_mapper = Azure::Compute::Mgmt::V2017_12_01::Models::OperationStatusResponse.mapper()
2237
+ result.body = @client.deserialize(result_mapper, parsed_response)
2238
+ rescue Exception => e
2239
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2240
+ end
2241
+ end
2242
+
2243
+ result
2244
+ end
2245
+
2246
+ promise.execute
2247
+ end
2248
+
1947
2249
  #
1948
2250
  # Upgrades one or more virtual machines to the latest SKU set in the VM scale
1949
2251
  # set model.