1package containerregistry
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// RegistriesClient is the client for the Registries methods of the Containerregistry service.
30type RegistriesClient struct {
31	BaseClient
32}
33
34// NewRegistriesClient creates an instance of the RegistriesClient client.
35func NewRegistriesClient(subscriptionID string) RegistriesClient {
36	return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID)
37}
38
39// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient client using a custom endpoint.  Use this
40// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
41func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient {
42	return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)}
43}
44
45// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only
46// alphanumeric characters, be globally unique, and between 5 and 50 characters in length.
47// Parameters:
48// registryNameCheckRequest - the object containing information for the availability request.
49func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) {
50	if tracing.IsEnabled() {
51		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.CheckNameAvailability")
52		defer func() {
53			sc := -1
54			if result.Response.Response != nil {
55				sc = result.Response.Response.StatusCode
56			}
57			tracing.EndSpan(ctx, sc, err)
58		}()
59	}
60	if err := validation.Validate([]validation.Validation{
61		{TargetValue: registryNameCheckRequest,
62			Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true,
63				Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil},
64					{Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil},
65					{Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil},
66				}},
67				{Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
68		return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error())
69	}
70
71	req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest)
72	if err != nil {
73		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request")
74		return
75	}
76
77	resp, err := client.CheckNameAvailabilitySender(req)
78	if err != nil {
79		result.Response = autorest.Response{Response: resp}
80		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request")
81		return
82	}
83
84	result, err = client.CheckNameAvailabilityResponder(resp)
85	if err != nil {
86		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request")
87	}
88
89	return
90}
91
92// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
93func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) {
94	pathParameters := map[string]interface{}{
95		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
96	}
97
98	const APIVersion = "2017-10-01"
99	queryParameters := map[string]interface{}{
100		"api-version": APIVersion,
101	}
102
103	preparer := autorest.CreatePreparer(
104		autorest.AsContentType("application/json; charset=utf-8"),
105		autorest.AsPost(),
106		autorest.WithBaseURL(client.BaseURI),
107		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters),
108		autorest.WithJSON(registryNameCheckRequest),
109		autorest.WithQueryParameters(queryParameters))
110	return preparer.Prepare((&http.Request{}).WithContext(ctx))
111}
112
113// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
114// http.Response Body if it receives an error.
115func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
116	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
117}
118
119// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
120// closes the http.Response Body.
121func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) {
122	err = autorest.Respond(
123		resp,
124		client.ByInspecting(),
125		azure.WithErrorUnlessStatusCode(http.StatusOK),
126		autorest.ByUnmarshallingJSON(&result),
127		autorest.ByClosing())
128	result.Response = autorest.Response{Response: resp}
129	return
130}
131
132// Create creates a container registry with the specified parameters.
133// Parameters:
134// resourceGroupName - the name of the resource group to which the container registry belongs.
135// registryName - the name of the container registry.
136// registry - the parameters for creating a container registry.
137func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) {
138	if tracing.IsEnabled() {
139		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.Create")
140		defer func() {
141			sc := -1
142			if result.Response() != nil {
143				sc = result.Response().StatusCode
144			}
145			tracing.EndSpan(ctx, sc, err)
146		}()
147	}
148	if err := validation.Validate([]validation.Validation{
149		{TargetValue: resourceGroupName,
150			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
151		{TargetValue: registryName,
152			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
153				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
154				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}},
155		{TargetValue: registry,
156			Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil},
157				{Target: "registry.RegistryProperties", Name: validation.Null, Rule: false,
158					Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: false,
159						Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.ID", Name: validation.Null, Rule: true, Chain: nil}}},
160					}}}}}); err != nil {
161		return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error())
162	}
163
164	req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry)
165	if err != nil {
166		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request")
167		return
168	}
169
170	result, err = client.CreateSender(req)
171	if err != nil {
172		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request")
173		return
174	}
175
176	return
177}
178
179// CreatePreparer prepares the Create request.
180func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) {
181	pathParameters := map[string]interface{}{
182		"registryName":      autorest.Encode("path", registryName),
183		"resourceGroupName": autorest.Encode("path", resourceGroupName),
184		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
185	}
186
187	const APIVersion = "2017-10-01"
188	queryParameters := map[string]interface{}{
189		"api-version": APIVersion,
190	}
191
192	preparer := autorest.CreatePreparer(
193		autorest.AsContentType("application/json; charset=utf-8"),
194		autorest.AsPut(),
195		autorest.WithBaseURL(client.BaseURI),
196		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
197		autorest.WithJSON(registry),
198		autorest.WithQueryParameters(queryParameters))
199	return preparer.Prepare((&http.Request{}).WithContext(ctx))
200}
201
202// CreateSender sends the Create request. The method will close the
203// http.Response Body if it receives an error.
204func (client RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, err error) {
205	var resp *http.Response
206	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
207	if err != nil {
208		return
209	}
210	future.Future, err = azure.NewFutureFromResponse(resp)
211	return
212}
213
214// CreateResponder handles the response to the Create request. The method always
215// closes the http.Response Body.
216func (client RegistriesClient) CreateResponder(resp *http.Response) (result Registry, err error) {
217	err = autorest.Respond(
218		resp,
219		client.ByInspecting(),
220		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
221		autorest.ByUnmarshallingJSON(&result),
222		autorest.ByClosing())
223	result.Response = autorest.Response{Response: resp}
224	return
225}
226
227// Delete deletes a container registry.
228// Parameters:
229// resourceGroupName - the name of the resource group to which the container registry belongs.
230// registryName - the name of the container registry.
231func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) {
232	if tracing.IsEnabled() {
233		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.Delete")
234		defer func() {
235			sc := -1
236			if result.Response() != nil {
237				sc = result.Response().StatusCode
238			}
239			tracing.EndSpan(ctx, sc, err)
240		}()
241	}
242	if err := validation.Validate([]validation.Validation{
243		{TargetValue: resourceGroupName,
244			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
245		{TargetValue: registryName,
246			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
247				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
248				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
249		return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error())
250	}
251
252	req, err := client.DeletePreparer(ctx, resourceGroupName, registryName)
253	if err != nil {
254		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request")
255		return
256	}
257
258	result, err = client.DeleteSender(req)
259	if err != nil {
260		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request")
261		return
262	}
263
264	return
265}
266
267// DeletePreparer prepares the Delete request.
268func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
269	pathParameters := map[string]interface{}{
270		"registryName":      autorest.Encode("path", registryName),
271		"resourceGroupName": autorest.Encode("path", resourceGroupName),
272		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
273	}
274
275	const APIVersion = "2017-10-01"
276	queryParameters := map[string]interface{}{
277		"api-version": APIVersion,
278	}
279
280	preparer := autorest.CreatePreparer(
281		autorest.AsDelete(),
282		autorest.WithBaseURL(client.BaseURI),
283		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
284		autorest.WithQueryParameters(queryParameters))
285	return preparer.Prepare((&http.Request{}).WithContext(ctx))
286}
287
288// DeleteSender sends the Delete request. The method will close the
289// http.Response Body if it receives an error.
290func (client RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, err error) {
291	var resp *http.Response
292	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
293	if err != nil {
294		return
295	}
296	future.Future, err = azure.NewFutureFromResponse(resp)
297	return
298}
299
300// DeleteResponder handles the response to the Delete request. The method always
301// closes the http.Response Body.
302func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
303	err = autorest.Respond(
304		resp,
305		client.ByInspecting(),
306		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
307		autorest.ByClosing())
308	result.Response = resp
309	return
310}
311
312// Get gets the properties of the specified container registry.
313// Parameters:
314// resourceGroupName - the name of the resource group to which the container registry belongs.
315// registryName - the name of the container registry.
316func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) {
317	if tracing.IsEnabled() {
318		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.Get")
319		defer func() {
320			sc := -1
321			if result.Response.Response != nil {
322				sc = result.Response.Response.StatusCode
323			}
324			tracing.EndSpan(ctx, sc, err)
325		}()
326	}
327	if err := validation.Validate([]validation.Validation{
328		{TargetValue: resourceGroupName,
329			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
330		{TargetValue: registryName,
331			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
332				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
333				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
334		return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error())
335	}
336
337	req, err := client.GetPreparer(ctx, resourceGroupName, registryName)
338	if err != nil {
339		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request")
340		return
341	}
342
343	resp, err := client.GetSender(req)
344	if err != nil {
345		result.Response = autorest.Response{Response: resp}
346		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request")
347		return
348	}
349
350	result, err = client.GetResponder(resp)
351	if err != nil {
352		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request")
353	}
354
355	return
356}
357
358// GetPreparer prepares the Get request.
359func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
360	pathParameters := map[string]interface{}{
361		"registryName":      autorest.Encode("path", registryName),
362		"resourceGroupName": autorest.Encode("path", resourceGroupName),
363		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
364	}
365
366	const APIVersion = "2017-10-01"
367	queryParameters := map[string]interface{}{
368		"api-version": APIVersion,
369	}
370
371	preparer := autorest.CreatePreparer(
372		autorest.AsGet(),
373		autorest.WithBaseURL(client.BaseURI),
374		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
375		autorest.WithQueryParameters(queryParameters))
376	return preparer.Prepare((&http.Request{}).WithContext(ctx))
377}
378
379// GetSender sends the Get request. The method will close the
380// http.Response Body if it receives an error.
381func (client RegistriesClient) GetSender(req *http.Request) (*http.Response, error) {
382	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
383}
384
385// GetResponder handles the response to the Get request. The method always
386// closes the http.Response Body.
387func (client RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) {
388	err = autorest.Respond(
389		resp,
390		client.ByInspecting(),
391		azure.WithErrorUnlessStatusCode(http.StatusOK),
392		autorest.ByUnmarshallingJSON(&result),
393		autorest.ByClosing())
394	result.Response = autorest.Response{Response: resp}
395	return
396}
397
398// ImportImage copies an image to this container registry from the specified container registry.
399// Parameters:
400// resourceGroupName - the name of the resource group to which the container registry belongs.
401// registryName - the name of the container registry.
402// parameters - the parameters specifying the image to copy and the source container registry.
403func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) {
404	if tracing.IsEnabled() {
405		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage")
406		defer func() {
407			sc := -1
408			if result.Response() != nil {
409				sc = result.Response().StatusCode
410			}
411			tracing.EndSpan(ctx, sc, err)
412		}()
413	}
414	if err := validation.Validate([]validation.Validation{
415		{TargetValue: resourceGroupName,
416			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
417		{TargetValue: registryName,
418			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
419				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
420				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}},
421		{TargetValue: parameters,
422			Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true,
423				Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false,
424					Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}},
425					{Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil},
426				}}}}}); err != nil {
427		return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error())
428	}
429
430	req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters)
431	if err != nil {
432		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request")
433		return
434	}
435
436	result, err = client.ImportImageSender(req)
437	if err != nil {
438		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request")
439		return
440	}
441
442	return
443}
444
445// ImportImagePreparer prepares the ImportImage request.
446func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) {
447	pathParameters := map[string]interface{}{
448		"registryName":      autorest.Encode("path", registryName),
449		"resourceGroupName": autorest.Encode("path", resourceGroupName),
450		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
451	}
452
453	const APIVersion = "2017-10-01"
454	queryParameters := map[string]interface{}{
455		"api-version": APIVersion,
456	}
457
458	preparer := autorest.CreatePreparer(
459		autorest.AsContentType("application/json; charset=utf-8"),
460		autorest.AsPost(),
461		autorest.WithBaseURL(client.BaseURI),
462		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage", pathParameters),
463		autorest.WithJSON(parameters),
464		autorest.WithQueryParameters(queryParameters))
465	return preparer.Prepare((&http.Request{}).WithContext(ctx))
466}
467
468// ImportImageSender sends the ImportImage request. The method will close the
469// http.Response Body if it receives an error.
470func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, err error) {
471	var resp *http.Response
472	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
473	if err != nil {
474		return
475	}
476	future.Future, err = azure.NewFutureFromResponse(resp)
477	return
478}
479
480// ImportImageResponder handles the response to the ImportImage request. The method always
481// closes the http.Response Body.
482func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) {
483	err = autorest.Respond(
484		resp,
485		client.ByInspecting(),
486		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
487		autorest.ByClosing())
488	result.Response = resp
489	return
490}
491
492// List lists all the container registries under the specified subscription.
493func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) {
494	if tracing.IsEnabled() {
495		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List")
496		defer func() {
497			sc := -1
498			if result.rlr.Response.Response != nil {
499				sc = result.rlr.Response.Response.StatusCode
500			}
501			tracing.EndSpan(ctx, sc, err)
502		}()
503	}
504	result.fn = client.listNextResults
505	req, err := client.ListPreparer(ctx)
506	if err != nil {
507		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request")
508		return
509	}
510
511	resp, err := client.ListSender(req)
512	if err != nil {
513		result.rlr.Response = autorest.Response{Response: resp}
514		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request")
515		return
516	}
517
518	result.rlr, err = client.ListResponder(resp)
519	if err != nil {
520		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request")
521	}
522
523	return
524}
525
526// ListPreparer prepares the List request.
527func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
528	pathParameters := map[string]interface{}{
529		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
530	}
531
532	const APIVersion = "2017-10-01"
533	queryParameters := map[string]interface{}{
534		"api-version": APIVersion,
535	}
536
537	preparer := autorest.CreatePreparer(
538		autorest.AsGet(),
539		autorest.WithBaseURL(client.BaseURI),
540		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
541		autorest.WithQueryParameters(queryParameters))
542	return preparer.Prepare((&http.Request{}).WithContext(ctx))
543}
544
545// ListSender sends the List request. The method will close the
546// http.Response Body if it receives an error.
547func (client RegistriesClient) ListSender(req *http.Request) (*http.Response, error) {
548	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
549}
550
551// ListResponder handles the response to the List request. The method always
552// closes the http.Response Body.
553func (client RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, err error) {
554	err = autorest.Respond(
555		resp,
556		client.ByInspecting(),
557		azure.WithErrorUnlessStatusCode(http.StatusOK),
558		autorest.ByUnmarshallingJSON(&result),
559		autorest.ByClosing())
560	result.Response = autorest.Response{Response: resp}
561	return
562}
563
564// listNextResults retrieves the next set of results, if any.
565func (client RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) {
566	req, err := lastResults.registryListResultPreparer(ctx)
567	if err != nil {
568		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", nil, "Failure preparing next results request")
569	}
570	if req == nil {
571		return
572	}
573	resp, err := client.ListSender(req)
574	if err != nil {
575		result.Response = autorest.Response{Response: resp}
576		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request")
577	}
578	result, err = client.ListResponder(resp)
579	if err != nil {
580		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request")
581	}
582	return
583}
584
585// ListComplete enumerates all values, automatically crossing page boundaries as required.
586func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) {
587	if tracing.IsEnabled() {
588		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List")
589		defer func() {
590			sc := -1
591			if result.Response().Response.Response != nil {
592				sc = result.page.Response().Response.Response.StatusCode
593			}
594			tracing.EndSpan(ctx, sc, err)
595		}()
596	}
597	result.page, err = client.List(ctx)
598	return
599}
600
601// ListByResourceGroup lists all the container registries under the specified resource group.
602// Parameters:
603// resourceGroupName - the name of the resource group to which the container registry belongs.
604func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) {
605	if tracing.IsEnabled() {
606		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup")
607		defer func() {
608			sc := -1
609			if result.rlr.Response.Response != nil {
610				sc = result.rlr.Response.Response.StatusCode
611			}
612			tracing.EndSpan(ctx, sc, err)
613		}()
614	}
615	if err := validation.Validate([]validation.Validation{
616		{TargetValue: resourceGroupName,
617			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
618		return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error())
619	}
620
621	result.fn = client.listByResourceGroupNextResults
622	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
623	if err != nil {
624		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request")
625		return
626	}
627
628	resp, err := client.ListByResourceGroupSender(req)
629	if err != nil {
630		result.rlr.Response = autorest.Response{Response: resp}
631		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request")
632		return
633	}
634
635	result.rlr, err = client.ListByResourceGroupResponder(resp)
636	if err != nil {
637		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request")
638	}
639
640	return
641}
642
643// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
644func (client RegistriesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
645	pathParameters := map[string]interface{}{
646		"resourceGroupName": autorest.Encode("path", resourceGroupName),
647		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
648	}
649
650	const APIVersion = "2017-10-01"
651	queryParameters := map[string]interface{}{
652		"api-version": APIVersion,
653	}
654
655	preparer := autorest.CreatePreparer(
656		autorest.AsGet(),
657		autorest.WithBaseURL(client.BaseURI),
658		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
659		autorest.WithQueryParameters(queryParameters))
660	return preparer.Prepare((&http.Request{}).WithContext(ctx))
661}
662
663// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
664// http.Response Body if it receives an error.
665func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
666	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
667}
668
669// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
670// closes the http.Response Body.
671func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) {
672	err = autorest.Respond(
673		resp,
674		client.ByInspecting(),
675		azure.WithErrorUnlessStatusCode(http.StatusOK),
676		autorest.ByUnmarshallingJSON(&result),
677		autorest.ByClosing())
678	result.Response = autorest.Response{Response: resp}
679	return
680}
681
682// listByResourceGroupNextResults retrieves the next set of results, if any.
683func (client RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) {
684	req, err := lastResults.registryListResultPreparer(ctx)
685	if err != nil {
686		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
687	}
688	if req == nil {
689		return
690	}
691	resp, err := client.ListByResourceGroupSender(req)
692	if err != nil {
693		result.Response = autorest.Response{Response: resp}
694		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
695	}
696	result, err = client.ListByResourceGroupResponder(resp)
697	if err != nil {
698		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
699	}
700	return
701}
702
703// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
704func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) {
705	if tracing.IsEnabled() {
706		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup")
707		defer func() {
708			sc := -1
709			if result.Response().Response.Response != nil {
710				sc = result.page.Response().Response.Response.StatusCode
711			}
712			tracing.EndSpan(ctx, sc, err)
713		}()
714	}
715	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
716	return
717}
718
719// ListCredentials lists the login credentials for the specified container registry.
720// Parameters:
721// resourceGroupName - the name of the resource group to which the container registry belongs.
722// registryName - the name of the container registry.
723func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) {
724	if tracing.IsEnabled() {
725		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials")
726		defer func() {
727			sc := -1
728			if result.Response.Response != nil {
729				sc = result.Response.Response.StatusCode
730			}
731			tracing.EndSpan(ctx, sc, err)
732		}()
733	}
734	if err := validation.Validate([]validation.Validation{
735		{TargetValue: resourceGroupName,
736			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
737		{TargetValue: registryName,
738			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
739				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
740				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
741		return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error())
742	}
743
744	req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName)
745	if err != nil {
746		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request")
747		return
748	}
749
750	resp, err := client.ListCredentialsSender(req)
751	if err != nil {
752		result.Response = autorest.Response{Response: resp}
753		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request")
754		return
755	}
756
757	result, err = client.ListCredentialsResponder(resp)
758	if err != nil {
759		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request")
760	}
761
762	return
763}
764
765// ListCredentialsPreparer prepares the ListCredentials request.
766func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
767	pathParameters := map[string]interface{}{
768		"registryName":      autorest.Encode("path", registryName),
769		"resourceGroupName": autorest.Encode("path", resourceGroupName),
770		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
771	}
772
773	const APIVersion = "2017-10-01"
774	queryParameters := map[string]interface{}{
775		"api-version": APIVersion,
776	}
777
778	preparer := autorest.CreatePreparer(
779		autorest.AsPost(),
780		autorest.WithBaseURL(client.BaseURI),
781		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters),
782		autorest.WithQueryParameters(queryParameters))
783	return preparer.Prepare((&http.Request{}).WithContext(ctx))
784}
785
786// ListCredentialsSender sends the ListCredentials request. The method will close the
787// http.Response Body if it receives an error.
788func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) {
789	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
790}
791
792// ListCredentialsResponder handles the response to the ListCredentials request. The method always
793// closes the http.Response Body.
794func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) {
795	err = autorest.Respond(
796		resp,
797		client.ByInspecting(),
798		azure.WithErrorUnlessStatusCode(http.StatusOK),
799		autorest.ByUnmarshallingJSON(&result),
800		autorest.ByClosing())
801	result.Response = autorest.Response{Response: resp}
802	return
803}
804
805// ListPolicies lists the policies for the specified container registry.
806// Parameters:
807// resourceGroupName - the name of the resource group to which the container registry belongs.
808// registryName - the name of the container registry.
809func (client RegistriesClient) ListPolicies(ctx context.Context, resourceGroupName string, registryName string) (result RegistryPolicies, err error) {
810	if tracing.IsEnabled() {
811		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPolicies")
812		defer func() {
813			sc := -1
814			if result.Response.Response != nil {
815				sc = result.Response.Response.StatusCode
816			}
817			tracing.EndSpan(ctx, sc, err)
818		}()
819	}
820	if err := validation.Validate([]validation.Validation{
821		{TargetValue: resourceGroupName,
822			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
823		{TargetValue: registryName,
824			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
825				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
826				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
827		return result, validation.NewError("containerregistry.RegistriesClient", "ListPolicies", err.Error())
828	}
829
830	req, err := client.ListPoliciesPreparer(ctx, resourceGroupName, registryName)
831	if err != nil {
832		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", nil, "Failure preparing request")
833		return
834	}
835
836	resp, err := client.ListPoliciesSender(req)
837	if err != nil {
838		result.Response = autorest.Response{Response: resp}
839		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", resp, "Failure sending request")
840		return
841	}
842
843	result, err = client.ListPoliciesResponder(resp)
844	if err != nil {
845		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", resp, "Failure responding to request")
846	}
847
848	return
849}
850
851// ListPoliciesPreparer prepares the ListPolicies request.
852func (client RegistriesClient) ListPoliciesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
853	pathParameters := map[string]interface{}{
854		"registryName":      autorest.Encode("path", registryName),
855		"resourceGroupName": autorest.Encode("path", resourceGroupName),
856		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
857	}
858
859	const APIVersion = "2017-10-01"
860	queryParameters := map[string]interface{}{
861		"api-version": APIVersion,
862	}
863
864	preparer := autorest.CreatePreparer(
865		autorest.AsGet(),
866		autorest.WithBaseURL(client.BaseURI),
867		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies", pathParameters),
868		autorest.WithQueryParameters(queryParameters))
869	return preparer.Prepare((&http.Request{}).WithContext(ctx))
870}
871
872// ListPoliciesSender sends the ListPolicies request. The method will close the
873// http.Response Body if it receives an error.
874func (client RegistriesClient) ListPoliciesSender(req *http.Request) (*http.Response, error) {
875	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
876}
877
878// ListPoliciesResponder handles the response to the ListPolicies request. The method always
879// closes the http.Response Body.
880func (client RegistriesClient) ListPoliciesResponder(resp *http.Response) (result RegistryPolicies, err error) {
881	err = autorest.Respond(
882		resp,
883		client.ByInspecting(),
884		azure.WithErrorUnlessStatusCode(http.StatusOK),
885		autorest.ByUnmarshallingJSON(&result),
886		autorest.ByClosing())
887	result.Response = autorest.Response{Response: resp}
888	return
889}
890
891// ListUsages gets the quota usages for the specified container registry.
892// Parameters:
893// resourceGroupName - the name of the resource group to which the container registry belongs.
894// registryName - the name of the container registry.
895func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) {
896	if tracing.IsEnabled() {
897		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages")
898		defer func() {
899			sc := -1
900			if result.Response.Response != nil {
901				sc = result.Response.Response.StatusCode
902			}
903			tracing.EndSpan(ctx, sc, err)
904		}()
905	}
906	if err := validation.Validate([]validation.Validation{
907		{TargetValue: resourceGroupName,
908			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
909		{TargetValue: registryName,
910			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
911				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
912				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
913		return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error())
914	}
915
916	req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName)
917	if err != nil {
918		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request")
919		return
920	}
921
922	resp, err := client.ListUsagesSender(req)
923	if err != nil {
924		result.Response = autorest.Response{Response: resp}
925		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request")
926		return
927	}
928
929	result, err = client.ListUsagesResponder(resp)
930	if err != nil {
931		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request")
932	}
933
934	return
935}
936
937// ListUsagesPreparer prepares the ListUsages request.
938func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
939	pathParameters := map[string]interface{}{
940		"registryName":      autorest.Encode("path", registryName),
941		"resourceGroupName": autorest.Encode("path", resourceGroupName),
942		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
943	}
944
945	const APIVersion = "2017-10-01"
946	queryParameters := map[string]interface{}{
947		"api-version": APIVersion,
948	}
949
950	preparer := autorest.CreatePreparer(
951		autorest.AsGet(),
952		autorest.WithBaseURL(client.BaseURI),
953		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages", pathParameters),
954		autorest.WithQueryParameters(queryParameters))
955	return preparer.Prepare((&http.Request{}).WithContext(ctx))
956}
957
958// ListUsagesSender sends the ListUsages request. The method will close the
959// http.Response Body if it receives an error.
960func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) {
961	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
962}
963
964// ListUsagesResponder handles the response to the ListUsages request. The method always
965// closes the http.Response Body.
966func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) {
967	err = autorest.Respond(
968		resp,
969		client.ByInspecting(),
970		azure.WithErrorUnlessStatusCode(http.StatusOK),
971		autorest.ByUnmarshallingJSON(&result),
972		autorest.ByClosing())
973	result.Response = autorest.Response{Response: resp}
974	return
975}
976
977// RegenerateCredential regenerates one of the login credentials for the specified container registry.
978// Parameters:
979// resourceGroupName - the name of the resource group to which the container registry belongs.
980// registryName - the name of the container registry.
981// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or
982// password2.
983func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) {
984	if tracing.IsEnabled() {
985		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential")
986		defer func() {
987			sc := -1
988			if result.Response.Response != nil {
989				sc = result.Response.Response.StatusCode
990			}
991			tracing.EndSpan(ctx, sc, err)
992		}()
993	}
994	if err := validation.Validate([]validation.Validation{
995		{TargetValue: resourceGroupName,
996			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
997		{TargetValue: registryName,
998			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
999				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
1000				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
1001		return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error())
1002	}
1003
1004	req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters)
1005	if err != nil {
1006		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request")
1007		return
1008	}
1009
1010	resp, err := client.RegenerateCredentialSender(req)
1011	if err != nil {
1012		result.Response = autorest.Response{Response: resp}
1013		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request")
1014		return
1015	}
1016
1017	result, err = client.RegenerateCredentialResponder(resp)
1018	if err != nil {
1019		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request")
1020	}
1021
1022	return
1023}
1024
1025// RegenerateCredentialPreparer prepares the RegenerateCredential request.
1026func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) {
1027	pathParameters := map[string]interface{}{
1028		"registryName":      autorest.Encode("path", registryName),
1029		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1030		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1031	}
1032
1033	const APIVersion = "2017-10-01"
1034	queryParameters := map[string]interface{}{
1035		"api-version": APIVersion,
1036	}
1037
1038	preparer := autorest.CreatePreparer(
1039		autorest.AsContentType("application/json; charset=utf-8"),
1040		autorest.AsPost(),
1041		autorest.WithBaseURL(client.BaseURI),
1042		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters),
1043		autorest.WithJSON(regenerateCredentialParameters),
1044		autorest.WithQueryParameters(queryParameters))
1045	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1046}
1047
1048// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the
1049// http.Response Body if it receives an error.
1050func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) {
1051	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1052}
1053
1054// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always
1055// closes the http.Response Body.
1056func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) {
1057	err = autorest.Respond(
1058		resp,
1059		client.ByInspecting(),
1060		azure.WithErrorUnlessStatusCode(http.StatusOK),
1061		autorest.ByUnmarshallingJSON(&result),
1062		autorest.ByClosing())
1063	result.Response = autorest.Response{Response: resp}
1064	return
1065}
1066
1067// Update updates a container registry with the specified parameters.
1068// Parameters:
1069// resourceGroupName - the name of the resource group to which the container registry belongs.
1070// registryName - the name of the container registry.
1071// registryUpdateParameters - the parameters for updating a container registry.
1072func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) {
1073	if tracing.IsEnabled() {
1074		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.Update")
1075		defer func() {
1076			sc := -1
1077			if result.Response() != nil {
1078				sc = result.Response().StatusCode
1079			}
1080			tracing.EndSpan(ctx, sc, err)
1081		}()
1082	}
1083	if err := validation.Validate([]validation.Validation{
1084		{TargetValue: resourceGroupName,
1085			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1086		{TargetValue: registryName,
1087			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1088				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
1089				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
1090		return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error())
1091	}
1092
1093	req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters)
1094	if err != nil {
1095		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request")
1096		return
1097	}
1098
1099	result, err = client.UpdateSender(req)
1100	if err != nil {
1101		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request")
1102		return
1103	}
1104
1105	return
1106}
1107
1108// UpdatePreparer prepares the Update request.
1109func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) {
1110	pathParameters := map[string]interface{}{
1111		"registryName":      autorest.Encode("path", registryName),
1112		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1113		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1114	}
1115
1116	const APIVersion = "2017-10-01"
1117	queryParameters := map[string]interface{}{
1118		"api-version": APIVersion,
1119	}
1120
1121	preparer := autorest.CreatePreparer(
1122		autorest.AsContentType("application/json; charset=utf-8"),
1123		autorest.AsPatch(),
1124		autorest.WithBaseURL(client.BaseURI),
1125		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
1126		autorest.WithJSON(registryUpdateParameters),
1127		autorest.WithQueryParameters(queryParameters))
1128	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1129}
1130
1131// UpdateSender sends the Update request. The method will close the
1132// http.Response Body if it receives an error.
1133func (client RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, err error) {
1134	var resp *http.Response
1135	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1136	if err != nil {
1137		return
1138	}
1139	future.Future, err = azure.NewFutureFromResponse(resp)
1140	return
1141}
1142
1143// UpdateResponder handles the response to the Update request. The method always
1144// closes the http.Response Body.
1145func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) {
1146	err = autorest.Respond(
1147		resp,
1148		client.ByInspecting(),
1149		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
1150		autorest.ByUnmarshallingJSON(&result),
1151		autorest.ByClosing())
1152	result.Response = autorest.Response{Response: resp}
1153	return
1154}
1155
1156// UpdatePolicies updates the policies for the specified container registry.
1157// Parameters:
1158// resourceGroupName - the name of the resource group to which the container registry belongs.
1159// registryName - the name of the container registry.
1160// registryPoliciesUpdateParameters - the parameters for updating policies of a container registry.
1161func (client RegistriesClient) UpdatePolicies(ctx context.Context, resourceGroupName string, registryName string, registryPoliciesUpdateParameters RegistryPolicies) (result RegistriesUpdatePoliciesFuture, err error) {
1162	if tracing.IsEnabled() {
1163		ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.UpdatePolicies")
1164		defer func() {
1165			sc := -1
1166			if result.Response() != nil {
1167				sc = result.Response().StatusCode
1168			}
1169			tracing.EndSpan(ctx, sc, err)
1170		}()
1171	}
1172	if err := validation.Validate([]validation.Validation{
1173		{TargetValue: resourceGroupName,
1174			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1175		{TargetValue: registryName,
1176			Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1177				{Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil},
1178				{Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil {
1179		return result, validation.NewError("containerregistry.RegistriesClient", "UpdatePolicies", err.Error())
1180	}
1181
1182	req, err := client.UpdatePoliciesPreparer(ctx, resourceGroupName, registryName, registryPoliciesUpdateParameters)
1183	if err != nil {
1184		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "UpdatePolicies", nil, "Failure preparing request")
1185		return
1186	}
1187
1188	result, err = client.UpdatePoliciesSender(req)
1189	if err != nil {
1190		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "UpdatePolicies", result.Response(), "Failure sending request")
1191		return
1192	}
1193
1194	return
1195}
1196
1197// UpdatePoliciesPreparer prepares the UpdatePolicies request.
1198func (client RegistriesClient) UpdatePoliciesPreparer(ctx context.Context, resourceGroupName string, registryName string, registryPoliciesUpdateParameters RegistryPolicies) (*http.Request, error) {
1199	pathParameters := map[string]interface{}{
1200		"registryName":      autorest.Encode("path", registryName),
1201		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1202		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1203	}
1204
1205	const APIVersion = "2017-10-01"
1206	queryParameters := map[string]interface{}{
1207		"api-version": APIVersion,
1208	}
1209
1210	preparer := autorest.CreatePreparer(
1211		autorest.AsContentType("application/json; charset=utf-8"),
1212		autorest.AsPost(),
1213		autorest.WithBaseURL(client.BaseURI),
1214		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies", pathParameters),
1215		autorest.WithJSON(registryPoliciesUpdateParameters),
1216		autorest.WithQueryParameters(queryParameters))
1217	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1218}
1219
1220// UpdatePoliciesSender sends the UpdatePolicies request. The method will close the
1221// http.Response Body if it receives an error.
1222func (client RegistriesClient) UpdatePoliciesSender(req *http.Request) (future RegistriesUpdatePoliciesFuture, err error) {
1223	var resp *http.Response
1224	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1225	if err != nil {
1226		return
1227	}
1228	future.Future, err = azure.NewFutureFromResponse(resp)
1229	return
1230}
1231
1232// UpdatePoliciesResponder handles the response to the UpdatePolicies request. The method always
1233// closes the http.Response Body.
1234func (client RegistriesClient) UpdatePoliciesResponder(resp *http.Response) (result RegistryPolicies, err error) {
1235	err = autorest.Respond(
1236		resp,
1237		client.ByInspecting(),
1238		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1239		autorest.ByUnmarshallingJSON(&result),
1240		autorest.ByClosing())
1241	result.Response = autorest.Response{Response: resp}
1242	return
1243}
1244