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	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"net/http"
29)
30
31// The package's fully qualified name.
32const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-03-01/containerregistry"
33
34// PasswordName enumerates the values for password name.
35type PasswordName string
36
37const (
38	// Password ...
39	Password PasswordName = "password"
40	// Password2 ...
41	Password2 PasswordName = "password2"
42)
43
44// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type.
45func PossiblePasswordNameValues() []PasswordName {
46	return []PasswordName{Password, Password2}
47}
48
49// ProvisioningState enumerates the values for provisioning state.
50type ProvisioningState string
51
52const (
53	// Creating ...
54	Creating ProvisioningState = "Creating"
55	// Succeeded ...
56	Succeeded ProvisioningState = "Succeeded"
57)
58
59// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
60func PossibleProvisioningStateValues() []ProvisioningState {
61	return []ProvisioningState{Creating, Succeeded}
62}
63
64// SkuTier enumerates the values for sku tier.
65type SkuTier string
66
67const (
68	// Basic ...
69	Basic SkuTier = "Basic"
70)
71
72// PossibleSkuTierValues returns an array of possible values for the SkuTier const type.
73func PossibleSkuTierValues() []SkuTier {
74	return []SkuTier{Basic}
75}
76
77// OperationDefinition the definition of a container registry operation.
78type OperationDefinition struct {
79	// Name - Operation name: {provider}/{resource}/{operation}.
80	Name *string `json:"name,omitempty"`
81	// Display - The display information for the container registry operation.
82	Display *OperationDisplayDefinition `json:"display,omitempty"`
83}
84
85// OperationDisplayDefinition the display information for a container registry operation.
86type OperationDisplayDefinition struct {
87	// Provider - The resource provider name: Microsoft.ContainerRegistry.
88	Provider *string `json:"provider,omitempty"`
89	// Resource - The resource on which the operation is performed.
90	Resource *string `json:"resource,omitempty"`
91	// Operation - The operation that users can perform.
92	Operation *string `json:"operation,omitempty"`
93	// Description - The description for the operation.
94	Description *string `json:"description,omitempty"`
95}
96
97// OperationListResult the result of a request to list container registry operations.
98type OperationListResult struct {
99	autorest.Response `json:"-"`
100	// Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations.
101	Value *[]OperationDefinition `json:"value,omitempty"`
102	// NextLink - The URI that can be used to request the next list of container registry operations.
103	NextLink *string `json:"nextLink,omitempty"`
104}
105
106// OperationListResultIterator provides access to a complete listing of OperationDefinition values.
107type OperationListResultIterator struct {
108	i    int
109	page OperationListResultPage
110}
111
112// NextWithContext advances to the next value.  If there was an error making
113// the request the iterator does not advance and the error is returned.
114func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
115	if tracing.IsEnabled() {
116		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
117		defer func() {
118			sc := -1
119			if iter.Response().Response.Response != nil {
120				sc = iter.Response().Response.Response.StatusCode
121			}
122			tracing.EndSpan(ctx, sc, err)
123		}()
124	}
125	iter.i++
126	if iter.i < len(iter.page.Values()) {
127		return nil
128	}
129	err = iter.page.NextWithContext(ctx)
130	if err != nil {
131		iter.i--
132		return err
133	}
134	iter.i = 0
135	return nil
136}
137
138// Next advances to the next value.  If there was an error making
139// the request the iterator does not advance and the error is returned.
140// Deprecated: Use NextWithContext() instead.
141func (iter *OperationListResultIterator) Next() error {
142	return iter.NextWithContext(context.Background())
143}
144
145// NotDone returns true if the enumeration should be started or is not yet complete.
146func (iter OperationListResultIterator) NotDone() bool {
147	return iter.page.NotDone() && iter.i < len(iter.page.Values())
148}
149
150// Response returns the raw server response from the last page request.
151func (iter OperationListResultIterator) Response() OperationListResult {
152	return iter.page.Response()
153}
154
155// Value returns the current value or a zero-initialized value if the
156// iterator has advanced beyond the end of the collection.
157func (iter OperationListResultIterator) Value() OperationDefinition {
158	if !iter.page.NotDone() {
159		return OperationDefinition{}
160	}
161	return iter.page.Values()[iter.i]
162}
163
164// Creates a new instance of the OperationListResultIterator type.
165func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
166	return OperationListResultIterator{page: page}
167}
168
169// IsEmpty returns true if the ListResult contains no values.
170func (olr OperationListResult) IsEmpty() bool {
171	return olr.Value == nil || len(*olr.Value) == 0
172}
173
174// operationListResultPreparer prepares a request to retrieve the next set of results.
175// It returns nil if no more results exist.
176func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
177	if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
178		return nil, nil
179	}
180	return autorest.Prepare((&http.Request{}).WithContext(ctx),
181		autorest.AsJSON(),
182		autorest.AsGet(),
183		autorest.WithBaseURL(to.String(olr.NextLink)))
184}
185
186// OperationListResultPage contains a page of OperationDefinition values.
187type OperationListResultPage struct {
188	fn  func(context.Context, OperationListResult) (OperationListResult, error)
189	olr OperationListResult
190}
191
192// NextWithContext advances to the next page of values.  If there was an error making
193// the request the page does not advance and the error is returned.
194func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
195	if tracing.IsEnabled() {
196		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
197		defer func() {
198			sc := -1
199			if page.Response().Response.Response != nil {
200				sc = page.Response().Response.Response.StatusCode
201			}
202			tracing.EndSpan(ctx, sc, err)
203		}()
204	}
205	next, err := page.fn(ctx, page.olr)
206	if err != nil {
207		return err
208	}
209	page.olr = next
210	return nil
211}
212
213// Next advances to the next page of values.  If there was an error making
214// the request the page does not advance and the error is returned.
215// Deprecated: Use NextWithContext() instead.
216func (page *OperationListResultPage) Next() error {
217	return page.NextWithContext(context.Background())
218}
219
220// NotDone returns true if the page enumeration should be started or is not yet complete.
221func (page OperationListResultPage) NotDone() bool {
222	return !page.olr.IsEmpty()
223}
224
225// Response returns the raw server response from the last page request.
226func (page OperationListResultPage) Response() OperationListResult {
227	return page.olr
228}
229
230// Values returns the slice of values for the current page or nil if there are no values.
231func (page OperationListResultPage) Values() []OperationDefinition {
232	if page.olr.IsEmpty() {
233		return nil
234	}
235	return *page.olr.Value
236}
237
238// Creates a new instance of the OperationListResultPage type.
239func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
240	return OperationListResultPage{fn: getNextPage}
241}
242
243// RegenerateCredentialParameters the parameters used to regenerate the login credential.
244type RegenerateCredentialParameters struct {
245	// Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2'
246	Name PasswordName `json:"name,omitempty"`
247}
248
249// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running
250// operation.
251type RegistriesCreateFuture struct {
252	azure.Future
253}
254
255// Result returns the result of the asynchronous operation.
256// If the operation has not completed it will return an error.
257func (future *RegistriesCreateFuture) Result(client RegistriesClient) (r Registry, err error) {
258	var done bool
259	done, err = future.DoneWithContext(context.Background(), client)
260	if err != nil {
261		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure")
262		return
263	}
264	if !done {
265		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture")
266		return
267	}
268	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
269	if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {
270		r, err = client.CreateResponder(r.Response.Response)
271		if err != nil {
272			err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request")
273		}
274	}
275	return
276}
277
278// Registry an object that represents a container registry.
279type Registry struct {
280	autorest.Response `json:"-"`
281	// Sku - The SKU of the container registry.
282	Sku *Sku `json:"sku,omitempty"`
283	// RegistryProperties - The properties of the container registry.
284	*RegistryProperties `json:"properties,omitempty"`
285	// ID - READ-ONLY; The resource ID.
286	ID *string `json:"id,omitempty"`
287	// Name - READ-ONLY; The name of the resource.
288	Name *string `json:"name,omitempty"`
289	// Type - READ-ONLY; The type of the resource.
290	Type *string `json:"type,omitempty"`
291	// Location - The location of the resource. This cannot be changed after the resource is created.
292	Location *string `json:"location,omitempty"`
293	// Tags - The tags of the resource.
294	Tags map[string]*string `json:"tags"`
295}
296
297// MarshalJSON is the custom marshaler for Registry.
298func (r Registry) MarshalJSON() ([]byte, error) {
299	objectMap := make(map[string]interface{})
300	if r.Sku != nil {
301		objectMap["sku"] = r.Sku
302	}
303	if r.RegistryProperties != nil {
304		objectMap["properties"] = r.RegistryProperties
305	}
306	if r.Location != nil {
307		objectMap["location"] = r.Location
308	}
309	if r.Tags != nil {
310		objectMap["tags"] = r.Tags
311	}
312	return json.Marshal(objectMap)
313}
314
315// UnmarshalJSON is the custom unmarshaler for Registry struct.
316func (r *Registry) UnmarshalJSON(body []byte) error {
317	var m map[string]*json.RawMessage
318	err := json.Unmarshal(body, &m)
319	if err != nil {
320		return err
321	}
322	for k, v := range m {
323		switch k {
324		case "sku":
325			if v != nil {
326				var sku Sku
327				err = json.Unmarshal(*v, &sku)
328				if err != nil {
329					return err
330				}
331				r.Sku = &sku
332			}
333		case "properties":
334			if v != nil {
335				var registryProperties RegistryProperties
336				err = json.Unmarshal(*v, &registryProperties)
337				if err != nil {
338					return err
339				}
340				r.RegistryProperties = &registryProperties
341			}
342		case "id":
343			if v != nil {
344				var ID string
345				err = json.Unmarshal(*v, &ID)
346				if err != nil {
347					return err
348				}
349				r.ID = &ID
350			}
351		case "name":
352			if v != nil {
353				var name string
354				err = json.Unmarshal(*v, &name)
355				if err != nil {
356					return err
357				}
358				r.Name = &name
359			}
360		case "type":
361			if v != nil {
362				var typeVar string
363				err = json.Unmarshal(*v, &typeVar)
364				if err != nil {
365					return err
366				}
367				r.Type = &typeVar
368			}
369		case "location":
370			if v != nil {
371				var location string
372				err = json.Unmarshal(*v, &location)
373				if err != nil {
374					return err
375				}
376				r.Location = &location
377			}
378		case "tags":
379			if v != nil {
380				var tags map[string]*string
381				err = json.Unmarshal(*v, &tags)
382				if err != nil {
383					return err
384				}
385				r.Tags = tags
386			}
387		}
388	}
389
390	return nil
391}
392
393// RegistryCreateParameters the parameters for creating a container registry.
394type RegistryCreateParameters struct {
395	// Tags - The tags for the container registry.
396	Tags map[string]*string `json:"tags"`
397	// Location - The location of the container registry. This cannot be changed after the resource is created.
398	Location *string `json:"location,omitempty"`
399	// Sku - The SKU of the container registry.
400	Sku *Sku `json:"sku,omitempty"`
401	// RegistryPropertiesCreateParameters - The properties that the container registry will be created with.
402	*RegistryPropertiesCreateParameters `json:"properties,omitempty"`
403}
404
405// MarshalJSON is the custom marshaler for RegistryCreateParameters.
406func (rcp RegistryCreateParameters) MarshalJSON() ([]byte, error) {
407	objectMap := make(map[string]interface{})
408	if rcp.Tags != nil {
409		objectMap["tags"] = rcp.Tags
410	}
411	if rcp.Location != nil {
412		objectMap["location"] = rcp.Location
413	}
414	if rcp.Sku != nil {
415		objectMap["sku"] = rcp.Sku
416	}
417	if rcp.RegistryPropertiesCreateParameters != nil {
418		objectMap["properties"] = rcp.RegistryPropertiesCreateParameters
419	}
420	return json.Marshal(objectMap)
421}
422
423// UnmarshalJSON is the custom unmarshaler for RegistryCreateParameters struct.
424func (rcp *RegistryCreateParameters) UnmarshalJSON(body []byte) error {
425	var m map[string]*json.RawMessage
426	err := json.Unmarshal(body, &m)
427	if err != nil {
428		return err
429	}
430	for k, v := range m {
431		switch k {
432		case "tags":
433			if v != nil {
434				var tags map[string]*string
435				err = json.Unmarshal(*v, &tags)
436				if err != nil {
437					return err
438				}
439				rcp.Tags = tags
440			}
441		case "location":
442			if v != nil {
443				var location string
444				err = json.Unmarshal(*v, &location)
445				if err != nil {
446					return err
447				}
448				rcp.Location = &location
449			}
450		case "sku":
451			if v != nil {
452				var sku Sku
453				err = json.Unmarshal(*v, &sku)
454				if err != nil {
455					return err
456				}
457				rcp.Sku = &sku
458			}
459		case "properties":
460			if v != nil {
461				var registryPropertiesCreateParameters RegistryPropertiesCreateParameters
462				err = json.Unmarshal(*v, &registryPropertiesCreateParameters)
463				if err != nil {
464					return err
465				}
466				rcp.RegistryPropertiesCreateParameters = &registryPropertiesCreateParameters
467			}
468		}
469	}
470
471	return nil
472}
473
474// RegistryListCredentialsResult the response from the ListCredentials operation.
475type RegistryListCredentialsResult struct {
476	autorest.Response `json:"-"`
477	// Username - The username for a container registry.
478	Username *string `json:"username,omitempty"`
479	// Passwords - The list of passwords for a container registry.
480	Passwords *[]RegistryPassword `json:"passwords,omitempty"`
481}
482
483// RegistryListResult the result of a request to list container registries.
484type RegistryListResult struct {
485	autorest.Response `json:"-"`
486	// Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries.
487	Value *[]Registry `json:"value,omitempty"`
488	// NextLink - The URI that can be used to request the next list of container registries.
489	NextLink *string `json:"nextLink,omitempty"`
490}
491
492// RegistryListResultIterator provides access to a complete listing of Registry values.
493type RegistryListResultIterator struct {
494	i    int
495	page RegistryListResultPage
496}
497
498// NextWithContext advances to the next value.  If there was an error making
499// the request the iterator does not advance and the error is returned.
500func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) {
501	if tracing.IsEnabled() {
502		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext")
503		defer func() {
504			sc := -1
505			if iter.Response().Response.Response != nil {
506				sc = iter.Response().Response.Response.StatusCode
507			}
508			tracing.EndSpan(ctx, sc, err)
509		}()
510	}
511	iter.i++
512	if iter.i < len(iter.page.Values()) {
513		return nil
514	}
515	err = iter.page.NextWithContext(ctx)
516	if err != nil {
517		iter.i--
518		return err
519	}
520	iter.i = 0
521	return nil
522}
523
524// Next advances to the next value.  If there was an error making
525// the request the iterator does not advance and the error is returned.
526// Deprecated: Use NextWithContext() instead.
527func (iter *RegistryListResultIterator) Next() error {
528	return iter.NextWithContext(context.Background())
529}
530
531// NotDone returns true if the enumeration should be started or is not yet complete.
532func (iter RegistryListResultIterator) NotDone() bool {
533	return iter.page.NotDone() && iter.i < len(iter.page.Values())
534}
535
536// Response returns the raw server response from the last page request.
537func (iter RegistryListResultIterator) Response() RegistryListResult {
538	return iter.page.Response()
539}
540
541// Value returns the current value or a zero-initialized value if the
542// iterator has advanced beyond the end of the collection.
543func (iter RegistryListResultIterator) Value() Registry {
544	if !iter.page.NotDone() {
545		return Registry{}
546	}
547	return iter.page.Values()[iter.i]
548}
549
550// Creates a new instance of the RegistryListResultIterator type.
551func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator {
552	return RegistryListResultIterator{page: page}
553}
554
555// IsEmpty returns true if the ListResult contains no values.
556func (rlr RegistryListResult) IsEmpty() bool {
557	return rlr.Value == nil || len(*rlr.Value) == 0
558}
559
560// registryListResultPreparer prepares a request to retrieve the next set of results.
561// It returns nil if no more results exist.
562func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) {
563	if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 {
564		return nil, nil
565	}
566	return autorest.Prepare((&http.Request{}).WithContext(ctx),
567		autorest.AsJSON(),
568		autorest.AsGet(),
569		autorest.WithBaseURL(to.String(rlr.NextLink)))
570}
571
572// RegistryListResultPage contains a page of Registry values.
573type RegistryListResultPage struct {
574	fn  func(context.Context, RegistryListResult) (RegistryListResult, error)
575	rlr RegistryListResult
576}
577
578// NextWithContext advances to the next page of values.  If there was an error making
579// the request the page does not advance and the error is returned.
580func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) {
581	if tracing.IsEnabled() {
582		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext")
583		defer func() {
584			sc := -1
585			if page.Response().Response.Response != nil {
586				sc = page.Response().Response.Response.StatusCode
587			}
588			tracing.EndSpan(ctx, sc, err)
589		}()
590	}
591	next, err := page.fn(ctx, page.rlr)
592	if err != nil {
593		return err
594	}
595	page.rlr = next
596	return nil
597}
598
599// Next advances to the next page of values.  If there was an error making
600// the request the page does not advance and the error is returned.
601// Deprecated: Use NextWithContext() instead.
602func (page *RegistryListResultPage) Next() error {
603	return page.NextWithContext(context.Background())
604}
605
606// NotDone returns true if the page enumeration should be started or is not yet complete.
607func (page RegistryListResultPage) NotDone() bool {
608	return !page.rlr.IsEmpty()
609}
610
611// Response returns the raw server response from the last page request.
612func (page RegistryListResultPage) Response() RegistryListResult {
613	return page.rlr
614}
615
616// Values returns the slice of values for the current page or nil if there are no values.
617func (page RegistryListResultPage) Values() []Registry {
618	if page.rlr.IsEmpty() {
619		return nil
620	}
621	return *page.rlr.Value
622}
623
624// Creates a new instance of the RegistryListResultPage type.
625func NewRegistryListResultPage(getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage {
626	return RegistryListResultPage{fn: getNextPage}
627}
628
629// RegistryNameCheckRequest a request to check whether a container registry name is available.
630type RegistryNameCheckRequest struct {
631	// Name - The name of the container registry.
632	Name *string `json:"name,omitempty"`
633	// Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'.
634	Type *string `json:"type,omitempty"`
635}
636
637// RegistryNameStatus the result of a request to check the availability of a container registry name.
638type RegistryNameStatus struct {
639	autorest.Response `json:"-"`
640	// NameAvailable - The value that indicates whether the name is available.
641	NameAvailable *bool `json:"nameAvailable,omitempty"`
642	// Reason - If any, the reason that the name is not available.
643	Reason *string `json:"reason,omitempty"`
644	// Message - If any, the error message that provides more detail for the reason that the name is not available.
645	Message *string `json:"message,omitempty"`
646}
647
648// RegistryPassword the login password for the container registry.
649type RegistryPassword struct {
650	// Name - The password name. Possible values include: 'Password', 'Password2'
651	Name PasswordName `json:"name,omitempty"`
652	// Value - The password value.
653	Value *string `json:"value,omitempty"`
654}
655
656// RegistryProperties the properties of a container registry.
657type RegistryProperties struct {
658	// LoginServer - READ-ONLY; The URL that can be used to log into the container registry.
659	LoginServer *string `json:"loginServer,omitempty"`
660	// CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format.
661	CreationDate *date.Time `json:"creationDate,omitempty"`
662	// ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Succeeded'
663	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
664	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
665	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
666	// StorageAccount - The properties of the storage account for the container registry.
667	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
668}
669
670// RegistryPropertiesCreateParameters the parameters for creating the properties of a container registry.
671type RegistryPropertiesCreateParameters struct {
672	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
673	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
674	// StorageAccount - The parameters of a storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry.
675	StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"`
676}
677
678// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry.
679type RegistryPropertiesUpdateParameters struct {
680	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
681	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
682	// StorageAccount - The parameters of a storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry.
683	StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"`
684}
685
686// RegistryUpdateParameters the parameters for updating a container registry.
687type RegistryUpdateParameters struct {
688	// Tags - The tags for the container registry.
689	Tags map[string]*string `json:"tags"`
690	// RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with.
691	*RegistryPropertiesUpdateParameters `json:"properties,omitempty"`
692}
693
694// MarshalJSON is the custom marshaler for RegistryUpdateParameters.
695func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) {
696	objectMap := make(map[string]interface{})
697	if rup.Tags != nil {
698		objectMap["tags"] = rup.Tags
699	}
700	if rup.RegistryPropertiesUpdateParameters != nil {
701		objectMap["properties"] = rup.RegistryPropertiesUpdateParameters
702	}
703	return json.Marshal(objectMap)
704}
705
706// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct.
707func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error {
708	var m map[string]*json.RawMessage
709	err := json.Unmarshal(body, &m)
710	if err != nil {
711		return err
712	}
713	for k, v := range m {
714		switch k {
715		case "tags":
716			if v != nil {
717				var tags map[string]*string
718				err = json.Unmarshal(*v, &tags)
719				if err != nil {
720					return err
721				}
722				rup.Tags = tags
723			}
724		case "properties":
725			if v != nil {
726				var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters
727				err = json.Unmarshal(*v, &registryPropertiesUpdateParameters)
728				if err != nil {
729					return err
730				}
731				rup.RegistryPropertiesUpdateParameters = &registryPropertiesUpdateParameters
732			}
733		}
734	}
735
736	return nil
737}
738
739// Resource an Azure resource.
740type Resource struct {
741	// ID - READ-ONLY; The resource ID.
742	ID *string `json:"id,omitempty"`
743	// Name - READ-ONLY; The name of the resource.
744	Name *string `json:"name,omitempty"`
745	// Type - READ-ONLY; The type of the resource.
746	Type *string `json:"type,omitempty"`
747	// Location - The location of the resource. This cannot be changed after the resource is created.
748	Location *string `json:"location,omitempty"`
749	// Tags - The tags of the resource.
750	Tags map[string]*string `json:"tags"`
751}
752
753// MarshalJSON is the custom marshaler for Resource.
754func (r Resource) MarshalJSON() ([]byte, error) {
755	objectMap := make(map[string]interface{})
756	if r.Location != nil {
757		objectMap["location"] = r.Location
758	}
759	if r.Tags != nil {
760		objectMap["tags"] = r.Tags
761	}
762	return json.Marshal(objectMap)
763}
764
765// Sku the SKU of a container registry.
766type Sku struct {
767	// Name - The SKU name of the container registry. Required for registry creation. Allowed value: Basic.
768	Name *string `json:"name,omitempty"`
769	// Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'Basic'
770	Tier SkuTier `json:"tier,omitempty"`
771}
772
773// StorageAccountParameters the parameters of a storage account for a container registry.
774type StorageAccountParameters struct {
775	// Name - The name of the storage account.
776	Name *string `json:"name,omitempty"`
777	// AccessKey - The access key to the storage account.
778	AccessKey *string `json:"accessKey,omitempty"`
779}
780
781// StorageAccountProperties the properties of a storage account for a container registry.
782type StorageAccountProperties struct {
783	// Name - The name of the storage account.
784	Name *string `json:"name,omitempty"`
785}
786