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/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry"
33
34// Actor the agent that initiated the event. For most situations, this could be from the authorization
35// context of the request.
36type Actor struct {
37	// Name - The subject or username associated with the request context that generated the event.
38	Name *string `json:"name,omitempty"`
39}
40
41// CallbackConfig the configuration of service URI and custom headers for the webhook.
42type CallbackConfig struct {
43	autorest.Response `json:"-"`
44	// ServiceURI - The service URI for the webhook to post notifications.
45	ServiceURI *string `json:"serviceUri,omitempty"`
46	// CustomHeaders - Custom headers that will be added to the webhook notifications.
47	CustomHeaders map[string]*string `json:"customHeaders"`
48}
49
50// MarshalJSON is the custom marshaler for CallbackConfig.
51func (cc CallbackConfig) MarshalJSON() ([]byte, error) {
52	objectMap := make(map[string]interface{})
53	if cc.ServiceURI != nil {
54		objectMap["serviceUri"] = cc.ServiceURI
55	}
56	if cc.CustomHeaders != nil {
57		objectMap["customHeaders"] = cc.CustomHeaders
58	}
59	return json.Marshal(objectMap)
60}
61
62// Event the event for a webhook.
63type Event struct {
64	// EventRequestMessage - The event request message sent to the service URI.
65	EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"`
66	// EventResponseMessage - The event response message received from the service URI.
67	EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"`
68	// ID - The event ID.
69	ID *string `json:"id,omitempty"`
70}
71
72// EventContent the content of the event request message.
73type EventContent struct {
74	// ID - The event ID.
75	ID *string `json:"id,omitempty"`
76	// Timestamp - The time at which the event occurred.
77	Timestamp *date.Time `json:"timestamp,omitempty"`
78	// Action - The action that encompasses the provided event.
79	Action *string `json:"action,omitempty"`
80	// Target - The target of the event.
81	Target *Target `json:"target,omitempty"`
82	// Request - The request that generated the event.
83	Request *Request `json:"request,omitempty"`
84	// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request.
85	Actor *Actor `json:"actor,omitempty"`
86	// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it.
87	Source *Source `json:"source,omitempty"`
88}
89
90// EventInfo the basic information of an event.
91type EventInfo struct {
92	autorest.Response `json:"-"`
93	// ID - The event ID.
94	ID *string `json:"id,omitempty"`
95}
96
97// EventListResult the result of a request to list events for a webhook.
98type EventListResult struct {
99	autorest.Response `json:"-"`
100	// Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events.
101	Value *[]Event `json:"value,omitempty"`
102	// NextLink - The URI that can be used to request the next list of events.
103	NextLink *string `json:"nextLink,omitempty"`
104}
105
106// EventListResultIterator provides access to a complete listing of Event values.
107type EventListResultIterator struct {
108	i    int
109	page EventListResultPage
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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) {
115	if tracing.IsEnabled() {
116		ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) 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 EventListResultIterator) 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 EventListResultIterator) Response() EventListResult {
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 EventListResultIterator) Value() Event {
158	if !iter.page.NotDone() {
159		return Event{}
160	}
161	return iter.page.Values()[iter.i]
162}
163
164// Creates a new instance of the EventListResultIterator type.
165func NewEventListResultIterator(page EventListResultPage) EventListResultIterator {
166	return EventListResultIterator{page: page}
167}
168
169// IsEmpty returns true if the ListResult contains no values.
170func (elr EventListResult) IsEmpty() bool {
171	return elr.Value == nil || len(*elr.Value) == 0
172}
173
174// hasNextLink returns true if the NextLink is not empty.
175func (elr EventListResult) hasNextLink() bool {
176	return elr.NextLink != nil && len(*elr.NextLink) != 0
177}
178
179// eventListResultPreparer prepares a request to retrieve the next set of results.
180// It returns nil if no more results exist.
181func (elr EventListResult) eventListResultPreparer(ctx context.Context) (*http.Request, error) {
182	if !elr.hasNextLink() {
183		return nil, nil
184	}
185	return autorest.Prepare((&http.Request{}).WithContext(ctx),
186		autorest.AsJSON(),
187		autorest.AsGet(),
188		autorest.WithBaseURL(to.String(elr.NextLink)))
189}
190
191// EventListResultPage contains a page of Event values.
192type EventListResultPage struct {
193	fn  func(context.Context, EventListResult) (EventListResult, error)
194	elr EventListResult
195}
196
197// NextWithContext advances to the next page of values.  If there was an error making
198// the request the page does not advance and the error is returned.
199func (page *EventListResultPage) NextWithContext(ctx context.Context) (err error) {
200	if tracing.IsEnabled() {
201		ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.NextWithContext")
202		defer func() {
203			sc := -1
204			if page.Response().Response.Response != nil {
205				sc = page.Response().Response.Response.StatusCode
206			}
207			tracing.EndSpan(ctx, sc, err)
208		}()
209	}
210	for {
211		next, err := page.fn(ctx, page.elr)
212		if err != nil {
213			return err
214		}
215		page.elr = next
216		if !next.hasNextLink() || !next.IsEmpty() {
217			break
218		}
219	}
220	return nil
221}
222
223// Next advances to the next page of values.  If there was an error making
224// the request the page does not advance and the error is returned.
225// Deprecated: Use NextWithContext() instead.
226func (page *EventListResultPage) Next() error {
227	return page.NextWithContext(context.Background())
228}
229
230// NotDone returns true if the page enumeration should be started or is not yet complete.
231func (page EventListResultPage) NotDone() bool {
232	return !page.elr.IsEmpty()
233}
234
235// Response returns the raw server response from the last page request.
236func (page EventListResultPage) Response() EventListResult {
237	return page.elr
238}
239
240// Values returns the slice of values for the current page or nil if there are no values.
241func (page EventListResultPage) Values() []Event {
242	if page.elr.IsEmpty() {
243		return nil
244	}
245	return *page.elr.Value
246}
247
248// Creates a new instance of the EventListResultPage type.
249func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage {
250	return EventListResultPage{
251		fn:  getNextPage,
252		elr: cur,
253	}
254}
255
256// EventRequestMessage the event request message sent to the service URI.
257type EventRequestMessage struct {
258	// Content - The content of the event request message.
259	Content *EventContent `json:"content,omitempty"`
260	// Headers - The headers of the event request message.
261	Headers map[string]*string `json:"headers"`
262	// Method - The HTTP method used to send the event request message.
263	Method *string `json:"method,omitempty"`
264	// RequestURI - The URI used to send the event request message.
265	RequestURI *string `json:"requestUri,omitempty"`
266	// Version - The HTTP message version.
267	Version *string `json:"version,omitempty"`
268}
269
270// MarshalJSON is the custom marshaler for EventRequestMessage.
271func (erm EventRequestMessage) MarshalJSON() ([]byte, error) {
272	objectMap := make(map[string]interface{})
273	if erm.Content != nil {
274		objectMap["content"] = erm.Content
275	}
276	if erm.Headers != nil {
277		objectMap["headers"] = erm.Headers
278	}
279	if erm.Method != nil {
280		objectMap["method"] = erm.Method
281	}
282	if erm.RequestURI != nil {
283		objectMap["requestUri"] = erm.RequestURI
284	}
285	if erm.Version != nil {
286		objectMap["version"] = erm.Version
287	}
288	return json.Marshal(objectMap)
289}
290
291// EventResponseMessage the event response message received from the service URI.
292type EventResponseMessage struct {
293	// Content - The content of the event response message.
294	Content *string `json:"content,omitempty"`
295	// Headers - The headers of the event response message.
296	Headers map[string]*string `json:"headers"`
297	// ReasonPhrase - The reason phrase of the event response message.
298	ReasonPhrase *string `json:"reasonPhrase,omitempty"`
299	// StatusCode - The status code of the event response message.
300	StatusCode *string `json:"statusCode,omitempty"`
301	// Version - The HTTP message version.
302	Version *string `json:"version,omitempty"`
303}
304
305// MarshalJSON is the custom marshaler for EventResponseMessage.
306func (erm EventResponseMessage) MarshalJSON() ([]byte, error) {
307	objectMap := make(map[string]interface{})
308	if erm.Content != nil {
309		objectMap["content"] = erm.Content
310	}
311	if erm.Headers != nil {
312		objectMap["headers"] = erm.Headers
313	}
314	if erm.ReasonPhrase != nil {
315		objectMap["reasonPhrase"] = erm.ReasonPhrase
316	}
317	if erm.StatusCode != nil {
318		objectMap["statusCode"] = erm.StatusCode
319	}
320	if erm.Version != nil {
321		objectMap["version"] = erm.Version
322	}
323	return json.Marshal(objectMap)
324}
325
326// OperationDefinition the definition of a container registry operation.
327type OperationDefinition struct {
328	// Name - Operation name: {provider}/{resource}/{operation}.
329	Name *string `json:"name,omitempty"`
330	// Display - The display information for the container registry operation.
331	Display *OperationDisplayDefinition `json:"display,omitempty"`
332}
333
334// OperationDisplayDefinition the display information for a container registry operation.
335type OperationDisplayDefinition struct {
336	// Provider - The resource provider name: Microsoft.ContainerRegistry.
337	Provider *string `json:"provider,omitempty"`
338	// Resource - The resource on which the operation is performed.
339	Resource *string `json:"resource,omitempty"`
340	// Operation - The operation that users can perform.
341	Operation *string `json:"operation,omitempty"`
342	// Description - The description for the operation.
343	Description *string `json:"description,omitempty"`
344}
345
346// OperationListResult the result of a request to list container registry operations.
347type OperationListResult struct {
348	autorest.Response `json:"-"`
349	// 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.
350	Value *[]OperationDefinition `json:"value,omitempty"`
351	// NextLink - The URI that can be used to request the next list of container registry operations.
352	NextLink *string `json:"nextLink,omitempty"`
353}
354
355// OperationListResultIterator provides access to a complete listing of OperationDefinition values.
356type OperationListResultIterator struct {
357	i    int
358	page OperationListResultPage
359}
360
361// NextWithContext advances to the next value.  If there was an error making
362// the request the iterator does not advance and the error is returned.
363func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
364	if tracing.IsEnabled() {
365		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
366		defer func() {
367			sc := -1
368			if iter.Response().Response.Response != nil {
369				sc = iter.Response().Response.Response.StatusCode
370			}
371			tracing.EndSpan(ctx, sc, err)
372		}()
373	}
374	iter.i++
375	if iter.i < len(iter.page.Values()) {
376		return nil
377	}
378	err = iter.page.NextWithContext(ctx)
379	if err != nil {
380		iter.i--
381		return err
382	}
383	iter.i = 0
384	return nil
385}
386
387// Next advances to the next value.  If there was an error making
388// the request the iterator does not advance and the error is returned.
389// Deprecated: Use NextWithContext() instead.
390func (iter *OperationListResultIterator) Next() error {
391	return iter.NextWithContext(context.Background())
392}
393
394// NotDone returns true if the enumeration should be started or is not yet complete.
395func (iter OperationListResultIterator) NotDone() bool {
396	return iter.page.NotDone() && iter.i < len(iter.page.Values())
397}
398
399// Response returns the raw server response from the last page request.
400func (iter OperationListResultIterator) Response() OperationListResult {
401	return iter.page.Response()
402}
403
404// Value returns the current value or a zero-initialized value if the
405// iterator has advanced beyond the end of the collection.
406func (iter OperationListResultIterator) Value() OperationDefinition {
407	if !iter.page.NotDone() {
408		return OperationDefinition{}
409	}
410	return iter.page.Values()[iter.i]
411}
412
413// Creates a new instance of the OperationListResultIterator type.
414func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
415	return OperationListResultIterator{page: page}
416}
417
418// IsEmpty returns true if the ListResult contains no values.
419func (olr OperationListResult) IsEmpty() bool {
420	return olr.Value == nil || len(*olr.Value) == 0
421}
422
423// hasNextLink returns true if the NextLink is not empty.
424func (olr OperationListResult) hasNextLink() bool {
425	return olr.NextLink != nil && len(*olr.NextLink) != 0
426}
427
428// operationListResultPreparer prepares a request to retrieve the next set of results.
429// It returns nil if no more results exist.
430func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
431	if !olr.hasNextLink() {
432		return nil, nil
433	}
434	return autorest.Prepare((&http.Request{}).WithContext(ctx),
435		autorest.AsJSON(),
436		autorest.AsGet(),
437		autorest.WithBaseURL(to.String(olr.NextLink)))
438}
439
440// OperationListResultPage contains a page of OperationDefinition values.
441type OperationListResultPage struct {
442	fn  func(context.Context, OperationListResult) (OperationListResult, error)
443	olr OperationListResult
444}
445
446// NextWithContext advances to the next page of values.  If there was an error making
447// the request the page does not advance and the error is returned.
448func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
449	if tracing.IsEnabled() {
450		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
451		defer func() {
452			sc := -1
453			if page.Response().Response.Response != nil {
454				sc = page.Response().Response.Response.StatusCode
455			}
456			tracing.EndSpan(ctx, sc, err)
457		}()
458	}
459	for {
460		next, err := page.fn(ctx, page.olr)
461		if err != nil {
462			return err
463		}
464		page.olr = next
465		if !next.hasNextLink() || !next.IsEmpty() {
466			break
467		}
468	}
469	return nil
470}
471
472// Next advances to the next page of values.  If there was an error making
473// the request the page does not advance and the error is returned.
474// Deprecated: Use NextWithContext() instead.
475func (page *OperationListResultPage) Next() error {
476	return page.NextWithContext(context.Background())
477}
478
479// NotDone returns true if the page enumeration should be started or is not yet complete.
480func (page OperationListResultPage) NotDone() bool {
481	return !page.olr.IsEmpty()
482}
483
484// Response returns the raw server response from the last page request.
485func (page OperationListResultPage) Response() OperationListResult {
486	return page.olr
487}
488
489// Values returns the slice of values for the current page or nil if there are no values.
490func (page OperationListResultPage) Values() []OperationDefinition {
491	if page.olr.IsEmpty() {
492		return nil
493	}
494	return *page.olr.Value
495}
496
497// Creates a new instance of the OperationListResultPage type.
498func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
499	return OperationListResultPage{
500		fn:  getNextPage,
501		olr: cur,
502	}
503}
504
505// RegenerateCredentialParameters the parameters used to regenerate the login credential.
506type RegenerateCredentialParameters struct {
507	// Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2'
508	Name PasswordName `json:"name,omitempty"`
509}
510
511// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running
512// operation.
513type RegistriesCreateFuture struct {
514	azure.FutureAPI
515	// Result returns the result of the asynchronous operation.
516	// If the operation has not completed it will return an error.
517	Result func(RegistriesClient) (Registry, error)
518}
519
520// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
521// operation.
522type RegistriesDeleteFuture struct {
523	azure.FutureAPI
524	// Result returns the result of the asynchronous operation.
525	// If the operation has not completed it will return an error.
526	Result func(RegistriesClient) (autorest.Response, error)
527}
528
529// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
530// operation.
531type RegistriesUpdateFuture struct {
532	azure.FutureAPI
533	// Result returns the result of the asynchronous operation.
534	// If the operation has not completed it will return an error.
535	Result func(RegistriesClient) (Registry, error)
536}
537
538// Registry an object that represents a container registry.
539type Registry struct {
540	autorest.Response `json:"-"`
541	// Sku - The SKU of the container registry.
542	Sku *Sku `json:"sku,omitempty"`
543	// RegistryProperties - The properties of the container registry.
544	*RegistryProperties `json:"properties,omitempty"`
545	// ID - READ-ONLY; The resource ID.
546	ID *string `json:"id,omitempty"`
547	// Name - READ-ONLY; The name of the resource.
548	Name *string `json:"name,omitempty"`
549	// Type - READ-ONLY; The type of the resource.
550	Type *string `json:"type,omitempty"`
551	// Location - The location of the resource. This cannot be changed after the resource is created.
552	Location *string `json:"location,omitempty"`
553	// Tags - The tags of the resource.
554	Tags map[string]*string `json:"tags"`
555}
556
557// MarshalJSON is the custom marshaler for Registry.
558func (r Registry) MarshalJSON() ([]byte, error) {
559	objectMap := make(map[string]interface{})
560	if r.Sku != nil {
561		objectMap["sku"] = r.Sku
562	}
563	if r.RegistryProperties != nil {
564		objectMap["properties"] = r.RegistryProperties
565	}
566	if r.Location != nil {
567		objectMap["location"] = r.Location
568	}
569	if r.Tags != nil {
570		objectMap["tags"] = r.Tags
571	}
572	return json.Marshal(objectMap)
573}
574
575// UnmarshalJSON is the custom unmarshaler for Registry struct.
576func (r *Registry) UnmarshalJSON(body []byte) error {
577	var m map[string]*json.RawMessage
578	err := json.Unmarshal(body, &m)
579	if err != nil {
580		return err
581	}
582	for k, v := range m {
583		switch k {
584		case "sku":
585			if v != nil {
586				var sku Sku
587				err = json.Unmarshal(*v, &sku)
588				if err != nil {
589					return err
590				}
591				r.Sku = &sku
592			}
593		case "properties":
594			if v != nil {
595				var registryProperties RegistryProperties
596				err = json.Unmarshal(*v, &registryProperties)
597				if err != nil {
598					return err
599				}
600				r.RegistryProperties = &registryProperties
601			}
602		case "id":
603			if v != nil {
604				var ID string
605				err = json.Unmarshal(*v, &ID)
606				if err != nil {
607					return err
608				}
609				r.ID = &ID
610			}
611		case "name":
612			if v != nil {
613				var name string
614				err = json.Unmarshal(*v, &name)
615				if err != nil {
616					return err
617				}
618				r.Name = &name
619			}
620		case "type":
621			if v != nil {
622				var typeVar string
623				err = json.Unmarshal(*v, &typeVar)
624				if err != nil {
625					return err
626				}
627				r.Type = &typeVar
628			}
629		case "location":
630			if v != nil {
631				var location string
632				err = json.Unmarshal(*v, &location)
633				if err != nil {
634					return err
635				}
636				r.Location = &location
637			}
638		case "tags":
639			if v != nil {
640				var tags map[string]*string
641				err = json.Unmarshal(*v, &tags)
642				if err != nil {
643					return err
644				}
645				r.Tags = tags
646			}
647		}
648	}
649
650	return nil
651}
652
653// RegistryListCredentialsResult the response from the ListCredentials operation.
654type RegistryListCredentialsResult struct {
655	autorest.Response `json:"-"`
656	// Username - The username for a container registry.
657	Username *string `json:"username,omitempty"`
658	// Passwords - The list of passwords for a container registry.
659	Passwords *[]RegistryPassword `json:"passwords,omitempty"`
660}
661
662// RegistryListResult the result of a request to list container registries.
663type RegistryListResult struct {
664	autorest.Response `json:"-"`
665	// 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.
666	Value *[]Registry `json:"value,omitempty"`
667	// NextLink - The URI that can be used to request the next list of container registries.
668	NextLink *string `json:"nextLink,omitempty"`
669}
670
671// RegistryListResultIterator provides access to a complete listing of Registry values.
672type RegistryListResultIterator struct {
673	i    int
674	page RegistryListResultPage
675}
676
677// NextWithContext advances to the next value.  If there was an error making
678// the request the iterator does not advance and the error is returned.
679func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) {
680	if tracing.IsEnabled() {
681		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext")
682		defer func() {
683			sc := -1
684			if iter.Response().Response.Response != nil {
685				sc = iter.Response().Response.Response.StatusCode
686			}
687			tracing.EndSpan(ctx, sc, err)
688		}()
689	}
690	iter.i++
691	if iter.i < len(iter.page.Values()) {
692		return nil
693	}
694	err = iter.page.NextWithContext(ctx)
695	if err != nil {
696		iter.i--
697		return err
698	}
699	iter.i = 0
700	return nil
701}
702
703// Next advances to the next value.  If there was an error making
704// the request the iterator does not advance and the error is returned.
705// Deprecated: Use NextWithContext() instead.
706func (iter *RegistryListResultIterator) Next() error {
707	return iter.NextWithContext(context.Background())
708}
709
710// NotDone returns true if the enumeration should be started or is not yet complete.
711func (iter RegistryListResultIterator) NotDone() bool {
712	return iter.page.NotDone() && iter.i < len(iter.page.Values())
713}
714
715// Response returns the raw server response from the last page request.
716func (iter RegistryListResultIterator) Response() RegistryListResult {
717	return iter.page.Response()
718}
719
720// Value returns the current value or a zero-initialized value if the
721// iterator has advanced beyond the end of the collection.
722func (iter RegistryListResultIterator) Value() Registry {
723	if !iter.page.NotDone() {
724		return Registry{}
725	}
726	return iter.page.Values()[iter.i]
727}
728
729// Creates a new instance of the RegistryListResultIterator type.
730func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator {
731	return RegistryListResultIterator{page: page}
732}
733
734// IsEmpty returns true if the ListResult contains no values.
735func (rlr RegistryListResult) IsEmpty() bool {
736	return rlr.Value == nil || len(*rlr.Value) == 0
737}
738
739// hasNextLink returns true if the NextLink is not empty.
740func (rlr RegistryListResult) hasNextLink() bool {
741	return rlr.NextLink != nil && len(*rlr.NextLink) != 0
742}
743
744// registryListResultPreparer prepares a request to retrieve the next set of results.
745// It returns nil if no more results exist.
746func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) {
747	if !rlr.hasNextLink() {
748		return nil, nil
749	}
750	return autorest.Prepare((&http.Request{}).WithContext(ctx),
751		autorest.AsJSON(),
752		autorest.AsGet(),
753		autorest.WithBaseURL(to.String(rlr.NextLink)))
754}
755
756// RegistryListResultPage contains a page of Registry values.
757type RegistryListResultPage struct {
758	fn  func(context.Context, RegistryListResult) (RegistryListResult, error)
759	rlr RegistryListResult
760}
761
762// NextWithContext advances to the next page of values.  If there was an error making
763// the request the page does not advance and the error is returned.
764func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) {
765	if tracing.IsEnabled() {
766		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext")
767		defer func() {
768			sc := -1
769			if page.Response().Response.Response != nil {
770				sc = page.Response().Response.Response.StatusCode
771			}
772			tracing.EndSpan(ctx, sc, err)
773		}()
774	}
775	for {
776		next, err := page.fn(ctx, page.rlr)
777		if err != nil {
778			return err
779		}
780		page.rlr = next
781		if !next.hasNextLink() || !next.IsEmpty() {
782			break
783		}
784	}
785	return nil
786}
787
788// Next advances to the next page of values.  If there was an error making
789// the request the page does not advance and the error is returned.
790// Deprecated: Use NextWithContext() instead.
791func (page *RegistryListResultPage) Next() error {
792	return page.NextWithContext(context.Background())
793}
794
795// NotDone returns true if the page enumeration should be started or is not yet complete.
796func (page RegistryListResultPage) NotDone() bool {
797	return !page.rlr.IsEmpty()
798}
799
800// Response returns the raw server response from the last page request.
801func (page RegistryListResultPage) Response() RegistryListResult {
802	return page.rlr
803}
804
805// Values returns the slice of values for the current page or nil if there are no values.
806func (page RegistryListResultPage) Values() []Registry {
807	if page.rlr.IsEmpty() {
808		return nil
809	}
810	return *page.rlr.Value
811}
812
813// Creates a new instance of the RegistryListResultPage type.
814func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage {
815	return RegistryListResultPage{
816		fn:  getNextPage,
817		rlr: cur,
818	}
819}
820
821// RegistryNameCheckRequest a request to check whether a container registry name is available.
822type RegistryNameCheckRequest struct {
823	// Name - The name of the container registry.
824	Name *string `json:"name,omitempty"`
825	// Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'.
826	Type *string `json:"type,omitempty"`
827}
828
829// RegistryNameStatus the result of a request to check the availability of a container registry name.
830type RegistryNameStatus struct {
831	autorest.Response `json:"-"`
832	// NameAvailable - The value that indicates whether the name is available.
833	NameAvailable *bool `json:"nameAvailable,omitempty"`
834	// Reason - If any, the reason that the name is not available.
835	Reason *string `json:"reason,omitempty"`
836	// Message - If any, the error message that provides more detail for the reason that the name is not available.
837	Message *string `json:"message,omitempty"`
838}
839
840// RegistryPassword the login password for the container registry.
841type RegistryPassword struct {
842	// Name - The password name. Possible values include: 'Password', 'Password2'
843	Name PasswordName `json:"name,omitempty"`
844	// Value - The password value.
845	Value *string `json:"value,omitempty"`
846}
847
848// RegistryProperties the properties of a container registry.
849type RegistryProperties struct {
850	// LoginServer - READ-ONLY; The URL that can be used to log into the container registry.
851	LoginServer *string `json:"loginServer,omitempty"`
852	// CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format.
853	CreationDate *date.Time `json:"creationDate,omitempty"`
854	// ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'
855	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
856	// Status - READ-ONLY; The status of the container registry at the time the operation was called.
857	Status *Status `json:"status,omitempty"`
858	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
859	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
860	// StorageAccount - The properties of the storage account for the container registry. Only applicable to Basic SKU.
861	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
862}
863
864// MarshalJSON is the custom marshaler for RegistryProperties.
865func (rp RegistryProperties) MarshalJSON() ([]byte, error) {
866	objectMap := make(map[string]interface{})
867	if rp.AdminUserEnabled != nil {
868		objectMap["adminUserEnabled"] = rp.AdminUserEnabled
869	}
870	if rp.StorageAccount != nil {
871		objectMap["storageAccount"] = rp.StorageAccount
872	}
873	return json.Marshal(objectMap)
874}
875
876// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry.
877type RegistryPropertiesUpdateParameters struct {
878	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
879	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
880	// StorageAccount - The parameters of a storage account for the container registry. Only applicable to Basic SKU. If specified, the storage account must be in the same physical location as the container registry.
881	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
882}
883
884// RegistryUpdateParameters the parameters for updating a container registry.
885type RegistryUpdateParameters struct {
886	// Tags - The tags for the container registry.
887	Tags map[string]*string `json:"tags"`
888	// Sku - The SKU of the container registry.
889	Sku *Sku `json:"sku,omitempty"`
890	// RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with.
891	*RegistryPropertiesUpdateParameters `json:"properties,omitempty"`
892}
893
894// MarshalJSON is the custom marshaler for RegistryUpdateParameters.
895func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) {
896	objectMap := make(map[string]interface{})
897	if rup.Tags != nil {
898		objectMap["tags"] = rup.Tags
899	}
900	if rup.Sku != nil {
901		objectMap["sku"] = rup.Sku
902	}
903	if rup.RegistryPropertiesUpdateParameters != nil {
904		objectMap["properties"] = rup.RegistryPropertiesUpdateParameters
905	}
906	return json.Marshal(objectMap)
907}
908
909// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct.
910func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error {
911	var m map[string]*json.RawMessage
912	err := json.Unmarshal(body, &m)
913	if err != nil {
914		return err
915	}
916	for k, v := range m {
917		switch k {
918		case "tags":
919			if v != nil {
920				var tags map[string]*string
921				err = json.Unmarshal(*v, &tags)
922				if err != nil {
923					return err
924				}
925				rup.Tags = tags
926			}
927		case "sku":
928			if v != nil {
929				var sku Sku
930				err = json.Unmarshal(*v, &sku)
931				if err != nil {
932					return err
933				}
934				rup.Sku = &sku
935			}
936		case "properties":
937			if v != nil {
938				var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters
939				err = json.Unmarshal(*v, &registryPropertiesUpdateParameters)
940				if err != nil {
941					return err
942				}
943				rup.RegistryPropertiesUpdateParameters = &registryPropertiesUpdateParameters
944			}
945		}
946	}
947
948	return nil
949}
950
951// RegistryUsage the quota usage for a container registry.
952type RegistryUsage struct {
953	// Name - The name of the usage.
954	Name *string `json:"name,omitempty"`
955	// Limit - The limit of the usage.
956	Limit *int64 `json:"limit,omitempty"`
957	// CurrentValue - The current value of the usage.
958	CurrentValue *int64 `json:"currentValue,omitempty"`
959	// Unit - The unit of measurement. Possible values include: 'Count', 'Bytes'
960	Unit RegistryUsageUnit `json:"unit,omitempty"`
961}
962
963// RegistryUsageListResult the result of a request to get container registry quota usages.
964type RegistryUsageListResult struct {
965	autorest.Response `json:"-"`
966	// Value - The list of container registry quota usages.
967	Value *[]RegistryUsage `json:"value,omitempty"`
968}
969
970// Replication an object that represents a replication for a container registry.
971type Replication struct {
972	autorest.Response `json:"-"`
973	// ReplicationProperties - The properties of the replication.
974	*ReplicationProperties `json:"properties,omitempty"`
975	// ID - READ-ONLY; The resource ID.
976	ID *string `json:"id,omitempty"`
977	// Name - READ-ONLY; The name of the resource.
978	Name *string `json:"name,omitempty"`
979	// Type - READ-ONLY; The type of the resource.
980	Type *string `json:"type,omitempty"`
981	// Location - The location of the resource. This cannot be changed after the resource is created.
982	Location *string `json:"location,omitempty"`
983	// Tags - The tags of the resource.
984	Tags map[string]*string `json:"tags"`
985}
986
987// MarshalJSON is the custom marshaler for Replication.
988func (r Replication) MarshalJSON() ([]byte, error) {
989	objectMap := make(map[string]interface{})
990	if r.ReplicationProperties != nil {
991		objectMap["properties"] = r.ReplicationProperties
992	}
993	if r.Location != nil {
994		objectMap["location"] = r.Location
995	}
996	if r.Tags != nil {
997		objectMap["tags"] = r.Tags
998	}
999	return json.Marshal(objectMap)
1000}
1001
1002// UnmarshalJSON is the custom unmarshaler for Replication struct.
1003func (r *Replication) UnmarshalJSON(body []byte) error {
1004	var m map[string]*json.RawMessage
1005	err := json.Unmarshal(body, &m)
1006	if err != nil {
1007		return err
1008	}
1009	for k, v := range m {
1010		switch k {
1011		case "properties":
1012			if v != nil {
1013				var replicationProperties ReplicationProperties
1014				err = json.Unmarshal(*v, &replicationProperties)
1015				if err != nil {
1016					return err
1017				}
1018				r.ReplicationProperties = &replicationProperties
1019			}
1020		case "id":
1021			if v != nil {
1022				var ID string
1023				err = json.Unmarshal(*v, &ID)
1024				if err != nil {
1025					return err
1026				}
1027				r.ID = &ID
1028			}
1029		case "name":
1030			if v != nil {
1031				var name string
1032				err = json.Unmarshal(*v, &name)
1033				if err != nil {
1034					return err
1035				}
1036				r.Name = &name
1037			}
1038		case "type":
1039			if v != nil {
1040				var typeVar string
1041				err = json.Unmarshal(*v, &typeVar)
1042				if err != nil {
1043					return err
1044				}
1045				r.Type = &typeVar
1046			}
1047		case "location":
1048			if v != nil {
1049				var location string
1050				err = json.Unmarshal(*v, &location)
1051				if err != nil {
1052					return err
1053				}
1054				r.Location = &location
1055			}
1056		case "tags":
1057			if v != nil {
1058				var tags map[string]*string
1059				err = json.Unmarshal(*v, &tags)
1060				if err != nil {
1061					return err
1062				}
1063				r.Tags = tags
1064			}
1065		}
1066	}
1067
1068	return nil
1069}
1070
1071// ReplicationListResult the result of a request to list replications for a container registry.
1072type ReplicationListResult struct {
1073	autorest.Response `json:"-"`
1074	// Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications.
1075	Value *[]Replication `json:"value,omitempty"`
1076	// NextLink - The URI that can be used to request the next list of replications.
1077	NextLink *string `json:"nextLink,omitempty"`
1078}
1079
1080// ReplicationListResultIterator provides access to a complete listing of Replication values.
1081type ReplicationListResultIterator struct {
1082	i    int
1083	page ReplicationListResultPage
1084}
1085
1086// NextWithContext advances to the next value.  If there was an error making
1087// the request the iterator does not advance and the error is returned.
1088func (iter *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1089	if tracing.IsEnabled() {
1090		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.NextWithContext")
1091		defer func() {
1092			sc := -1
1093			if iter.Response().Response.Response != nil {
1094				sc = iter.Response().Response.Response.StatusCode
1095			}
1096			tracing.EndSpan(ctx, sc, err)
1097		}()
1098	}
1099	iter.i++
1100	if iter.i < len(iter.page.Values()) {
1101		return nil
1102	}
1103	err = iter.page.NextWithContext(ctx)
1104	if err != nil {
1105		iter.i--
1106		return err
1107	}
1108	iter.i = 0
1109	return nil
1110}
1111
1112// Next advances to the next value.  If there was an error making
1113// the request the iterator does not advance and the error is returned.
1114// Deprecated: Use NextWithContext() instead.
1115func (iter *ReplicationListResultIterator) Next() error {
1116	return iter.NextWithContext(context.Background())
1117}
1118
1119// NotDone returns true if the enumeration should be started or is not yet complete.
1120func (iter ReplicationListResultIterator) NotDone() bool {
1121	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1122}
1123
1124// Response returns the raw server response from the last page request.
1125func (iter ReplicationListResultIterator) Response() ReplicationListResult {
1126	return iter.page.Response()
1127}
1128
1129// Value returns the current value or a zero-initialized value if the
1130// iterator has advanced beyond the end of the collection.
1131func (iter ReplicationListResultIterator) Value() Replication {
1132	if !iter.page.NotDone() {
1133		return Replication{}
1134	}
1135	return iter.page.Values()[iter.i]
1136}
1137
1138// Creates a new instance of the ReplicationListResultIterator type.
1139func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator {
1140	return ReplicationListResultIterator{page: page}
1141}
1142
1143// IsEmpty returns true if the ListResult contains no values.
1144func (rlr ReplicationListResult) IsEmpty() bool {
1145	return rlr.Value == nil || len(*rlr.Value) == 0
1146}
1147
1148// hasNextLink returns true if the NextLink is not empty.
1149func (rlr ReplicationListResult) hasNextLink() bool {
1150	return rlr.NextLink != nil && len(*rlr.NextLink) != 0
1151}
1152
1153// replicationListResultPreparer prepares a request to retrieve the next set of results.
1154// It returns nil if no more results exist.
1155func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) {
1156	if !rlr.hasNextLink() {
1157		return nil, nil
1158	}
1159	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1160		autorest.AsJSON(),
1161		autorest.AsGet(),
1162		autorest.WithBaseURL(to.String(rlr.NextLink)))
1163}
1164
1165// ReplicationListResultPage contains a page of Replication values.
1166type ReplicationListResultPage struct {
1167	fn  func(context.Context, ReplicationListResult) (ReplicationListResult, error)
1168	rlr ReplicationListResult
1169}
1170
1171// NextWithContext advances to the next page of values.  If there was an error making
1172// the request the page does not advance and the error is returned.
1173func (page *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
1174	if tracing.IsEnabled() {
1175		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.NextWithContext")
1176		defer func() {
1177			sc := -1
1178			if page.Response().Response.Response != nil {
1179				sc = page.Response().Response.Response.StatusCode
1180			}
1181			tracing.EndSpan(ctx, sc, err)
1182		}()
1183	}
1184	for {
1185		next, err := page.fn(ctx, page.rlr)
1186		if err != nil {
1187			return err
1188		}
1189		page.rlr = next
1190		if !next.hasNextLink() || !next.IsEmpty() {
1191			break
1192		}
1193	}
1194	return nil
1195}
1196
1197// Next advances to the next page of values.  If there was an error making
1198// the request the page does not advance and the error is returned.
1199// Deprecated: Use NextWithContext() instead.
1200func (page *ReplicationListResultPage) Next() error {
1201	return page.NextWithContext(context.Background())
1202}
1203
1204// NotDone returns true if the page enumeration should be started or is not yet complete.
1205func (page ReplicationListResultPage) NotDone() bool {
1206	return !page.rlr.IsEmpty()
1207}
1208
1209// Response returns the raw server response from the last page request.
1210func (page ReplicationListResultPage) Response() ReplicationListResult {
1211	return page.rlr
1212}
1213
1214// Values returns the slice of values for the current page or nil if there are no values.
1215func (page ReplicationListResultPage) Values() []Replication {
1216	if page.rlr.IsEmpty() {
1217		return nil
1218	}
1219	return *page.rlr.Value
1220}
1221
1222// Creates a new instance of the ReplicationListResultPage type.
1223func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage {
1224	return ReplicationListResultPage{
1225		fn:  getNextPage,
1226		rlr: cur,
1227	}
1228}
1229
1230// ReplicationProperties the properties of a replication.
1231type ReplicationProperties struct {
1232	// ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'
1233	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1234	// Status - READ-ONLY; The status of the replication at the time the operation was called.
1235	Status *Status `json:"status,omitempty"`
1236}
1237
1238// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1239// operation.
1240type ReplicationsCreateFuture struct {
1241	azure.FutureAPI
1242	// Result returns the result of the asynchronous operation.
1243	// If the operation has not completed it will return an error.
1244	Result func(ReplicationsClient) (Replication, error)
1245}
1246
1247// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1248// operation.
1249type ReplicationsDeleteFuture struct {
1250	azure.FutureAPI
1251	// Result returns the result of the asynchronous operation.
1252	// If the operation has not completed it will return an error.
1253	Result func(ReplicationsClient) (autorest.Response, error)
1254}
1255
1256// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1257// operation.
1258type ReplicationsUpdateFuture struct {
1259	azure.FutureAPI
1260	// Result returns the result of the asynchronous operation.
1261	// If the operation has not completed it will return an error.
1262	Result func(ReplicationsClient) (Replication, error)
1263}
1264
1265// ReplicationUpdateParameters the parameters for updating a replication.
1266type ReplicationUpdateParameters struct {
1267	// Tags - The tags for the replication.
1268	Tags map[string]*string `json:"tags"`
1269}
1270
1271// MarshalJSON is the custom marshaler for ReplicationUpdateParameters.
1272func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) {
1273	objectMap := make(map[string]interface{})
1274	if rup.Tags != nil {
1275		objectMap["tags"] = rup.Tags
1276	}
1277	return json.Marshal(objectMap)
1278}
1279
1280// Request the request that generated the event.
1281type Request struct {
1282	// ID - The ID of the request that initiated the event.
1283	ID *string `json:"id,omitempty"`
1284	// Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request.
1285	Addr *string `json:"addr,omitempty"`
1286	// Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests.
1287	Host *string `json:"host,omitempty"`
1288	// Method - The request method that generated the event.
1289	Method *string `json:"method,omitempty"`
1290	// Useragent - The user agent header of the request.
1291	Useragent *string `json:"useragent,omitempty"`
1292}
1293
1294// Resource an Azure resource.
1295type Resource struct {
1296	// ID - READ-ONLY; The resource ID.
1297	ID *string `json:"id,omitempty"`
1298	// Name - READ-ONLY; The name of the resource.
1299	Name *string `json:"name,omitempty"`
1300	// Type - READ-ONLY; The type of the resource.
1301	Type *string `json:"type,omitempty"`
1302	// Location - The location of the resource. This cannot be changed after the resource is created.
1303	Location *string `json:"location,omitempty"`
1304	// Tags - The tags of the resource.
1305	Tags map[string]*string `json:"tags"`
1306}
1307
1308// MarshalJSON is the custom marshaler for Resource.
1309func (r Resource) MarshalJSON() ([]byte, error) {
1310	objectMap := make(map[string]interface{})
1311	if r.Location != nil {
1312		objectMap["location"] = r.Location
1313	}
1314	if r.Tags != nil {
1315		objectMap["tags"] = r.Tags
1316	}
1317	return json.Marshal(objectMap)
1318}
1319
1320// Sku the SKU of a container registry.
1321type Sku struct {
1322	// Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Basic', 'ManagedBasic', 'ManagedStandard', 'ManagedPremium'
1323	Name SkuName `json:"name,omitempty"`
1324	// Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierBasic', 'SkuTierManaged'
1325	Tier SkuTier `json:"tier,omitempty"`
1326}
1327
1328// MarshalJSON is the custom marshaler for Sku.
1329func (s Sku) MarshalJSON() ([]byte, error) {
1330	objectMap := make(map[string]interface{})
1331	if s.Name != "" {
1332		objectMap["name"] = s.Name
1333	}
1334	return json.Marshal(objectMap)
1335}
1336
1337// Source the registry node that generated the event. Put differently, while the actor initiates the event,
1338// the source generates it.
1339type Source struct {
1340	// Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port.
1341	Addr *string `json:"addr,omitempty"`
1342	// InstanceID - The running instance of an application. Changes after each restart.
1343	InstanceID *string `json:"instanceID,omitempty"`
1344}
1345
1346// Status the status of an Azure resource at the time the operation was called.
1347type Status struct {
1348	// DisplayStatus - READ-ONLY; The short label for the status.
1349	DisplayStatus *string `json:"displayStatus,omitempty"`
1350	// Message - READ-ONLY; The detailed message for the status, including alerts and error messages.
1351	Message *string `json:"message,omitempty"`
1352	// Timestamp - READ-ONLY; The timestamp when the status was changed to the current value.
1353	Timestamp *date.Time `json:"timestamp,omitempty"`
1354}
1355
1356// StorageAccountProperties the properties of a storage account for a container registry. Only applicable
1357// to Basic SKU.
1358type StorageAccountProperties struct {
1359	// ID - The resource ID of the storage account.
1360	ID *string `json:"id,omitempty"`
1361}
1362
1363// Target the target of the event.
1364type Target struct {
1365	// MediaType - The MIME type of the referenced object.
1366	MediaType *string `json:"mediaType,omitempty"`
1367	// Size - The number of bytes of the content. Same as Length field.
1368	Size *int64 `json:"size,omitempty"`
1369	// Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification.
1370	Digest *string `json:"digest,omitempty"`
1371	// Length - The number of bytes of the content. Same as Size field.
1372	Length *int64 `json:"length,omitempty"`
1373	// Repository - The repository name.
1374	Repository *string `json:"repository,omitempty"`
1375	// URL - The direct URL to the content.
1376	URL *string `json:"url,omitempty"`
1377	// Tag - The tag name.
1378	Tag *string `json:"tag,omitempty"`
1379}
1380
1381// Webhook an object that represents a webhook for a container registry.
1382type Webhook struct {
1383	autorest.Response `json:"-"`
1384	// WebhookProperties - The properties of the webhook.
1385	*WebhookProperties `json:"properties,omitempty"`
1386	// ID - READ-ONLY; The resource ID.
1387	ID *string `json:"id,omitempty"`
1388	// Name - READ-ONLY; The name of the resource.
1389	Name *string `json:"name,omitempty"`
1390	// Type - READ-ONLY; The type of the resource.
1391	Type *string `json:"type,omitempty"`
1392	// Location - The location of the resource. This cannot be changed after the resource is created.
1393	Location *string `json:"location,omitempty"`
1394	// Tags - The tags of the resource.
1395	Tags map[string]*string `json:"tags"`
1396}
1397
1398// MarshalJSON is the custom marshaler for Webhook.
1399func (w Webhook) MarshalJSON() ([]byte, error) {
1400	objectMap := make(map[string]interface{})
1401	if w.WebhookProperties != nil {
1402		objectMap["properties"] = w.WebhookProperties
1403	}
1404	if w.Location != nil {
1405		objectMap["location"] = w.Location
1406	}
1407	if w.Tags != nil {
1408		objectMap["tags"] = w.Tags
1409	}
1410	return json.Marshal(objectMap)
1411}
1412
1413// UnmarshalJSON is the custom unmarshaler for Webhook struct.
1414func (w *Webhook) UnmarshalJSON(body []byte) error {
1415	var m map[string]*json.RawMessage
1416	err := json.Unmarshal(body, &m)
1417	if err != nil {
1418		return err
1419	}
1420	for k, v := range m {
1421		switch k {
1422		case "properties":
1423			if v != nil {
1424				var webhookProperties WebhookProperties
1425				err = json.Unmarshal(*v, &webhookProperties)
1426				if err != nil {
1427					return err
1428				}
1429				w.WebhookProperties = &webhookProperties
1430			}
1431		case "id":
1432			if v != nil {
1433				var ID string
1434				err = json.Unmarshal(*v, &ID)
1435				if err != nil {
1436					return err
1437				}
1438				w.ID = &ID
1439			}
1440		case "name":
1441			if v != nil {
1442				var name string
1443				err = json.Unmarshal(*v, &name)
1444				if err != nil {
1445					return err
1446				}
1447				w.Name = &name
1448			}
1449		case "type":
1450			if v != nil {
1451				var typeVar string
1452				err = json.Unmarshal(*v, &typeVar)
1453				if err != nil {
1454					return err
1455				}
1456				w.Type = &typeVar
1457			}
1458		case "location":
1459			if v != nil {
1460				var location string
1461				err = json.Unmarshal(*v, &location)
1462				if err != nil {
1463					return err
1464				}
1465				w.Location = &location
1466			}
1467		case "tags":
1468			if v != nil {
1469				var tags map[string]*string
1470				err = json.Unmarshal(*v, &tags)
1471				if err != nil {
1472					return err
1473				}
1474				w.Tags = tags
1475			}
1476		}
1477	}
1478
1479	return nil
1480}
1481
1482// WebhookCreateParameters the parameters for creating a webhook.
1483type WebhookCreateParameters struct {
1484	// Tags - The tags for the webhook.
1485	Tags map[string]*string `json:"tags"`
1486	// Location - The location of the webhook. This cannot be changed after the resource is created.
1487	Location *string `json:"location,omitempty"`
1488	// WebhookPropertiesCreateParameters - The properties that the webhook will be created with.
1489	*WebhookPropertiesCreateParameters `json:"properties,omitempty"`
1490}
1491
1492// MarshalJSON is the custom marshaler for WebhookCreateParameters.
1493func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) {
1494	objectMap := make(map[string]interface{})
1495	if wcp.Tags != nil {
1496		objectMap["tags"] = wcp.Tags
1497	}
1498	if wcp.Location != nil {
1499		objectMap["location"] = wcp.Location
1500	}
1501	if wcp.WebhookPropertiesCreateParameters != nil {
1502		objectMap["properties"] = wcp.WebhookPropertiesCreateParameters
1503	}
1504	return json.Marshal(objectMap)
1505}
1506
1507// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct.
1508func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error {
1509	var m map[string]*json.RawMessage
1510	err := json.Unmarshal(body, &m)
1511	if err != nil {
1512		return err
1513	}
1514	for k, v := range m {
1515		switch k {
1516		case "tags":
1517			if v != nil {
1518				var tags map[string]*string
1519				err = json.Unmarshal(*v, &tags)
1520				if err != nil {
1521					return err
1522				}
1523				wcp.Tags = tags
1524			}
1525		case "location":
1526			if v != nil {
1527				var location string
1528				err = json.Unmarshal(*v, &location)
1529				if err != nil {
1530					return err
1531				}
1532				wcp.Location = &location
1533			}
1534		case "properties":
1535			if v != nil {
1536				var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters
1537				err = json.Unmarshal(*v, &webhookPropertiesCreateParameters)
1538				if err != nil {
1539					return err
1540				}
1541				wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters
1542			}
1543		}
1544	}
1545
1546	return nil
1547}
1548
1549// WebhookListResult the result of a request to list webhooks for a container registry.
1550type WebhookListResult struct {
1551	autorest.Response `json:"-"`
1552	// Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks.
1553	Value *[]Webhook `json:"value,omitempty"`
1554	// NextLink - The URI that can be used to request the next list of webhooks.
1555	NextLink *string `json:"nextLink,omitempty"`
1556}
1557
1558// WebhookListResultIterator provides access to a complete listing of Webhook values.
1559type WebhookListResultIterator struct {
1560	i    int
1561	page WebhookListResultPage
1562}
1563
1564// NextWithContext advances to the next value.  If there was an error making
1565// the request the iterator does not advance and the error is returned.
1566func (iter *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) {
1567	if tracing.IsEnabled() {
1568		ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.NextWithContext")
1569		defer func() {
1570			sc := -1
1571			if iter.Response().Response.Response != nil {
1572				sc = iter.Response().Response.Response.StatusCode
1573			}
1574			tracing.EndSpan(ctx, sc, err)
1575		}()
1576	}
1577	iter.i++
1578	if iter.i < len(iter.page.Values()) {
1579		return nil
1580	}
1581	err = iter.page.NextWithContext(ctx)
1582	if err != nil {
1583		iter.i--
1584		return err
1585	}
1586	iter.i = 0
1587	return nil
1588}
1589
1590// Next advances to the next value.  If there was an error making
1591// the request the iterator does not advance and the error is returned.
1592// Deprecated: Use NextWithContext() instead.
1593func (iter *WebhookListResultIterator) Next() error {
1594	return iter.NextWithContext(context.Background())
1595}
1596
1597// NotDone returns true if the enumeration should be started or is not yet complete.
1598func (iter WebhookListResultIterator) NotDone() bool {
1599	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1600}
1601
1602// Response returns the raw server response from the last page request.
1603func (iter WebhookListResultIterator) Response() WebhookListResult {
1604	return iter.page.Response()
1605}
1606
1607// Value returns the current value or a zero-initialized value if the
1608// iterator has advanced beyond the end of the collection.
1609func (iter WebhookListResultIterator) Value() Webhook {
1610	if !iter.page.NotDone() {
1611		return Webhook{}
1612	}
1613	return iter.page.Values()[iter.i]
1614}
1615
1616// Creates a new instance of the WebhookListResultIterator type.
1617func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator {
1618	return WebhookListResultIterator{page: page}
1619}
1620
1621// IsEmpty returns true if the ListResult contains no values.
1622func (wlr WebhookListResult) IsEmpty() bool {
1623	return wlr.Value == nil || len(*wlr.Value) == 0
1624}
1625
1626// hasNextLink returns true if the NextLink is not empty.
1627func (wlr WebhookListResult) hasNextLink() bool {
1628	return wlr.NextLink != nil && len(*wlr.NextLink) != 0
1629}
1630
1631// webhookListResultPreparer prepares a request to retrieve the next set of results.
1632// It returns nil if no more results exist.
1633func (wlr WebhookListResult) webhookListResultPreparer(ctx context.Context) (*http.Request, error) {
1634	if !wlr.hasNextLink() {
1635		return nil, nil
1636	}
1637	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1638		autorest.AsJSON(),
1639		autorest.AsGet(),
1640		autorest.WithBaseURL(to.String(wlr.NextLink)))
1641}
1642
1643// WebhookListResultPage contains a page of Webhook values.
1644type WebhookListResultPage struct {
1645	fn  func(context.Context, WebhookListResult) (WebhookListResult, error)
1646	wlr WebhookListResult
1647}
1648
1649// NextWithContext advances to the next page of values.  If there was an error making
1650// the request the page does not advance and the error is returned.
1651func (page *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) {
1652	if tracing.IsEnabled() {
1653		ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.NextWithContext")
1654		defer func() {
1655			sc := -1
1656			if page.Response().Response.Response != nil {
1657				sc = page.Response().Response.Response.StatusCode
1658			}
1659			tracing.EndSpan(ctx, sc, err)
1660		}()
1661	}
1662	for {
1663		next, err := page.fn(ctx, page.wlr)
1664		if err != nil {
1665			return err
1666		}
1667		page.wlr = next
1668		if !next.hasNextLink() || !next.IsEmpty() {
1669			break
1670		}
1671	}
1672	return nil
1673}
1674
1675// Next advances to the next page of values.  If there was an error making
1676// the request the page does not advance and the error is returned.
1677// Deprecated: Use NextWithContext() instead.
1678func (page *WebhookListResultPage) Next() error {
1679	return page.NextWithContext(context.Background())
1680}
1681
1682// NotDone returns true if the page enumeration should be started or is not yet complete.
1683func (page WebhookListResultPage) NotDone() bool {
1684	return !page.wlr.IsEmpty()
1685}
1686
1687// Response returns the raw server response from the last page request.
1688func (page WebhookListResultPage) Response() WebhookListResult {
1689	return page.wlr
1690}
1691
1692// Values returns the slice of values for the current page or nil if there are no values.
1693func (page WebhookListResultPage) Values() []Webhook {
1694	if page.wlr.IsEmpty() {
1695		return nil
1696	}
1697	return *page.wlr.Value
1698}
1699
1700// Creates a new instance of the WebhookListResultPage type.
1701func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage {
1702	return WebhookListResultPage{
1703		fn:  getNextPage,
1704		wlr: cur,
1705	}
1706}
1707
1708// WebhookProperties the properties of a webhook.
1709type WebhookProperties struct {
1710	// Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled'
1711	Status WebhookStatus `json:"status,omitempty"`
1712	// Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.
1713	Scope *string `json:"scope,omitempty"`
1714	// Actions - The list of actions that trigger the webhook to post notifications.
1715	Actions *[]WebhookAction `json:"actions,omitempty"`
1716	// ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'
1717	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1718}
1719
1720// MarshalJSON is the custom marshaler for WebhookProperties.
1721func (wp WebhookProperties) MarshalJSON() ([]byte, error) {
1722	objectMap := make(map[string]interface{})
1723	if wp.Status != "" {
1724		objectMap["status"] = wp.Status
1725	}
1726	if wp.Scope != nil {
1727		objectMap["scope"] = wp.Scope
1728	}
1729	if wp.Actions != nil {
1730		objectMap["actions"] = wp.Actions
1731	}
1732	return json.Marshal(objectMap)
1733}
1734
1735// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook.
1736type WebhookPropertiesCreateParameters struct {
1737	// ServiceURI - The service URI for the webhook to post notifications.
1738	ServiceURI *string `json:"serviceUri,omitempty"`
1739	// CustomHeaders - Custom headers that will be added to the webhook notifications.
1740	CustomHeaders map[string]*string `json:"customHeaders"`
1741	// Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled'
1742	Status WebhookStatus `json:"status,omitempty"`
1743	// Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.
1744	Scope *string `json:"scope,omitempty"`
1745	// Actions - The list of actions that trigger the webhook to post notifications.
1746	Actions *[]WebhookAction `json:"actions,omitempty"`
1747}
1748
1749// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters.
1750func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) {
1751	objectMap := make(map[string]interface{})
1752	if wpcp.ServiceURI != nil {
1753		objectMap["serviceUri"] = wpcp.ServiceURI
1754	}
1755	if wpcp.CustomHeaders != nil {
1756		objectMap["customHeaders"] = wpcp.CustomHeaders
1757	}
1758	if wpcp.Status != "" {
1759		objectMap["status"] = wpcp.Status
1760	}
1761	if wpcp.Scope != nil {
1762		objectMap["scope"] = wpcp.Scope
1763	}
1764	if wpcp.Actions != nil {
1765		objectMap["actions"] = wpcp.Actions
1766	}
1767	return json.Marshal(objectMap)
1768}
1769
1770// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook.
1771type WebhookPropertiesUpdateParameters struct {
1772	// ServiceURI - The service URI for the webhook to post notifications.
1773	ServiceURI *string `json:"serviceUri,omitempty"`
1774	// CustomHeaders - Custom headers that will be added to the webhook notifications.
1775	CustomHeaders map[string]*string `json:"customHeaders"`
1776	// Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled'
1777	Status WebhookStatus `json:"status,omitempty"`
1778	// Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events.
1779	Scope *string `json:"scope,omitempty"`
1780	// Actions - The list of actions that trigger the webhook to post notifications.
1781	Actions *[]WebhookAction `json:"actions,omitempty"`
1782}
1783
1784// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters.
1785func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) {
1786	objectMap := make(map[string]interface{})
1787	if wpup.ServiceURI != nil {
1788		objectMap["serviceUri"] = wpup.ServiceURI
1789	}
1790	if wpup.CustomHeaders != nil {
1791		objectMap["customHeaders"] = wpup.CustomHeaders
1792	}
1793	if wpup.Status != "" {
1794		objectMap["status"] = wpup.Status
1795	}
1796	if wpup.Scope != nil {
1797		objectMap["scope"] = wpup.Scope
1798	}
1799	if wpup.Actions != nil {
1800		objectMap["actions"] = wpup.Actions
1801	}
1802	return json.Marshal(objectMap)
1803}
1804
1805// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1806// operation.
1807type WebhooksCreateFuture struct {
1808	azure.FutureAPI
1809	// Result returns the result of the asynchronous operation.
1810	// If the operation has not completed it will return an error.
1811	Result func(WebhooksClient) (Webhook, error)
1812}
1813
1814// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1815// operation.
1816type WebhooksDeleteFuture struct {
1817	azure.FutureAPI
1818	// Result returns the result of the asynchronous operation.
1819	// If the operation has not completed it will return an error.
1820	Result func(WebhooksClient) (autorest.Response, error)
1821}
1822
1823// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1824// operation.
1825type WebhooksUpdateFuture struct {
1826	azure.FutureAPI
1827	// Result returns the result of the asynchronous operation.
1828	// If the operation has not completed it will return an error.
1829	Result func(WebhooksClient) (Webhook, error)
1830}
1831
1832// WebhookUpdateParameters the parameters for updating a webhook.
1833type WebhookUpdateParameters struct {
1834	// Tags - The tags for the webhook.
1835	Tags map[string]*string `json:"tags"`
1836	// WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with.
1837	*WebhookPropertiesUpdateParameters `json:"properties,omitempty"`
1838}
1839
1840// MarshalJSON is the custom marshaler for WebhookUpdateParameters.
1841func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) {
1842	objectMap := make(map[string]interface{})
1843	if wup.Tags != nil {
1844		objectMap["tags"] = wup.Tags
1845	}
1846	if wup.WebhookPropertiesUpdateParameters != nil {
1847		objectMap["properties"] = wup.WebhookPropertiesUpdateParameters
1848	}
1849	return json.Marshal(objectMap)
1850}
1851
1852// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct.
1853func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error {
1854	var m map[string]*json.RawMessage
1855	err := json.Unmarshal(body, &m)
1856	if err != nil {
1857		return err
1858	}
1859	for k, v := range m {
1860		switch k {
1861		case "tags":
1862			if v != nil {
1863				var tags map[string]*string
1864				err = json.Unmarshal(*v, &tags)
1865				if err != nil {
1866					return err
1867				}
1868				wup.Tags = tags
1869			}
1870		case "properties":
1871			if v != nil {
1872				var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters
1873				err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters)
1874				if err != nil {
1875					return err
1876				}
1877				wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters
1878			}
1879		}
1880	}
1881
1882	return nil
1883}
1884