azure_mgmt_hybrid_compute 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute.rb +72 -0
  4. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/hybrid_compute_management_client.rb +139 -0
  5. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/machine_extensions.rb +805 -0
  6. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/machines.rb +630 -0
  7. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/azure_entity_resource.rb +75 -0
  8. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/error_additional_info.rb +59 -0
  9. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/error_detail.rb +90 -0
  10. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/error_response.rb +113 -0
  11. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/identity.rb +72 -0
  12. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/instance_view_types.rb +15 -0
  13. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/location_data.rb +84 -0
  14. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine.rb +287 -0
  15. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension.rb +195 -0
  16. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view.rb +81 -0
  17. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view_status.rb +92 -0
  18. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_instance_view.rb +68 -0
  19. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_model.rb +144 -0
  20. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_update.rb +134 -0
  21. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extension_update_properties_model.rb +118 -0
  22. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_extensions_list_result.rb +99 -0
  23. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_identity.rb +63 -0
  24. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_list_result.rb +99 -0
  25. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_properties.rb +224 -0
  26. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_properties_os_profile.rb +44 -0
  27. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_reconnect.rb +58 -0
  28. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_reconnect_properties.rb +58 -0
  29. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_update.rb +100 -0
  30. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/machine_update_properties.rb +47 -0
  31. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/operation_list_result.rb +56 -0
  32. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/operation_value.rb +108 -0
  33. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/operation_value_display_model.rb +84 -0
  34. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/osprofile.rb +47 -0
  35. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/plan.rb +95 -0
  36. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/proxy_resource.rb +63 -0
  37. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource.rb +83 -0
  38. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource_identity_type.rb +15 -0
  39. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource_model_with_allowed_property_set.rb +191 -0
  40. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource_model_with_allowed_property_set_identity.rb +64 -0
  41. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource_model_with_allowed_property_set_plan.rb +76 -0
  42. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/resource_model_with_allowed_property_set_sku.rb +77 -0
  43. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/sku.rb +99 -0
  44. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/sku_tier.rb +18 -0
  45. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/status_level_types.rb +17 -0
  46. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/status_types.rb +17 -0
  47. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/tracked_resource.rb +92 -0
  48. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/models/update_resource.rb +54 -0
  49. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/module_definition.rb +9 -0
  50. data/lib/2019-12-12/generated/azure_mgmt_hybrid_compute/operations.rb +110 -0
  51. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute.rb +61 -0
  52. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/hybrid_compute_management_client.rb +141 -0
  53. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/machine_extensions.rb +795 -0
  54. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/machines.rb +622 -0
  55. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/azure_entity_resource.rb +75 -0
  56. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/error_detail.rb +90 -0
  57. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/error_response.rb +49 -0
  58. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/identity.rb +71 -0
  59. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/instance_view_types.rb +15 -0
  60. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/location_data.rb +84 -0
  61. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine.rb +348 -0
  62. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension.rb +195 -0
  63. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view.rb +84 -0
  64. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view_status.rb +97 -0
  65. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_instance_view.rb +71 -0
  66. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_model.rb +144 -0
  67. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_update.rb +134 -0
  68. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_update_properties_model.rb +118 -0
  69. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extensions_list_result.rb +99 -0
  70. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_identity.rb +62 -0
  71. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_list_result.rb +99 -0
  72. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_properties.rb +285 -0
  73. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_properties_os_profile.rb +44 -0
  74. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_update.rb +98 -0
  75. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_update_properties.rb +47 -0
  76. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_list_result.rb +56 -0
  77. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_value.rb +108 -0
  78. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_value_display_model.rb +84 -0
  79. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/osprofile.rb +47 -0
  80. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/proxy_resource.rb +63 -0
  81. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/resource.rb +83 -0
  82. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/status_level_types.rb +17 -0
  83. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/status_types.rb +17 -0
  84. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/tracked_resource.rb +92 -0
  85. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/models/update_resource.rb +54 -0
  86. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/module_definition.rb +9 -0
  87. data/lib/2020-08-02/generated/azure_mgmt_hybrid_compute/operations.rb +109 -0
  88. data/lib/azure_mgmt_hybrid_compute.rb +7 -0
  89. data/lib/module_definition.rb +7 -0
  90. data/lib/profiles/latest/hybridcompute_latest_profile_client.rb +40 -0
  91. data/lib/profiles/latest/hybridcompute_module_definition.rb +8 -0
  92. data/lib/profiles/latest/modules/hybridcompute_profile_module.rb +189 -0
  93. data/lib/version.rb +7 -0
  94. metadata +209 -0
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::HybridCompute::Mgmt::V2019_12_12
7
+ module Models
8
+ #
9
+ # The Update Resource model definition.
10
+ #
11
+ class UpdateResource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Hash{String => String}] Resource tags
16
+ attr_accessor :tags
17
+
18
+
19
+ #
20
+ # Mapper for UpdateResource class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ client_side_validation: true,
26
+ required: false,
27
+ serialized_name: 'UpdateResource',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'UpdateResource',
31
+ model_properties: {
32
+ tags: {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'tags',
36
+ type: {
37
+ name: 'Dictionary',
38
+ value: {
39
+ client_side_validation: true,
40
+ required: false,
41
+ serialized_name: 'StringElementType',
42
+ type: {
43
+ name: 'String'
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::HybridCompute end
8
+ module Azure::HybridCompute::Mgmt end
9
+ module Azure::HybridCompute::Mgmt::V2019_12_12 end
@@ -0,0 +1,110 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::HybridCompute::Mgmt::V2019_12_12
7
+ #
8
+ # The Hybrid Compute Management Client.
9
+ #
10
+ class Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [HybridComputeManagementClient] reference to the HybridComputeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets a list of hybrid compute operations.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [OperationListResult] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ response = list_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Gets a list of hybrid compute operations.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Gets a list of hybrid compute operations.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
60
+
61
+
62
+ request_headers = {}
63
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
64
+
65
+ # Set Headers
66
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
67
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
68
+ path_template = 'providers/Microsoft.HybridCompute/operations'
69
+
70
+ request_url = @base_url || @client.base_url
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ query_params: {'api-version' => @client.api_version},
75
+ headers: request_headers.merge(custom_headers || {}),
76
+ base_url: request_url
77
+ }
78
+ promise = @client.make_request_async(:get, path_template, options)
79
+
80
+ promise = promise.then do |result|
81
+ http_response = result.response
82
+ status_code = http_response.status
83
+ response_content = http_response.body
84
+ unless status_code == 200
85
+ error_model = JSON.load(response_content)
86
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
87
+ end
88
+
89
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
90
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
91
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::HybridCompute::Mgmt::V2019_12_12::Models::OperationListResult.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2020-08-02/generated/azure_mgmt_hybrid_compute/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::HybridCompute::Mgmt::V2020_08_02
23
+ autoload :Machines, '2020-08-02/generated/azure_mgmt_hybrid_compute/machines.rb'
24
+ autoload :MachineExtensions, '2020-08-02/generated/azure_mgmt_hybrid_compute/machine_extensions.rb'
25
+ autoload :Operations, '2020-08-02/generated/azure_mgmt_hybrid_compute/operations.rb'
26
+ autoload :HybridComputeManagementClient, '2020-08-02/generated/azure_mgmt_hybrid_compute/hybrid_compute_management_client.rb'
27
+
28
+ module Models
29
+ autoload :MachineListResult, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_list_result.rb'
30
+ autoload :OperationValue, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_value.rb'
31
+ autoload :UpdateResource, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/update_resource.rb'
32
+ autoload :OperationValueDisplayModel, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_value_display_model.rb'
33
+ autoload :ErrorResponse, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/error_response.rb'
34
+ autoload :LocationData, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/location_data.rb'
35
+ autoload :Identity, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/identity.rb'
36
+ autoload :ErrorDetail, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/error_detail.rb'
37
+ autoload :OSProfile, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/osprofile.rb'
38
+ autoload :MachineExtensionPropertiesModel, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_model.rb'
39
+ autoload :OperationListResult, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/operation_list_result.rb'
40
+ autoload :MachineUpdateProperties, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_update_properties.rb'
41
+ autoload :MachineExtensionInstanceView, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view.rb'
42
+ autoload :MachineExtensionUpdatePropertiesModel, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_update_properties_model.rb'
43
+ autoload :Resource, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/resource.rb'
44
+ autoload :MachineExtensionsListResult, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extensions_list_result.rb'
45
+ autoload :MachineExtensionInstanceViewStatus, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_instance_view_status.rb'
46
+ autoload :MachineProperties, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_properties.rb'
47
+ autoload :MachinePropertiesOsProfile, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_properties_os_profile.rb'
48
+ autoload :MachineIdentity, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_identity.rb'
49
+ autoload :Machine, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine.rb'
50
+ autoload :MachineUpdate, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_update.rb'
51
+ autoload :TrackedResource, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/tracked_resource.rb'
52
+ autoload :MachineExtension, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension.rb'
53
+ autoload :MachineExtensionUpdate, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_update.rb'
54
+ autoload :MachineExtensionPropertiesInstanceView, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/machine_extension_properties_instance_view.rb'
55
+ autoload :ProxyResource, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/proxy_resource.rb'
56
+ autoload :AzureEntityResource, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/azure_entity_resource.rb'
57
+ autoload :StatusTypes, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/status_types.rb'
58
+ autoload :StatusLevelTypes, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/status_level_types.rb'
59
+ autoload :InstanceViewTypes, '2020-08-02/generated/azure_mgmt_hybrid_compute/models/instance_view_types.rb'
60
+ end
61
+ end
@@ -0,0 +1,141 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::HybridCompute::Mgmt::V2020_08_02
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class HybridComputeManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Subscription credentials which uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client Api Version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] The preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [Machines] machines
41
+ attr_reader :machines
42
+
43
+ # @return [MachineExtensions] machine_extensions
44
+ attr_reader :machine_extensions
45
+
46
+ # @return [Operations] operations
47
+ attr_reader :operations
48
+
49
+ #
50
+ # Creates initializes a new instance of the HybridComputeManagementClient class.
51
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
52
+ # @param base_url [String] the base URI of the service.
53
+ # @param options [Array] filters to be applied to the HTTP requests.
54
+ #
55
+ def initialize(credentials = nil, base_url = nil, options = nil)
56
+ super(credentials, options)
57
+ @base_url = base_url || 'https://management.azure.com'
58
+
59
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
60
+ @credentials = credentials
61
+
62
+ @machines = Machines.new(self)
63
+ @machine_extensions = MachineExtensions.new(self)
64
+ @operations = Operations.new(self)
65
+ @api_version = '2020-08-02'
66
+ @accept_language = 'en-US'
67
+ @long_running_operation_retry_timeout = 30
68
+ @generate_client_request_id = true
69
+ add_telemetry
70
+ end
71
+
72
+ #
73
+ # Makes a request and returns the body of the response.
74
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
75
+ # @param path [String] the path, relative to {base_url}.
76
+ # @param options [Hash{String=>String}] specifying any request options like :body.
77
+ # @return [Hash{String=>String}] containing the body of the response.
78
+ # Example:
79
+ #
80
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
81
+ # path = "/path"
82
+ # options = {
83
+ # body: request_content,
84
+ # query_params: {'api-version' => '2016-02-01'}
85
+ # }
86
+ # result = @client.make_request(:put, path, options)
87
+ #
88
+ def make_request(method, path, options = {})
89
+ result = make_request_with_http_info(method, path, options)
90
+ result.body unless result.nil?
91
+ end
92
+
93
+ #
94
+ # Makes a request and returns the operation response.
95
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
96
+ # @param path [String] the path, relative to {base_url}.
97
+ # @param options [Hash{String=>String}] specifying any request options like :body.
98
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
99
+ #
100
+ def make_request_with_http_info(method, path, options = {})
101
+ result = make_request_async(method, path, options).value!
102
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
103
+ result
104
+ end
105
+
106
+ #
107
+ # Makes a request asynchronously.
108
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
109
+ # @param path [String] the path, relative to {base_url}.
110
+ # @param options [Hash{String=>String}] specifying any request options like :body.
111
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
112
+ #
113
+ def make_request_async(method, path, options = {})
114
+ fail ArgumentError, 'method is nil' if method.nil?
115
+ fail ArgumentError, 'path is nil' if path.nil?
116
+
117
+ request_url = options[:base_url] || @base_url
118
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
119
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
120
+ end
121
+
122
+ request_headers = @request_headers
123
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
124
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
125
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
126
+
127
+ super(request_url, method, path, options)
128
+ end
129
+
130
+
131
+ private
132
+ #
133
+ # Adds telemetry information.
134
+ #
135
+ def add_telemetry
136
+ sdk_information = 'azure_mgmt_hybrid_compute'
137
+ sdk_information = "#{sdk_information}/0.17.0"
138
+ add_user_agent_information(sdk_information)
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,795 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::HybridCompute::Mgmt::V2020_08_02
7
+ #
8
+ # The Hybrid Compute Management Client.
9
+ #
10
+ class MachineExtensions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the MachineExtensions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [HybridComputeManagementClient] reference to the HybridComputeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # The operation to create or update the extension.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param name [String] The name of the machine where the extension should be
29
+ # created or updated.
30
+ # @param extension_name [String] The name of the machine extension.
31
+ # @param extension_parameters [MachineExtension] Parameters supplied to the
32
+ # Create Machine Extension operation.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [MachineExtension] operation results.
37
+ #
38
+ def create_or_update(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
39
+ response = create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param name [String] The name of the machine where the extension should be
46
+ # created or updated.
47
+ # @param extension_name [String] The name of the machine extension.
48
+ # @param extension_parameters [MachineExtension] Parameters supplied to the
49
+ # Create Machine Extension operation.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [Concurrent::Promise] promise which provides async access to http
54
+ # response.
55
+ #
56
+ def create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
57
+ # Send request
58
+ promise = begin_create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers)
59
+
60
+ promise = promise.then do |response|
61
+ # Defining deserialization method.
62
+ deserialize_method = lambda do |parsed_response|
63
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
64
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
65
+ end
66
+
67
+ # Waiting for response.
68
+ @client.get_long_running_operation_result(response, deserialize_method)
69
+ end
70
+
71
+ promise
72
+ end
73
+
74
+ #
75
+ # The operation to create or update the extension.
76
+ #
77
+ # @param resource_group_name [String] The name of the resource group.
78
+ # @param name [String] The name of the machine where the extension should be
79
+ # created or updated.
80
+ # @param extension_name [String] The name of the machine extension.
81
+ # @param extension_parameters [MachineExtensionUpdate] Parameters supplied to
82
+ # the Create Machine Extension operation.
83
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
84
+ # will be added to the HTTP request.
85
+ #
86
+ # @return [MachineExtension] operation results.
87
+ #
88
+ def update(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
89
+ response = update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
90
+ response.body unless response.nil?
91
+ end
92
+
93
+ #
94
+ # @param resource_group_name [String] The name of the resource group.
95
+ # @param name [String] The name of the machine where the extension should be
96
+ # created or updated.
97
+ # @param extension_name [String] The name of the machine extension.
98
+ # @param extension_parameters [MachineExtensionUpdate] Parameters supplied to
99
+ # the Create Machine Extension operation.
100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
+ # will be added to the HTTP request.
102
+ #
103
+ # @return [Concurrent::Promise] promise which provides async access to http
104
+ # response.
105
+ #
106
+ def update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
107
+ # Send request
108
+ promise = begin_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers)
109
+
110
+ promise = promise.then do |response|
111
+ # Defining deserialization method.
112
+ deserialize_method = lambda do |parsed_response|
113
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
114
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
115
+ end
116
+
117
+ # Waiting for response.
118
+ @client.get_long_running_operation_result(response, deserialize_method)
119
+ end
120
+
121
+ promise
122
+ end
123
+
124
+ #
125
+ # The operation to delete the extension.
126
+ #
127
+ # @param resource_group_name [String] The name of the resource group.
128
+ # @param name [String] The name of the machine where the extension should be
129
+ # deleted.
130
+ # @param extension_name [String] The name of the machine extension.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ def delete(resource_group_name, name, extension_name, custom_headers:nil)
135
+ response = delete_async(resource_group_name, name, extension_name, custom_headers:custom_headers).value!
136
+ nil
137
+ end
138
+
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group.
141
+ # @param name [String] The name of the machine where the extension should be
142
+ # deleted.
143
+ # @param extension_name [String] The name of the machine extension.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [Concurrent::Promise] promise which provides async access to http
148
+ # response.
149
+ #
150
+ def delete_async(resource_group_name, name, extension_name, custom_headers:nil)
151
+ # Send request
152
+ promise = begin_delete_async(resource_group_name, name, extension_name, custom_headers:custom_headers)
153
+
154
+ promise = promise.then do |response|
155
+ # Defining deserialization method.
156
+ deserialize_method = lambda do |parsed_response|
157
+ end
158
+
159
+ # Waiting for response.
160
+ @client.get_long_running_operation_result(response, deserialize_method)
161
+ end
162
+
163
+ promise
164
+ end
165
+
166
+ #
167
+ # The operation to get the extension.
168
+ #
169
+ # @param resource_group_name [String] The name of the resource group.
170
+ # @param name [String] The name of the machine containing the extension.
171
+ # @param extension_name [String] The name of the machine extension.
172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
173
+ # will be added to the HTTP request.
174
+ #
175
+ # @return [MachineExtension] operation results.
176
+ #
177
+ def get(resource_group_name, name, extension_name, custom_headers:nil)
178
+ response = get_async(resource_group_name, name, extension_name, custom_headers:custom_headers).value!
179
+ response.body unless response.nil?
180
+ end
181
+
182
+ #
183
+ # The operation to get the extension.
184
+ #
185
+ # @param resource_group_name [String] The name of the resource group.
186
+ # @param name [String] The name of the machine containing the extension.
187
+ # @param extension_name [String] The name of the machine extension.
188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
189
+ # will be added to the HTTP request.
190
+ #
191
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
192
+ #
193
+ def get_with_http_info(resource_group_name, name, extension_name, custom_headers:nil)
194
+ get_async(resource_group_name, name, extension_name, custom_headers:custom_headers).value!
195
+ end
196
+
197
+ #
198
+ # The operation to get the extension.
199
+ #
200
+ # @param resource_group_name [String] The name of the resource group.
201
+ # @param name [String] The name of the machine containing the extension.
202
+ # @param extension_name [String] The name of the machine extension.
203
+ # @param [Hash{String => String}] A hash of custom headers that will be added
204
+ # to the HTTP request.
205
+ #
206
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
207
+ #
208
+ def get_async(resource_group_name, name, extension_name, custom_headers:nil)
209
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
210
+ fail ArgumentError, 'name is nil' if name.nil?
211
+ fail ArgumentError, 'extension_name is nil' if extension_name.nil?
212
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
213
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
214
+
215
+
216
+ request_headers = {}
217
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
218
+
219
+ # Set Headers
220
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
221
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
222
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/extensions/{extensionName}'
223
+
224
+ request_url = @base_url || @client.base_url
225
+
226
+ options = {
227
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
228
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'extensionName' => extension_name,'subscriptionId' => @client.subscription_id},
229
+ query_params: {'api-version' => @client.api_version},
230
+ headers: request_headers.merge(custom_headers || {}),
231
+ base_url: request_url
232
+ }
233
+ promise = @client.make_request_async(:get, path_template, options)
234
+
235
+ promise = promise.then do |result|
236
+ http_response = result.response
237
+ status_code = http_response.status
238
+ response_content = http_response.body
239
+ unless status_code == 200
240
+ error_model = JSON.load(response_content)
241
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
242
+ end
243
+
244
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
245
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
246
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
247
+ # Deserialize Response
248
+ if status_code == 200
249
+ begin
250
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
251
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
252
+ result.body = @client.deserialize(result_mapper, parsed_response)
253
+ rescue Exception => e
254
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
255
+ end
256
+ end
257
+
258
+ result
259
+ end
260
+
261
+ promise.execute
262
+ end
263
+
264
+ #
265
+ # The operation to get all extensions of a non-Azure machine
266
+ #
267
+ # @param resource_group_name [String] The name of the resource group.
268
+ # @param name [String] The name of the machine containing the extension.
269
+ # @param expand [String] The expand expression to apply on the operation.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [Array<MachineExtension>] operation results.
274
+ #
275
+ def list(resource_group_name, name, expand:nil, custom_headers:nil)
276
+ first_page = list_as_lazy(resource_group_name, name, expand:expand, custom_headers:custom_headers)
277
+ first_page.get_all_items
278
+ end
279
+
280
+ #
281
+ # The operation to get all extensions of a non-Azure machine
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group.
284
+ # @param name [String] The name of the machine containing the extension.
285
+ # @param expand [String] The expand expression to apply on the operation.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
290
+ #
291
+ def list_with_http_info(resource_group_name, name, expand:nil, custom_headers:nil)
292
+ list_async(resource_group_name, name, expand:expand, custom_headers:custom_headers).value!
293
+ end
294
+
295
+ #
296
+ # The operation to get all extensions of a non-Azure machine
297
+ #
298
+ # @param resource_group_name [String] The name of the resource group.
299
+ # @param name [String] The name of the machine containing the extension.
300
+ # @param expand [String] The expand expression to apply on the operation.
301
+ # @param [Hash{String => String}] A hash of custom headers that will be added
302
+ # to the HTTP request.
303
+ #
304
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
305
+ #
306
+ def list_async(resource_group_name, name, expand:nil, custom_headers:nil)
307
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
308
+ fail ArgumentError, 'name is nil' if name.nil?
309
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
310
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
311
+
312
+
313
+ request_headers = {}
314
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
315
+
316
+ # Set Headers
317
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
318
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
319
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/extensions'
320
+
321
+ request_url = @base_url || @client.base_url
322
+
323
+ options = {
324
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
325
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
326
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
327
+ headers: request_headers.merge(custom_headers || {}),
328
+ base_url: request_url
329
+ }
330
+ promise = @client.make_request_async(:get, path_template, options)
331
+
332
+ promise = promise.then do |result|
333
+ http_response = result.response
334
+ status_code = http_response.status
335
+ response_content = http_response.body
336
+ unless status_code == 200
337
+ error_model = JSON.load(response_content)
338
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
339
+ end
340
+
341
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
342
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
343
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
344
+ # Deserialize Response
345
+ if status_code == 200
346
+ begin
347
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
348
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtensionsListResult.mapper()
349
+ result.body = @client.deserialize(result_mapper, parsed_response)
350
+ rescue Exception => e
351
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
352
+ end
353
+ end
354
+
355
+ result
356
+ end
357
+
358
+ promise.execute
359
+ end
360
+
361
+ #
362
+ # The operation to create or update the extension.
363
+ #
364
+ # @param resource_group_name [String] The name of the resource group.
365
+ # @param name [String] The name of the machine where the extension should be
366
+ # created or updated.
367
+ # @param extension_name [String] The name of the machine extension.
368
+ # @param extension_parameters [MachineExtension] Parameters supplied to the
369
+ # Create Machine Extension operation.
370
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
371
+ # will be added to the HTTP request.
372
+ #
373
+ # @return [MachineExtension] operation results.
374
+ #
375
+ def begin_create_or_update(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
376
+ response = begin_create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
377
+ response.body unless response.nil?
378
+ end
379
+
380
+ #
381
+ # The operation to create or update the extension.
382
+ #
383
+ # @param resource_group_name [String] The name of the resource group.
384
+ # @param name [String] The name of the machine where the extension should be
385
+ # created or updated.
386
+ # @param extension_name [String] The name of the machine extension.
387
+ # @param extension_parameters [MachineExtension] Parameters supplied to the
388
+ # Create Machine Extension operation.
389
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
390
+ # will be added to the HTTP request.
391
+ #
392
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
393
+ #
394
+ def begin_create_or_update_with_http_info(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
395
+ begin_create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
396
+ end
397
+
398
+ #
399
+ # The operation to create or update the extension.
400
+ #
401
+ # @param resource_group_name [String] The name of the resource group.
402
+ # @param name [String] The name of the machine where the extension should be
403
+ # created or updated.
404
+ # @param extension_name [String] The name of the machine extension.
405
+ # @param extension_parameters [MachineExtension] Parameters supplied to the
406
+ # Create Machine Extension operation.
407
+ # @param [Hash{String => String}] A hash of custom headers that will be added
408
+ # to the HTTP request.
409
+ #
410
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
411
+ #
412
+ def begin_create_or_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
413
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
414
+ fail ArgumentError, 'name is nil' if name.nil?
415
+ fail ArgumentError, 'extension_name is nil' if extension_name.nil?
416
+ fail ArgumentError, 'extension_parameters is nil' if extension_parameters.nil?
417
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
418
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
419
+
420
+
421
+ request_headers = {}
422
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
423
+
424
+ # Set Headers
425
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
426
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
427
+
428
+ # Serialize Request
429
+ request_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
430
+ request_content = @client.serialize(request_mapper, extension_parameters)
431
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
432
+
433
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/extensions/{extensionName}'
434
+
435
+ request_url = @base_url || @client.base_url
436
+
437
+ options = {
438
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
439
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'extensionName' => extension_name,'subscriptionId' => @client.subscription_id},
440
+ query_params: {'api-version' => @client.api_version},
441
+ body: request_content,
442
+ headers: request_headers.merge(custom_headers || {}),
443
+ base_url: request_url
444
+ }
445
+ promise = @client.make_request_async(:put, path_template, options)
446
+
447
+ promise = promise.then do |result|
448
+ http_response = result.response
449
+ status_code = http_response.status
450
+ response_content = http_response.body
451
+ unless status_code == 200 || status_code == 202
452
+ error_model = JSON.load(response_content)
453
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
454
+ end
455
+
456
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
457
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
458
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
459
+ # Deserialize Response
460
+ if status_code == 200
461
+ begin
462
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
463
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
464
+ result.body = @client.deserialize(result_mapper, parsed_response)
465
+ rescue Exception => e
466
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
467
+ end
468
+ end
469
+
470
+ result
471
+ end
472
+
473
+ promise.execute
474
+ end
475
+
476
+ #
477
+ # The operation to create or update the extension.
478
+ #
479
+ # @param resource_group_name [String] The name of the resource group.
480
+ # @param name [String] The name of the machine where the extension should be
481
+ # created or updated.
482
+ # @param extension_name [String] The name of the machine extension.
483
+ # @param extension_parameters [MachineExtensionUpdate] Parameters supplied to
484
+ # the Create Machine Extension operation.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [MachineExtension] operation results.
489
+ #
490
+ def begin_update(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
491
+ response = begin_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
492
+ response.body unless response.nil?
493
+ end
494
+
495
+ #
496
+ # The operation to create or update the extension.
497
+ #
498
+ # @param resource_group_name [String] The name of the resource group.
499
+ # @param name [String] The name of the machine where the extension should be
500
+ # created or updated.
501
+ # @param extension_name [String] The name of the machine extension.
502
+ # @param extension_parameters [MachineExtensionUpdate] Parameters supplied to
503
+ # the Create Machine Extension operation.
504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
505
+ # will be added to the HTTP request.
506
+ #
507
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
508
+ #
509
+ def begin_update_with_http_info(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
510
+ begin_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:custom_headers).value!
511
+ end
512
+
513
+ #
514
+ # The operation to create or update the extension.
515
+ #
516
+ # @param resource_group_name [String] The name of the resource group.
517
+ # @param name [String] The name of the machine where the extension should be
518
+ # created or updated.
519
+ # @param extension_name [String] The name of the machine extension.
520
+ # @param extension_parameters [MachineExtensionUpdate] Parameters supplied to
521
+ # the Create Machine Extension operation.
522
+ # @param [Hash{String => String}] A hash of custom headers that will be added
523
+ # to the HTTP request.
524
+ #
525
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
526
+ #
527
+ def begin_update_async(resource_group_name, name, extension_name, extension_parameters, custom_headers:nil)
528
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
529
+ fail ArgumentError, 'name is nil' if name.nil?
530
+ fail ArgumentError, 'extension_name is nil' if extension_name.nil?
531
+ fail ArgumentError, 'extension_parameters is nil' if extension_parameters.nil?
532
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
533
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
534
+
535
+
536
+ request_headers = {}
537
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
538
+
539
+ # Set Headers
540
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
541
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
542
+
543
+ # Serialize Request
544
+ request_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtensionUpdate.mapper()
545
+ request_content = @client.serialize(request_mapper, extension_parameters)
546
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
547
+
548
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/extensions/{extensionName}'
549
+
550
+ request_url = @base_url || @client.base_url
551
+
552
+ options = {
553
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
554
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'extensionName' => extension_name,'subscriptionId' => @client.subscription_id},
555
+ query_params: {'api-version' => @client.api_version},
556
+ body: request_content,
557
+ headers: request_headers.merge(custom_headers || {}),
558
+ base_url: request_url
559
+ }
560
+ promise = @client.make_request_async(:patch, path_template, options)
561
+
562
+ promise = promise.then do |result|
563
+ http_response = result.response
564
+ status_code = http_response.status
565
+ response_content = http_response.body
566
+ unless status_code == 200 || status_code == 202
567
+ error_model = JSON.load(response_content)
568
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
569
+ end
570
+
571
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
572
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
573
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
574
+ # Deserialize Response
575
+ if status_code == 200
576
+ begin
577
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
578
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtension.mapper()
579
+ result.body = @client.deserialize(result_mapper, parsed_response)
580
+ rescue Exception => e
581
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
582
+ end
583
+ end
584
+
585
+ result
586
+ end
587
+
588
+ promise.execute
589
+ end
590
+
591
+ #
592
+ # The operation to delete the extension.
593
+ #
594
+ # @param resource_group_name [String] The name of the resource group.
595
+ # @param name [String] The name of the machine where the extension should be
596
+ # deleted.
597
+ # @param extension_name [String] The name of the machine extension.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ #
602
+ def begin_delete(resource_group_name, name, extension_name, custom_headers:nil)
603
+ response = begin_delete_async(resource_group_name, name, extension_name, custom_headers:custom_headers).value!
604
+ nil
605
+ end
606
+
607
+ #
608
+ # The operation to delete the extension.
609
+ #
610
+ # @param resource_group_name [String] The name of the resource group.
611
+ # @param name [String] The name of the machine where the extension should be
612
+ # deleted.
613
+ # @param extension_name [String] The name of the machine extension.
614
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
615
+ # will be added to the HTTP request.
616
+ #
617
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
618
+ #
619
+ def begin_delete_with_http_info(resource_group_name, name, extension_name, custom_headers:nil)
620
+ begin_delete_async(resource_group_name, name, extension_name, custom_headers:custom_headers).value!
621
+ end
622
+
623
+ #
624
+ # The operation to delete the extension.
625
+ #
626
+ # @param resource_group_name [String] The name of the resource group.
627
+ # @param name [String] The name of the machine where the extension should be
628
+ # deleted.
629
+ # @param extension_name [String] The name of the machine extension.
630
+ # @param [Hash{String => String}] A hash of custom headers that will be added
631
+ # to the HTTP request.
632
+ #
633
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
634
+ #
635
+ def begin_delete_async(resource_group_name, name, extension_name, custom_headers:nil)
636
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
637
+ fail ArgumentError, 'name is nil' if name.nil?
638
+ fail ArgumentError, 'extension_name is nil' if extension_name.nil?
639
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
640
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
641
+
642
+
643
+ request_headers = {}
644
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
645
+
646
+ # Set Headers
647
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
648
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
649
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/extensions/{extensionName}'
650
+
651
+ request_url = @base_url || @client.base_url
652
+
653
+ options = {
654
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
655
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'extensionName' => extension_name,'subscriptionId' => @client.subscription_id},
656
+ query_params: {'api-version' => @client.api_version},
657
+ headers: request_headers.merge(custom_headers || {}),
658
+ base_url: request_url
659
+ }
660
+ promise = @client.make_request_async(:delete, path_template, options)
661
+
662
+ promise = promise.then do |result|
663
+ http_response = result.response
664
+ status_code = http_response.status
665
+ response_content = http_response.body
666
+ unless status_code == 200 || status_code == 202 || status_code == 204
667
+ error_model = JSON.load(response_content)
668
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
669
+ end
670
+
671
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
672
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
673
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
674
+
675
+ result
676
+ end
677
+
678
+ promise.execute
679
+ end
680
+
681
+ #
682
+ # The operation to get all extensions of a non-Azure machine
683
+ #
684
+ # @param next_page_link [String] The NextLink from the previous successful call
685
+ # to List operation.
686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
687
+ # will be added to the HTTP request.
688
+ #
689
+ # @return [MachineExtensionsListResult] operation results.
690
+ #
691
+ def list_next(next_page_link, custom_headers:nil)
692
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
693
+ response.body unless response.nil?
694
+ end
695
+
696
+ #
697
+ # The operation to get all extensions of a non-Azure machine
698
+ #
699
+ # @param next_page_link [String] The NextLink from the previous successful call
700
+ # to List operation.
701
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
702
+ # will be added to the HTTP request.
703
+ #
704
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
705
+ #
706
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
707
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
708
+ end
709
+
710
+ #
711
+ # The operation to get all extensions of a non-Azure machine
712
+ #
713
+ # @param next_page_link [String] The NextLink from the previous successful call
714
+ # to List operation.
715
+ # @param [Hash{String => String}] A hash of custom headers that will be added
716
+ # to the HTTP request.
717
+ #
718
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
719
+ #
720
+ def list_next_async(next_page_link, custom_headers:nil)
721
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
722
+
723
+
724
+ request_headers = {}
725
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
726
+
727
+ # Set Headers
728
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
729
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
730
+ path_template = '{nextLink}'
731
+
732
+ request_url = @base_url || @client.base_url
733
+
734
+ options = {
735
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
736
+ skip_encoding_path_params: {'nextLink' => next_page_link},
737
+ headers: request_headers.merge(custom_headers || {}),
738
+ base_url: request_url
739
+ }
740
+ promise = @client.make_request_async(:get, path_template, options)
741
+
742
+ promise = promise.then do |result|
743
+ http_response = result.response
744
+ status_code = http_response.status
745
+ response_content = http_response.body
746
+ unless status_code == 200
747
+ error_model = JSON.load(response_content)
748
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
749
+ end
750
+
751
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
752
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
753
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
754
+ # Deserialize Response
755
+ if status_code == 200
756
+ begin
757
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
758
+ result_mapper = Azure::HybridCompute::Mgmt::V2020_08_02::Models::MachineExtensionsListResult.mapper()
759
+ result.body = @client.deserialize(result_mapper, parsed_response)
760
+ rescue Exception => e
761
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
762
+ end
763
+ end
764
+
765
+ result
766
+ end
767
+
768
+ promise.execute
769
+ end
770
+
771
+ #
772
+ # The operation to get all extensions of a non-Azure machine
773
+ #
774
+ # @param resource_group_name [String] The name of the resource group.
775
+ # @param name [String] The name of the machine containing the extension.
776
+ # @param expand [String] The expand expression to apply on the operation.
777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
778
+ # will be added to the HTTP request.
779
+ #
780
+ # @return [MachineExtensionsListResult] which provide lazy access to pages of
781
+ # the response.
782
+ #
783
+ def list_as_lazy(resource_group_name, name, expand:nil, custom_headers:nil)
784
+ response = list_async(resource_group_name, name, expand:expand, custom_headers:custom_headers).value!
785
+ unless response.nil?
786
+ page = response.body
787
+ page.next_method = Proc.new do |next_page_link|
788
+ list_next_async(next_page_link, custom_headers:custom_headers)
789
+ end
790
+ page
791
+ end
792
+ end
793
+
794
+ end
795
+ end