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	"net/http"
26)
27
28// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
29// RegistriesClient is the client for the Registries methods of the Containerregistry service.
30type RegistriesClient struct {
31	BaseClient
32}
33
34// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
35// NewRegistriesClient creates an instance of the RegistriesClient client.
36func NewRegistriesClient(subscriptionID string) RegistriesClient {
37	return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID)
38}
39
40// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
41// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient client.
42func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient {
43	return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)}
44}
45
46// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
47// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only
48// alphanumeric characters, be globally unique, and between 5 and 60 characters in length.
49//
50// registryNameCheckRequest is the object containing information for the availability request.
51func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) {
52	if err := validation.Validate([]validation.Validation{
53		{TargetValue: registryNameCheckRequest,
54			Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, Chain: nil},
55				{Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
56		return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error())
57	}
58
59	req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest)
60	if err != nil {
61		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request")
62		return
63	}
64
65	resp, err := client.CheckNameAvailabilitySender(req)
66	if err != nil {
67		result.Response = autorest.Response{Response: resp}
68		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request")
69		return
70	}
71
72	result, err = client.CheckNameAvailabilityResponder(resp)
73	if err != nil {
74		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request")
75	}
76
77	return
78}
79
80// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
81// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
82func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) {
83	pathParameters := map[string]interface{}{
84		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
85	}
86
87	const APIVersion = "2016-06-27-preview"
88	queryParameters := map[string]interface{}{
89		"api-version": APIVersion,
90	}
91
92	preparer := autorest.CreatePreparer(
93		autorest.AsContentType("application/json; charset=utf-8"),
94		autorest.AsPost(),
95		autorest.WithBaseURL(client.BaseURI),
96		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters),
97		autorest.WithJSON(registryNameCheckRequest),
98		autorest.WithQueryParameters(queryParameters))
99	return preparer.Prepare((&http.Request{}).WithContext(ctx))
100}
101
102// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
103// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
104// http.Response Body if it receives an error.
105func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
106	return autorest.SendWithSender(client, req,
107		azure.DoRetryWithRegistration(client.Client))
108}
109
110// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
111// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
112// closes the http.Response Body.
113func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) {
114	err = autorest.Respond(
115		resp,
116		client.ByInspecting(),
117		azure.WithErrorUnlessStatusCode(http.StatusOK),
118		autorest.ByUnmarshallingJSON(&result),
119		autorest.ByClosing())
120	result.Response = autorest.Response{Response: resp}
121	return
122}
123
124// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
125// CreateOrUpdate creates or updates a container registry with the specified parameters.
126//
127// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
128// name of the container registry. registry is the parameters for creating or updating a container registry.
129func (client RegistriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result Registry, err error) {
130	if err := validation.Validate([]validation.Validation{
131		{TargetValue: registry,
132			Constraints: []validation.Constraint{{Target: "registry.RegistryProperties", Name: validation.Null, Rule: false,
133				Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: true,
134					Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil},
135						{Target: "registry.RegistryProperties.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil},
136					}},
137				}}}}}); err != nil {
138		return result, validation.NewError("containerregistry.RegistriesClient", "CreateOrUpdate", err.Error())
139	}
140
141	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, registry)
142	if err != nil {
143		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", nil, "Failure preparing request")
144		return
145	}
146
147	resp, err := client.CreateOrUpdateSender(req)
148	if err != nil {
149		result.Response = autorest.Response{Response: resp}
150		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure sending request")
151		return
152	}
153
154	result, err = client.CreateOrUpdateResponder(resp)
155	if err != nil {
156		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure responding to request")
157	}
158
159	return
160}
161
162// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
163// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
164func (client RegistriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) {
165	pathParameters := map[string]interface{}{
166		"registryName":      autorest.Encode("path", registryName),
167		"resourceGroupName": autorest.Encode("path", resourceGroupName),
168		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
169	}
170
171	const APIVersion = "2016-06-27-preview"
172	queryParameters := map[string]interface{}{
173		"api-version": APIVersion,
174	}
175
176	preparer := autorest.CreatePreparer(
177		autorest.AsContentType("application/json; charset=utf-8"),
178		autorest.AsPut(),
179		autorest.WithBaseURL(client.BaseURI),
180		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
181		autorest.WithJSON(registry),
182		autorest.WithQueryParameters(queryParameters))
183	return preparer.Prepare((&http.Request{}).WithContext(ctx))
184}
185
186// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
187// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
188// http.Response Body if it receives an error.
189func (client RegistriesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
190	return autorest.SendWithSender(client, req,
191		azure.DoRetryWithRegistration(client.Client))
192}
193
194// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
195// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
196// closes the http.Response Body.
197func (client RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result Registry, err error) {
198	err = autorest.Respond(
199		resp,
200		client.ByInspecting(),
201		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
202		autorest.ByUnmarshallingJSON(&result),
203		autorest.ByClosing())
204	result.Response = autorest.Response{Response: resp}
205	return
206}
207
208// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
209// Delete deletes a container registry.
210//
211// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
212// name of the container registry.
213func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result autorest.Response, err error) {
214	req, err := client.DeletePreparer(ctx, resourceGroupName, registryName)
215	if err != nil {
216		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request")
217		return
218	}
219
220	resp, err := client.DeleteSender(req)
221	if err != nil {
222		result.Response = resp
223		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request")
224		return
225	}
226
227	result, err = client.DeleteResponder(resp)
228	if err != nil {
229		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request")
230	}
231
232	return
233}
234
235// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
236// DeletePreparer prepares the Delete request.
237func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
238	pathParameters := map[string]interface{}{
239		"registryName":      autorest.Encode("path", registryName),
240		"resourceGroupName": autorest.Encode("path", resourceGroupName),
241		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
242	}
243
244	const APIVersion = "2016-06-27-preview"
245	queryParameters := map[string]interface{}{
246		"api-version": APIVersion,
247	}
248
249	preparer := autorest.CreatePreparer(
250		autorest.AsDelete(),
251		autorest.WithBaseURL(client.BaseURI),
252		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
253		autorest.WithQueryParameters(queryParameters))
254	return preparer.Prepare((&http.Request{}).WithContext(ctx))
255}
256
257// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
258// DeleteSender sends the Delete request. The method will close the
259// http.Response Body if it receives an error.
260func (client RegistriesClient) DeleteSender(req *http.Request) (*http.Response, error) {
261	return autorest.SendWithSender(client, req,
262		azure.DoRetryWithRegistration(client.Client))
263}
264
265// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
266// DeleteResponder handles the response to the Delete request. The method always
267// closes the http.Response Body.
268func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
269	err = autorest.Respond(
270		resp,
271		client.ByInspecting(),
272		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
273		autorest.ByClosing())
274	result.Response = resp
275	return
276}
277
278// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
279// GetCredentials gets the administrator login credentials for the specified container registry.
280//
281// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
282// name of the container registry.
283func (client RegistriesClient) GetCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
284	req, err := client.GetCredentialsPreparer(ctx, resourceGroupName, registryName)
285	if err != nil {
286		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", nil, "Failure preparing request")
287		return
288	}
289
290	resp, err := client.GetCredentialsSender(req)
291	if err != nil {
292		result.Response = autorest.Response{Response: resp}
293		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure sending request")
294		return
295	}
296
297	result, err = client.GetCredentialsResponder(resp)
298	if err != nil {
299		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure responding to request")
300	}
301
302	return
303}
304
305// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
306// GetCredentialsPreparer prepares the GetCredentials request.
307func (client RegistriesClient) GetCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
308	pathParameters := map[string]interface{}{
309		"registryName":      autorest.Encode("path", registryName),
310		"resourceGroupName": autorest.Encode("path", resourceGroupName),
311		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
312	}
313
314	const APIVersion = "2016-06-27-preview"
315	queryParameters := map[string]interface{}{
316		"api-version": APIVersion,
317	}
318
319	preparer := autorest.CreatePreparer(
320		autorest.AsPost(),
321		autorest.WithBaseURL(client.BaseURI),
322		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getCredentials", pathParameters),
323		autorest.WithQueryParameters(queryParameters))
324	return preparer.Prepare((&http.Request{}).WithContext(ctx))
325}
326
327// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
328// GetCredentialsSender sends the GetCredentials request. The method will close the
329// http.Response Body if it receives an error.
330func (client RegistriesClient) GetCredentialsSender(req *http.Request) (*http.Response, error) {
331	return autorest.SendWithSender(client, req,
332		azure.DoRetryWithRegistration(client.Client))
333}
334
335// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
336// GetCredentialsResponder handles the response to the GetCredentials request. The method always
337// closes the http.Response Body.
338func (client RegistriesClient) GetCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
339	err = autorest.Respond(
340		resp,
341		client.ByInspecting(),
342		azure.WithErrorUnlessStatusCode(http.StatusOK),
343		autorest.ByUnmarshallingJSON(&result),
344		autorest.ByClosing())
345	result.Response = autorest.Response{Response: resp}
346	return
347}
348
349// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
350// GetProperties gets the properties of the specified container registry.
351//
352// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
353// name of the container registry.
354func (client RegistriesClient) GetProperties(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) {
355	req, err := client.GetPropertiesPreparer(ctx, resourceGroupName, registryName)
356	if err != nil {
357		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", nil, "Failure preparing request")
358		return
359	}
360
361	resp, err := client.GetPropertiesSender(req)
362	if err != nil {
363		result.Response = autorest.Response{Response: resp}
364		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure sending request")
365		return
366	}
367
368	result, err = client.GetPropertiesResponder(resp)
369	if err != nil {
370		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure responding to request")
371	}
372
373	return
374}
375
376// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
377// GetPropertiesPreparer prepares the GetProperties request.
378func (client RegistriesClient) GetPropertiesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
379	pathParameters := map[string]interface{}{
380		"registryName":      autorest.Encode("path", registryName),
381		"resourceGroupName": autorest.Encode("path", resourceGroupName),
382		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
383	}
384
385	const APIVersion = "2016-06-27-preview"
386	queryParameters := map[string]interface{}{
387		"api-version": APIVersion,
388	}
389
390	preparer := autorest.CreatePreparer(
391		autorest.AsGet(),
392		autorest.WithBaseURL(client.BaseURI),
393		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
394		autorest.WithQueryParameters(queryParameters))
395	return preparer.Prepare((&http.Request{}).WithContext(ctx))
396}
397
398// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
399// GetPropertiesSender sends the GetProperties request. The method will close the
400// http.Response Body if it receives an error.
401func (client RegistriesClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
402	return autorest.SendWithSender(client, req,
403		azure.DoRetryWithRegistration(client.Client))
404}
405
406// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
407// GetPropertiesResponder handles the response to the GetProperties request. The method always
408// closes the http.Response Body.
409func (client RegistriesClient) GetPropertiesResponder(resp *http.Response) (result Registry, err error) {
410	err = autorest.Respond(
411		resp,
412		client.ByInspecting(),
413		azure.WithErrorUnlessStatusCode(http.StatusOK),
414		autorest.ByUnmarshallingJSON(&result),
415		autorest.ByClosing())
416	result.Response = autorest.Response{Response: resp}
417	return
418}
419
420// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
421// List lists all the available container registries under the specified subscription.
422func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) {
423	result.fn = client.listNextResults
424	req, err := client.ListPreparer(ctx)
425	if err != nil {
426		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request")
427		return
428	}
429
430	resp, err := client.ListSender(req)
431	if err != nil {
432		result.rlr.Response = autorest.Response{Response: resp}
433		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request")
434		return
435	}
436
437	result.rlr, err = client.ListResponder(resp)
438	if err != nil {
439		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request")
440	}
441
442	return
443}
444
445// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
446// ListPreparer prepares the List request.
447func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
448	pathParameters := map[string]interface{}{
449		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
450	}
451
452	const APIVersion = "2016-06-27-preview"
453	queryParameters := map[string]interface{}{
454		"api-version": APIVersion,
455	}
456
457	preparer := autorest.CreatePreparer(
458		autorest.AsGet(),
459		autorest.WithBaseURL(client.BaseURI),
460		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
461		autorest.WithQueryParameters(queryParameters))
462	return preparer.Prepare((&http.Request{}).WithContext(ctx))
463}
464
465// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
466// ListSender sends the List request. The method will close the
467// http.Response Body if it receives an error.
468func (client RegistriesClient) ListSender(req *http.Request) (*http.Response, error) {
469	return autorest.SendWithSender(client, req,
470		azure.DoRetryWithRegistration(client.Client))
471}
472
473// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
474// ListResponder handles the response to the List request. The method always
475// closes the http.Response Body.
476func (client RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, err error) {
477	err = autorest.Respond(
478		resp,
479		client.ByInspecting(),
480		azure.WithErrorUnlessStatusCode(http.StatusOK),
481		autorest.ByUnmarshallingJSON(&result),
482		autorest.ByClosing())
483	result.Response = autorest.Response{Response: resp}
484	return
485}
486
487// listNextResults retrieves the next set of results, if any.
488func (client RegistriesClient) listNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
489	req, err := lastResults.registryListResultPreparer()
490	if err != nil {
491		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", nil, "Failure preparing next results request")
492	}
493	if req == nil {
494		return
495	}
496	resp, err := client.ListSender(req)
497	if err != nil {
498		result.Response = autorest.Response{Response: resp}
499		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request")
500	}
501	result, err = client.ListResponder(resp)
502	if err != nil {
503		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request")
504	}
505	return
506}
507
508// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
509// ListComplete enumerates all values, automatically crossing page boundaries as required.
510func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) {
511	result.page, err = client.List(ctx)
512	return
513}
514
515// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
516// ListByResourceGroup lists all the available container registries under the specified resource group.
517//
518// resourceGroupName is the name of the resource group to which the container registry belongs.
519func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) {
520	result.fn = client.listByResourceGroupNextResults
521	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
522	if err != nil {
523		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request")
524		return
525	}
526
527	resp, err := client.ListByResourceGroupSender(req)
528	if err != nil {
529		result.rlr.Response = autorest.Response{Response: resp}
530		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request")
531		return
532	}
533
534	result.rlr, err = client.ListByResourceGroupResponder(resp)
535	if err != nil {
536		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request")
537	}
538
539	return
540}
541
542// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
543// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
544func (client RegistriesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
545	pathParameters := map[string]interface{}{
546		"resourceGroupName": autorest.Encode("path", resourceGroupName),
547		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
548	}
549
550	const APIVersion = "2016-06-27-preview"
551	queryParameters := map[string]interface{}{
552		"api-version": APIVersion,
553	}
554
555	preparer := autorest.CreatePreparer(
556		autorest.AsGet(),
557		autorest.WithBaseURL(client.BaseURI),
558		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
559		autorest.WithQueryParameters(queryParameters))
560	return preparer.Prepare((&http.Request{}).WithContext(ctx))
561}
562
563// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
564// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
565// http.Response Body if it receives an error.
566func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
567	return autorest.SendWithSender(client, req,
568		azure.DoRetryWithRegistration(client.Client))
569}
570
571// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
572// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
573// closes the http.Response Body.
574func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) {
575	err = autorest.Respond(
576		resp,
577		client.ByInspecting(),
578		azure.WithErrorUnlessStatusCode(http.StatusOK),
579		autorest.ByUnmarshallingJSON(&result),
580		autorest.ByClosing())
581	result.Response = autorest.Response{Response: resp}
582	return
583}
584
585// listByResourceGroupNextResults retrieves the next set of results, if any.
586func (client RegistriesClient) listByResourceGroupNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
587	req, err := lastResults.registryListResultPreparer()
588	if err != nil {
589		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
590	}
591	if req == nil {
592		return
593	}
594	resp, err := client.ListByResourceGroupSender(req)
595	if err != nil {
596		result.Response = autorest.Response{Response: resp}
597		return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
598	}
599	result, err = client.ListByResourceGroupResponder(resp)
600	if err != nil {
601		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
602	}
603	return
604}
605
606// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
607// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
608func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) {
609	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
610	return
611}
612
613// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
614// RegenerateCredentials regenerates the administrator login credentials for the specified container registry.
615//
616// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
617// name of the container registry.
618func (client RegistriesClient) RegenerateCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
619	req, err := client.RegenerateCredentialsPreparer(ctx, resourceGroupName, registryName)
620	if err != nil {
621		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", nil, "Failure preparing request")
622		return
623	}
624
625	resp, err := client.RegenerateCredentialsSender(req)
626	if err != nil {
627		result.Response = autorest.Response{Response: resp}
628		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure sending request")
629		return
630	}
631
632	result, err = client.RegenerateCredentialsResponder(resp)
633	if err != nil {
634		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure responding to request")
635	}
636
637	return
638}
639
640// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
641// RegenerateCredentialsPreparer prepares the RegenerateCredentials request.
642func (client RegistriesClient) RegenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) {
643	pathParameters := map[string]interface{}{
644		"registryName":      autorest.Encode("path", registryName),
645		"resourceGroupName": autorest.Encode("path", resourceGroupName),
646		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
647	}
648
649	const APIVersion = "2016-06-27-preview"
650	queryParameters := map[string]interface{}{
651		"api-version": APIVersion,
652	}
653
654	preparer := autorest.CreatePreparer(
655		autorest.AsPost(),
656		autorest.WithBaseURL(client.BaseURI),
657		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredentials", pathParameters),
658		autorest.WithQueryParameters(queryParameters))
659	return preparer.Prepare((&http.Request{}).WithContext(ctx))
660}
661
662// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
663// RegenerateCredentialsSender sends the RegenerateCredentials request. The method will close the
664// http.Response Body if it receives an error.
665func (client RegistriesClient) RegenerateCredentialsSender(req *http.Request) (*http.Response, error) {
666	return autorest.SendWithSender(client, req,
667		azure.DoRetryWithRegistration(client.Client))
668}
669
670// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
671// RegenerateCredentialsResponder handles the response to the RegenerateCredentials request. The method always
672// closes the http.Response Body.
673func (client RegistriesClient) RegenerateCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
674	err = autorest.Respond(
675		resp,
676		client.ByInspecting(),
677		azure.WithErrorUnlessStatusCode(http.StatusOK),
678		autorest.ByUnmarshallingJSON(&result),
679		autorest.ByClosing())
680	result.Response = autorest.Response{Response: resp}
681	return
682}
683
684// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
685// Update updates a container registry with the specified parameters.
686//
687// resourceGroupName is the name of the resource group to which the container registry belongs. registryName is the
688// name of the container registry. registryUpdateParameters is the parameters for updating a container registry.
689func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) {
690	req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters)
691	if err != nil {
692		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request")
693		return
694	}
695
696	resp, err := client.UpdateSender(req)
697	if err != nil {
698		result.Response = autorest.Response{Response: resp}
699		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request")
700		return
701	}
702
703	result, err = client.UpdateResponder(resp)
704	if err != nil {
705		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request")
706	}
707
708	return
709}
710
711// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
712// UpdatePreparer prepares the Update request.
713func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) {
714	pathParameters := map[string]interface{}{
715		"registryName":      autorest.Encode("path", registryName),
716		"resourceGroupName": autorest.Encode("path", resourceGroupName),
717		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
718	}
719
720	const APIVersion = "2016-06-27-preview"
721	queryParameters := map[string]interface{}{
722		"api-version": APIVersion,
723	}
724
725	preparer := autorest.CreatePreparer(
726		autorest.AsContentType("application/json; charset=utf-8"),
727		autorest.AsPatch(),
728		autorest.WithBaseURL(client.BaseURI),
729		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
730		autorest.WithJSON(registryUpdateParameters),
731		autorest.WithQueryParameters(queryParameters))
732	return preparer.Prepare((&http.Request{}).WithContext(ctx))
733}
734
735// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
736// UpdateSender sends the Update request. The method will close the
737// http.Response Body if it receives an error.
738func (client RegistriesClient) UpdateSender(req *http.Request) (*http.Response, error) {
739	return autorest.SendWithSender(client, req,
740		azure.DoRetryWithRegistration(client.Client))
741}
742
743// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry instead.
744// UpdateResponder handles the response to the Update request. The method always
745// closes the http.Response Body.
746func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) {
747	err = autorest.Respond(
748		resp,
749		client.ByInspecting(),
750		azure.WithErrorUnlessStatusCode(http.StatusOK),
751		autorest.ByUnmarshallingJSON(&result),
752		autorest.ByClosing())
753	result.Response = autorest.Response{Response: resp}
754	return
755}
756