azure_mgmt_kubernetes_configuration 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration.rb +47 -0
  4. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/compliance_state.rb +17 -0
  5. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/compliance_status.rb +82 -0
  6. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/enable_helm_operator.rb +16 -0
  7. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/error_definition.rb +81 -0
  8. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/error_response.rb +47 -0
  9. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/helm_operator_properties.rb +57 -0
  10. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/message_level.rb +17 -0
  11. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/operator_scope.rb +16 -0
  12. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/operator_type.rb +15 -0
  13. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/provisioning_state.rb +19 -0
  14. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/proxy_resource.rb +62 -0
  15. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/resource.rb +80 -0
  16. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/resource_provider_operation.rb +60 -0
  17. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/resource_provider_operation_display.rb +79 -0
  18. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/resource_provider_operation_list.rb +100 -0
  19. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/result.rb +46 -0
  20. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/source_control_configuration.rb +202 -0
  21. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/models/source_control_configuration_list.rb +104 -0
  22. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/module_definition.rb +9 -0
  23. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/operations.rb +231 -0
  24. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/source_control_configuration_client.rb +132 -0
  25. data/lib/2019-11-01-preview/generated/azure_mgmt_kubernetes_configuration/source_control_configurations.rb +737 -0
  26. data/lib/azure_mgmt_kubernetes_configuration.rb +6 -0
  27. data/lib/module_definition.rb +7 -0
  28. data/lib/profiles/latest/kubernetesconfiguration_latest_profile_client.rb +40 -0
  29. data/lib/profiles/latest/kubernetesconfiguration_module_definition.rb +8 -0
  30. data/lib/profiles/latest/modules/kubernetesconfiguration_profile_module.rb +135 -0
  31. data/lib/version.rb +7 -0
  32. metadata +147 -0
@@ -0,0 +1,737 @@
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::KubernetesConfiguration::Mgmt::V2019_11_01_preview
7
+ #
8
+ # Use these APIs to create Source Control Configuration resources through
9
+ # ARM, for Kubernetes Clusters.
10
+ #
11
+ class SourceControlConfigurations
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the SourceControlConfigurations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [SourceControlConfigurationClient] reference to the SourceControlConfigurationClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets details of the Source Control Configuration.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
30
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
31
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
32
+ # 'Microsoft.Kubernetes'
33
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
34
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
35
+ # K8S clusters). Possible values include: 'managedClusters',
36
+ # 'connectedClusters'
37
+ # @param cluster_name [String] The name of the kubernetes cluster.
38
+ # @param source_control_configuration_name [String] Name of the Source Control
39
+ # Configuration.
40
+ # @param api_version [String] The API version to be used with the HTTP request.
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [SourceControlConfiguration] operation results.
45
+ #
46
+ def get(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
47
+ response = get_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers).value!
48
+ response.body unless response.nil?
49
+ end
50
+
51
+ #
52
+ # Gets details of the Source Control Configuration.
53
+ #
54
+ # @param resource_group_name [String] The name of the resource group.
55
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
56
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
57
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
58
+ # 'Microsoft.Kubernetes'
59
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
60
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
61
+ # K8S clusters). Possible values include: 'managedClusters',
62
+ # 'connectedClusters'
63
+ # @param cluster_name [String] The name of the kubernetes cluster.
64
+ # @param source_control_configuration_name [String] Name of the Source Control
65
+ # Configuration.
66
+ # @param api_version [String] The API version to be used with the HTTP request.
67
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
68
+ # will be added to the HTTP request.
69
+ #
70
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
71
+ #
72
+ def get_with_http_info(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
73
+ get_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers).value!
74
+ end
75
+
76
+ #
77
+ # Gets details of the Source Control Configuration.
78
+ #
79
+ # @param resource_group_name [String] The name of the resource group.
80
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
81
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
82
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
83
+ # 'Microsoft.Kubernetes'
84
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
85
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
86
+ # K8S clusters). Possible values include: 'managedClusters',
87
+ # 'connectedClusters'
88
+ # @param cluster_name [String] The name of the kubernetes cluster.
89
+ # @param source_control_configuration_name [String] Name of the Source Control
90
+ # Configuration.
91
+ # @param api_version [String] The API version to be used with the HTTP request.
92
+ # @param [Hash{String => String}] A hash of custom headers that will be added
93
+ # to the HTTP request.
94
+ #
95
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
96
+ #
97
+ def get_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
98
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
99
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
100
+ fail ArgumentError, 'cluster_rp is nil' if cluster_rp.nil?
101
+ fail ArgumentError, 'cluster_resource_name is nil' if cluster_resource_name.nil?
102
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
103
+ fail ArgumentError, 'source_control_configuration_name is nil' if source_control_configuration_name.nil?
104
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
105
+
106
+
107
+ request_headers = {}
108
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
109
+
110
+ # Set Headers
111
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
112
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
113
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'
114
+
115
+ request_url = @base_url || @client.base_url
116
+
117
+ options = {
118
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
119
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterRp' => cluster_rp,'clusterResourceName' => cluster_resource_name,'clusterName' => cluster_name,'sourceControlConfigurationName' => source_control_configuration_name},
120
+ query_params: {'api-version' => api_version},
121
+ headers: request_headers.merge(custom_headers || {}),
122
+ base_url: request_url
123
+ }
124
+ promise = @client.make_request_async(:get, path_template, options)
125
+
126
+ promise = promise.then do |result|
127
+ http_response = result.response
128
+ status_code = http_response.status
129
+ response_content = http_response.body
130
+ unless status_code == 200
131
+ error_model = JSON.load(response_content)
132
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
133
+ end
134
+
135
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
136
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
137
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
138
+ # Deserialize Response
139
+ if status_code == 200
140
+ begin
141
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
142
+ result_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfiguration.mapper()
143
+ result.body = @client.deserialize(result_mapper, parsed_response)
144
+ rescue Exception => e
145
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
146
+ end
147
+ end
148
+
149
+ result
150
+ end
151
+
152
+ promise.execute
153
+ end
154
+
155
+ #
156
+ # Create a new Kubernetes Source Control Configuration.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group.
159
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
160
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
161
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
162
+ # 'Microsoft.Kubernetes'
163
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
164
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
165
+ # K8S clusters). Possible values include: 'managedClusters',
166
+ # 'connectedClusters'
167
+ # @param cluster_name [String] The name of the kubernetes cluster.
168
+ # @param source_control_configuration_name [String] Name of the Source Control
169
+ # Configuration.
170
+ # @param api_version [String] The API version to be used with the HTTP request.
171
+ # @param source_control_configuration [SourceControlConfiguration] Properties
172
+ # necessary to Create KubernetesConfiguration.
173
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
174
+ # will be added to the HTTP request.
175
+ #
176
+ # @return [SourceControlConfiguration] operation results.
177
+ #
178
+ def create_or_update(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, source_control_configuration, custom_headers:nil)
179
+ response = create_or_update_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, source_control_configuration, custom_headers:custom_headers).value!
180
+ response.body unless response.nil?
181
+ end
182
+
183
+ #
184
+ # Create a new Kubernetes Source Control Configuration.
185
+ #
186
+ # @param resource_group_name [String] The name of the resource group.
187
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
188
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
189
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
190
+ # 'Microsoft.Kubernetes'
191
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
192
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
193
+ # K8S clusters). Possible values include: 'managedClusters',
194
+ # 'connectedClusters'
195
+ # @param cluster_name [String] The name of the kubernetes cluster.
196
+ # @param source_control_configuration_name [String] Name of the Source Control
197
+ # Configuration.
198
+ # @param api_version [String] The API version to be used with the HTTP request.
199
+ # @param source_control_configuration [SourceControlConfiguration] Properties
200
+ # necessary to Create KubernetesConfiguration.
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
205
+ #
206
+ def create_or_update_with_http_info(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, source_control_configuration, custom_headers:nil)
207
+ create_or_update_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, source_control_configuration, custom_headers:custom_headers).value!
208
+ end
209
+
210
+ #
211
+ # Create a new Kubernetes Source Control Configuration.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group.
214
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
215
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
216
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
217
+ # 'Microsoft.Kubernetes'
218
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
219
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
220
+ # K8S clusters). Possible values include: 'managedClusters',
221
+ # 'connectedClusters'
222
+ # @param cluster_name [String] The name of the kubernetes cluster.
223
+ # @param source_control_configuration_name [String] Name of the Source Control
224
+ # Configuration.
225
+ # @param api_version [String] The API version to be used with the HTTP request.
226
+ # @param source_control_configuration [SourceControlConfiguration] Properties
227
+ # necessary to Create KubernetesConfiguration.
228
+ # @param [Hash{String => String}] A hash of custom headers that will be added
229
+ # to the HTTP request.
230
+ #
231
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
232
+ #
233
+ def create_or_update_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, source_control_configuration, custom_headers:nil)
234
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
235
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
236
+ fail ArgumentError, 'cluster_rp is nil' if cluster_rp.nil?
237
+ fail ArgumentError, 'cluster_resource_name is nil' if cluster_resource_name.nil?
238
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
239
+ fail ArgumentError, 'source_control_configuration_name is nil' if source_control_configuration_name.nil?
240
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
241
+ fail ArgumentError, 'source_control_configuration is nil' if source_control_configuration.nil?
242
+
243
+
244
+ request_headers = {}
245
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
246
+
247
+ # Set Headers
248
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
249
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
250
+
251
+ # Serialize Request
252
+ request_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfiguration.mapper()
253
+ request_content = @client.serialize(request_mapper, source_control_configuration)
254
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
255
+
256
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'
257
+
258
+ request_url = @base_url || @client.base_url
259
+
260
+ options = {
261
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
262
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterRp' => cluster_rp,'clusterResourceName' => cluster_resource_name,'clusterName' => cluster_name,'sourceControlConfigurationName' => source_control_configuration_name},
263
+ query_params: {'api-version' => api_version},
264
+ body: request_content,
265
+ headers: request_headers.merge(custom_headers || {}),
266
+ base_url: request_url
267
+ }
268
+ promise = @client.make_request_async(:put, path_template, options)
269
+
270
+ promise = promise.then do |result|
271
+ http_response = result.response
272
+ status_code = http_response.status
273
+ response_content = http_response.body
274
+ unless status_code == 200 || status_code == 201
275
+ error_model = JSON.load(response_content)
276
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
277
+ end
278
+
279
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
280
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
281
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
282
+ # Deserialize Response
283
+ if status_code == 200
284
+ begin
285
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
286
+ result_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfiguration.mapper()
287
+ result.body = @client.deserialize(result_mapper, parsed_response)
288
+ rescue Exception => e
289
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
290
+ end
291
+ end
292
+ # Deserialize Response
293
+ if status_code == 201
294
+ begin
295
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
296
+ result_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfiguration.mapper()
297
+ result.body = @client.deserialize(result_mapper, parsed_response)
298
+ rescue Exception => e
299
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
300
+ end
301
+ end
302
+
303
+ result
304
+ end
305
+
306
+ promise.execute
307
+ end
308
+
309
+ #
310
+ # This will delete the YAML file used to set up the Source control
311
+ # configuration, thus stopping future sync from the source repo.
312
+ #
313
+ # @param resource_group_name [String] The name of the resource group.
314
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
315
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
316
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
317
+ # 'Microsoft.Kubernetes'
318
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
319
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
320
+ # K8S clusters). Possible values include: 'managedClusters',
321
+ # 'connectedClusters'
322
+ # @param cluster_name [String] The name of the kubernetes cluster.
323
+ # @param source_control_configuration_name [String] Name of the Source Control
324
+ # Configuration.
325
+ # @param api_version [String] The API version to be used with the HTTP request.
326
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
327
+ # will be added to the HTTP request.
328
+ #
329
+ def delete(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
330
+ response = delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers).value!
331
+ nil
332
+ end
333
+
334
+ #
335
+ # @param resource_group_name [String] The name of the resource group.
336
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
337
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
338
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
339
+ # 'Microsoft.Kubernetes'
340
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
341
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
342
+ # K8S clusters). Possible values include: 'managedClusters',
343
+ # 'connectedClusters'
344
+ # @param cluster_name [String] The name of the kubernetes cluster.
345
+ # @param source_control_configuration_name [String] Name of the Source Control
346
+ # Configuration.
347
+ # @param api_version [String] The API version to be used with the HTTP request.
348
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
349
+ # will be added to the HTTP request.
350
+ #
351
+ # @return [Concurrent::Promise] promise which provides async access to http
352
+ # response.
353
+ #
354
+ def delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
355
+ # Send request
356
+ promise = begin_delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers)
357
+
358
+ promise = promise.then do |response|
359
+ # Defining deserialization method.
360
+ deserialize_method = lambda do |parsed_response|
361
+ end
362
+
363
+ # Waiting for response.
364
+ @client.get_long_running_operation_result(response, deserialize_method)
365
+ end
366
+
367
+ promise
368
+ end
369
+
370
+ #
371
+ # List all Source Control Configurations.
372
+ #
373
+ # @param resource_group_name [String] The name of the resource group.
374
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
375
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
376
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
377
+ # 'Microsoft.Kubernetes'
378
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
379
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
380
+ # K8S clusters). Possible values include: 'managedClusters',
381
+ # 'connectedClusters'
382
+ # @param cluster_name [String] The name of the kubernetes cluster.
383
+ # @param api_version [String] The API version to be used with the HTTP request.
384
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
385
+ # will be added to the HTTP request.
386
+ #
387
+ # @return [Array<SourceControlConfiguration>] operation results.
388
+ #
389
+ def list(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:nil)
390
+ first_page = list_as_lazy(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:custom_headers)
391
+ first_page.get_all_items
392
+ end
393
+
394
+ #
395
+ # List all Source Control Configurations.
396
+ #
397
+ # @param resource_group_name [String] The name of the resource group.
398
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
399
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
400
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
401
+ # 'Microsoft.Kubernetes'
402
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
403
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
404
+ # K8S clusters). Possible values include: 'managedClusters',
405
+ # 'connectedClusters'
406
+ # @param cluster_name [String] The name of the kubernetes cluster.
407
+ # @param api_version [String] The API version to be used with the HTTP request.
408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
409
+ # will be added to the HTTP request.
410
+ #
411
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
412
+ #
413
+ def list_with_http_info(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:nil)
414
+ list_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:custom_headers).value!
415
+ end
416
+
417
+ #
418
+ # List all Source Control Configurations.
419
+ #
420
+ # @param resource_group_name [String] The name of the resource group.
421
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
422
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
423
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
424
+ # 'Microsoft.Kubernetes'
425
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
426
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
427
+ # K8S clusters). Possible values include: 'managedClusters',
428
+ # 'connectedClusters'
429
+ # @param cluster_name [String] The name of the kubernetes cluster.
430
+ # @param api_version [String] The API version to be used with the HTTP request.
431
+ # @param [Hash{String => String}] A hash of custom headers that will be added
432
+ # to the HTTP request.
433
+ #
434
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
435
+ #
436
+ def list_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:nil)
437
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
438
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
439
+ fail ArgumentError, 'cluster_rp is nil' if cluster_rp.nil?
440
+ fail ArgumentError, 'cluster_resource_name is nil' if cluster_resource_name.nil?
441
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
442
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
443
+
444
+
445
+ request_headers = {}
446
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
447
+
448
+ # Set Headers
449
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
450
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
451
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations'
452
+
453
+ request_url = @base_url || @client.base_url
454
+
455
+ options = {
456
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
457
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterRp' => cluster_rp,'clusterResourceName' => cluster_resource_name,'clusterName' => cluster_name},
458
+ query_params: {'api-version' => api_version},
459
+ headers: request_headers.merge(custom_headers || {}),
460
+ base_url: request_url
461
+ }
462
+ promise = @client.make_request_async(:get, path_template, options)
463
+
464
+ promise = promise.then do |result|
465
+ http_response = result.response
466
+ status_code = http_response.status
467
+ response_content = http_response.body
468
+ unless status_code == 200
469
+ error_model = JSON.load(response_content)
470
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
471
+ end
472
+
473
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
474
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
475
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
476
+ # Deserialize Response
477
+ if status_code == 200
478
+ begin
479
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
480
+ result_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfigurationList.mapper()
481
+ result.body = @client.deserialize(result_mapper, parsed_response)
482
+ rescue Exception => e
483
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
484
+ end
485
+ end
486
+
487
+ result
488
+ end
489
+
490
+ promise.execute
491
+ end
492
+
493
+ #
494
+ # This will delete the YAML file used to set up the Source control
495
+ # configuration, thus stopping future sync from the source repo.
496
+ #
497
+ # @param resource_group_name [String] The name of the resource group.
498
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
499
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
500
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
501
+ # 'Microsoft.Kubernetes'
502
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
503
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
504
+ # K8S clusters). Possible values include: 'managedClusters',
505
+ # 'connectedClusters'
506
+ # @param cluster_name [String] The name of the kubernetes cluster.
507
+ # @param source_control_configuration_name [String] Name of the Source Control
508
+ # Configuration.
509
+ # @param api_version [String] The API version to be used with the HTTP request.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ #
514
+ def begin_delete(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
515
+ response = begin_delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers).value!
516
+ nil
517
+ end
518
+
519
+ #
520
+ # This will delete the YAML file used to set up the Source control
521
+ # configuration, thus stopping future sync from the source repo.
522
+ #
523
+ # @param resource_group_name [String] The name of the resource group.
524
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
525
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
526
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
527
+ # 'Microsoft.Kubernetes'
528
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
529
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
530
+ # K8S clusters). Possible values include: 'managedClusters',
531
+ # 'connectedClusters'
532
+ # @param cluster_name [String] The name of the kubernetes cluster.
533
+ # @param source_control_configuration_name [String] Name of the Source Control
534
+ # Configuration.
535
+ # @param api_version [String] The API version to be used with the HTTP request.
536
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
537
+ # will be added to the HTTP request.
538
+ #
539
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
540
+ #
541
+ def begin_delete_with_http_info(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
542
+ begin_delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:custom_headers).value!
543
+ end
544
+
545
+ #
546
+ # This will delete the YAML file used to set up the Source control
547
+ # configuration, thus stopping future sync from the source repo.
548
+ #
549
+ # @param resource_group_name [String] The name of the resource group.
550
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
551
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
552
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
553
+ # 'Microsoft.Kubernetes'
554
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
555
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
556
+ # K8S clusters). Possible values include: 'managedClusters',
557
+ # 'connectedClusters'
558
+ # @param cluster_name [String] The name of the kubernetes cluster.
559
+ # @param source_control_configuration_name [String] Name of the Source Control
560
+ # Configuration.
561
+ # @param api_version [String] The API version to be used with the HTTP request.
562
+ # @param [Hash{String => String}] A hash of custom headers that will be added
563
+ # to the HTTP request.
564
+ #
565
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
566
+ #
567
+ def begin_delete_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, source_control_configuration_name, api_version, custom_headers:nil)
568
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
569
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
570
+ fail ArgumentError, 'cluster_rp is nil' if cluster_rp.nil?
571
+ fail ArgumentError, 'cluster_resource_name is nil' if cluster_resource_name.nil?
572
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
573
+ fail ArgumentError, 'source_control_configuration_name is nil' if source_control_configuration_name.nil?
574
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
575
+
576
+
577
+ request_headers = {}
578
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
579
+
580
+ # Set Headers
581
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
582
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
583
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'
584
+
585
+ request_url = @base_url || @client.base_url
586
+
587
+ options = {
588
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
589
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterRp' => cluster_rp,'clusterResourceName' => cluster_resource_name,'clusterName' => cluster_name,'sourceControlConfigurationName' => source_control_configuration_name},
590
+ query_params: {'api-version' => api_version},
591
+ headers: request_headers.merge(custom_headers || {}),
592
+ base_url: request_url
593
+ }
594
+ promise = @client.make_request_async(:delete, path_template, options)
595
+
596
+ promise = promise.then do |result|
597
+ http_response = result.response
598
+ status_code = http_response.status
599
+ response_content = http_response.body
600
+ unless status_code == 200 || status_code == 204
601
+ error_model = JSON.load(response_content)
602
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
603
+ end
604
+
605
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
606
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
607
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
608
+
609
+ result
610
+ end
611
+
612
+ promise.execute
613
+ end
614
+
615
+ #
616
+ # List all Source Control Configurations.
617
+ #
618
+ # @param next_page_link [String] The NextLink from the previous successful call
619
+ # to List operation.
620
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
621
+ # will be added to the HTTP request.
622
+ #
623
+ # @return [SourceControlConfigurationList] operation results.
624
+ #
625
+ def list_next(next_page_link, custom_headers:nil)
626
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
627
+ response.body unless response.nil?
628
+ end
629
+
630
+ #
631
+ # List all Source Control Configurations.
632
+ #
633
+ # @param next_page_link [String] The NextLink from the previous successful call
634
+ # to List operation.
635
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
636
+ # will be added to the HTTP request.
637
+ #
638
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
639
+ #
640
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
641
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
642
+ end
643
+
644
+ #
645
+ # List all Source Control Configurations.
646
+ #
647
+ # @param next_page_link [String] The NextLink from the previous successful call
648
+ # to List operation.
649
+ # @param [Hash{String => String}] A hash of custom headers that will be added
650
+ # to the HTTP request.
651
+ #
652
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
653
+ #
654
+ def list_next_async(next_page_link, custom_headers:nil)
655
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
656
+
657
+
658
+ request_headers = {}
659
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
660
+
661
+ # Set Headers
662
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
663
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
664
+ path_template = '{nextLink}'
665
+
666
+ request_url = @base_url || @client.base_url
667
+
668
+ options = {
669
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
670
+ skip_encoding_path_params: {'nextLink' => next_page_link},
671
+ headers: request_headers.merge(custom_headers || {}),
672
+ base_url: request_url
673
+ }
674
+ promise = @client.make_request_async(:get, path_template, options)
675
+
676
+ promise = promise.then do |result|
677
+ http_response = result.response
678
+ status_code = http_response.status
679
+ response_content = http_response.body
680
+ unless status_code == 200
681
+ error_model = JSON.load(response_content)
682
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
683
+ end
684
+
685
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
686
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
687
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
688
+ # Deserialize Response
689
+ if status_code == 200
690
+ begin
691
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
692
+ result_mapper = Azure::KubernetesConfiguration::Mgmt::V2019_11_01_preview::Models::SourceControlConfigurationList.mapper()
693
+ result.body = @client.deserialize(result_mapper, parsed_response)
694
+ rescue Exception => e
695
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
696
+ end
697
+ end
698
+
699
+ result
700
+ end
701
+
702
+ promise.execute
703
+ end
704
+
705
+ #
706
+ # List all Source Control Configurations.
707
+ #
708
+ # @param resource_group_name [String] The name of the resource group.
709
+ # @param cluster_rp [Enum] The Kubernetes cluster RP - either
710
+ # Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for
711
+ # OnPrem K8S clusters). Possible values include: 'Microsoft.ContainerService',
712
+ # 'Microsoft.Kubernetes'
713
+ # @param cluster_resource_name [Enum] The Kubernetes cluster resource name -
714
+ # either managedClusters (for AKS clusters) or connectedClusters (for OnPrem
715
+ # K8S clusters). Possible values include: 'managedClusters',
716
+ # 'connectedClusters'
717
+ # @param cluster_name [String] The name of the kubernetes cluster.
718
+ # @param api_version [String] The API version to be used with the HTTP request.
719
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
720
+ # will be added to the HTTP request.
721
+ #
722
+ # @return [SourceControlConfigurationList] which provide lazy access to pages
723
+ # of the response.
724
+ #
725
+ def list_as_lazy(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:nil)
726
+ response = list_async(resource_group_name, cluster_rp, cluster_resource_name, cluster_name, api_version, custom_headers:custom_headers).value!
727
+ unless response.nil?
728
+ page = response.body
729
+ page.next_method = Proc.new do |next_page_link|
730
+ list_next_async(next_page_link, custom_headers:custom_headers)
731
+ end
732
+ page
733
+ end
734
+ end
735
+
736
+ end
737
+ end