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