azure_mgmt_automanage 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage.rb +63 -0
  4. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/accounts.rb +646 -0
  5. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/automanage_client.rb +145 -0
  6. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/configuration_profile_assignments.rb +603 -0
  7. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/configuration_profile_preferences.rb +661 -0
  8. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account.rb +98 -0
  9. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_identity.rb +74 -0
  10. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_list.rb +55 -0
  11. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_update.rb +63 -0
  12. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/azure_entity_resource.rb +75 -0
  13. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile.rb +16 -0
  14. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment.rb +76 -0
  15. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_compliance.rb +48 -0
  16. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_list.rb +56 -0
  17. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_properties.rb +109 -0
  18. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference.rb +99 -0
  19. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_anti_malware.rb +105 -0
  20. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_list.rb +56 -0
  21. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_properties.rb +61 -0
  22. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_update.rb +64 -0
  23. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_vm_backup.rb +81 -0
  24. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/enable_real_time_protection.rb +16 -0
  25. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_additional_info.rb +59 -0
  26. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_response.rb +47 -0
  27. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_response_error.rb +113 -0
  28. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation.rb +83 -0
  29. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation_display.rb +79 -0
  30. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation_list.rb +56 -0
  31. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/provisioning_state.rb +17 -0
  32. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/proxy_resource.rb +63 -0
  33. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/resource.rb +83 -0
  34. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/resource_identity_type.rb +16 -0
  35. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/run_scheduled_scan.rb +16 -0
  36. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/scan_type.rb +16 -0
  37. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/tracked_resource.rb +92 -0
  38. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/update_resource.rb +54 -0
  39. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/update_status.rb +17 -0
  40. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/module_definition.rb +9 -0
  41. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/operations.rb +110 -0
  42. data/lib/azure_mgmt_automanage.rb +6 -0
  43. data/lib/module_definition.rb +7 -0
  44. data/lib/profiles/latest/automanage_latest_profile_client.rb +40 -0
  45. data/lib/profiles/latest/automanage_module_definition.rb +8 -0
  46. data/lib/profiles/latest/modules/automanage_profile_module.rb +195 -0
  47. data/lib/version.rb +7 -0
  48. metadata +163 -0
@@ -0,0 +1,145 @@
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::Automanage::Mgmt::V2020_06_30_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AutomanageClient < 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] The API version to use for this operation.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The ID of the target subscription.
24
+ attr_accessor :subscription_id
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Accounts] accounts
39
+ attr_reader :accounts
40
+
41
+ # @return [ConfigurationProfileAssignments]
42
+ # configuration_profile_assignments
43
+ attr_reader :configuration_profile_assignments
44
+
45
+ # @return [ConfigurationProfilePreferences]
46
+ # configuration_profile_preferences
47
+ attr_reader :configuration_profile_preferences
48
+
49
+ # @return [Operations] operations
50
+ attr_reader :operations
51
+
52
+ #
53
+ # Creates initializes a new instance of the AutomanageClient class.
54
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
55
+ # @param base_url [String] the base URI of the service.
56
+ # @param options [Array] filters to be applied to the HTTP requests.
57
+ #
58
+ def initialize(credentials = nil, base_url = nil, options = nil)
59
+ super(credentials, options)
60
+ @base_url = base_url || 'https://management.azure.com'
61
+
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
63
+ @credentials = credentials
64
+
65
+ @accounts = Accounts.new(self)
66
+ @configuration_profile_assignments = ConfigurationProfileAssignments.new(self)
67
+ @configuration_profile_preferences = ConfigurationProfilePreferences.new(self)
68
+ @operations = Operations.new(self)
69
+ @api_version = '2020-06-30-preview'
70
+ @accept_language = 'en-US'
71
+ @long_running_operation_retry_timeout = 30
72
+ @generate_client_request_id = true
73
+ add_telemetry
74
+ end
75
+
76
+ #
77
+ # Makes a request and returns the body of the response.
78
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
79
+ # @param path [String] the path, relative to {base_url}.
80
+ # @param options [Hash{String=>String}] specifying any request options like :body.
81
+ # @return [Hash{String=>String}] containing the body of the response.
82
+ # Example:
83
+ #
84
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
85
+ # path = "/path"
86
+ # options = {
87
+ # body: request_content,
88
+ # query_params: {'api-version' => '2016-02-01'}
89
+ # }
90
+ # result = @client.make_request(:put, path, options)
91
+ #
92
+ def make_request(method, path, options = {})
93
+ result = make_request_with_http_info(method, path, options)
94
+ result.body unless result.nil?
95
+ end
96
+
97
+ #
98
+ # Makes a request and returns the operation response.
99
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
100
+ # @param path [String] the path, relative to {base_url}.
101
+ # @param options [Hash{String=>String}] specifying any request options like :body.
102
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
103
+ #
104
+ def make_request_with_http_info(method, path, options = {})
105
+ result = make_request_async(method, path, options).value!
106
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
107
+ result
108
+ end
109
+
110
+ #
111
+ # Makes a request asynchronously.
112
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
113
+ # @param path [String] the path, relative to {base_url}.
114
+ # @param options [Hash{String=>String}] specifying any request options like :body.
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def make_request_async(method, path, options = {})
118
+ fail ArgumentError, 'method is nil' if method.nil?
119
+ fail ArgumentError, 'path is nil' if path.nil?
120
+
121
+ request_url = options[:base_url] || @base_url
122
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
123
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
124
+ end
125
+
126
+ request_headers = @request_headers
127
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
128
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
129
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
130
+
131
+ super(request_url, method, path, options)
132
+ end
133
+
134
+
135
+ private
136
+ #
137
+ # Adds telemetry information.
138
+ #
139
+ def add_telemetry
140
+ sdk_information = 'azure_mgmt_automanage'
141
+ sdk_information = "#{sdk_information}/0.17.0"
142
+ add_user_agent_information(sdk_information)
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,603 @@
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::Automanage::Mgmt::V2020_06_30_preview
7
+ #
8
+ # Automanage Client
9
+ #
10
+ class ConfigurationProfileAssignments
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ConfigurationProfileAssignments class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AutomanageClient] reference to the AutomanageClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates an association between a VM and Automanage configuration profile
26
+ #
27
+ # @param configuration_profile_assignment_name [String] Name of the
28
+ # configuration profile assignment. Only default is supported.
29
+ # @param parameters [ConfigurationProfileAssignment] Parameters supplied to the
30
+ # create or update configuration profile assignment.
31
+ # @param resource_group_name [String] The name of the resource group. The name
32
+ # is case insensitive.
33
+ # @param vm_name [String] The name of the virtual machine.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [ConfigurationProfileAssignment] operation results.
38
+ #
39
+ def create_or_update(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:nil)
40
+ response = create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # @param configuration_profile_assignment_name [String] Name of the
46
+ # configuration profile assignment. Only default is supported.
47
+ # @param parameters [ConfigurationProfileAssignment] Parameters supplied to the
48
+ # create or update configuration profile assignment.
49
+ # @param resource_group_name [String] The name of the resource group. The name
50
+ # is case insensitive.
51
+ # @param vm_name [String] The name of the virtual machine.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] promise which provides async access to http
56
+ # response.
57
+ #
58
+ def create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:nil)
59
+ # Send request
60
+ promise = begin_create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:custom_headers)
61
+
62
+ promise = promise.then do |response|
63
+ # Defining deserialization method.
64
+ deserialize_method = lambda do |parsed_response|
65
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignment.mapper()
66
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
67
+ end
68
+
69
+ # Waiting for response.
70
+ @client.get_long_running_operation_result(response, deserialize_method)
71
+ end
72
+
73
+ promise
74
+ end
75
+
76
+ #
77
+ # Get information about a configuration profile assignment
78
+ #
79
+ # @param resource_group_name [String] The name of the resource group. The name
80
+ # is case insensitive.
81
+ # @param configuration_profile_assignment_name [String] The configuration
82
+ # profile assignment name.
83
+ # @param vm_name [String] The name of the virtual machine.
84
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
85
+ # will be added to the HTTP request.
86
+ #
87
+ # @return [ConfigurationProfileAssignment] operation results.
88
+ #
89
+ def get(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
90
+ response = get_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:custom_headers).value!
91
+ response.body unless response.nil?
92
+ end
93
+
94
+ #
95
+ # Get information about a configuration profile assignment
96
+ #
97
+ # @param resource_group_name [String] The name of the resource group. The name
98
+ # is case insensitive.
99
+ # @param configuration_profile_assignment_name [String] The configuration
100
+ # profile assignment name.
101
+ # @param vm_name [String] The name of the virtual machine.
102
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
103
+ # will be added to the HTTP request.
104
+ #
105
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
106
+ #
107
+ def get_with_http_info(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
108
+ get_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:custom_headers).value!
109
+ end
110
+
111
+ #
112
+ # Get information about a configuration profile assignment
113
+ #
114
+ # @param resource_group_name [String] The name of the resource group. The name
115
+ # is case insensitive.
116
+ # @param configuration_profile_assignment_name [String] The configuration
117
+ # profile assignment name.
118
+ # @param vm_name [String] The name of the virtual machine.
119
+ # @param [Hash{String => String}] A hash of custom headers that will be added
120
+ # to the HTTP request.
121
+ #
122
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
123
+ #
124
+ def get_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
125
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
126
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
127
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
128
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
129
+ fail ArgumentError, 'configuration_profile_assignment_name is nil' if configuration_profile_assignment_name.nil?
130
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
131
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
132
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
133
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
134
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
135
+
136
+
137
+ request_headers = {}
138
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
139
+
140
+ # Set Headers
141
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
142
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
143
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'
144
+
145
+ request_url = @base_url || @client.base_url
146
+
147
+ options = {
148
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
149
+ path_params: {'resourceGroupName' => resource_group_name,'configurationProfileAssignmentName' => configuration_profile_assignment_name,'subscriptionId' => @client.subscription_id,'vmName' => vm_name},
150
+ query_params: {'api-version' => @client.api_version},
151
+ headers: request_headers.merge(custom_headers || {}),
152
+ base_url: request_url
153
+ }
154
+ promise = @client.make_request_async(:get, path_template, options)
155
+
156
+ promise = promise.then do |result|
157
+ http_response = result.response
158
+ status_code = http_response.status
159
+ response_content = http_response.body
160
+ unless status_code == 200
161
+ error_model = JSON.load(response_content)
162
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
163
+ end
164
+
165
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
166
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
167
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
168
+ # Deserialize Response
169
+ if status_code == 200
170
+ begin
171
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
172
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignment.mapper()
173
+ result.body = @client.deserialize(result_mapper, parsed_response)
174
+ rescue Exception => e
175
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
176
+ end
177
+ end
178
+
179
+ result
180
+ end
181
+
182
+ promise.execute
183
+ end
184
+
185
+ #
186
+ # Delete a configuration profile assignment
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group. The name
189
+ # is case insensitive.
190
+ # @param configuration_profile_assignment_name [String] Name of the
191
+ # configuration profile assignment
192
+ # @param vm_name [String] The name of the virtual machine.
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ #
197
+ def delete(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
198
+ response = delete_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:custom_headers).value!
199
+ nil
200
+ end
201
+
202
+ #
203
+ # Delete a configuration profile assignment
204
+ #
205
+ # @param resource_group_name [String] The name of the resource group. The name
206
+ # is case insensitive.
207
+ # @param configuration_profile_assignment_name [String] Name of the
208
+ # configuration profile assignment
209
+ # @param vm_name [String] The name of the virtual machine.
210
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
211
+ # will be added to the HTTP request.
212
+ #
213
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
214
+ #
215
+ def delete_with_http_info(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
216
+ delete_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:custom_headers).value!
217
+ end
218
+
219
+ #
220
+ # Delete a configuration profile assignment
221
+ #
222
+ # @param resource_group_name [String] The name of the resource group. The name
223
+ # is case insensitive.
224
+ # @param configuration_profile_assignment_name [String] Name of the
225
+ # configuration profile assignment
226
+ # @param vm_name [String] The name of the virtual machine.
227
+ # @param [Hash{String => String}] A hash of custom headers that will be added
228
+ # to the HTTP request.
229
+ #
230
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
231
+ #
232
+ def delete_async(resource_group_name, configuration_profile_assignment_name, vm_name, custom_headers:nil)
233
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
234
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
235
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
236
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
237
+ fail ArgumentError, 'configuration_profile_assignment_name is nil' if configuration_profile_assignment_name.nil?
238
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
239
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
240
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
241
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
242
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
243
+
244
+
245
+ request_headers = {}
246
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
247
+
248
+ # Set Headers
249
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
250
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
251
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'
252
+
253
+ request_url = @base_url || @client.base_url
254
+
255
+ options = {
256
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
257
+ path_params: {'resourceGroupName' => resource_group_name,'configurationProfileAssignmentName' => configuration_profile_assignment_name,'subscriptionId' => @client.subscription_id,'vmName' => vm_name},
258
+ query_params: {'api-version' => @client.api_version},
259
+ headers: request_headers.merge(custom_headers || {}),
260
+ base_url: request_url
261
+ }
262
+ promise = @client.make_request_async(:delete, path_template, options)
263
+
264
+ promise = promise.then do |result|
265
+ http_response = result.response
266
+ status_code = http_response.status
267
+ response_content = http_response.body
268
+ unless status_code == 200 || status_code == 204
269
+ error_model = JSON.load(response_content)
270
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
271
+ end
272
+
273
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
274
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
275
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
276
+
277
+ result
278
+ end
279
+
280
+ promise.execute
281
+ end
282
+
283
+ #
284
+ # Get list of configuration profile assignments
285
+ #
286
+ # @param resource_group_name [String] The name of the resource group. The name
287
+ # is case insensitive.
288
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
289
+ # will be added to the HTTP request.
290
+ #
291
+ # @return [ConfigurationProfileAssignmentList] operation results.
292
+ #
293
+ def list(resource_group_name, custom_headers:nil)
294
+ response = list_async(resource_group_name, custom_headers:custom_headers).value!
295
+ response.body unless response.nil?
296
+ end
297
+
298
+ #
299
+ # Get list of configuration profile assignments
300
+ #
301
+ # @param resource_group_name [String] The name of the resource group. The name
302
+ # is case insensitive.
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
307
+ #
308
+ def list_with_http_info(resource_group_name, custom_headers:nil)
309
+ list_async(resource_group_name, custom_headers:custom_headers).value!
310
+ end
311
+
312
+ #
313
+ # Get list of configuration profile assignments
314
+ #
315
+ # @param resource_group_name [String] The name of the resource group. The name
316
+ # is case insensitive.
317
+ # @param [Hash{String => String}] A hash of custom headers that will be added
318
+ # to the HTTP request.
319
+ #
320
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
321
+ #
322
+ def list_async(resource_group_name, custom_headers:nil)
323
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
324
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
325
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
326
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
327
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
328
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
329
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
330
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
331
+
332
+
333
+ request_headers = {}
334
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
335
+
336
+ # Set Headers
337
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
338
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
339
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfileAssignments'
340
+
341
+ request_url = @base_url || @client.base_url
342
+
343
+ options = {
344
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
345
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
346
+ query_params: {'api-version' => @client.api_version},
347
+ headers: request_headers.merge(custom_headers || {}),
348
+ base_url: request_url
349
+ }
350
+ promise = @client.make_request_async(:get, path_template, options)
351
+
352
+ promise = promise.then do |result|
353
+ http_response = result.response
354
+ status_code = http_response.status
355
+ response_content = http_response.body
356
+ unless status_code == 200
357
+ error_model = JSON.load(response_content)
358
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
359
+ end
360
+
361
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
362
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
363
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
364
+ # Deserialize Response
365
+ if status_code == 200
366
+ begin
367
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
368
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignmentList.mapper()
369
+ result.body = @client.deserialize(result_mapper, parsed_response)
370
+ rescue Exception => e
371
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
372
+ end
373
+ end
374
+
375
+ result
376
+ end
377
+
378
+ promise.execute
379
+ end
380
+
381
+ #
382
+ # Get list of configuration profile assignments under a given subscription
383
+ #
384
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
385
+ # will be added to the HTTP request.
386
+ #
387
+ # @return [ConfigurationProfileAssignmentList] operation results.
388
+ #
389
+ def list_by_subscription(custom_headers:nil)
390
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
391
+ response.body unless response.nil?
392
+ end
393
+
394
+ #
395
+ # Get list of configuration profile assignments under a given subscription
396
+ #
397
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
398
+ # will be added to the HTTP request.
399
+ #
400
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
401
+ #
402
+ def list_by_subscription_with_http_info(custom_headers:nil)
403
+ list_by_subscription_async(custom_headers:custom_headers).value!
404
+ end
405
+
406
+ #
407
+ # Get list of configuration profile assignments under a given subscription
408
+ #
409
+ # @param [Hash{String => String}] A hash of custom headers that will be added
410
+ # to the HTTP request.
411
+ #
412
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
413
+ #
414
+ def list_by_subscription_async(custom_headers:nil)
415
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
416
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
417
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
418
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
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
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfileAssignments'
428
+
429
+ request_url = @base_url || @client.base_url
430
+
431
+ options = {
432
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
433
+ path_params: {'subscriptionId' => @client.subscription_id},
434
+ query_params: {'api-version' => @client.api_version},
435
+ headers: request_headers.merge(custom_headers || {}),
436
+ base_url: request_url
437
+ }
438
+ promise = @client.make_request_async(:get, path_template, options)
439
+
440
+ promise = promise.then do |result|
441
+ http_response = result.response
442
+ status_code = http_response.status
443
+ response_content = http_response.body
444
+ unless status_code == 200
445
+ error_model = JSON.load(response_content)
446
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
447
+ end
448
+
449
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
450
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
451
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
452
+ # Deserialize Response
453
+ if status_code == 200
454
+ begin
455
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
456
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignmentList.mapper()
457
+ result.body = @client.deserialize(result_mapper, parsed_response)
458
+ rescue Exception => e
459
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
460
+ end
461
+ end
462
+
463
+ result
464
+ end
465
+
466
+ promise.execute
467
+ end
468
+
469
+ #
470
+ # Creates an association between a VM and Automanage configuration profile
471
+ #
472
+ # @param configuration_profile_assignment_name [String] Name of the
473
+ # configuration profile assignment. Only default is supported.
474
+ # @param parameters [ConfigurationProfileAssignment] Parameters supplied to the
475
+ # create or update configuration profile assignment.
476
+ # @param resource_group_name [String] The name of the resource group. The name
477
+ # is case insensitive.
478
+ # @param vm_name [String] The name of the virtual machine.
479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
480
+ # will be added to the HTTP request.
481
+ #
482
+ # @return [ConfigurationProfileAssignment] operation results.
483
+ #
484
+ def begin_create_or_update(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:nil)
485
+ response = begin_create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:custom_headers).value!
486
+ response.body unless response.nil?
487
+ end
488
+
489
+ #
490
+ # Creates an association between a VM and Automanage configuration profile
491
+ #
492
+ # @param configuration_profile_assignment_name [String] Name of the
493
+ # configuration profile assignment. Only default is supported.
494
+ # @param parameters [ConfigurationProfileAssignment] Parameters supplied to the
495
+ # create or update configuration profile assignment.
496
+ # @param resource_group_name [String] The name of the resource group. The name
497
+ # is case insensitive.
498
+ # @param vm_name [String] The name of the virtual machine.
499
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
500
+ # will be added to the HTTP request.
501
+ #
502
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
503
+ #
504
+ def begin_create_or_update_with_http_info(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:nil)
505
+ begin_create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:custom_headers).value!
506
+ end
507
+
508
+ #
509
+ # Creates an association between a VM and Automanage configuration profile
510
+ #
511
+ # @param configuration_profile_assignment_name [String] Name of the
512
+ # configuration profile assignment. Only default is supported.
513
+ # @param parameters [ConfigurationProfileAssignment] Parameters supplied to the
514
+ # create or update configuration profile assignment.
515
+ # @param resource_group_name [String] The name of the resource group. The name
516
+ # is case insensitive.
517
+ # @param vm_name [String] The name of the virtual machine.
518
+ # @param [Hash{String => String}] A hash of custom headers that will be added
519
+ # to the HTTP request.
520
+ #
521
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
522
+ #
523
+ def begin_create_or_update_async(configuration_profile_assignment_name, parameters, resource_group_name, vm_name, custom_headers:nil)
524
+ fail ArgumentError, 'configuration_profile_assignment_name is nil' if configuration_profile_assignment_name.nil?
525
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
526
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
527
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
528
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
529
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
530
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
531
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
532
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
533
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
534
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
535
+
536
+
537
+ request_headers = {}
538
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
539
+
540
+ # Set Headers
541
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
542
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
543
+
544
+ # Serialize Request
545
+ request_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignment.mapper()
546
+ request_content = @client.serialize(request_mapper, parameters)
547
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
548
+
549
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'
550
+
551
+ request_url = @base_url || @client.base_url
552
+
553
+ options = {
554
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
555
+ path_params: {'configurationProfileAssignmentName' => configuration_profile_assignment_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'vmName' => vm_name},
556
+ query_params: {'api-version' => @client.api_version},
557
+ body: request_content,
558
+ headers: request_headers.merge(custom_headers || {}),
559
+ base_url: request_url
560
+ }
561
+ promise = @client.make_request_async(:put, path_template, options)
562
+
563
+ promise = promise.then do |result|
564
+ http_response = result.response
565
+ status_code = http_response.status
566
+ response_content = http_response.body
567
+ unless status_code == 201 || status_code == 200
568
+ error_model = JSON.load(response_content)
569
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
570
+ end
571
+
572
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
573
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
574
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
575
+ # Deserialize Response
576
+ if status_code == 201
577
+ begin
578
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
579
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignment.mapper()
580
+ result.body = @client.deserialize(result_mapper, parsed_response)
581
+ rescue Exception => e
582
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
583
+ end
584
+ end
585
+ # Deserialize Response
586
+ if status_code == 200
587
+ begin
588
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
589
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfileAssignment.mapper()
590
+ result.body = @client.deserialize(result_mapper, parsed_response)
591
+ rescue Exception => e
592
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
593
+ end
594
+ end
595
+
596
+ result
597
+ end
598
+
599
+ promise.execute
600
+ end
601
+
602
+ end
603
+ end