azure_mgmt_container_registry 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_container_registry.rb +5 -0
  4. data/lib/generated/azure_mgmt_container_registry.rb +72 -0
  5. data/lib/generated/azure_mgmt_container_registry/container_registry_management_client.rb +141 -0
  6. data/lib/generated/azure_mgmt_container_registry/models/actor.rb +47 -0
  7. data/lib/generated/azure_mgmt_container_registry/models/callback_config.rb +63 -0
  8. data/lib/generated/azure_mgmt_container_registry/models/event.rb +66 -0
  9. data/lib/generated/azure_mgmt_container_registry/models/event_content.rb +113 -0
  10. data/lib/generated/azure_mgmt_container_registry/models/event_info.rb +45 -0
  11. data/lib/generated/azure_mgmt_container_registry/models/event_list_result.rb +97 -0
  12. data/lib/generated/azure_mgmt_container_registry/models/event_request_message.rb +95 -0
  13. data/lib/generated/azure_mgmt_container_registry/models/event_response_message.rb +93 -0
  14. data/lib/generated/azure_mgmt_container_registry/models/operation_definition.rb +57 -0
  15. data/lib/generated/azure_mgmt_container_registry/models/operation_display_definition.rb +76 -0
  16. data/lib/generated/azure_mgmt_container_registry/models/operation_list_result.rb +97 -0
  17. data/lib/generated/azure_mgmt_container_registry/models/password_name.rb +16 -0
  18. data/lib/generated/azure_mgmt_container_registry/models/provisioning_state.rb +20 -0
  19. data/lib/generated/azure_mgmt_container_registry/models/regenerate_credential_parameters.rb +48 -0
  20. data/lib/generated/azure_mgmt_container_registry/models/registry.rb +165 -0
  21. data/lib/generated/azure_mgmt_container_registry/models/registry_list_credentials_result.rb +64 -0
  22. data/lib/generated/azure_mgmt_container_registry/models/registry_list_result.rb +97 -0
  23. data/lib/generated/azure_mgmt_container_registry/models/registry_name_check_request.rb +64 -0
  24. data/lib/generated/azure_mgmt_container_registry/models/registry_name_status.rb +68 -0
  25. data/lib/generated/azure_mgmt_container_registry/models/registry_password.rb +57 -0
  26. data/lib/generated/azure_mgmt_container_registry/models/registry_update_parameters.rb +88 -0
  27. data/lib/generated/azure_mgmt_container_registry/models/registry_usage.rb +76 -0
  28. data/lib/generated/azure_mgmt_container_registry/models/registry_usage_list_result.rb +54 -0
  29. data/lib/generated/azure_mgmt_container_registry/models/registry_usage_unit.rb +16 -0
  30. data/lib/generated/azure_mgmt_container_registry/models/replication.rb +106 -0
  31. data/lib/generated/azure_mgmt_container_registry/models/replication_list_result.rb +97 -0
  32. data/lib/generated/azure_mgmt_container_registry/models/replication_update_parameters.rb +52 -0
  33. data/lib/generated/azure_mgmt_container_registry/models/request.rb +88 -0
  34. data/lib/generated/azure_mgmt_container_registry/models/sku.rb +59 -0
  35. data/lib/generated/azure_mgmt_container_registry/models/sku_name.rb +18 -0
  36. data/lib/generated/azure_mgmt_container_registry/models/sku_tier.rb +16 -0
  37. data/lib/generated/azure_mgmt_container_registry/models/source.rb +59 -0
  38. data/lib/generated/azure_mgmt_container_registry/models/status.rb +70 -0
  39. data/lib/generated/azure_mgmt_container_registry/models/storage_account_properties.rb +46 -0
  40. data/lib/generated/azure_mgmt_container_registry/models/target.rb +108 -0
  41. data/lib/generated/azure_mgmt_container_registry/models/webhook.rb +135 -0
  42. data/lib/generated/azure_mgmt_container_registry/models/webhook_action.rb +16 -0
  43. data/lib/generated/azure_mgmt_container_registry/models/webhook_create_parameters.rb +133 -0
  44. data/lib/generated/azure_mgmt_container_registry/models/webhook_list_result.rb +97 -0
  45. data/lib/generated/azure_mgmt_container_registry/models/webhook_status.rb +16 -0
  46. data/lib/generated/azure_mgmt_container_registry/models/webhook_update_parameters.rb +122 -0
  47. data/lib/generated/azure_mgmt_container_registry/module_definition.rb +8 -0
  48. data/lib/generated/azure_mgmt_container_registry/operations.rb +213 -0
  49. data/lib/generated/azure_mgmt_container_registry/registries.rb +1371 -0
  50. data/lib/generated/azure_mgmt_container_registry/replications.rb +799 -0
  51. data/lib/generated/azure_mgmt_container_registry/version.rb +8 -0
  52. data/lib/generated/azure_mgmt_container_registry/webhooks.rb +1208 -0
  53. metadata +165 -0
@@ -0,0 +1,16 @@
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::ARM::ContainerRegistry
7
+ module Models
8
+ #
9
+ # Defines values for WebhookStatus
10
+ #
11
+ module WebhookStatus
12
+ Enabled = "enabled"
13
+ Disabled = "disabled"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,122 @@
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::ARM::ContainerRegistry
7
+ module Models
8
+ #
9
+ # The parameters for updating a webhook.
10
+ #
11
+ class WebhookUpdateParameters
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Hash{String => String}] The tags for the webhook.
17
+ attr_accessor :tags
18
+
19
+ # @return [String] The service URI for the webhook to post notifications.
20
+ attr_accessor :service_uri
21
+
22
+ # @return [Hash{String => String}] Custom headers that will be added to
23
+ # the webhook notifications.
24
+ attr_accessor :custom_headers
25
+
26
+ # @return [WebhookStatus] The status of the webhook at the time the
27
+ # operation was called. Possible values include: 'enabled', 'disabled'
28
+ attr_accessor :status
29
+
30
+ # @return [String] The scope of repositories where the event can be
31
+ # triggered. For example, 'foo:*' means events for all tags under
32
+ # repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is
33
+ # equivalent to 'foo:latest'. Empty means all events.
34
+ attr_accessor :scope
35
+
36
+ # @return [Array<WebhookAction>] The list of actions that trigger the
37
+ # webhook to post notifications.
38
+ attr_accessor :actions
39
+
40
+
41
+ #
42
+ # Mapper for WebhookUpdateParameters class as Ruby Hash.
43
+ # This will be used for serialization/deserialization.
44
+ #
45
+ def self.mapper()
46
+ {
47
+ required: false,
48
+ serialized_name: 'WebhookUpdateParameters',
49
+ type: {
50
+ name: 'Composite',
51
+ class_name: 'WebhookUpdateParameters',
52
+ model_properties: {
53
+ tags: {
54
+ required: false,
55
+ serialized_name: 'tags',
56
+ type: {
57
+ name: 'Dictionary',
58
+ value: {
59
+ required: false,
60
+ serialized_name: 'StringElementType',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ }
65
+ }
66
+ },
67
+ service_uri: {
68
+ required: false,
69
+ serialized_name: 'properties.serviceUri',
70
+ type: {
71
+ name: 'String'
72
+ }
73
+ },
74
+ custom_headers: {
75
+ required: false,
76
+ serialized_name: 'properties.customHeaders',
77
+ type: {
78
+ name: 'Dictionary',
79
+ value: {
80
+ required: false,
81
+ serialized_name: 'StringElementType',
82
+ type: {
83
+ name: 'String'
84
+ }
85
+ }
86
+ }
87
+ },
88
+ status: {
89
+ required: false,
90
+ serialized_name: 'properties.status',
91
+ type: {
92
+ name: 'String'
93
+ }
94
+ },
95
+ scope: {
96
+ required: false,
97
+ serialized_name: 'properties.scope',
98
+ type: {
99
+ name: 'String'
100
+ }
101
+ },
102
+ actions: {
103
+ required: false,
104
+ serialized_name: 'properties.actions',
105
+ type: {
106
+ name: 'Sequence',
107
+ element: {
108
+ required: false,
109
+ serialized_name: 'WebhookActionElementType',
110
+ type: {
111
+ name: 'String'
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,8 @@
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::ARM end
8
+ module Azure::ARM::ContainerRegistry end
@@ -0,0 +1,213 @@
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::ARM::ContainerRegistry
7
+ #
8
+ # Operations
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 [ContainerRegistryManagementClient] reference to the ContainerRegistryManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all of the available Azure Container Registry REST API 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 [Array<OperationDefinition>] operation results.
31
+ #
32
+ def list(custom_headers = nil)
33
+ first_page = list_as_lazy(custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Lists all of the available Azure Container Registry REST API 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).value!
47
+ end
48
+
49
+ #
50
+ # Lists all of the available Azure Container Registry REST API 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
+
60
+
61
+ request_headers = {}
62
+
63
+ # Set Headers
64
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
65
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
66
+ path_template = 'providers/Microsoft.ContainerRegistry/operations'
67
+
68
+ request_url = @base_url || @client.base_url
69
+
70
+ options = {
71
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
72
+ query_params: {'api-version' => @client.api_version},
73
+ headers: request_headers.merge(custom_headers || {}),
74
+ base_url: request_url
75
+ }
76
+ promise = @client.make_request_async(:get, path_template, options)
77
+
78
+ promise = promise.then do |result|
79
+ http_response = result.response
80
+ status_code = http_response.status
81
+ response_content = http_response.body
82
+ unless status_code == 200
83
+ error_model = JSON.load(response_content)
84
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
85
+ end
86
+
87
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
88
+ # Deserialize Response
89
+ if status_code == 200
90
+ begin
91
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
92
+ result_mapper = Azure::ARM::ContainerRegistry::Models::OperationListResult.mapper()
93
+ result.body = @client.deserialize(result_mapper, parsed_response)
94
+ rescue Exception => e
95
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
96
+ end
97
+ end
98
+
99
+ result
100
+ end
101
+
102
+ promise.execute
103
+ end
104
+
105
+ #
106
+ # Lists all of the available Azure Container Registry REST API operations.
107
+ #
108
+ # @param next_page_link [String] The NextLink from the previous successful call
109
+ # to List operation.
110
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
111
+ # will be added to the HTTP request.
112
+ #
113
+ # @return [OperationListResult] operation results.
114
+ #
115
+ def list_next(next_page_link, custom_headers = nil)
116
+ response = list_next_async(next_page_link, custom_headers).value!
117
+ response.body unless response.nil?
118
+ end
119
+
120
+ #
121
+ # Lists all of the available Azure Container Registry REST API operations.
122
+ #
123
+ # @param next_page_link [String] The NextLink from the previous successful call
124
+ # to List operation.
125
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
126
+ # will be added to the HTTP request.
127
+ #
128
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
129
+ #
130
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
131
+ list_next_async(next_page_link, custom_headers).value!
132
+ end
133
+
134
+ #
135
+ # Lists all of the available Azure Container Registry REST API operations.
136
+ #
137
+ # @param next_page_link [String] The NextLink from the previous successful call
138
+ # to List operation.
139
+ # @param [Hash{String => String}] A hash of custom headers that will be added
140
+ # to the HTTP request.
141
+ #
142
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
143
+ #
144
+ def list_next_async(next_page_link, custom_headers = nil)
145
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
146
+
147
+
148
+ request_headers = {}
149
+
150
+ # Set Headers
151
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
152
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
153
+ path_template = '{nextLink}'
154
+
155
+ request_url = @base_url || @client.base_url
156
+
157
+ options = {
158
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
159
+ skip_encoding_path_params: {'nextLink' => next_page_link},
160
+ headers: request_headers.merge(custom_headers || {}),
161
+ base_url: request_url
162
+ }
163
+ promise = @client.make_request_async(:get, path_template, options)
164
+
165
+ promise = promise.then do |result|
166
+ http_response = result.response
167
+ status_code = http_response.status
168
+ response_content = http_response.body
169
+ unless status_code == 200
170
+ error_model = JSON.load(response_content)
171
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
172
+ end
173
+
174
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
175
+ # Deserialize Response
176
+ if status_code == 200
177
+ begin
178
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
179
+ result_mapper = Azure::ARM::ContainerRegistry::Models::OperationListResult.mapper()
180
+ result.body = @client.deserialize(result_mapper, parsed_response)
181
+ rescue Exception => e
182
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
183
+ end
184
+ end
185
+
186
+ result
187
+ end
188
+
189
+ promise.execute
190
+ end
191
+
192
+ #
193
+ # Lists all of the available Azure Container Registry REST API operations.
194
+ #
195
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
196
+ # will be added to the HTTP request.
197
+ #
198
+ # @return [OperationListResult] which provide lazy access to pages of the
199
+ # response.
200
+ #
201
+ def list_as_lazy(custom_headers = nil)
202
+ response = list_async(custom_headers).value!
203
+ unless response.nil?
204
+ page = response.body
205
+ page.next_method = Proc.new do |next_page_link|
206
+ list_next_async(next_page_link, custom_headers)
207
+ end
208
+ page
209
+ end
210
+ end
211
+
212
+ end
213
+ end
@@ -0,0 +1,1371 @@
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::ARM::ContainerRegistry
7
+ #
8
+ # Registries
9
+ #
10
+ class Registries
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Registries class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ContainerRegistryManagementClient] reference to the ContainerRegistryManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Checks whether the container registry name is available for use. The name
26
+ # must contain only alphanumeric characters, be globally unique, and between 5
27
+ # and 50 characters in length.
28
+ #
29
+ # @param registry_name_check_request [RegistryNameCheckRequest] The object
30
+ # containing information for the availability request.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [RegistryNameStatus] operation results.
35
+ #
36
+ def check_name_availability(registry_name_check_request, custom_headers = nil)
37
+ response = check_name_availability_async(registry_name_check_request, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Checks whether the container registry name is available for use. The name
43
+ # must contain only alphanumeric characters, be globally unique, and between 5
44
+ # and 50 characters in length.
45
+ #
46
+ # @param registry_name_check_request [RegistryNameCheckRequest] The object
47
+ # containing information for the availability request.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def check_name_availability_with_http_info(registry_name_check_request, custom_headers = nil)
54
+ check_name_availability_async(registry_name_check_request, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Checks whether the container registry name is available for use. The name
59
+ # must contain only alphanumeric characters, be globally unique, and between 5
60
+ # and 50 characters in length.
61
+ #
62
+ # @param registry_name_check_request [RegistryNameCheckRequest] The object
63
+ # containing information for the availability request.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def check_name_availability_async(registry_name_check_request, custom_headers = nil)
70
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
71
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
72
+ fail ArgumentError, 'registry_name_check_request is nil' if registry_name_check_request.nil?
73
+
74
+
75
+ request_headers = {}
76
+
77
+ # Set Headers
78
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
79
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
80
+
81
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
82
+
83
+ # Serialize Request
84
+ request_mapper = Azure::ARM::ContainerRegistry::Models::RegistryNameCheckRequest.mapper()
85
+ request_content = @client.serialize(request_mapper, registry_name_check_request)
86
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
87
+
88
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ options = {
93
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
94
+ path_params: {'subscriptionId' => @client.subscription_id},
95
+ query_params: {'api-version' => @client.api_version},
96
+ body: request_content,
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:post, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryNameStatus.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Gets the properties of the specified container registry.
131
+ #
132
+ # @param resource_group_name [String] The name of the resource group to which
133
+ # the container registry belongs.
134
+ # @param registry_name [String] The name of the container registry.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ # @return [Registry] operation results.
139
+ #
140
+ def get(resource_group_name, registry_name, custom_headers = nil)
141
+ response = get_async(resource_group_name, registry_name, custom_headers).value!
142
+ response.body unless response.nil?
143
+ end
144
+
145
+ #
146
+ # Gets the properties of the specified container registry.
147
+ #
148
+ # @param resource_group_name [String] The name of the resource group to which
149
+ # the container registry belongs.
150
+ # @param registry_name [String] The name of the container registry.
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
155
+ #
156
+ def get_with_http_info(resource_group_name, registry_name, custom_headers = nil)
157
+ get_async(resource_group_name, registry_name, custom_headers).value!
158
+ end
159
+
160
+ #
161
+ # Gets the properties of the specified container registry.
162
+ #
163
+ # @param resource_group_name [String] The name of the resource group to which
164
+ # the container registry belongs.
165
+ # @param registry_name [String] The name of the container registry.
166
+ # @param [Hash{String => String}] A hash of custom headers that will be added
167
+ # to the HTTP request.
168
+ #
169
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
170
+ #
171
+ def get_async(resource_group_name, registry_name, custom_headers = nil)
172
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
173
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
174
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
175
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
176
+
177
+
178
+ request_headers = {}
179
+
180
+ # Set Headers
181
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
182
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
183
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'
184
+
185
+ request_url = @base_url || @client.base_url
186
+
187
+ options = {
188
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
189
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
190
+ query_params: {'api-version' => @client.api_version},
191
+ headers: request_headers.merge(custom_headers || {}),
192
+ base_url: request_url
193
+ }
194
+ promise = @client.make_request_async(:get, path_template, options)
195
+
196
+ promise = promise.then do |result|
197
+ http_response = result.response
198
+ status_code = http_response.status
199
+ response_content = http_response.body
200
+ unless status_code == 200
201
+ error_model = JSON.load(response_content)
202
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
203
+ end
204
+
205
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
206
+ # Deserialize Response
207
+ if status_code == 200
208
+ begin
209
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
210
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
211
+ result.body = @client.deserialize(result_mapper, parsed_response)
212
+ rescue Exception => e
213
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
214
+ end
215
+ end
216
+
217
+ result
218
+ end
219
+
220
+ promise.execute
221
+ end
222
+
223
+ #
224
+ # Creates a container registry with the specified parameters.
225
+ #
226
+ # @param resource_group_name [String] The name of the resource group to which
227
+ # the container registry belongs.
228
+ # @param registry_name [String] The name of the container registry.
229
+ # @param registry [Registry] The parameters for creating a container registry.
230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
231
+ # will be added to the HTTP request.
232
+ #
233
+ # @return [Registry] operation results.
234
+ #
235
+ def create(resource_group_name, registry_name, registry, custom_headers = nil)
236
+ response = create_async(resource_group_name, registry_name, registry, custom_headers).value!
237
+ response.body unless response.nil?
238
+ end
239
+
240
+ #
241
+ # @param resource_group_name [String] The name of the resource group to which
242
+ # the container registry belongs.
243
+ # @param registry_name [String] The name of the container registry.
244
+ # @param registry [Registry] The parameters for creating a container registry.
245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
246
+ # will be added to the HTTP request.
247
+ #
248
+ # @return [Concurrent::Promise] promise which provides async access to http
249
+ # response.
250
+ #
251
+ def create_async(resource_group_name, registry_name, registry, custom_headers = nil)
252
+ # Send request
253
+ promise = begin_create_async(resource_group_name, registry_name, registry, custom_headers)
254
+
255
+ promise = promise.then do |response|
256
+ # Defining deserialization method.
257
+ deserialize_method = lambda do |parsed_response|
258
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
259
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
260
+ end
261
+
262
+ # Waiting for response.
263
+ @client.get_long_running_operation_result(response, deserialize_method)
264
+ end
265
+
266
+ promise
267
+ end
268
+
269
+ #
270
+ # Deletes a container registry.
271
+ #
272
+ # @param resource_group_name [String] The name of the resource group to which
273
+ # the container registry belongs.
274
+ # @param registry_name [String] The name of the container registry.
275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
276
+ # will be added to the HTTP request.
277
+ #
278
+ def delete(resource_group_name, registry_name, custom_headers = nil)
279
+ response = delete_async(resource_group_name, registry_name, custom_headers).value!
280
+ nil
281
+ end
282
+
283
+ #
284
+ # @param resource_group_name [String] The name of the resource group to which
285
+ # the container registry belongs.
286
+ # @param registry_name [String] The name of the container registry.
287
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
288
+ # will be added to the HTTP request.
289
+ #
290
+ # @return [Concurrent::Promise] promise which provides async access to http
291
+ # response.
292
+ #
293
+ def delete_async(resource_group_name, registry_name, custom_headers = nil)
294
+ # Send request
295
+ promise = begin_delete_async(resource_group_name, registry_name, custom_headers)
296
+
297
+ promise = promise.then do |response|
298
+ # Defining deserialization method.
299
+ deserialize_method = lambda do |parsed_response|
300
+ end
301
+
302
+ # Waiting for response.
303
+ @client.get_long_running_operation_result(response, deserialize_method)
304
+ end
305
+
306
+ promise
307
+ end
308
+
309
+ #
310
+ # Updates a container registry with the specified parameters.
311
+ #
312
+ # @param resource_group_name [String] The name of the resource group to which
313
+ # the container registry belongs.
314
+ # @param registry_name [String] The name of the container registry.
315
+ # @param registry_update_parameters [RegistryUpdateParameters] The parameters
316
+ # for updating a container registry.
317
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
318
+ # will be added to the HTTP request.
319
+ #
320
+ # @return [Registry] operation results.
321
+ #
322
+ def update(resource_group_name, registry_name, registry_update_parameters, custom_headers = nil)
323
+ response = update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers).value!
324
+ response.body unless response.nil?
325
+ end
326
+
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group to which
329
+ # the container registry belongs.
330
+ # @param registry_name [String] The name of the container registry.
331
+ # @param registry_update_parameters [RegistryUpdateParameters] The parameters
332
+ # for updating a container registry.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [Concurrent::Promise] promise which provides async access to http
337
+ # response.
338
+ #
339
+ def update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers = nil)
340
+ # Send request
341
+ promise = begin_update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers)
342
+
343
+ promise = promise.then do |response|
344
+ # Defining deserialization method.
345
+ deserialize_method = lambda do |parsed_response|
346
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
347
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
348
+ end
349
+
350
+ # Waiting for response.
351
+ @client.get_long_running_operation_result(response, deserialize_method)
352
+ end
353
+
354
+ promise
355
+ end
356
+
357
+ #
358
+ # Lists all the container registries under the specified resource group.
359
+ #
360
+ # @param resource_group_name [String] The name of the resource group to which
361
+ # the container registry belongs.
362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
363
+ # will be added to the HTTP request.
364
+ #
365
+ # @return [Array<Registry>] operation results.
366
+ #
367
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
368
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
369
+ first_page.get_all_items
370
+ end
371
+
372
+ #
373
+ # Lists all the container registries under the specified resource group.
374
+ #
375
+ # @param resource_group_name [String] The name of the resource group to which
376
+ # the container registry belongs.
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
381
+ #
382
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
383
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
384
+ end
385
+
386
+ #
387
+ # Lists all the container registries under the specified resource group.
388
+ #
389
+ # @param resource_group_name [String] The name of the resource group to which
390
+ # the container registry belongs.
391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
392
+ # to the HTTP request.
393
+ #
394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
395
+ #
396
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
397
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
398
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
399
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
400
+
401
+
402
+ request_headers = {}
403
+
404
+ # Set Headers
405
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
406
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
407
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'
408
+
409
+ request_url = @base_url || @client.base_url
410
+
411
+ options = {
412
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
413
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
414
+ query_params: {'api-version' => @client.api_version},
415
+ headers: request_headers.merge(custom_headers || {}),
416
+ base_url: request_url
417
+ }
418
+ promise = @client.make_request_async(:get, path_template, options)
419
+
420
+ promise = promise.then do |result|
421
+ http_response = result.response
422
+ status_code = http_response.status
423
+ response_content = http_response.body
424
+ unless status_code == 200
425
+ error_model = JSON.load(response_content)
426
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
427
+ end
428
+
429
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
430
+ # Deserialize Response
431
+ if status_code == 200
432
+ begin
433
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
434
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListResult.mapper()
435
+ result.body = @client.deserialize(result_mapper, parsed_response)
436
+ rescue Exception => e
437
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
438
+ end
439
+ end
440
+
441
+ result
442
+ end
443
+
444
+ promise.execute
445
+ end
446
+
447
+ #
448
+ # Lists all the container registries under the specified subscription.
449
+ #
450
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
451
+ # will be added to the HTTP request.
452
+ #
453
+ # @return [Array<Registry>] operation results.
454
+ #
455
+ def list(custom_headers = nil)
456
+ first_page = list_as_lazy(custom_headers)
457
+ first_page.get_all_items
458
+ end
459
+
460
+ #
461
+ # Lists all the container registries under the specified subscription.
462
+ #
463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
464
+ # will be added to the HTTP request.
465
+ #
466
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
467
+ #
468
+ def list_with_http_info(custom_headers = nil)
469
+ list_async(custom_headers).value!
470
+ end
471
+
472
+ #
473
+ # Lists all the container registries under the specified subscription.
474
+ #
475
+ # @param [Hash{String => String}] A hash of custom headers that will be added
476
+ # to the HTTP request.
477
+ #
478
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
479
+ #
480
+ def list_async(custom_headers = nil)
481
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
482
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
483
+
484
+
485
+ request_headers = {}
486
+
487
+ # Set Headers
488
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
489
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
490
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'
491
+
492
+ request_url = @base_url || @client.base_url
493
+
494
+ options = {
495
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
496
+ path_params: {'subscriptionId' => @client.subscription_id},
497
+ query_params: {'api-version' => @client.api_version},
498
+ headers: request_headers.merge(custom_headers || {}),
499
+ base_url: request_url
500
+ }
501
+ promise = @client.make_request_async(:get, path_template, options)
502
+
503
+ promise = promise.then do |result|
504
+ http_response = result.response
505
+ status_code = http_response.status
506
+ response_content = http_response.body
507
+ unless status_code == 200
508
+ error_model = JSON.load(response_content)
509
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
510
+ end
511
+
512
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
513
+ # Deserialize Response
514
+ if status_code == 200
515
+ begin
516
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
517
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListResult.mapper()
518
+ result.body = @client.deserialize(result_mapper, parsed_response)
519
+ rescue Exception => e
520
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
521
+ end
522
+ end
523
+
524
+ result
525
+ end
526
+
527
+ promise.execute
528
+ end
529
+
530
+ #
531
+ # Lists the login credentials for the specified container registry.
532
+ #
533
+ # @param resource_group_name [String] The name of the resource group to which
534
+ # the container registry belongs.
535
+ # @param registry_name [String] The name of the container registry.
536
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
537
+ # will be added to the HTTP request.
538
+ #
539
+ # @return [RegistryListCredentialsResult] operation results.
540
+ #
541
+ def list_credentials(resource_group_name, registry_name, custom_headers = nil)
542
+ response = list_credentials_async(resource_group_name, registry_name, custom_headers).value!
543
+ response.body unless response.nil?
544
+ end
545
+
546
+ #
547
+ # Lists the login credentials for the specified container registry.
548
+ #
549
+ # @param resource_group_name [String] The name of the resource group to which
550
+ # the container registry belongs.
551
+ # @param registry_name [String] The name of the container registry.
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
556
+ #
557
+ def list_credentials_with_http_info(resource_group_name, registry_name, custom_headers = nil)
558
+ list_credentials_async(resource_group_name, registry_name, custom_headers).value!
559
+ end
560
+
561
+ #
562
+ # Lists the login credentials for the specified container registry.
563
+ #
564
+ # @param resource_group_name [String] The name of the resource group to which
565
+ # the container registry belongs.
566
+ # @param registry_name [String] The name of the container registry.
567
+ # @param [Hash{String => String}] A hash of custom headers that will be added
568
+ # to the HTTP request.
569
+ #
570
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
571
+ #
572
+ def list_credentials_async(resource_group_name, registry_name, custom_headers = nil)
573
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
574
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
575
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
576
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
577
+
578
+
579
+ request_headers = {}
580
+
581
+ # Set Headers
582
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
583
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
584
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'
585
+
586
+ request_url = @base_url || @client.base_url
587
+
588
+ options = {
589
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
590
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
591
+ query_params: {'api-version' => @client.api_version},
592
+ headers: request_headers.merge(custom_headers || {}),
593
+ base_url: request_url
594
+ }
595
+ promise = @client.make_request_async(:post, path_template, options)
596
+
597
+ promise = promise.then do |result|
598
+ http_response = result.response
599
+ status_code = http_response.status
600
+ response_content = http_response.body
601
+ unless status_code == 200
602
+ error_model = JSON.load(response_content)
603
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
604
+ end
605
+
606
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
607
+ # Deserialize Response
608
+ if status_code == 200
609
+ begin
610
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
611
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListCredentialsResult.mapper()
612
+ result.body = @client.deserialize(result_mapper, parsed_response)
613
+ rescue Exception => e
614
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
615
+ end
616
+ end
617
+
618
+ result
619
+ end
620
+
621
+ promise.execute
622
+ end
623
+
624
+ #
625
+ # Regenerates one of the login credentials for the specified container
626
+ # registry.
627
+ #
628
+ # @param resource_group_name [String] The name of the resource group to which
629
+ # the container registry belongs.
630
+ # @param registry_name [String] The name of the container registry.
631
+ # @param regenerate_credential_parameters [RegenerateCredentialParameters]
632
+ # Specifies name of the password which should be regenerated -- password or
633
+ # password2.
634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
635
+ # will be added to the HTTP request.
636
+ #
637
+ # @return [RegistryListCredentialsResult] operation results.
638
+ #
639
+ def regenerate_credential(resource_group_name, registry_name, regenerate_credential_parameters, custom_headers = nil)
640
+ response = regenerate_credential_async(resource_group_name, registry_name, regenerate_credential_parameters, custom_headers).value!
641
+ response.body unless response.nil?
642
+ end
643
+
644
+ #
645
+ # Regenerates one of the login credentials for the specified container
646
+ # registry.
647
+ #
648
+ # @param resource_group_name [String] The name of the resource group to which
649
+ # the container registry belongs.
650
+ # @param registry_name [String] The name of the container registry.
651
+ # @param regenerate_credential_parameters [RegenerateCredentialParameters]
652
+ # Specifies name of the password which should be regenerated -- password or
653
+ # password2.
654
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
655
+ # will be added to the HTTP request.
656
+ #
657
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
658
+ #
659
+ def regenerate_credential_with_http_info(resource_group_name, registry_name, regenerate_credential_parameters, custom_headers = nil)
660
+ regenerate_credential_async(resource_group_name, registry_name, regenerate_credential_parameters, custom_headers).value!
661
+ end
662
+
663
+ #
664
+ # Regenerates one of the login credentials for the specified container
665
+ # registry.
666
+ #
667
+ # @param resource_group_name [String] The name of the resource group to which
668
+ # the container registry belongs.
669
+ # @param registry_name [String] The name of the container registry.
670
+ # @param regenerate_credential_parameters [RegenerateCredentialParameters]
671
+ # Specifies name of the password which should be regenerated -- password or
672
+ # password2.
673
+ # @param [Hash{String => String}] A hash of custom headers that will be added
674
+ # to the HTTP request.
675
+ #
676
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
677
+ #
678
+ def regenerate_credential_async(resource_group_name, registry_name, regenerate_credential_parameters, custom_headers = nil)
679
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
680
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
681
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
682
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
683
+ fail ArgumentError, 'regenerate_credential_parameters is nil' if regenerate_credential_parameters.nil?
684
+
685
+
686
+ request_headers = {}
687
+
688
+ # Set Headers
689
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
690
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
691
+
692
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
693
+
694
+ # Serialize Request
695
+ request_mapper = Azure::ARM::ContainerRegistry::Models::RegenerateCredentialParameters.mapper()
696
+ request_content = @client.serialize(request_mapper, regenerate_credential_parameters)
697
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
698
+
699
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'
700
+
701
+ request_url = @base_url || @client.base_url
702
+
703
+ options = {
704
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
705
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
706
+ query_params: {'api-version' => @client.api_version},
707
+ body: request_content,
708
+ headers: request_headers.merge(custom_headers || {}),
709
+ base_url: request_url
710
+ }
711
+ promise = @client.make_request_async(:post, path_template, options)
712
+
713
+ promise = promise.then do |result|
714
+ http_response = result.response
715
+ status_code = http_response.status
716
+ response_content = http_response.body
717
+ unless status_code == 200
718
+ error_model = JSON.load(response_content)
719
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
720
+ end
721
+
722
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
723
+ # Deserialize Response
724
+ if status_code == 200
725
+ begin
726
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
727
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListCredentialsResult.mapper()
728
+ result.body = @client.deserialize(result_mapper, parsed_response)
729
+ rescue Exception => e
730
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
731
+ end
732
+ end
733
+
734
+ result
735
+ end
736
+
737
+ promise.execute
738
+ end
739
+
740
+ #
741
+ # Gets the quota usages for the specified container registry.
742
+ #
743
+ # @param resource_group_name [String] The name of the resource group to which
744
+ # the container registry belongs.
745
+ # @param registry_name [String] The name of the container registry.
746
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
747
+ # will be added to the HTTP request.
748
+ #
749
+ # @return [RegistryUsageListResult] operation results.
750
+ #
751
+ def list_usages(resource_group_name, registry_name, custom_headers = nil)
752
+ response = list_usages_async(resource_group_name, registry_name, custom_headers).value!
753
+ response.body unless response.nil?
754
+ end
755
+
756
+ #
757
+ # Gets the quota usages for the specified container registry.
758
+ #
759
+ # @param resource_group_name [String] The name of the resource group to which
760
+ # the container registry belongs.
761
+ # @param registry_name [String] The name of the container registry.
762
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
763
+ # will be added to the HTTP request.
764
+ #
765
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
766
+ #
767
+ def list_usages_with_http_info(resource_group_name, registry_name, custom_headers = nil)
768
+ list_usages_async(resource_group_name, registry_name, custom_headers).value!
769
+ end
770
+
771
+ #
772
+ # Gets the quota usages for the specified container registry.
773
+ #
774
+ # @param resource_group_name [String] The name of the resource group to which
775
+ # the container registry belongs.
776
+ # @param registry_name [String] The name of the container registry.
777
+ # @param [Hash{String => String}] A hash of custom headers that will be added
778
+ # to the HTTP request.
779
+ #
780
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
781
+ #
782
+ def list_usages_async(resource_group_name, registry_name, custom_headers = nil)
783
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
784
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
785
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
786
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
787
+
788
+
789
+ request_headers = {}
790
+
791
+ # Set Headers
792
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
793
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
794
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'
795
+
796
+ request_url = @base_url || @client.base_url
797
+
798
+ options = {
799
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
800
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
801
+ query_params: {'api-version' => @client.api_version},
802
+ headers: request_headers.merge(custom_headers || {}),
803
+ base_url: request_url
804
+ }
805
+ promise = @client.make_request_async(:get, path_template, options)
806
+
807
+ promise = promise.then do |result|
808
+ http_response = result.response
809
+ status_code = http_response.status
810
+ response_content = http_response.body
811
+ unless status_code == 200
812
+ error_model = JSON.load(response_content)
813
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
814
+ end
815
+
816
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
817
+ # Deserialize Response
818
+ if status_code == 200
819
+ begin
820
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
821
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryUsageListResult.mapper()
822
+ result.body = @client.deserialize(result_mapper, parsed_response)
823
+ rescue Exception => e
824
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
825
+ end
826
+ end
827
+
828
+ result
829
+ end
830
+
831
+ promise.execute
832
+ end
833
+
834
+ #
835
+ # Creates a container registry with the specified parameters.
836
+ #
837
+ # @param resource_group_name [String] The name of the resource group to which
838
+ # the container registry belongs.
839
+ # @param registry_name [String] The name of the container registry.
840
+ # @param registry [Registry] The parameters for creating a container registry.
841
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
842
+ # will be added to the HTTP request.
843
+ #
844
+ # @return [Registry] operation results.
845
+ #
846
+ def begin_create(resource_group_name, registry_name, registry, custom_headers = nil)
847
+ response = begin_create_async(resource_group_name, registry_name, registry, custom_headers).value!
848
+ response.body unless response.nil?
849
+ end
850
+
851
+ #
852
+ # Creates a container registry with the specified parameters.
853
+ #
854
+ # @param resource_group_name [String] The name of the resource group to which
855
+ # the container registry belongs.
856
+ # @param registry_name [String] The name of the container registry.
857
+ # @param registry [Registry] The parameters for creating a container registry.
858
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
859
+ # will be added to the HTTP request.
860
+ #
861
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
862
+ #
863
+ def begin_create_with_http_info(resource_group_name, registry_name, registry, custom_headers = nil)
864
+ begin_create_async(resource_group_name, registry_name, registry, custom_headers).value!
865
+ end
866
+
867
+ #
868
+ # Creates a container registry with the specified parameters.
869
+ #
870
+ # @param resource_group_name [String] The name of the resource group to which
871
+ # the container registry belongs.
872
+ # @param registry_name [String] The name of the container registry.
873
+ # @param registry [Registry] The parameters for creating a container registry.
874
+ # @param [Hash{String => String}] A hash of custom headers that will be added
875
+ # to the HTTP request.
876
+ #
877
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
878
+ #
879
+ def begin_create_async(resource_group_name, registry_name, registry, custom_headers = nil)
880
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
881
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
882
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
883
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
884
+ fail ArgumentError, 'registry is nil' if registry.nil?
885
+
886
+
887
+ request_headers = {}
888
+
889
+ # Set Headers
890
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
891
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
892
+
893
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
894
+
895
+ # Serialize Request
896
+ request_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
897
+ request_content = @client.serialize(request_mapper, registry)
898
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
899
+
900
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'
901
+
902
+ request_url = @base_url || @client.base_url
903
+
904
+ options = {
905
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
906
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
907
+ query_params: {'api-version' => @client.api_version},
908
+ body: request_content,
909
+ headers: request_headers.merge(custom_headers || {}),
910
+ base_url: request_url
911
+ }
912
+ promise = @client.make_request_async(:put, path_template, options)
913
+
914
+ promise = promise.then do |result|
915
+ http_response = result.response
916
+ status_code = http_response.status
917
+ response_content = http_response.body
918
+ unless status_code == 200 || status_code == 201
919
+ error_model = JSON.load(response_content)
920
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
921
+ end
922
+
923
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
924
+ # Deserialize Response
925
+ if status_code == 200
926
+ begin
927
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
928
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
929
+ result.body = @client.deserialize(result_mapper, parsed_response)
930
+ rescue Exception => e
931
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
932
+ end
933
+ end
934
+ # Deserialize Response
935
+ if status_code == 201
936
+ begin
937
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
938
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
939
+ result.body = @client.deserialize(result_mapper, parsed_response)
940
+ rescue Exception => e
941
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
942
+ end
943
+ end
944
+
945
+ result
946
+ end
947
+
948
+ promise.execute
949
+ end
950
+
951
+ #
952
+ # Deletes a container registry.
953
+ #
954
+ # @param resource_group_name [String] The name of the resource group to which
955
+ # the container registry belongs.
956
+ # @param registry_name [String] The name of the container registry.
957
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
958
+ # will be added to the HTTP request.
959
+ #
960
+ #
961
+ def begin_delete(resource_group_name, registry_name, custom_headers = nil)
962
+ response = begin_delete_async(resource_group_name, registry_name, custom_headers).value!
963
+ nil
964
+ end
965
+
966
+ #
967
+ # Deletes a container registry.
968
+ #
969
+ # @param resource_group_name [String] The name of the resource group to which
970
+ # the container registry belongs.
971
+ # @param registry_name [String] The name of the container registry.
972
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
973
+ # will be added to the HTTP request.
974
+ #
975
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
976
+ #
977
+ def begin_delete_with_http_info(resource_group_name, registry_name, custom_headers = nil)
978
+ begin_delete_async(resource_group_name, registry_name, custom_headers).value!
979
+ end
980
+
981
+ #
982
+ # Deletes a container registry.
983
+ #
984
+ # @param resource_group_name [String] The name of the resource group to which
985
+ # the container registry belongs.
986
+ # @param registry_name [String] The name of the container registry.
987
+ # @param [Hash{String => String}] A hash of custom headers that will be added
988
+ # to the HTTP request.
989
+ #
990
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
991
+ #
992
+ def begin_delete_async(resource_group_name, registry_name, custom_headers = nil)
993
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
994
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
995
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
996
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
997
+
998
+
999
+ request_headers = {}
1000
+
1001
+ # Set Headers
1002
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1003
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1004
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'
1005
+
1006
+ request_url = @base_url || @client.base_url
1007
+
1008
+ options = {
1009
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1010
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
1011
+ query_params: {'api-version' => @client.api_version},
1012
+ headers: request_headers.merge(custom_headers || {}),
1013
+ base_url: request_url
1014
+ }
1015
+ promise = @client.make_request_async(:delete, path_template, options)
1016
+
1017
+ promise = promise.then do |result|
1018
+ http_response = result.response
1019
+ status_code = http_response.status
1020
+ response_content = http_response.body
1021
+ unless status_code == 200 || status_code == 202 || status_code == 204
1022
+ error_model = JSON.load(response_content)
1023
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1024
+ end
1025
+
1026
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1027
+
1028
+ result
1029
+ end
1030
+
1031
+ promise.execute
1032
+ end
1033
+
1034
+ #
1035
+ # Updates a container registry with the specified parameters.
1036
+ #
1037
+ # @param resource_group_name [String] The name of the resource group to which
1038
+ # the container registry belongs.
1039
+ # @param registry_name [String] The name of the container registry.
1040
+ # @param registry_update_parameters [RegistryUpdateParameters] The parameters
1041
+ # for updating a container registry.
1042
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1043
+ # will be added to the HTTP request.
1044
+ #
1045
+ # @return [Registry] operation results.
1046
+ #
1047
+ def begin_update(resource_group_name, registry_name, registry_update_parameters, custom_headers = nil)
1048
+ response = begin_update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers).value!
1049
+ response.body unless response.nil?
1050
+ end
1051
+
1052
+ #
1053
+ # Updates a container registry with the specified parameters.
1054
+ #
1055
+ # @param resource_group_name [String] The name of the resource group to which
1056
+ # the container registry belongs.
1057
+ # @param registry_name [String] The name of the container registry.
1058
+ # @param registry_update_parameters [RegistryUpdateParameters] The parameters
1059
+ # for updating a container registry.
1060
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1061
+ # will be added to the HTTP request.
1062
+ #
1063
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1064
+ #
1065
+ def begin_update_with_http_info(resource_group_name, registry_name, registry_update_parameters, custom_headers = nil)
1066
+ begin_update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers).value!
1067
+ end
1068
+
1069
+ #
1070
+ # Updates a container registry with the specified parameters.
1071
+ #
1072
+ # @param resource_group_name [String] The name of the resource group to which
1073
+ # the container registry belongs.
1074
+ # @param registry_name [String] The name of the container registry.
1075
+ # @param registry_update_parameters [RegistryUpdateParameters] The parameters
1076
+ # for updating a container registry.
1077
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1078
+ # to the HTTP request.
1079
+ #
1080
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1081
+ #
1082
+ def begin_update_async(resource_group_name, registry_name, registry_update_parameters, custom_headers = nil)
1083
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1084
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1085
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1086
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
1087
+ fail ArgumentError, 'registry_update_parameters is nil' if registry_update_parameters.nil?
1088
+
1089
+
1090
+ request_headers = {}
1091
+
1092
+ # Set Headers
1093
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1094
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1095
+
1096
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1097
+
1098
+ # Serialize Request
1099
+ request_mapper = Azure::ARM::ContainerRegistry::Models::RegistryUpdateParameters.mapper()
1100
+ request_content = @client.serialize(request_mapper, registry_update_parameters)
1101
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1102
+
1103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'
1104
+
1105
+ request_url = @base_url || @client.base_url
1106
+
1107
+ options = {
1108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1109
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
1110
+ query_params: {'api-version' => @client.api_version},
1111
+ body: request_content,
1112
+ headers: request_headers.merge(custom_headers || {}),
1113
+ base_url: request_url
1114
+ }
1115
+ promise = @client.make_request_async(:patch, path_template, options)
1116
+
1117
+ promise = promise.then do |result|
1118
+ http_response = result.response
1119
+ status_code = http_response.status
1120
+ response_content = http_response.body
1121
+ unless status_code == 200 || status_code == 201
1122
+ error_model = JSON.load(response_content)
1123
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1124
+ end
1125
+
1126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1127
+ # Deserialize Response
1128
+ if status_code == 200
1129
+ begin
1130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1131
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
1132
+ result.body = @client.deserialize(result_mapper, parsed_response)
1133
+ rescue Exception => e
1134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1135
+ end
1136
+ end
1137
+ # Deserialize Response
1138
+ if status_code == 201
1139
+ begin
1140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1141
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Registry.mapper()
1142
+ result.body = @client.deserialize(result_mapper, parsed_response)
1143
+ rescue Exception => e
1144
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1145
+ end
1146
+ end
1147
+
1148
+ result
1149
+ end
1150
+
1151
+ promise.execute
1152
+ end
1153
+
1154
+ #
1155
+ # Lists all the container registries under the specified resource group.
1156
+ #
1157
+ # @param next_page_link [String] The NextLink from the previous successful call
1158
+ # to List operation.
1159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1160
+ # will be added to the HTTP request.
1161
+ #
1162
+ # @return [RegistryListResult] operation results.
1163
+ #
1164
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1165
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1166
+ response.body unless response.nil?
1167
+ end
1168
+
1169
+ #
1170
+ # Lists all the container registries under the specified resource group.
1171
+ #
1172
+ # @param next_page_link [String] The NextLink from the previous successful call
1173
+ # to List operation.
1174
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1175
+ # will be added to the HTTP request.
1176
+ #
1177
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1178
+ #
1179
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1180
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1181
+ end
1182
+
1183
+ #
1184
+ # Lists all the container registries under the specified resource group.
1185
+ #
1186
+ # @param next_page_link [String] The NextLink from the previous successful call
1187
+ # to List operation.
1188
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1189
+ # to the HTTP request.
1190
+ #
1191
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1192
+ #
1193
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1194
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1195
+
1196
+
1197
+ request_headers = {}
1198
+
1199
+ # Set Headers
1200
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1201
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1202
+ path_template = '{nextLink}'
1203
+
1204
+ request_url = @base_url || @client.base_url
1205
+
1206
+ options = {
1207
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1208
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1209
+ headers: request_headers.merge(custom_headers || {}),
1210
+ base_url: request_url
1211
+ }
1212
+ promise = @client.make_request_async(:get, path_template, options)
1213
+
1214
+ promise = promise.then do |result|
1215
+ http_response = result.response
1216
+ status_code = http_response.status
1217
+ response_content = http_response.body
1218
+ unless status_code == 200
1219
+ error_model = JSON.load(response_content)
1220
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1221
+ end
1222
+
1223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1224
+ # Deserialize Response
1225
+ if status_code == 200
1226
+ begin
1227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1228
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListResult.mapper()
1229
+ result.body = @client.deserialize(result_mapper, parsed_response)
1230
+ rescue Exception => e
1231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1232
+ end
1233
+ end
1234
+
1235
+ result
1236
+ end
1237
+
1238
+ promise.execute
1239
+ end
1240
+
1241
+ #
1242
+ # Lists all the container registries under the specified subscription.
1243
+ #
1244
+ # @param next_page_link [String] The NextLink from the previous successful call
1245
+ # to List operation.
1246
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1247
+ # will be added to the HTTP request.
1248
+ #
1249
+ # @return [RegistryListResult] operation results.
1250
+ #
1251
+ def list_next(next_page_link, custom_headers = nil)
1252
+ response = list_next_async(next_page_link, custom_headers).value!
1253
+ response.body unless response.nil?
1254
+ end
1255
+
1256
+ #
1257
+ # Lists all the container registries under the specified subscription.
1258
+ #
1259
+ # @param next_page_link [String] The NextLink from the previous successful call
1260
+ # to List operation.
1261
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1262
+ # will be added to the HTTP request.
1263
+ #
1264
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1265
+ #
1266
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1267
+ list_next_async(next_page_link, custom_headers).value!
1268
+ end
1269
+
1270
+ #
1271
+ # Lists all the container registries under the specified subscription.
1272
+ #
1273
+ # @param next_page_link [String] The NextLink from the previous successful call
1274
+ # to List operation.
1275
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1276
+ # to the HTTP request.
1277
+ #
1278
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1279
+ #
1280
+ def list_next_async(next_page_link, custom_headers = nil)
1281
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1282
+
1283
+
1284
+ request_headers = {}
1285
+
1286
+ # Set Headers
1287
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1288
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1289
+ path_template = '{nextLink}'
1290
+
1291
+ request_url = @base_url || @client.base_url
1292
+
1293
+ options = {
1294
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1295
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1296
+ headers: request_headers.merge(custom_headers || {}),
1297
+ base_url: request_url
1298
+ }
1299
+ promise = @client.make_request_async(:get, path_template, options)
1300
+
1301
+ promise = promise.then do |result|
1302
+ http_response = result.response
1303
+ status_code = http_response.status
1304
+ response_content = http_response.body
1305
+ unless status_code == 200
1306
+ error_model = JSON.load(response_content)
1307
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1308
+ end
1309
+
1310
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1311
+ # Deserialize Response
1312
+ if status_code == 200
1313
+ begin
1314
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1315
+ result_mapper = Azure::ARM::ContainerRegistry::Models::RegistryListResult.mapper()
1316
+ result.body = @client.deserialize(result_mapper, parsed_response)
1317
+ rescue Exception => e
1318
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1319
+ end
1320
+ end
1321
+
1322
+ result
1323
+ end
1324
+
1325
+ promise.execute
1326
+ end
1327
+
1328
+ #
1329
+ # Lists all the container registries under the specified resource group.
1330
+ #
1331
+ # @param resource_group_name [String] The name of the resource group to which
1332
+ # the container registry belongs.
1333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1334
+ # will be added to the HTTP request.
1335
+ #
1336
+ # @return [RegistryListResult] which provide lazy access to pages of the
1337
+ # response.
1338
+ #
1339
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
1340
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
1341
+ unless response.nil?
1342
+ page = response.body
1343
+ page.next_method = Proc.new do |next_page_link|
1344
+ list_by_resource_group_next_async(next_page_link, custom_headers)
1345
+ end
1346
+ page
1347
+ end
1348
+ end
1349
+
1350
+ #
1351
+ # Lists all the container registries under the specified subscription.
1352
+ #
1353
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1354
+ # will be added to the HTTP request.
1355
+ #
1356
+ # @return [RegistryListResult] which provide lazy access to pages of the
1357
+ # response.
1358
+ #
1359
+ def list_as_lazy(custom_headers = nil)
1360
+ response = list_async(custom_headers).value!
1361
+ unless response.nil?
1362
+ page = response.body
1363
+ page.next_method = Proc.new do |next_page_link|
1364
+ list_next_async(next_page_link, custom_headers)
1365
+ end
1366
+ page
1367
+ end
1368
+ end
1369
+
1370
+ end
1371
+ end