1package containerregistry
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/date"
15	"github.com/Azure/go-autorest/autorest/to"
16	"github.com/Azure/go-autorest/tracing"
17	"net/http"
18)
19
20// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2018-02-01/containerregistry"
22
23// Actor the agent that initiated the event. For most situations, this could be from the authorization
24// context of the request.
25type Actor struct {
26	// Name - The subject or username associated with the request context that generated the event.
27	Name *string `json:"name,omitempty"`
28}
29
30// BaseImageDependency properties that describe a base image dependency.
31type BaseImageDependency struct {
32	// Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime'
33	Type BaseImageDependencyType `json:"type,omitempty"`
34	// Registry - The registry login server.
35	Registry *string `json:"registry,omitempty"`
36	// Repository - The repository name.
37	Repository *string `json:"repository,omitempty"`
38	// Tag - The tag name.
39	Tag *string `json:"tag,omitempty"`
40	// Digest - The sha256-based digest of the image manifest.
41	Digest *string `json:"digest,omitempty"`
42}
43
44// Build build resource properties
45type Build struct {
46	autorest.Response `json:"-"`
47	// BuildProperties - The properties of a build.
48	*BuildProperties `json:"properties,omitempty"`
49	// ID - READ-ONLY; The resource ID.
50	ID *string `json:"id,omitempty"`
51	// Name - READ-ONLY; The name of the resource.
52	Name *string `json:"name,omitempty"`
53	// Type - READ-ONLY; The type of the resource.
54	Type *string `json:"type,omitempty"`
55}
56
57// MarshalJSON is the custom marshaler for Build.
58func (b Build) MarshalJSON() ([]byte, error) {
59	objectMap := make(map[string]interface{})
60	if b.BuildProperties != nil {
61		objectMap["properties"] = b.BuildProperties
62	}
63	return json.Marshal(objectMap)
64}
65
66// UnmarshalJSON is the custom unmarshaler for Build struct.
67func (b *Build) UnmarshalJSON(body []byte) error {
68	var m map[string]*json.RawMessage
69	err := json.Unmarshal(body, &m)
70	if err != nil {
71		return err
72	}
73	for k, v := range m {
74		switch k {
75		case "properties":
76			if v != nil {
77				var buildProperties BuildProperties
78				err = json.Unmarshal(*v, &buildProperties)
79				if err != nil {
80					return err
81				}
82				b.BuildProperties = &buildProperties
83			}
84		case "id":
85			if v != nil {
86				var ID string
87				err = json.Unmarshal(*v, &ID)
88				if err != nil {
89					return err
90				}
91				b.ID = &ID
92			}
93		case "name":
94			if v != nil {
95				var name string
96				err = json.Unmarshal(*v, &name)
97				if err != nil {
98					return err
99				}
100				b.Name = &name
101			}
102		case "type":
103			if v != nil {
104				var typeVar string
105				err = json.Unmarshal(*v, &typeVar)
106				if err != nil {
107					return err
108				}
109				b.Type = &typeVar
110			}
111		}
112	}
113
114	return nil
115}
116
117// BuildArgument properties of a build argument.
118type BuildArgument struct {
119	// Type - The type of the argument.
120	Type *string `json:"type,omitempty"`
121	// Name - The name of the argument.
122	Name *string `json:"name,omitempty"`
123	// Value - The value of the argument.
124	Value *string `json:"value,omitempty"`
125	// IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs.
126	IsSecret *bool `json:"isSecret,omitempty"`
127}
128
129// BuildArgumentList the list of build arguments for a build step.
130type BuildArgumentList struct {
131	autorest.Response `json:"-"`
132	// Value - The collection value.
133	Value *[]BuildArgument `json:"value,omitempty"`
134	// NextLink - The URI that can be used to request the next set of paged results.
135	NextLink *string `json:"nextLink,omitempty"`
136}
137
138// BuildArgumentListIterator provides access to a complete listing of BuildArgument values.
139type BuildArgumentListIterator struct {
140	i    int
141	page BuildArgumentListPage
142}
143
144// NextWithContext advances to the next value.  If there was an error making
145// the request the iterator does not advance and the error is returned.
146func (iter *BuildArgumentListIterator) NextWithContext(ctx context.Context) (err error) {
147	if tracing.IsEnabled() {
148		ctx = tracing.StartSpan(ctx, fqdn+"/BuildArgumentListIterator.NextWithContext")
149		defer func() {
150			sc := -1
151			if iter.Response().Response.Response != nil {
152				sc = iter.Response().Response.Response.StatusCode
153			}
154			tracing.EndSpan(ctx, sc, err)
155		}()
156	}
157	iter.i++
158	if iter.i < len(iter.page.Values()) {
159		return nil
160	}
161	err = iter.page.NextWithContext(ctx)
162	if err != nil {
163		iter.i--
164		return err
165	}
166	iter.i = 0
167	return nil
168}
169
170// Next advances to the next value.  If there was an error making
171// the request the iterator does not advance and the error is returned.
172// Deprecated: Use NextWithContext() instead.
173func (iter *BuildArgumentListIterator) Next() error {
174	return iter.NextWithContext(context.Background())
175}
176
177// NotDone returns true if the enumeration should be started or is not yet complete.
178func (iter BuildArgumentListIterator) NotDone() bool {
179	return iter.page.NotDone() && iter.i < len(iter.page.Values())
180}
181
182// Response returns the raw server response from the last page request.
183func (iter BuildArgumentListIterator) Response() BuildArgumentList {
184	return iter.page.Response()
185}
186
187// Value returns the current value or a zero-initialized value if the
188// iterator has advanced beyond the end of the collection.
189func (iter BuildArgumentListIterator) Value() BuildArgument {
190	if !iter.page.NotDone() {
191		return BuildArgument{}
192	}
193	return iter.page.Values()[iter.i]
194}
195
196// Creates a new instance of the BuildArgumentListIterator type.
197func NewBuildArgumentListIterator(page BuildArgumentListPage) BuildArgumentListIterator {
198	return BuildArgumentListIterator{page: page}
199}
200
201// IsEmpty returns true if the ListResult contains no values.
202func (bal BuildArgumentList) IsEmpty() bool {
203	return bal.Value == nil || len(*bal.Value) == 0
204}
205
206// hasNextLink returns true if the NextLink is not empty.
207func (bal BuildArgumentList) hasNextLink() bool {
208	return bal.NextLink != nil && len(*bal.NextLink) != 0
209}
210
211// buildArgumentListPreparer prepares a request to retrieve the next set of results.
212// It returns nil if no more results exist.
213func (bal BuildArgumentList) buildArgumentListPreparer(ctx context.Context) (*http.Request, error) {
214	if !bal.hasNextLink() {
215		return nil, nil
216	}
217	return autorest.Prepare((&http.Request{}).WithContext(ctx),
218		autorest.AsJSON(),
219		autorest.AsGet(),
220		autorest.WithBaseURL(to.String(bal.NextLink)))
221}
222
223// BuildArgumentListPage contains a page of BuildArgument values.
224type BuildArgumentListPage struct {
225	fn  func(context.Context, BuildArgumentList) (BuildArgumentList, error)
226	bal BuildArgumentList
227}
228
229// NextWithContext advances to the next page of values.  If there was an error making
230// the request the page does not advance and the error is returned.
231func (page *BuildArgumentListPage) NextWithContext(ctx context.Context) (err error) {
232	if tracing.IsEnabled() {
233		ctx = tracing.StartSpan(ctx, fqdn+"/BuildArgumentListPage.NextWithContext")
234		defer func() {
235			sc := -1
236			if page.Response().Response.Response != nil {
237				sc = page.Response().Response.Response.StatusCode
238			}
239			tracing.EndSpan(ctx, sc, err)
240		}()
241	}
242	for {
243		next, err := page.fn(ctx, page.bal)
244		if err != nil {
245			return err
246		}
247		page.bal = next
248		if !next.hasNextLink() || !next.IsEmpty() {
249			break
250		}
251	}
252	return nil
253}
254
255// Next advances to the next page of values.  If there was an error making
256// the request the page does not advance and the error is returned.
257// Deprecated: Use NextWithContext() instead.
258func (page *BuildArgumentListPage) Next() error {
259	return page.NextWithContext(context.Background())
260}
261
262// NotDone returns true if the page enumeration should be started or is not yet complete.
263func (page BuildArgumentListPage) NotDone() bool {
264	return !page.bal.IsEmpty()
265}
266
267// Response returns the raw server response from the last page request.
268func (page BuildArgumentListPage) Response() BuildArgumentList {
269	return page.bal
270}
271
272// Values returns the slice of values for the current page or nil if there are no values.
273func (page BuildArgumentListPage) Values() []BuildArgument {
274	if page.bal.IsEmpty() {
275		return nil
276	}
277	return *page.bal.Value
278}
279
280// Creates a new instance of the BuildArgumentListPage type.
281func NewBuildArgumentListPage(cur BuildArgumentList, getNextPage func(context.Context, BuildArgumentList) (BuildArgumentList, error)) BuildArgumentListPage {
282	return BuildArgumentListPage{
283		fn:  getNextPage,
284		bal: cur,
285	}
286}
287
288// BuildFilter properties that are enabled for Odata querying.
289type BuildFilter struct {
290	// BuildID - The unique identifier for the build.
291	BuildID *string `json:"buildId,omitempty"`
292	// BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild'
293	BuildType BuildType `json:"buildType,omitempty"`
294	// Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout'
295	Status BuildStatus `json:"status,omitempty"`
296	// CreateTime - The create time for a build.
297	CreateTime *date.Time `json:"createTime,omitempty"`
298	// FinishTime - The time the build finished.
299	FinishTime *date.Time `json:"finishTime,omitempty"`
300	// OutputImageManifests - The list of comma-separated image manifests that were generated from the build.
301	OutputImageManifests *string `json:"outputImageManifests,omitempty"`
302	// IsArchiveEnabled - The value that indicates whether archiving is enabled or not.
303	IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"`
304	// BuildTaskName - The name of the build task that the build corresponds to.
305	BuildTaskName *string `json:"buildTaskName,omitempty"`
306}
307
308// BuildGetLogResult the result of get log link operation.
309type BuildGetLogResult struct {
310	autorest.Response `json:"-"`
311	// LogLink - The link to logs for a azure container registry build.
312	LogLink *string `json:"logLink,omitempty"`
313}
314
315// BuildListResult collection of builds.
316type BuildListResult struct {
317	autorest.Response `json:"-"`
318	// Value - The collection value.
319	Value *[]Build `json:"value,omitempty"`
320	// NextLink - The URI that can be used to request the next set of paged results.
321	NextLink *string `json:"nextLink,omitempty"`
322}
323
324// BuildListResultIterator provides access to a complete listing of Build values.
325type BuildListResultIterator struct {
326	i    int
327	page BuildListResultPage
328}
329
330// NextWithContext advances to the next value.  If there was an error making
331// the request the iterator does not advance and the error is returned.
332func (iter *BuildListResultIterator) NextWithContext(ctx context.Context) (err error) {
333	if tracing.IsEnabled() {
334		ctx = tracing.StartSpan(ctx, fqdn+"/BuildListResultIterator.NextWithContext")
335		defer func() {
336			sc := -1
337			if iter.Response().Response.Response != nil {
338				sc = iter.Response().Response.Response.StatusCode
339			}
340			tracing.EndSpan(ctx, sc, err)
341		}()
342	}
343	iter.i++
344	if iter.i < len(iter.page.Values()) {
345		return nil
346	}
347	err = iter.page.NextWithContext(ctx)
348	if err != nil {
349		iter.i--
350		return err
351	}
352	iter.i = 0
353	return nil
354}
355
356// Next advances to the next value.  If there was an error making
357// the request the iterator does not advance and the error is returned.
358// Deprecated: Use NextWithContext() instead.
359func (iter *BuildListResultIterator) Next() error {
360	return iter.NextWithContext(context.Background())
361}
362
363// NotDone returns true if the enumeration should be started or is not yet complete.
364func (iter BuildListResultIterator) NotDone() bool {
365	return iter.page.NotDone() && iter.i < len(iter.page.Values())
366}
367
368// Response returns the raw server response from the last page request.
369func (iter BuildListResultIterator) Response() BuildListResult {
370	return iter.page.Response()
371}
372
373// Value returns the current value or a zero-initialized value if the
374// iterator has advanced beyond the end of the collection.
375func (iter BuildListResultIterator) Value() Build {
376	if !iter.page.NotDone() {
377		return Build{}
378	}
379	return iter.page.Values()[iter.i]
380}
381
382// Creates a new instance of the BuildListResultIterator type.
383func NewBuildListResultIterator(page BuildListResultPage) BuildListResultIterator {
384	return BuildListResultIterator{page: page}
385}
386
387// IsEmpty returns true if the ListResult contains no values.
388func (blr BuildListResult) IsEmpty() bool {
389	return blr.Value == nil || len(*blr.Value) == 0
390}
391
392// hasNextLink returns true if the NextLink is not empty.
393func (blr BuildListResult) hasNextLink() bool {
394	return blr.NextLink != nil && len(*blr.NextLink) != 0
395}
396
397// buildListResultPreparer prepares a request to retrieve the next set of results.
398// It returns nil if no more results exist.
399func (blr BuildListResult) buildListResultPreparer(ctx context.Context) (*http.Request, error) {
400	if !blr.hasNextLink() {
401		return nil, nil
402	}
403	return autorest.Prepare((&http.Request{}).WithContext(ctx),
404		autorest.AsJSON(),
405		autorest.AsGet(),
406		autorest.WithBaseURL(to.String(blr.NextLink)))
407}
408
409// BuildListResultPage contains a page of Build values.
410type BuildListResultPage struct {
411	fn  func(context.Context, BuildListResult) (BuildListResult, error)
412	blr BuildListResult
413}
414
415// NextWithContext advances to the next page of values.  If there was an error making
416// the request the page does not advance and the error is returned.
417func (page *BuildListResultPage) NextWithContext(ctx context.Context) (err error) {
418	if tracing.IsEnabled() {
419		ctx = tracing.StartSpan(ctx, fqdn+"/BuildListResultPage.NextWithContext")
420		defer func() {
421			sc := -1
422			if page.Response().Response.Response != nil {
423				sc = page.Response().Response.Response.StatusCode
424			}
425			tracing.EndSpan(ctx, sc, err)
426		}()
427	}
428	for {
429		next, err := page.fn(ctx, page.blr)
430		if err != nil {
431			return err
432		}
433		page.blr = next
434		if !next.hasNextLink() || !next.IsEmpty() {
435			break
436		}
437	}
438	return nil
439}
440
441// Next advances to the next page of values.  If there was an error making
442// the request the page does not advance and the error is returned.
443// Deprecated: Use NextWithContext() instead.
444func (page *BuildListResultPage) Next() error {
445	return page.NextWithContext(context.Background())
446}
447
448// NotDone returns true if the page enumeration should be started or is not yet complete.
449func (page BuildListResultPage) NotDone() bool {
450	return !page.blr.IsEmpty()
451}
452
453// Response returns the raw server response from the last page request.
454func (page BuildListResultPage) Response() BuildListResult {
455	return page.blr
456}
457
458// Values returns the slice of values for the current page or nil if there are no values.
459func (page BuildListResultPage) Values() []Build {
460	if page.blr.IsEmpty() {
461		return nil
462	}
463	return *page.blr.Value
464}
465
466// Creates a new instance of the BuildListResultPage type.
467func NewBuildListResultPage(cur BuildListResult, getNextPage func(context.Context, BuildListResult) (BuildListResult, error)) BuildListResultPage {
468	return BuildListResultPage{
469		fn:  getNextPage,
470		blr: cur,
471	}
472}
473
474// BuildProperties the properties for a build.
475type BuildProperties struct {
476	// BuildID - The unique identifier for the build.
477	BuildID *string `json:"buildId,omitempty"`
478	// Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout'
479	Status BuildStatus `json:"status,omitempty"`
480	// LastUpdatedTime - The last updated time for the build.
481	LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
482	// BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild'
483	BuildType BuildType `json:"buildType,omitempty"`
484	// CreateTime - The time the build was created.
485	CreateTime *date.Time `json:"createTime,omitempty"`
486	// StartTime - The time the build started.
487	StartTime *date.Time `json:"startTime,omitempty"`
488	// FinishTime - The time the build finished.
489	FinishTime *date.Time `json:"finishTime,omitempty"`
490	// OutputImages - The list of all images that were generated from the build.
491	OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"`
492	// BuildTask - The build task with which the build was started.
493	BuildTask *string `json:"buildTask,omitempty"`
494	// ImageUpdateTrigger - The image update trigger that caused the build.
495	ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"`
496	// GitCommitTrigger - The git commit trigger that caused the build.
497	GitCommitTrigger *GitCommitTrigger `json:"gitCommitTrigger,omitempty"`
498	// IsArchiveEnabled - The value that indicates whether archiving is enabled or not.
499	IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"`
500	// Platform - The platform properties against which the build will happen.
501	Platform *PlatformProperties `json:"platform,omitempty"`
502	// ProvisioningState - The provisioning state of a build. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
503	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
504}
505
506// BuildsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation.
507type BuildsCancelFuture struct {
508	azure.FutureAPI
509	// Result returns the result of the asynchronous operation.
510	// If the operation has not completed it will return an error.
511	Result func(BuildsClient) (autorest.Response, error)
512}
513
514// UnmarshalJSON is the custom unmarshaller for CreateFuture.
515func (future *BuildsCancelFuture) UnmarshalJSON(body []byte) error {
516	var azFuture azure.Future
517	if err := json.Unmarshal(body, &azFuture); err != nil {
518		return err
519	}
520	future.FutureAPI = &azFuture
521	future.Result = future.result
522	return nil
523}
524
525// result is the default implementation for BuildsCancelFuture.Result.
526func (future *BuildsCancelFuture) result(client BuildsClient) (ar autorest.Response, err error) {
527	var done bool
528	done, err = future.DoneWithContext(context.Background(), client)
529	if err != nil {
530		err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", future.Response(), "Polling failure")
531		return
532	}
533	if !done {
534		ar.Response = future.Response()
535		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildsCancelFuture")
536		return
537	}
538	ar.Response = future.Response()
539	return
540}
541
542// BuildStep build step resource properties
543type BuildStep struct {
544	autorest.Response `json:"-"`
545	// Properties - The properties of a build step.
546	Properties BasicBuildStepProperties `json:"properties,omitempty"`
547	// ID - READ-ONLY; The resource ID.
548	ID *string `json:"id,omitempty"`
549	// Name - READ-ONLY; The name of the resource.
550	Name *string `json:"name,omitempty"`
551	// Type - READ-ONLY; The type of the resource.
552	Type *string `json:"type,omitempty"`
553}
554
555// MarshalJSON is the custom marshaler for BuildStep.
556func (bs BuildStep) MarshalJSON() ([]byte, error) {
557	objectMap := make(map[string]interface{})
558	objectMap["properties"] = bs.Properties
559	return json.Marshal(objectMap)
560}
561
562// UnmarshalJSON is the custom unmarshaler for BuildStep struct.
563func (bs *BuildStep) UnmarshalJSON(body []byte) error {
564	var m map[string]*json.RawMessage
565	err := json.Unmarshal(body, &m)
566	if err != nil {
567		return err
568	}
569	for k, v := range m {
570		switch k {
571		case "properties":
572			if v != nil {
573				properties, err := unmarshalBasicBuildStepProperties(*v)
574				if err != nil {
575					return err
576				}
577				bs.Properties = properties
578			}
579		case "id":
580			if v != nil {
581				var ID string
582				err = json.Unmarshal(*v, &ID)
583				if err != nil {
584					return err
585				}
586				bs.ID = &ID
587			}
588		case "name":
589			if v != nil {
590				var name string
591				err = json.Unmarshal(*v, &name)
592				if err != nil {
593					return err
594				}
595				bs.Name = &name
596			}
597		case "type":
598			if v != nil {
599				var typeVar string
600				err = json.Unmarshal(*v, &typeVar)
601				if err != nil {
602					return err
603				}
604				bs.Type = &typeVar
605			}
606		}
607	}
608
609	return nil
610}
611
612// BuildStepList the collection of build items.
613type BuildStepList struct {
614	autorest.Response `json:"-"`
615	// Value - The collection value.
616	Value *[]BuildStep `json:"value,omitempty"`
617	// NextLink - The URI that can be used to request the next set of paged results.
618	NextLink *string `json:"nextLink,omitempty"`
619}
620
621// BuildStepListIterator provides access to a complete listing of BuildStep values.
622type BuildStepListIterator struct {
623	i    int
624	page BuildStepListPage
625}
626
627// NextWithContext advances to the next value.  If there was an error making
628// the request the iterator does not advance and the error is returned.
629func (iter *BuildStepListIterator) NextWithContext(ctx context.Context) (err error) {
630	if tracing.IsEnabled() {
631		ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepListIterator.NextWithContext")
632		defer func() {
633			sc := -1
634			if iter.Response().Response.Response != nil {
635				sc = iter.Response().Response.Response.StatusCode
636			}
637			tracing.EndSpan(ctx, sc, err)
638		}()
639	}
640	iter.i++
641	if iter.i < len(iter.page.Values()) {
642		return nil
643	}
644	err = iter.page.NextWithContext(ctx)
645	if err != nil {
646		iter.i--
647		return err
648	}
649	iter.i = 0
650	return nil
651}
652
653// Next advances to the next value.  If there was an error making
654// the request the iterator does not advance and the error is returned.
655// Deprecated: Use NextWithContext() instead.
656func (iter *BuildStepListIterator) Next() error {
657	return iter.NextWithContext(context.Background())
658}
659
660// NotDone returns true if the enumeration should be started or is not yet complete.
661func (iter BuildStepListIterator) NotDone() bool {
662	return iter.page.NotDone() && iter.i < len(iter.page.Values())
663}
664
665// Response returns the raw server response from the last page request.
666func (iter BuildStepListIterator) Response() BuildStepList {
667	return iter.page.Response()
668}
669
670// Value returns the current value or a zero-initialized value if the
671// iterator has advanced beyond the end of the collection.
672func (iter BuildStepListIterator) Value() BuildStep {
673	if !iter.page.NotDone() {
674		return BuildStep{}
675	}
676	return iter.page.Values()[iter.i]
677}
678
679// Creates a new instance of the BuildStepListIterator type.
680func NewBuildStepListIterator(page BuildStepListPage) BuildStepListIterator {
681	return BuildStepListIterator{page: page}
682}
683
684// IsEmpty returns true if the ListResult contains no values.
685func (bsl BuildStepList) IsEmpty() bool {
686	return bsl.Value == nil || len(*bsl.Value) == 0
687}
688
689// hasNextLink returns true if the NextLink is not empty.
690func (bsl BuildStepList) hasNextLink() bool {
691	return bsl.NextLink != nil && len(*bsl.NextLink) != 0
692}
693
694// buildStepListPreparer prepares a request to retrieve the next set of results.
695// It returns nil if no more results exist.
696func (bsl BuildStepList) buildStepListPreparer(ctx context.Context) (*http.Request, error) {
697	if !bsl.hasNextLink() {
698		return nil, nil
699	}
700	return autorest.Prepare((&http.Request{}).WithContext(ctx),
701		autorest.AsJSON(),
702		autorest.AsGet(),
703		autorest.WithBaseURL(to.String(bsl.NextLink)))
704}
705
706// BuildStepListPage contains a page of BuildStep values.
707type BuildStepListPage struct {
708	fn  func(context.Context, BuildStepList) (BuildStepList, error)
709	bsl BuildStepList
710}
711
712// NextWithContext advances to the next page of values.  If there was an error making
713// the request the page does not advance and the error is returned.
714func (page *BuildStepListPage) NextWithContext(ctx context.Context) (err error) {
715	if tracing.IsEnabled() {
716		ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepListPage.NextWithContext")
717		defer func() {
718			sc := -1
719			if page.Response().Response.Response != nil {
720				sc = page.Response().Response.Response.StatusCode
721			}
722			tracing.EndSpan(ctx, sc, err)
723		}()
724	}
725	for {
726		next, err := page.fn(ctx, page.bsl)
727		if err != nil {
728			return err
729		}
730		page.bsl = next
731		if !next.hasNextLink() || !next.IsEmpty() {
732			break
733		}
734	}
735	return nil
736}
737
738// Next advances to the next page of values.  If there was an error making
739// the request the page does not advance and the error is returned.
740// Deprecated: Use NextWithContext() instead.
741func (page *BuildStepListPage) Next() error {
742	return page.NextWithContext(context.Background())
743}
744
745// NotDone returns true if the page enumeration should be started or is not yet complete.
746func (page BuildStepListPage) NotDone() bool {
747	return !page.bsl.IsEmpty()
748}
749
750// Response returns the raw server response from the last page request.
751func (page BuildStepListPage) Response() BuildStepList {
752	return page.bsl
753}
754
755// Values returns the slice of values for the current page or nil if there are no values.
756func (page BuildStepListPage) Values() []BuildStep {
757	if page.bsl.IsEmpty() {
758		return nil
759	}
760	return *page.bsl.Value
761}
762
763// Creates a new instance of the BuildStepListPage type.
764func NewBuildStepListPage(cur BuildStepList, getNextPage func(context.Context, BuildStepList) (BuildStepList, error)) BuildStepListPage {
765	return BuildStepListPage{
766		fn:  getNextPage,
767		bsl: cur,
768	}
769}
770
771// BasicBuildStepProperties base properties for any build step.
772type BasicBuildStepProperties interface {
773	AsDockerBuildStep() (*DockerBuildStep, bool)
774	AsBuildStepProperties() (*BuildStepProperties, bool)
775}
776
777// BuildStepProperties base properties for any build step.
778type BuildStepProperties struct {
779	// ProvisioningState - READ-ONLY; The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
780	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
781	// Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker'
782	Type Type `json:"type,omitempty"`
783}
784
785func unmarshalBasicBuildStepProperties(body []byte) (BasicBuildStepProperties, error) {
786	var m map[string]interface{}
787	err := json.Unmarshal(body, &m)
788	if err != nil {
789		return nil, err
790	}
791
792	switch m["type"] {
793	case string(TypeDocker):
794		var dbs DockerBuildStep
795		err := json.Unmarshal(body, &dbs)
796		return dbs, err
797	default:
798		var bsp BuildStepProperties
799		err := json.Unmarshal(body, &bsp)
800		return bsp, err
801	}
802}
803func unmarshalBasicBuildStepPropertiesArray(body []byte) ([]BasicBuildStepProperties, error) {
804	var rawMessages []*json.RawMessage
805	err := json.Unmarshal(body, &rawMessages)
806	if err != nil {
807		return nil, err
808	}
809
810	bspArray := make([]BasicBuildStepProperties, len(rawMessages))
811
812	for index, rawMessage := range rawMessages {
813		bsp, err := unmarshalBasicBuildStepProperties(*rawMessage)
814		if err != nil {
815			return nil, err
816		}
817		bspArray[index] = bsp
818	}
819	return bspArray, nil
820}
821
822// MarshalJSON is the custom marshaler for BuildStepProperties.
823func (bsp BuildStepProperties) MarshalJSON() ([]byte, error) {
824	bsp.Type = TypeBuildStepProperties
825	objectMap := make(map[string]interface{})
826	if bsp.Type != "" {
827		objectMap["type"] = bsp.Type
828	}
829	return json.Marshal(objectMap)
830}
831
832// AsDockerBuildStep is the BasicBuildStepProperties implementation for BuildStepProperties.
833func (bsp BuildStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) {
834	return nil, false
835}
836
837// AsBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties.
838func (bsp BuildStepProperties) AsBuildStepProperties() (*BuildStepProperties, bool) {
839	return &bsp, true
840}
841
842// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties.
843func (bsp BuildStepProperties) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) {
844	return &bsp, true
845}
846
847// BasicBuildStepPropertiesUpdateParameters the properties for updating a build step.
848type BasicBuildStepPropertiesUpdateParameters interface {
849	AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool)
850	AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool)
851}
852
853// BuildStepPropertiesUpdateParameters the properties for updating a build step.
854type BuildStepPropertiesUpdateParameters struct {
855	// Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker'
856	Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"`
857}
858
859func unmarshalBasicBuildStepPropertiesUpdateParameters(body []byte) (BasicBuildStepPropertiesUpdateParameters, error) {
860	var m map[string]interface{}
861	err := json.Unmarshal(body, &m)
862	if err != nil {
863		return nil, err
864	}
865
866	switch m["type"] {
867	case string(TypeBasicBuildStepPropertiesUpdateParametersTypeDocker):
868		var dbsup DockerBuildStepUpdateParameters
869		err := json.Unmarshal(body, &dbsup)
870		return dbsup, err
871	default:
872		var bspup BuildStepPropertiesUpdateParameters
873		err := json.Unmarshal(body, &bspup)
874		return bspup, err
875	}
876}
877func unmarshalBasicBuildStepPropertiesUpdateParametersArray(body []byte) ([]BasicBuildStepPropertiesUpdateParameters, error) {
878	var rawMessages []*json.RawMessage
879	err := json.Unmarshal(body, &rawMessages)
880	if err != nil {
881		return nil, err
882	}
883
884	bspupArray := make([]BasicBuildStepPropertiesUpdateParameters, len(rawMessages))
885
886	for index, rawMessage := range rawMessages {
887		bspup, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*rawMessage)
888		if err != nil {
889			return nil, err
890		}
891		bspupArray[index] = bspup
892	}
893	return bspupArray, nil
894}
895
896// MarshalJSON is the custom marshaler for BuildStepPropertiesUpdateParameters.
897func (bspup BuildStepPropertiesUpdateParameters) MarshalJSON() ([]byte, error) {
898	bspup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters
899	objectMap := make(map[string]interface{})
900	if bspup.Type != "" {
901		objectMap["type"] = bspup.Type
902	}
903	return json.Marshal(objectMap)
904}
905
906// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters.
907func (bspup BuildStepPropertiesUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) {
908	return nil, false
909}
910
911// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters.
912func (bspup BuildStepPropertiesUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) {
913	return &bspup, true
914}
915
916// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters.
917func (bspup BuildStepPropertiesUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) {
918	return &bspup, true
919}
920
921// BuildStepsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
922// operation.
923type BuildStepsCreateFuture struct {
924	azure.FutureAPI
925	// Result returns the result of the asynchronous operation.
926	// If the operation has not completed it will return an error.
927	Result func(BuildStepsClient) (BuildStep, error)
928}
929
930// UnmarshalJSON is the custom unmarshaller for CreateFuture.
931func (future *BuildStepsCreateFuture) UnmarshalJSON(body []byte) error {
932	var azFuture azure.Future
933	if err := json.Unmarshal(body, &azFuture); err != nil {
934		return err
935	}
936	future.FutureAPI = &azFuture
937	future.Result = future.result
938	return nil
939}
940
941// result is the default implementation for BuildStepsCreateFuture.Result.
942func (future *BuildStepsCreateFuture) result(client BuildStepsClient) (bs BuildStep, err error) {
943	var done bool
944	done, err = future.DoneWithContext(context.Background(), client)
945	if err != nil {
946		err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", future.Response(), "Polling failure")
947		return
948	}
949	if !done {
950		bs.Response.Response = future.Response()
951		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsCreateFuture")
952		return
953	}
954	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
955	if bs.Response.Response, err = future.GetResult(sender); err == nil && bs.Response.Response.StatusCode != http.StatusNoContent {
956		bs, err = client.CreateResponder(bs.Response.Response)
957		if err != nil {
958			err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", bs.Response.Response, "Failure responding to request")
959		}
960	}
961	return
962}
963
964// BuildStepsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
965// operation.
966type BuildStepsDeleteFuture struct {
967	azure.FutureAPI
968	// Result returns the result of the asynchronous operation.
969	// If the operation has not completed it will return an error.
970	Result func(BuildStepsClient) (autorest.Response, error)
971}
972
973// UnmarshalJSON is the custom unmarshaller for CreateFuture.
974func (future *BuildStepsDeleteFuture) UnmarshalJSON(body []byte) error {
975	var azFuture azure.Future
976	if err := json.Unmarshal(body, &azFuture); err != nil {
977		return err
978	}
979	future.FutureAPI = &azFuture
980	future.Result = future.result
981	return nil
982}
983
984// result is the default implementation for BuildStepsDeleteFuture.Result.
985func (future *BuildStepsDeleteFuture) result(client BuildStepsClient) (ar autorest.Response, err error) {
986	var done bool
987	done, err = future.DoneWithContext(context.Background(), client)
988	if err != nil {
989		err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", future.Response(), "Polling failure")
990		return
991	}
992	if !done {
993		ar.Response = future.Response()
994		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsDeleteFuture")
995		return
996	}
997	ar.Response = future.Response()
998	return
999}
1000
1001// BuildStepsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1002// operation.
1003type BuildStepsUpdateFuture struct {
1004	azure.FutureAPI
1005	// Result returns the result of the asynchronous operation.
1006	// If the operation has not completed it will return an error.
1007	Result func(BuildStepsClient) (BuildStep, error)
1008}
1009
1010// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1011func (future *BuildStepsUpdateFuture) UnmarshalJSON(body []byte) error {
1012	var azFuture azure.Future
1013	if err := json.Unmarshal(body, &azFuture); err != nil {
1014		return err
1015	}
1016	future.FutureAPI = &azFuture
1017	future.Result = future.result
1018	return nil
1019}
1020
1021// result is the default implementation for BuildStepsUpdateFuture.Result.
1022func (future *BuildStepsUpdateFuture) result(client BuildStepsClient) (bs BuildStep, err error) {
1023	var done bool
1024	done, err = future.DoneWithContext(context.Background(), client)
1025	if err != nil {
1026		err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", future.Response(), "Polling failure")
1027		return
1028	}
1029	if !done {
1030		bs.Response.Response = future.Response()
1031		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsUpdateFuture")
1032		return
1033	}
1034	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1035	if bs.Response.Response, err = future.GetResult(sender); err == nil && bs.Response.Response.StatusCode != http.StatusNoContent {
1036		bs, err = client.UpdateResponder(bs.Response.Response)
1037		if err != nil {
1038			err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", bs.Response.Response, "Failure responding to request")
1039		}
1040	}
1041	return
1042}
1043
1044// BuildStepUpdateParameters the parameters for updating a build step.
1045type BuildStepUpdateParameters struct {
1046	// Properties - The properties for updating a build step.
1047	Properties BasicBuildStepPropertiesUpdateParameters `json:"properties,omitempty"`
1048	// Tags - The ARM resource tags.
1049	Tags map[string]*string `json:"tags"`
1050}
1051
1052// MarshalJSON is the custom marshaler for BuildStepUpdateParameters.
1053func (bsup BuildStepUpdateParameters) MarshalJSON() ([]byte, error) {
1054	objectMap := make(map[string]interface{})
1055	objectMap["properties"] = bsup.Properties
1056	if bsup.Tags != nil {
1057		objectMap["tags"] = bsup.Tags
1058	}
1059	return json.Marshal(objectMap)
1060}
1061
1062// UnmarshalJSON is the custom unmarshaler for BuildStepUpdateParameters struct.
1063func (bsup *BuildStepUpdateParameters) UnmarshalJSON(body []byte) error {
1064	var m map[string]*json.RawMessage
1065	err := json.Unmarshal(body, &m)
1066	if err != nil {
1067		return err
1068	}
1069	for k, v := range m {
1070		switch k {
1071		case "properties":
1072			if v != nil {
1073				properties, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*v)
1074				if err != nil {
1075					return err
1076				}
1077				bsup.Properties = properties
1078			}
1079		case "tags":
1080			if v != nil {
1081				var tags map[string]*string
1082				err = json.Unmarshal(*v, &tags)
1083				if err != nil {
1084					return err
1085				}
1086				bsup.Tags = tags
1087			}
1088		}
1089	}
1090
1091	return nil
1092}
1093
1094// BuildsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1095type BuildsUpdateFuture struct {
1096	azure.FutureAPI
1097	// Result returns the result of the asynchronous operation.
1098	// If the operation has not completed it will return an error.
1099	Result func(BuildsClient) (Build, error)
1100}
1101
1102// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1103func (future *BuildsUpdateFuture) UnmarshalJSON(body []byte) error {
1104	var azFuture azure.Future
1105	if err := json.Unmarshal(body, &azFuture); err != nil {
1106		return err
1107	}
1108	future.FutureAPI = &azFuture
1109	future.Result = future.result
1110	return nil
1111}
1112
1113// result is the default implementation for BuildsUpdateFuture.Result.
1114func (future *BuildsUpdateFuture) result(client BuildsClient) (b Build, err error) {
1115	var done bool
1116	done, err = future.DoneWithContext(context.Background(), client)
1117	if err != nil {
1118		err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", future.Response(), "Polling failure")
1119		return
1120	}
1121	if !done {
1122		b.Response.Response = future.Response()
1123		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildsUpdateFuture")
1124		return
1125	}
1126	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1127	if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent {
1128		b, err = client.UpdateResponder(b.Response.Response)
1129		if err != nil {
1130			err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", b.Response.Response, "Failure responding to request")
1131		}
1132	}
1133	return
1134}
1135
1136// BuildTask the build task that has the resource properties and all build items. The build task will have
1137// all information to schedule a build against it.
1138type BuildTask struct {
1139	autorest.Response `json:"-"`
1140	// BuildTaskProperties - The properties of a build task.
1141	*BuildTaskProperties `json:"properties,omitempty"`
1142	// ID - READ-ONLY; The resource ID.
1143	ID *string `json:"id,omitempty"`
1144	// Name - READ-ONLY; The name of the resource.
1145	Name *string `json:"name,omitempty"`
1146	// Type - READ-ONLY; The type of the resource.
1147	Type *string `json:"type,omitempty"`
1148	// Location - The location of the resource. This cannot be changed after the resource is created.
1149	Location *string `json:"location,omitempty"`
1150	// Tags - The tags of the resource.
1151	Tags map[string]*string `json:"tags"`
1152}
1153
1154// MarshalJSON is the custom marshaler for BuildTask.
1155func (bt BuildTask) MarshalJSON() ([]byte, error) {
1156	objectMap := make(map[string]interface{})
1157	if bt.BuildTaskProperties != nil {
1158		objectMap["properties"] = bt.BuildTaskProperties
1159	}
1160	if bt.Location != nil {
1161		objectMap["location"] = bt.Location
1162	}
1163	if bt.Tags != nil {
1164		objectMap["tags"] = bt.Tags
1165	}
1166	return json.Marshal(objectMap)
1167}
1168
1169// UnmarshalJSON is the custom unmarshaler for BuildTask struct.
1170func (bt *BuildTask) UnmarshalJSON(body []byte) error {
1171	var m map[string]*json.RawMessage
1172	err := json.Unmarshal(body, &m)
1173	if err != nil {
1174		return err
1175	}
1176	for k, v := range m {
1177		switch k {
1178		case "properties":
1179			if v != nil {
1180				var buildTaskProperties BuildTaskProperties
1181				err = json.Unmarshal(*v, &buildTaskProperties)
1182				if err != nil {
1183					return err
1184				}
1185				bt.BuildTaskProperties = &buildTaskProperties
1186			}
1187		case "id":
1188			if v != nil {
1189				var ID string
1190				err = json.Unmarshal(*v, &ID)
1191				if err != nil {
1192					return err
1193				}
1194				bt.ID = &ID
1195			}
1196		case "name":
1197			if v != nil {
1198				var name string
1199				err = json.Unmarshal(*v, &name)
1200				if err != nil {
1201					return err
1202				}
1203				bt.Name = &name
1204			}
1205		case "type":
1206			if v != nil {
1207				var typeVar string
1208				err = json.Unmarshal(*v, &typeVar)
1209				if err != nil {
1210					return err
1211				}
1212				bt.Type = &typeVar
1213			}
1214		case "location":
1215			if v != nil {
1216				var location string
1217				err = json.Unmarshal(*v, &location)
1218				if err != nil {
1219					return err
1220				}
1221				bt.Location = &location
1222			}
1223		case "tags":
1224			if v != nil {
1225				var tags map[string]*string
1226				err = json.Unmarshal(*v, &tags)
1227				if err != nil {
1228					return err
1229				}
1230				bt.Tags = tags
1231			}
1232		}
1233	}
1234
1235	return nil
1236}
1237
1238// BuildTaskBuildRequest the queue build parameters based on a build task.
1239type BuildTaskBuildRequest struct {
1240	// BuildTaskName - The name of build task against which build has to be queued.
1241	BuildTaskName *string `json:"buildTaskName,omitempty"`
1242	// Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild'
1243	Type TypeBasicQueueBuildRequest `json:"type,omitempty"`
1244}
1245
1246// MarshalJSON is the custom marshaler for BuildTaskBuildRequest.
1247func (btbr BuildTaskBuildRequest) MarshalJSON() ([]byte, error) {
1248	btbr.Type = TypeBuildTask
1249	objectMap := make(map[string]interface{})
1250	if btbr.BuildTaskName != nil {
1251		objectMap["buildTaskName"] = btbr.BuildTaskName
1252	}
1253	if btbr.Type != "" {
1254		objectMap["type"] = btbr.Type
1255	}
1256	return json.Marshal(objectMap)
1257}
1258
1259// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest.
1260func (btbr BuildTaskBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) {
1261	return &btbr, true
1262}
1263
1264// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest.
1265func (btbr BuildTaskBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) {
1266	return nil, false
1267}
1268
1269// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest.
1270func (btbr BuildTaskBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) {
1271	return nil, false
1272}
1273
1274// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest.
1275func (btbr BuildTaskBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) {
1276	return &btbr, true
1277}
1278
1279// BuildTaskFilter the filter that can be used for listing build tasks.
1280type BuildTaskFilter struct {
1281	// Alias - The alternative name for build task.
1282	Alias *string `json:"alias,omitempty"`
1283}
1284
1285// BuildTaskListResult the collection of build tasks.
1286type BuildTaskListResult struct {
1287	autorest.Response `json:"-"`
1288	// Value - The collection value.
1289	Value *[]BuildTask `json:"value,omitempty"`
1290	// NextLink - The URI that can be used to request the next set of paged results.
1291	NextLink *string `json:"nextLink,omitempty"`
1292}
1293
1294// BuildTaskListResultIterator provides access to a complete listing of BuildTask values.
1295type BuildTaskListResultIterator struct {
1296	i    int
1297	page BuildTaskListResultPage
1298}
1299
1300// NextWithContext advances to the next value.  If there was an error making
1301// the request the iterator does not advance and the error is returned.
1302func (iter *BuildTaskListResultIterator) NextWithContext(ctx context.Context) (err error) {
1303	if tracing.IsEnabled() {
1304		ctx = tracing.StartSpan(ctx, fqdn+"/BuildTaskListResultIterator.NextWithContext")
1305		defer func() {
1306			sc := -1
1307			if iter.Response().Response.Response != nil {
1308				sc = iter.Response().Response.Response.StatusCode
1309			}
1310			tracing.EndSpan(ctx, sc, err)
1311		}()
1312	}
1313	iter.i++
1314	if iter.i < len(iter.page.Values()) {
1315		return nil
1316	}
1317	err = iter.page.NextWithContext(ctx)
1318	if err != nil {
1319		iter.i--
1320		return err
1321	}
1322	iter.i = 0
1323	return nil
1324}
1325
1326// Next advances to the next value.  If there was an error making
1327// the request the iterator does not advance and the error is returned.
1328// Deprecated: Use NextWithContext() instead.
1329func (iter *BuildTaskListResultIterator) Next() error {
1330	return iter.NextWithContext(context.Background())
1331}
1332
1333// NotDone returns true if the enumeration should be started or is not yet complete.
1334func (iter BuildTaskListResultIterator) NotDone() bool {
1335	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1336}
1337
1338// Response returns the raw server response from the last page request.
1339func (iter BuildTaskListResultIterator) Response() BuildTaskListResult {
1340	return iter.page.Response()
1341}
1342
1343// Value returns the current value or a zero-initialized value if the
1344// iterator has advanced beyond the end of the collection.
1345func (iter BuildTaskListResultIterator) Value() BuildTask {
1346	if !iter.page.NotDone() {
1347		return BuildTask{}
1348	}
1349	return iter.page.Values()[iter.i]
1350}
1351
1352// Creates a new instance of the BuildTaskListResultIterator type.
1353func NewBuildTaskListResultIterator(page BuildTaskListResultPage) BuildTaskListResultIterator {
1354	return BuildTaskListResultIterator{page: page}
1355}
1356
1357// IsEmpty returns true if the ListResult contains no values.
1358func (btlr BuildTaskListResult) IsEmpty() bool {
1359	return btlr.Value == nil || len(*btlr.Value) == 0
1360}
1361
1362// hasNextLink returns true if the NextLink is not empty.
1363func (btlr BuildTaskListResult) hasNextLink() bool {
1364	return btlr.NextLink != nil && len(*btlr.NextLink) != 0
1365}
1366
1367// buildTaskListResultPreparer prepares a request to retrieve the next set of results.
1368// It returns nil if no more results exist.
1369func (btlr BuildTaskListResult) buildTaskListResultPreparer(ctx context.Context) (*http.Request, error) {
1370	if !btlr.hasNextLink() {
1371		return nil, nil
1372	}
1373	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1374		autorest.AsJSON(),
1375		autorest.AsGet(),
1376		autorest.WithBaseURL(to.String(btlr.NextLink)))
1377}
1378
1379// BuildTaskListResultPage contains a page of BuildTask values.
1380type BuildTaskListResultPage struct {
1381	fn   func(context.Context, BuildTaskListResult) (BuildTaskListResult, error)
1382	btlr BuildTaskListResult
1383}
1384
1385// NextWithContext advances to the next page of values.  If there was an error making
1386// the request the page does not advance and the error is returned.
1387func (page *BuildTaskListResultPage) NextWithContext(ctx context.Context) (err error) {
1388	if tracing.IsEnabled() {
1389		ctx = tracing.StartSpan(ctx, fqdn+"/BuildTaskListResultPage.NextWithContext")
1390		defer func() {
1391			sc := -1
1392			if page.Response().Response.Response != nil {
1393				sc = page.Response().Response.Response.StatusCode
1394			}
1395			tracing.EndSpan(ctx, sc, err)
1396		}()
1397	}
1398	for {
1399		next, err := page.fn(ctx, page.btlr)
1400		if err != nil {
1401			return err
1402		}
1403		page.btlr = next
1404		if !next.hasNextLink() || !next.IsEmpty() {
1405			break
1406		}
1407	}
1408	return nil
1409}
1410
1411// Next advances to the next page of values.  If there was an error making
1412// the request the page does not advance and the error is returned.
1413// Deprecated: Use NextWithContext() instead.
1414func (page *BuildTaskListResultPage) Next() error {
1415	return page.NextWithContext(context.Background())
1416}
1417
1418// NotDone returns true if the page enumeration should be started or is not yet complete.
1419func (page BuildTaskListResultPage) NotDone() bool {
1420	return !page.btlr.IsEmpty()
1421}
1422
1423// Response returns the raw server response from the last page request.
1424func (page BuildTaskListResultPage) Response() BuildTaskListResult {
1425	return page.btlr
1426}
1427
1428// Values returns the slice of values for the current page or nil if there are no values.
1429func (page BuildTaskListResultPage) Values() []BuildTask {
1430	if page.btlr.IsEmpty() {
1431		return nil
1432	}
1433	return *page.btlr.Value
1434}
1435
1436// Creates a new instance of the BuildTaskListResultPage type.
1437func NewBuildTaskListResultPage(cur BuildTaskListResult, getNextPage func(context.Context, BuildTaskListResult) (BuildTaskListResult, error)) BuildTaskListResultPage {
1438	return BuildTaskListResultPage{
1439		fn:   getNextPage,
1440		btlr: cur,
1441	}
1442}
1443
1444// BuildTaskProperties the properties of a build task.
1445type BuildTaskProperties struct {
1446	// ProvisioningState - READ-ONLY; The provisioning state of the build task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
1447	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1448	// CreationDate - READ-ONLY; The creation date of build task.
1449	CreationDate *date.Time `json:"creationDate,omitempty"`
1450	// Alias - The alternative updatable name for a build task.
1451	Alias *string `json:"alias,omitempty"`
1452	// Status - The current status of build task. Possible values include: 'Disabled', 'Enabled'
1453	Status BuildTaskStatus `json:"status,omitempty"`
1454	// SourceRepository - The properties that describes the source(code) for the build task.
1455	SourceRepository *SourceRepositoryProperties `json:"sourceRepository,omitempty"`
1456	// Platform - The platform properties against which the build has to happen.
1457	Platform *PlatformProperties `json:"platform,omitempty"`
1458	// Timeout - Build timeout in seconds.
1459	Timeout *int32 `json:"timeout,omitempty"`
1460}
1461
1462// MarshalJSON is the custom marshaler for BuildTaskProperties.
1463func (btp BuildTaskProperties) MarshalJSON() ([]byte, error) {
1464	objectMap := make(map[string]interface{})
1465	if btp.Alias != nil {
1466		objectMap["alias"] = btp.Alias
1467	}
1468	if btp.Status != "" {
1469		objectMap["status"] = btp.Status
1470	}
1471	if btp.SourceRepository != nil {
1472		objectMap["sourceRepository"] = btp.SourceRepository
1473	}
1474	if btp.Platform != nil {
1475		objectMap["platform"] = btp.Platform
1476	}
1477	if btp.Timeout != nil {
1478		objectMap["timeout"] = btp.Timeout
1479	}
1480	return json.Marshal(objectMap)
1481}
1482
1483// BuildTaskPropertiesUpdateParameters the properties for updating a build task.
1484type BuildTaskPropertiesUpdateParameters struct {
1485	// Alias - The alternative updatable name for a build task.
1486	Alias *string `json:"alias,omitempty"`
1487	// Status - The current status of build task. Possible values include: 'Disabled', 'Enabled'
1488	Status BuildTaskStatus `json:"status,omitempty"`
1489	// Platform - The platform properties against which the build has to happen.
1490	Platform *PlatformProperties `json:"platform,omitempty"`
1491	// Timeout - Build timeout in seconds.
1492	Timeout *int32 `json:"timeout,omitempty"`
1493	// SourceRepository - The properties that describes the source(code) for the build task.
1494	SourceRepository *SourceRepositoryUpdateParameters `json:"sourceRepository,omitempty"`
1495}
1496
1497// BuildTasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1498// operation.
1499type BuildTasksCreateFuture struct {
1500	azure.FutureAPI
1501	// Result returns the result of the asynchronous operation.
1502	// If the operation has not completed it will return an error.
1503	Result func(BuildTasksClient) (BuildTask, error)
1504}
1505
1506// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1507func (future *BuildTasksCreateFuture) UnmarshalJSON(body []byte) error {
1508	var azFuture azure.Future
1509	if err := json.Unmarshal(body, &azFuture); err != nil {
1510		return err
1511	}
1512	future.FutureAPI = &azFuture
1513	future.Result = future.result
1514	return nil
1515}
1516
1517// result is the default implementation for BuildTasksCreateFuture.Result.
1518func (future *BuildTasksCreateFuture) result(client BuildTasksClient) (bt BuildTask, err error) {
1519	var done bool
1520	done, err = future.DoneWithContext(context.Background(), client)
1521	if err != nil {
1522		err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", future.Response(), "Polling failure")
1523		return
1524	}
1525	if !done {
1526		bt.Response.Response = future.Response()
1527		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksCreateFuture")
1528		return
1529	}
1530	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1531	if bt.Response.Response, err = future.GetResult(sender); err == nil && bt.Response.Response.StatusCode != http.StatusNoContent {
1532		bt, err = client.CreateResponder(bt.Response.Response)
1533		if err != nil {
1534			err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", bt.Response.Response, "Failure responding to request")
1535		}
1536	}
1537	return
1538}
1539
1540// BuildTasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1541// operation.
1542type BuildTasksDeleteFuture struct {
1543	azure.FutureAPI
1544	// Result returns the result of the asynchronous operation.
1545	// If the operation has not completed it will return an error.
1546	Result func(BuildTasksClient) (autorest.Response, error)
1547}
1548
1549// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1550func (future *BuildTasksDeleteFuture) UnmarshalJSON(body []byte) error {
1551	var azFuture azure.Future
1552	if err := json.Unmarshal(body, &azFuture); err != nil {
1553		return err
1554	}
1555	future.FutureAPI = &azFuture
1556	future.Result = future.result
1557	return nil
1558}
1559
1560// result is the default implementation for BuildTasksDeleteFuture.Result.
1561func (future *BuildTasksDeleteFuture) result(client BuildTasksClient) (ar autorest.Response, err error) {
1562	var done bool
1563	done, err = future.DoneWithContext(context.Background(), client)
1564	if err != nil {
1565		err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", future.Response(), "Polling failure")
1566		return
1567	}
1568	if !done {
1569		ar.Response = future.Response()
1570		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksDeleteFuture")
1571		return
1572	}
1573	ar.Response = future.Response()
1574	return
1575}
1576
1577// BuildTasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1578// operation.
1579type BuildTasksUpdateFuture struct {
1580	azure.FutureAPI
1581	// Result returns the result of the asynchronous operation.
1582	// If the operation has not completed it will return an error.
1583	Result func(BuildTasksClient) (BuildTask, error)
1584}
1585
1586// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1587func (future *BuildTasksUpdateFuture) UnmarshalJSON(body []byte) error {
1588	var azFuture azure.Future
1589	if err := json.Unmarshal(body, &azFuture); err != nil {
1590		return err
1591	}
1592	future.FutureAPI = &azFuture
1593	future.Result = future.result
1594	return nil
1595}
1596
1597// result is the default implementation for BuildTasksUpdateFuture.Result.
1598func (future *BuildTasksUpdateFuture) result(client BuildTasksClient) (bt BuildTask, err error) {
1599	var done bool
1600	done, err = future.DoneWithContext(context.Background(), client)
1601	if err != nil {
1602		err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", future.Response(), "Polling failure")
1603		return
1604	}
1605	if !done {
1606		bt.Response.Response = future.Response()
1607		err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksUpdateFuture")
1608		return
1609	}
1610	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1611	if bt.Response.Response, err = future.GetResult(sender); err == nil && bt.Response.Response.StatusCode != http.StatusNoContent {
1612		bt, err = client.UpdateResponder(bt.Response.Response)
1613		if err != nil {
1614			err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", bt.Response.Response, "Failure responding to request")
1615		}
1616	}
1617	return
1618}
1619
1620// BuildTaskUpdateParameters the parameters for updating a build task.
1621type BuildTaskUpdateParameters struct {
1622	// BuildTaskPropertiesUpdateParameters - The properties for updating a build task.
1623	*BuildTaskPropertiesUpdateParameters `json:"properties,omitempty"`
1624	// Tags - The ARM resource tags.
1625	Tags map[string]*string `json:"tags"`
1626}
1627
1628// MarshalJSON is the custom marshaler for BuildTaskUpdateParameters.
1629func (btup BuildTaskUpdateParameters) MarshalJSON() ([]byte, error) {
1630	objectMap := make(map[string]interface{})
1631	if btup.BuildTaskPropertiesUpdateParameters != nil {
1632		objectMap["properties"] = btup.BuildTaskPropertiesUpdateParameters
1633	}
1634	if btup.Tags != nil {
1635		objectMap["tags"] = btup.Tags
1636	}
1637	return json.Marshal(objectMap)
1638}
1639
1640// UnmarshalJSON is the custom unmarshaler for BuildTaskUpdateParameters struct.
1641func (btup *BuildTaskUpdateParameters) UnmarshalJSON(body []byte) error {
1642	var m map[string]*json.RawMessage
1643	err := json.Unmarshal(body, &m)
1644	if err != nil {
1645		return err
1646	}
1647	for k, v := range m {
1648		switch k {
1649		case "properties":
1650			if v != nil {
1651				var buildTaskPropertiesUpdateParameters BuildTaskPropertiesUpdateParameters
1652				err = json.Unmarshal(*v, &buildTaskPropertiesUpdateParameters)
1653				if err != nil {
1654					return err
1655				}
1656				btup.BuildTaskPropertiesUpdateParameters = &buildTaskPropertiesUpdateParameters
1657			}
1658		case "tags":
1659			if v != nil {
1660				var tags map[string]*string
1661				err = json.Unmarshal(*v, &tags)
1662				if err != nil {
1663					return err
1664				}
1665				btup.Tags = tags
1666			}
1667		}
1668	}
1669
1670	return nil
1671}
1672
1673// BuildUpdateParameters the set of build properties that can be updated.
1674type BuildUpdateParameters struct {
1675	// IsArchiveEnabled - The value that indicates whether archiving is enabled or not.
1676	IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"`
1677}
1678
1679// CallbackConfig the configuration of service URI and custom headers for the webhook.
1680type CallbackConfig struct {
1681	autorest.Response `json:"-"`
1682	// ServiceURI - The service URI for the webhook to post notifications.
1683	ServiceURI *string `json:"serviceUri,omitempty"`
1684	// CustomHeaders - Custom headers that will be added to the webhook notifications.
1685	CustomHeaders map[string]*string `json:"customHeaders"`
1686}
1687
1688// MarshalJSON is the custom marshaler for CallbackConfig.
1689func (cc CallbackConfig) MarshalJSON() ([]byte, error) {
1690	objectMap := make(map[string]interface{})
1691	if cc.ServiceURI != nil {
1692		objectMap["serviceUri"] = cc.ServiceURI
1693	}
1694	if cc.CustomHeaders != nil {
1695		objectMap["customHeaders"] = cc.CustomHeaders
1696	}
1697	return json.Marshal(objectMap)
1698}
1699
1700// DockerBuildStep the Docker build step.
1701type DockerBuildStep struct {
1702	// Branch - The repository branch name.
1703	Branch *string `json:"branch,omitempty"`
1704	// ImageNames - The fully qualified image names including the repository and tag.
1705	ImageNames *[]string `json:"imageNames,omitempty"`
1706	// IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not.
1707	IsPushEnabled *bool `json:"isPushEnabled,omitempty"`
1708	// NoCache - The value of this property indicates whether the image cache is enabled or not.
1709	NoCache *bool `json:"noCache,omitempty"`
1710	// DockerFilePath - The Docker file path relative to the source control root.
1711	DockerFilePath *string `json:"dockerFilePath,omitempty"`
1712	// ContextPath - The relative context path for a docker build in the source.
1713	ContextPath *string `json:"contextPath,omitempty"`
1714	// BuildArguments - The custom arguments for building this build step.
1715	BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"`
1716	// BaseImageDependencies - READ-ONLY; List of base image dependencies for a step.
1717	BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"`
1718	// BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None'
1719	BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"`
1720	// ProvisioningState - READ-ONLY; The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
1721	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1722	// Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker'
1723	Type Type `json:"type,omitempty"`
1724}
1725
1726// MarshalJSON is the custom marshaler for DockerBuildStep.
1727func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) {
1728	dbs.Type = TypeDocker
1729	objectMap := make(map[string]interface{})
1730	if dbs.Branch != nil {
1731		objectMap["branch"] = dbs.Branch
1732	}
1733	if dbs.ImageNames != nil {
1734		objectMap["imageNames"] = dbs.ImageNames
1735	}
1736	if dbs.IsPushEnabled != nil {
1737		objectMap["isPushEnabled"] = dbs.IsPushEnabled
1738	}
1739	if dbs.NoCache != nil {
1740		objectMap["noCache"] = dbs.NoCache
1741	}
1742	if dbs.DockerFilePath != nil {
1743		objectMap["dockerFilePath"] = dbs.DockerFilePath
1744	}
1745	if dbs.ContextPath != nil {
1746		objectMap["contextPath"] = dbs.ContextPath
1747	}
1748	if dbs.BuildArguments != nil {
1749		objectMap["buildArguments"] = dbs.BuildArguments
1750	}
1751	if dbs.BaseImageTrigger != "" {
1752		objectMap["baseImageTrigger"] = dbs.BaseImageTrigger
1753	}
1754	if dbs.Type != "" {
1755		objectMap["type"] = dbs.Type
1756	}
1757	return json.Marshal(objectMap)
1758}
1759
1760// AsDockerBuildStep is the BasicBuildStepProperties implementation for DockerBuildStep.
1761func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) {
1762	return &dbs, true
1763}
1764
1765// AsBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep.
1766func (dbs DockerBuildStep) AsBuildStepProperties() (*BuildStepProperties, bool) {
1767	return nil, false
1768}
1769
1770// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep.
1771func (dbs DockerBuildStep) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) {
1772	return &dbs, true
1773}
1774
1775// DockerBuildStepUpdateParameters the properties for updating a docker build step.
1776type DockerBuildStepUpdateParameters struct {
1777	// Branch - The repository branch name.
1778	Branch *string `json:"branch,omitempty"`
1779	// ImageNames - The fully qualified image names including the repository and tag.
1780	ImageNames *[]string `json:"imageNames,omitempty"`
1781	// IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not.
1782	IsPushEnabled *bool `json:"isPushEnabled,omitempty"`
1783	// NoCache - The value of this property indicates whether the image cache is enabled or not.
1784	NoCache *bool `json:"noCache,omitempty"`
1785	// DockerFilePath - The Docker file path relative to the source control root.
1786	DockerFilePath *string `json:"dockerFilePath,omitempty"`
1787	// ContextPath - The relative context path for a docker build in the source.
1788	ContextPath *string `json:"contextPath,omitempty"`
1789	// BuildArguments - The custom arguments for building this build step.
1790	BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"`
1791	// BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None'
1792	BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"`
1793	// Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker'
1794	Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"`
1795}
1796
1797// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters.
1798func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) {
1799	dbsup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeDocker
1800	objectMap := make(map[string]interface{})
1801	if dbsup.Branch != nil {
1802		objectMap["branch"] = dbsup.Branch
1803	}
1804	if dbsup.ImageNames != nil {
1805		objectMap["imageNames"] = dbsup.ImageNames
1806	}
1807	if dbsup.IsPushEnabled != nil {
1808		objectMap["isPushEnabled"] = dbsup.IsPushEnabled
1809	}
1810	if dbsup.NoCache != nil {
1811		objectMap["noCache"] = dbsup.NoCache
1812	}
1813	if dbsup.DockerFilePath != nil {
1814		objectMap["dockerFilePath"] = dbsup.DockerFilePath
1815	}
1816	if dbsup.ContextPath != nil {
1817		objectMap["contextPath"] = dbsup.ContextPath
1818	}
1819	if dbsup.BuildArguments != nil {
1820		objectMap["buildArguments"] = dbsup.BuildArguments
1821	}
1822	if dbsup.BaseImageTrigger != "" {
1823		objectMap["baseImageTrigger"] = dbsup.BaseImageTrigger
1824	}
1825	if dbsup.Type != "" {
1826		objectMap["type"] = dbsup.Type
1827	}
1828	return json.Marshal(objectMap)
1829}
1830
1831// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters.
1832func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) {
1833	return &dbsup, true
1834}
1835
1836// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters.
1837func (dbsup DockerBuildStepUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) {
1838	return nil, false
1839}
1840
1841// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters.
1842func (dbsup DockerBuildStepUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) {
1843	return &dbsup, true
1844}
1845
1846// Event the event for a webhook.
1847type Event struct {
1848	// EventRequestMessage - The event request message sent to the service URI.
1849	EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"`
1850	// EventResponseMessage - The event response message received from the service URI.
1851	EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"`
1852	// ID - The event ID.
1853	ID *string `json:"id,omitempty"`
1854}
1855
1856// EventContent the content of the event request message.
1857type EventContent struct {
1858	// ID - The event ID.
1859	ID *string `json:"id,omitempty"`
1860	// Timestamp - The time at which the event occurred.
1861	Timestamp *date.Time `json:"timestamp,omitempty"`
1862	// Action - The action that encompasses the provided event.
1863	Action *string `json:"action,omitempty"`
1864	// Target - The target of the event.
1865	Target *Target `json:"target,omitempty"`
1866	// Request - The request that generated the event.
1867	Request *Request `json:"request,omitempty"`
1868	// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request.
1869	Actor *Actor `json:"actor,omitempty"`
1870	// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it.
1871	Source *Source `json:"source,omitempty"`
1872}
1873
1874// EventInfo the basic information of an event.
1875type EventInfo struct {
1876	autorest.Response `json:"-"`
1877	// ID - The event ID.
1878	ID *string `json:"id,omitempty"`
1879}
1880
1881// EventListResult the result of a request to list events for a webhook.
1882type EventListResult struct {
1883	autorest.Response `json:"-"`
1884	// Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events.
1885	Value *[]Event `json:"value,omitempty"`
1886	// NextLink - The URI that can be used to request the next list of events.
1887	NextLink *string `json:"nextLink,omitempty"`
1888}
1889
1890// EventListResultIterator provides access to a complete listing of Event values.
1891type EventListResultIterator struct {
1892	i    int
1893	page EventListResultPage
1894}
1895
1896// NextWithContext advances to the next value.  If there was an error making
1897// the request the iterator does not advance and the error is returned.
1898func (iter *EventListResultIterator) NextWithContext(ctx context.Context) (err error) {
1899	if tracing.IsEnabled() {
1900		ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.NextWithContext")
1901		defer func() {
1902			sc := -1
1903			if iter.Response().Response.Response != nil {
1904				sc = iter.Response().Response.Response.StatusCode
1905			}
1906			tracing.EndSpan(ctx, sc, err)
1907		}()
1908	}
1909	iter.i++
1910	if iter.i < len(iter.page.Values()) {
1911		return nil
1912	}
1913	err = iter.page.NextWithContext(ctx)
1914	if err != nil {
1915		iter.i--
1916		return err
1917	}
1918	iter.i = 0
1919	return nil
1920}
1921
1922// Next advances to the next value.  If there was an error making
1923// the request the iterator does not advance and the error is returned.
1924// Deprecated: Use NextWithContext() instead.
1925func (iter *EventListResultIterator) Next() error {
1926	return iter.NextWithContext(context.Background())
1927}
1928
1929// NotDone returns true if the enumeration should be started or is not yet complete.
1930func (iter EventListResultIterator) NotDone() bool {
1931	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1932}
1933
1934// Response returns the raw server response from the last page request.
1935func (iter EventListResultIterator) Response() EventListResult {
1936	return iter.page.Response()
1937}
1938
1939// Value returns the current value or a zero-initialized value if the
1940// iterator has advanced beyond the end of the collection.
1941func (iter EventListResultIterator) Value() Event {
1942	if !iter.page.NotDone() {
1943		return Event{}
1944	}
1945	return iter.page.Values()[iter.i]
1946}
1947
1948// Creates a new instance of the EventListResultIterator type.
1949func NewEventListResultIterator(page EventListResultPage) EventListResultIterator {
1950	return EventListResultIterator{page: page}
1951}
1952
1953// IsEmpty returns true if the ListResult contains no values.
1954func (elr EventListResult) IsEmpty() bool {
1955	return elr.Value == nil || len(*elr.Value) == 0
1956}
1957
1958// hasNextLink returns true if the NextLink is not empty.
1959func (elr EventListResult) hasNextLink() bool {
1960	return elr.NextLink != nil && len(*elr.NextLink) != 0
1961}
1962
1963// eventListResultPreparer prepares a request to retrieve the next set of results.
1964// It returns nil if no more results exist.
1965func (elr EventListResult) eventListResultPreparer(ctx context.Context) (*http.Request, error) {
1966	if !elr.hasNextLink() {
1967		return nil, nil
1968	}
1969	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1970		autorest.AsJSON(),
1971		autorest.AsGet(),
1972		autorest.WithBaseURL(to.String(elr.NextLink)))
1973}
1974
1975// EventListResultPage contains a page of Event values.
1976type EventListResultPage struct {
1977	fn  func(context.Context, EventListResult) (EventListResult, error)
1978	elr EventListResult
1979}
1980
1981// NextWithContext advances to the next page of values.  If there was an error making
1982// the request the page does not advance and the error is returned.
1983func (page *EventListResultPage) NextWithContext(ctx context.Context) (err error) {
1984	if tracing.IsEnabled() {
1985		ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.NextWithContext")
1986		defer func() {
1987			sc := -1
1988			if page.Response().Response.Response != nil {
1989				sc = page.Response().Response.Response.StatusCode
1990			}
1991			tracing.EndSpan(ctx, sc, err)
1992		}()
1993	}
1994	for {
1995		next, err := page.fn(ctx, page.elr)
1996		if err != nil {
1997			return err
1998		}
1999		page.elr = next
2000		if !next.hasNextLink() || !next.IsEmpty() {
2001			break
2002		}
2003	}
2004	return nil
2005}
2006
2007// Next advances to the next page of values.  If there was an error making
2008// the request the page does not advance and the error is returned.
2009// Deprecated: Use NextWithContext() instead.
2010func (page *EventListResultPage) Next() error {
2011	return page.NextWithContext(context.Background())
2012}
2013
2014// NotDone returns true if the page enumeration should be started or is not yet complete.
2015func (page EventListResultPage) NotDone() bool {
2016	return !page.elr.IsEmpty()
2017}
2018
2019// Response returns the raw server response from the last page request.
2020func (page EventListResultPage) Response() EventListResult {
2021	return page.elr
2022}
2023
2024// Values returns the slice of values for the current page or nil if there are no values.
2025func (page EventListResultPage) Values() []Event {
2026	if page.elr.IsEmpty() {
2027		return nil
2028	}
2029	return *page.elr.Value
2030}
2031
2032// Creates a new instance of the EventListResultPage type.
2033func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage {
2034	return EventListResultPage{
2035		fn:  getNextPage,
2036		elr: cur,
2037	}
2038}
2039
2040// EventRequestMessage the event request message sent to the service URI.
2041type EventRequestMessage struct {
2042	// Content - The content of the event request message.
2043	Content *EventContent `json:"content,omitempty"`
2044	// Headers - The headers of the event request message.
2045	Headers map[string]*string `json:"headers"`
2046	// Method - The HTTP method used to send the event request message.
2047	Method *string `json:"method,omitempty"`
2048	// RequestURI - The URI used to send the event request message.
2049	RequestURI *string `json:"requestUri,omitempty"`
2050	// Version - The HTTP message version.
2051	Version *string `json:"version,omitempty"`
2052}
2053
2054// MarshalJSON is the custom marshaler for EventRequestMessage.
2055func (erm EventRequestMessage) MarshalJSON() ([]byte, error) {
2056	objectMap := make(map[string]interface{})
2057	if erm.Content != nil {
2058		objectMap["content"] = erm.Content
2059	}
2060	if erm.Headers != nil {
2061		objectMap["headers"] = erm.Headers
2062	}
2063	if erm.Method != nil {
2064		objectMap["method"] = erm.Method
2065	}
2066	if erm.RequestURI != nil {
2067		objectMap["requestUri"] = erm.RequestURI
2068	}
2069	if erm.Version != nil {
2070		objectMap["version"] = erm.Version
2071	}
2072	return json.Marshal(objectMap)
2073}
2074
2075// EventResponseMessage the event response message received from the service URI.
2076type EventResponseMessage struct {
2077	// Content - The content of the event response message.
2078	Content *string `json:"content,omitempty"`
2079	// Headers - The headers of the event response message.
2080	Headers map[string]*string `json:"headers"`
2081	// ReasonPhrase - The reason phrase of the event response message.
2082	ReasonPhrase *string `json:"reasonPhrase,omitempty"`
2083	// StatusCode - The status code of the event response message.
2084	StatusCode *string `json:"statusCode,omitempty"`
2085	// Version - The HTTP message version.
2086	Version *string `json:"version,omitempty"`
2087}
2088
2089// MarshalJSON is the custom marshaler for EventResponseMessage.
2090func (erm EventResponseMessage) MarshalJSON() ([]byte, error) {
2091	objectMap := make(map[string]interface{})
2092	if erm.Content != nil {
2093		objectMap["content"] = erm.Content
2094	}
2095	if erm.Headers != nil {
2096		objectMap["headers"] = erm.Headers
2097	}
2098	if erm.ReasonPhrase != nil {
2099		objectMap["reasonPhrase"] = erm.ReasonPhrase
2100	}
2101	if erm.StatusCode != nil {
2102		objectMap["statusCode"] = erm.StatusCode
2103	}
2104	if erm.Version != nil {
2105		objectMap["version"] = erm.Version
2106	}
2107	return json.Marshal(objectMap)
2108}
2109
2110// GitCommitTrigger the git commit trigger that caused a build.
2111type GitCommitTrigger struct {
2112	// ID - The unique ID of the trigger.
2113	ID *string `json:"id,omitempty"`
2114	// CommitID - The unique ID that identifies a commit.
2115	CommitID *string `json:"commitId,omitempty"`
2116	// RepositoryURL - The repository URL.
2117	RepositoryURL *string `json:"repositoryUrl,omitempty"`
2118	// BranchName - The branch name in the repository.
2119	BranchName *string `json:"branchName,omitempty"`
2120	// ProviderType - The source control provider type.
2121	ProviderType *string `json:"providerType,omitempty"`
2122}
2123
2124// ImageDescriptor properties for a registry image.
2125type ImageDescriptor struct {
2126	// Registry - The registry login server.
2127	Registry *string `json:"registry,omitempty"`
2128	// Repository - The repository name.
2129	Repository *string `json:"repository,omitempty"`
2130	// Tag - The tag name.
2131	Tag *string `json:"tag,omitempty"`
2132	// Digest - The sha256-based digest of the image manifest.
2133	Digest *string `json:"digest,omitempty"`
2134}
2135
2136// ImageUpdateTrigger the image update trigger that caused a build.
2137type ImageUpdateTrigger struct {
2138	// ID - The unique ID of the trigger.
2139	ID *string `json:"id,omitempty"`
2140	// Timestamp - The timestamp when the image update happened.
2141	Timestamp *date.Time `json:"timestamp,omitempty"`
2142	// Images - The list of image updates that caused the build.
2143	Images *[]ImageDescriptor `json:"images,omitempty"`
2144}
2145
2146// ImportImageParameters ...
2147type ImportImageParameters struct {
2148	// Source - The source of the image.
2149	Source *ImportSource `json:"source,omitempty"`
2150	// TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted).
2151	TargetTags *[]string `json:"targetTags,omitempty"`
2152	// UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created.
2153	UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"`
2154	// Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force'
2155	Mode ImportMode `json:"mode,omitempty"`
2156}
2157
2158// ImportSource ...
2159type ImportSource struct {
2160	// ResourceID - The resource identifier of the source Azure Container Registry.
2161	ResourceID *string `json:"resourceId,omitempty"`
2162	// RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com').
2163	RegistryURI *string `json:"registryUri,omitempty"`
2164	// Credentials - Credentials used when importing from a registry uri.
2165	Credentials *ImportSourceCredentials `json:"credentials,omitempty"`
2166	// SourceImage - Repository name of the source image.
2167	// Specify an image by repository ('hello-world'). This will use the 'latest' tag.
2168	// Specify an image by tag ('hello-world:latest').
2169	// Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123').
2170	SourceImage *string `json:"sourceImage,omitempty"`
2171}
2172
2173// ImportSourceCredentials ...
2174type ImportSourceCredentials struct {
2175	// Username - The username to authenticate with the source registry.
2176	Username *string `json:"username,omitempty"`
2177	// Password - The password used to authenticate with the source registry.
2178	Password *string `json:"password,omitempty"`
2179}
2180
2181// IPRule IP rule with specific IP or IP range in CIDR format.
2182type IPRule struct {
2183	// Action - The action of IP ACL rule. Possible values include: 'Allow'
2184	Action Action `json:"action,omitempty"`
2185	// IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed.
2186	IPAddressOrRange *string `json:"value,omitempty"`
2187}
2188
2189// NetworkRuleSet the network rule set for a container registry.
2190type NetworkRuleSet struct {
2191	// DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny'
2192	DefaultAction DefaultAction `json:"defaultAction,omitempty"`
2193	// VirtualNetworkRules - The virtual network rules.
2194	VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"`
2195	// IPRules - The IP ACL rules.
2196	IPRules *[]IPRule `json:"ipRules,omitempty"`
2197}
2198
2199// OperationDefinition the definition of a container registry operation.
2200type OperationDefinition struct {
2201	// Origin - The origin information of the container registry operation.
2202	Origin *string `json:"origin,omitempty"`
2203	// Name - Operation name: {provider}/{resource}/{operation}.
2204	Name *string `json:"name,omitempty"`
2205	// Display - The display information for the container registry operation.
2206	Display *OperationDisplayDefinition `json:"display,omitempty"`
2207	// OperationPropertiesDefinition - The properties information for the container registry operation.
2208	*OperationPropertiesDefinition `json:"properties,omitempty"`
2209}
2210
2211// MarshalJSON is the custom marshaler for OperationDefinition.
2212func (od OperationDefinition) MarshalJSON() ([]byte, error) {
2213	objectMap := make(map[string]interface{})
2214	if od.Origin != nil {
2215		objectMap["origin"] = od.Origin
2216	}
2217	if od.Name != nil {
2218		objectMap["name"] = od.Name
2219	}
2220	if od.Display != nil {
2221		objectMap["display"] = od.Display
2222	}
2223	if od.OperationPropertiesDefinition != nil {
2224		objectMap["properties"] = od.OperationPropertiesDefinition
2225	}
2226	return json.Marshal(objectMap)
2227}
2228
2229// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct.
2230func (od *OperationDefinition) UnmarshalJSON(body []byte) error {
2231	var m map[string]*json.RawMessage
2232	err := json.Unmarshal(body, &m)
2233	if err != nil {
2234		return err
2235	}
2236	for k, v := range m {
2237		switch k {
2238		case "origin":
2239			if v != nil {
2240				var origin string
2241				err = json.Unmarshal(*v, &origin)
2242				if err != nil {
2243					return err
2244				}
2245				od.Origin = &origin
2246			}
2247		case "name":
2248			if v != nil {
2249				var name string
2250				err = json.Unmarshal(*v, &name)
2251				if err != nil {
2252					return err
2253				}
2254				od.Name = &name
2255			}
2256		case "display":
2257			if v != nil {
2258				var display OperationDisplayDefinition
2259				err = json.Unmarshal(*v, &display)
2260				if err != nil {
2261					return err
2262				}
2263				od.Display = &display
2264			}
2265		case "properties":
2266			if v != nil {
2267				var operationPropertiesDefinition OperationPropertiesDefinition
2268				err = json.Unmarshal(*v, &operationPropertiesDefinition)
2269				if err != nil {
2270					return err
2271				}
2272				od.OperationPropertiesDefinition = &operationPropertiesDefinition
2273			}
2274		}
2275	}
2276
2277	return nil
2278}
2279
2280// OperationDisplayDefinition the display information for a container registry operation.
2281type OperationDisplayDefinition struct {
2282	// Provider - The resource provider name: Microsoft.ContainerRegistry.
2283	Provider *string `json:"provider,omitempty"`
2284	// Resource - The resource on which the operation is performed.
2285	Resource *string `json:"resource,omitempty"`
2286	// Operation - The operation that users can perform.
2287	Operation *string `json:"operation,omitempty"`
2288	// Description - The description for the operation.
2289	Description *string `json:"description,omitempty"`
2290}
2291
2292// OperationListResult the result of a request to list container registry operations.
2293type OperationListResult struct {
2294	autorest.Response `json:"-"`
2295	// 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.
2296	Value *[]OperationDefinition `json:"value,omitempty"`
2297	// NextLink - The URI that can be used to request the next list of container registry operations.
2298	NextLink *string `json:"nextLink,omitempty"`
2299}
2300
2301// OperationListResultIterator provides access to a complete listing of OperationDefinition values.
2302type OperationListResultIterator struct {
2303	i    int
2304	page OperationListResultPage
2305}
2306
2307// NextWithContext advances to the next value.  If there was an error making
2308// the request the iterator does not advance and the error is returned.
2309func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
2310	if tracing.IsEnabled() {
2311		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
2312		defer func() {
2313			sc := -1
2314			if iter.Response().Response.Response != nil {
2315				sc = iter.Response().Response.Response.StatusCode
2316			}
2317			tracing.EndSpan(ctx, sc, err)
2318		}()
2319	}
2320	iter.i++
2321	if iter.i < len(iter.page.Values()) {
2322		return nil
2323	}
2324	err = iter.page.NextWithContext(ctx)
2325	if err != nil {
2326		iter.i--
2327		return err
2328	}
2329	iter.i = 0
2330	return nil
2331}
2332
2333// Next advances to the next value.  If there was an error making
2334// the request the iterator does not advance and the error is returned.
2335// Deprecated: Use NextWithContext() instead.
2336func (iter *OperationListResultIterator) Next() error {
2337	return iter.NextWithContext(context.Background())
2338}
2339
2340// NotDone returns true if the enumeration should be started or is not yet complete.
2341func (iter OperationListResultIterator) NotDone() bool {
2342	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2343}
2344
2345// Response returns the raw server response from the last page request.
2346func (iter OperationListResultIterator) Response() OperationListResult {
2347	return iter.page.Response()
2348}
2349
2350// Value returns the current value or a zero-initialized value if the
2351// iterator has advanced beyond the end of the collection.
2352func (iter OperationListResultIterator) Value() OperationDefinition {
2353	if !iter.page.NotDone() {
2354		return OperationDefinition{}
2355	}
2356	return iter.page.Values()[iter.i]
2357}
2358
2359// Creates a new instance of the OperationListResultIterator type.
2360func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
2361	return OperationListResultIterator{page: page}
2362}
2363
2364// IsEmpty returns true if the ListResult contains no values.
2365func (olr OperationListResult) IsEmpty() bool {
2366	return olr.Value == nil || len(*olr.Value) == 0
2367}
2368
2369// hasNextLink returns true if the NextLink is not empty.
2370func (olr OperationListResult) hasNextLink() bool {
2371	return olr.NextLink != nil && len(*olr.NextLink) != 0
2372}
2373
2374// operationListResultPreparer prepares a request to retrieve the next set of results.
2375// It returns nil if no more results exist.
2376func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
2377	if !olr.hasNextLink() {
2378		return nil, nil
2379	}
2380	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2381		autorest.AsJSON(),
2382		autorest.AsGet(),
2383		autorest.WithBaseURL(to.String(olr.NextLink)))
2384}
2385
2386// OperationListResultPage contains a page of OperationDefinition values.
2387type OperationListResultPage struct {
2388	fn  func(context.Context, OperationListResult) (OperationListResult, error)
2389	olr OperationListResult
2390}
2391
2392// NextWithContext advances to the next page of values.  If there was an error making
2393// the request the page does not advance and the error is returned.
2394func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
2395	if tracing.IsEnabled() {
2396		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
2397		defer func() {
2398			sc := -1
2399			if page.Response().Response.Response != nil {
2400				sc = page.Response().Response.Response.StatusCode
2401			}
2402			tracing.EndSpan(ctx, sc, err)
2403		}()
2404	}
2405	for {
2406		next, err := page.fn(ctx, page.olr)
2407		if err != nil {
2408			return err
2409		}
2410		page.olr = next
2411		if !next.hasNextLink() || !next.IsEmpty() {
2412			break
2413		}
2414	}
2415	return nil
2416}
2417
2418// Next advances to the next page of values.  If there was an error making
2419// the request the page does not advance and the error is returned.
2420// Deprecated: Use NextWithContext() instead.
2421func (page *OperationListResultPage) Next() error {
2422	return page.NextWithContext(context.Background())
2423}
2424
2425// NotDone returns true if the page enumeration should be started or is not yet complete.
2426func (page OperationListResultPage) NotDone() bool {
2427	return !page.olr.IsEmpty()
2428}
2429
2430// Response returns the raw server response from the last page request.
2431func (page OperationListResultPage) Response() OperationListResult {
2432	return page.olr
2433}
2434
2435// Values returns the slice of values for the current page or nil if there are no values.
2436func (page OperationListResultPage) Values() []OperationDefinition {
2437	if page.olr.IsEmpty() {
2438		return nil
2439	}
2440	return *page.olr.Value
2441}
2442
2443// Creates a new instance of the OperationListResultPage type.
2444func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
2445	return OperationListResultPage{
2446		fn:  getNextPage,
2447		olr: cur,
2448	}
2449}
2450
2451// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric.
2452type OperationMetricSpecificationDefinition struct {
2453	// Name - Metric name.
2454	Name *string `json:"name,omitempty"`
2455	// DisplayName - Metric display name.
2456	DisplayName *string `json:"displayName,omitempty"`
2457	// DisplayDescription - Metric description.
2458	DisplayDescription *string `json:"displayDescription,omitempty"`
2459	// Unit - Metric unit.
2460	Unit *string `json:"unit,omitempty"`
2461	// AggregationType - Metric aggregation type.
2462	AggregationType *string `json:"aggregationType,omitempty"`
2463	// InternalMetricName - Internal metric name.
2464	InternalMetricName *string `json:"internalMetricName,omitempty"`
2465}
2466
2467// OperationPropertiesDefinition the definition of Azure Monitoring properties.
2468type OperationPropertiesDefinition struct {
2469	// ServiceSpecification - The definition of Azure Monitoring service.
2470	ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"`
2471}
2472
2473// OperationServiceSpecificationDefinition the definition of Azure Monitoring metrics list.
2474type OperationServiceSpecificationDefinition struct {
2475	// MetricSpecifications - A list of Azure Monitoring metrics definition.
2476	MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"`
2477}
2478
2479// PlatformProperties the platform properties against which the build has to happen.
2480type PlatformProperties struct {
2481	// OsType - The operating system type required for the build. Possible values include: 'Windows', 'Linux'
2482	OsType OsType `json:"osType,omitempty"`
2483	// CPU - The CPU configuration in terms of number of cores required for the build.
2484	CPU *int32 `json:"cpu,omitempty"`
2485}
2486
2487// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
2488// required location and tags.
2489type ProxyResource struct {
2490	// ID - READ-ONLY; The resource ID.
2491	ID *string `json:"id,omitempty"`
2492	// Name - READ-ONLY; The name of the resource.
2493	Name *string `json:"name,omitempty"`
2494	// Type - READ-ONLY; The type of the resource.
2495	Type *string `json:"type,omitempty"`
2496}
2497
2498// MarshalJSON is the custom marshaler for ProxyResource.
2499func (pr ProxyResource) MarshalJSON() ([]byte, error) {
2500	objectMap := make(map[string]interface{})
2501	return json.Marshal(objectMap)
2502}
2503
2504// QuarantinePolicy an object that represents quarantine policy for a container registry.
2505type QuarantinePolicy struct {
2506	// Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled'
2507	Status PolicyStatus `json:"status,omitempty"`
2508}
2509
2510// BasicQueueBuildRequest the queue build request parameters.
2511type BasicQueueBuildRequest interface {
2512	AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool)
2513	AsQuickBuildRequest() (*QuickBuildRequest, bool)
2514	AsQueueBuildRequest() (*QueueBuildRequest, bool)
2515}
2516
2517// QueueBuildRequest the queue build request parameters.
2518type QueueBuildRequest struct {
2519	// Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild'
2520	Type TypeBasicQueueBuildRequest `json:"type,omitempty"`
2521}
2522
2523func unmarshalBasicQueueBuildRequest(body []byte) (BasicQueueBuildRequest, error) {
2524	var m map[string]interface{}
2525	err := json.Unmarshal(body, &m)
2526	if err != nil {
2527		return nil, err
2528	}
2529
2530	switch m["type"] {
2531	case string(TypeBuildTask):
2532		var btbr BuildTaskBuildRequest
2533		err := json.Unmarshal(body, &btbr)
2534		return btbr, err
2535	case string(TypeQuickBuild):
2536		var qbr QuickBuildRequest
2537		err := json.Unmarshal(body, &qbr)
2538		return qbr, err
2539	default:
2540		var qbr QueueBuildRequest
2541		err := json.Unmarshal(body, &qbr)
2542		return qbr, err
2543	}
2544}
2545func unmarshalBasicQueueBuildRequestArray(body []byte) ([]BasicQueueBuildRequest, error) {
2546	var rawMessages []*json.RawMessage
2547	err := json.Unmarshal(body, &rawMessages)
2548	if err != nil {
2549		return nil, err
2550	}
2551
2552	qbrArray := make([]BasicQueueBuildRequest, len(rawMessages))
2553
2554	for index, rawMessage := range rawMessages {
2555		qbr, err := unmarshalBasicQueueBuildRequest(*rawMessage)
2556		if err != nil {
2557			return nil, err
2558		}
2559		qbrArray[index] = qbr
2560	}
2561	return qbrArray, nil
2562}
2563
2564// MarshalJSON is the custom marshaler for QueueBuildRequest.
2565func (qbr QueueBuildRequest) MarshalJSON() ([]byte, error) {
2566	qbr.Type = TypeQueueBuildRequest
2567	objectMap := make(map[string]interface{})
2568	if qbr.Type != "" {
2569		objectMap["type"] = qbr.Type
2570	}
2571	return json.Marshal(objectMap)
2572}
2573
2574// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest.
2575func (qbr QueueBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) {
2576	return nil, false
2577}
2578
2579// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest.
2580func (qbr QueueBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) {
2581	return nil, false
2582}
2583
2584// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest.
2585func (qbr QueueBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) {
2586	return &qbr, true
2587}
2588
2589// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest.
2590func (qbr QueueBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) {
2591	return &qbr, true
2592}
2593
2594// QuickBuildRequest the queue build request parameters for a quick build.
2595type QuickBuildRequest struct {
2596	// ImageNames - The fully qualified image names including the repository and tag.
2597	ImageNames *[]string `json:"imageNames,omitempty"`
2598	// SourceLocation - The URL(absolute or relative) of the source that needs to be built. For Docker build, it can be an URL to a tar or github repository as supported by Docker.
2599	// If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl API.
2600	SourceLocation *string `json:"sourceLocation,omitempty"`
2601	// BuildArguments - The collection of build arguments to be used.
2602	BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"`
2603	// IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not.
2604	IsPushEnabled *bool `json:"isPushEnabled,omitempty"`
2605	// NoCache - The value of this property indicates whether the image cache is enabled or not.
2606	NoCache *bool `json:"noCache,omitempty"`
2607	// Timeout - Build timeout in seconds.
2608	Timeout *int32 `json:"timeout,omitempty"`
2609	// Platform - The platform properties against which the build will happen.
2610	Platform *PlatformProperties `json:"platform,omitempty"`
2611	// DockerFilePath - The Docker file path relative to the source location.
2612	DockerFilePath *string `json:"dockerFilePath,omitempty"`
2613	// Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild'
2614	Type TypeBasicQueueBuildRequest `json:"type,omitempty"`
2615}
2616
2617// MarshalJSON is the custom marshaler for QuickBuildRequest.
2618func (qbr QuickBuildRequest) MarshalJSON() ([]byte, error) {
2619	qbr.Type = TypeQuickBuild
2620	objectMap := make(map[string]interface{})
2621	if qbr.ImageNames != nil {
2622		objectMap["imageNames"] = qbr.ImageNames
2623	}
2624	if qbr.SourceLocation != nil {
2625		objectMap["sourceLocation"] = qbr.SourceLocation
2626	}
2627	if qbr.BuildArguments != nil {
2628		objectMap["buildArguments"] = qbr.BuildArguments
2629	}
2630	if qbr.IsPushEnabled != nil {
2631		objectMap["isPushEnabled"] = qbr.IsPushEnabled
2632	}
2633	if qbr.NoCache != nil {
2634		objectMap["noCache"] = qbr.NoCache
2635	}
2636	if qbr.Timeout != nil {
2637		objectMap["timeout"] = qbr.Timeout
2638	}
2639	if qbr.Platform != nil {
2640		objectMap["platform"] = qbr.Platform
2641	}
2642	if qbr.DockerFilePath != nil {
2643		objectMap["dockerFilePath"] = qbr.DockerFilePath
2644	}
2645	if qbr.Type != "" {
2646		objectMap["type"] = qbr.Type
2647	}
2648	return json.Marshal(objectMap)
2649}
2650
2651// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest.
2652func (qbr QuickBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) {
2653	return nil, false
2654}
2655
2656// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest.
2657func (qbr QuickBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) {
2658	return &qbr, true
2659}
2660
2661// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest.
2662func (qbr QuickBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) {
2663	return nil, false
2664}
2665
2666// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest.
2667func (qbr QuickBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) {
2668	return &qbr, true
2669}
2670
2671// RegenerateCredentialParameters the parameters used to regenerate the login credential.
2672type RegenerateCredentialParameters struct {
2673	// Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2'
2674	Name PasswordName `json:"name,omitempty"`
2675}
2676
2677// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running
2678// operation.
2679type RegistriesCreateFuture struct {
2680	azure.FutureAPI
2681	// Result returns the result of the asynchronous operation.
2682	// If the operation has not completed it will return an error.
2683	Result func(RegistriesClient) (Registry, error)
2684}
2685
2686// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2687func (future *RegistriesCreateFuture) UnmarshalJSON(body []byte) error {
2688	var azFuture azure.Future
2689	if err := json.Unmarshal(body, &azFuture); err != nil {
2690		return err
2691	}
2692	future.FutureAPI = &azFuture
2693	future.Result = future.result
2694	return nil
2695}
2696
2697// result is the default implementation for RegistriesCreateFuture.Result.
2698func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) {
2699	var done bool
2700	done, err = future.DoneWithContext(context.Background(), client)
2701	if err != nil {
2702		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure")
2703		return
2704	}
2705	if !done {
2706		r.Response.Response = future.Response()
2707		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture")
2708		return
2709	}
2710	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2711	if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {
2712		r, err = client.CreateResponder(r.Response.Response)
2713		if err != nil {
2714			err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request")
2715		}
2716	}
2717	return
2718}
2719
2720// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
2721// operation.
2722type RegistriesDeleteFuture struct {
2723	azure.FutureAPI
2724	// Result returns the result of the asynchronous operation.
2725	// If the operation has not completed it will return an error.
2726	Result func(RegistriesClient) (autorest.Response, error)
2727}
2728
2729// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2730func (future *RegistriesDeleteFuture) UnmarshalJSON(body []byte) error {
2731	var azFuture azure.Future
2732	if err := json.Unmarshal(body, &azFuture); err != nil {
2733		return err
2734	}
2735	future.FutureAPI = &azFuture
2736	future.Result = future.result
2737	return nil
2738}
2739
2740// result is the default implementation for RegistriesDeleteFuture.Result.
2741func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) {
2742	var done bool
2743	done, err = future.DoneWithContext(context.Background(), client)
2744	if err != nil {
2745		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure")
2746		return
2747	}
2748	if !done {
2749		ar.Response = future.Response()
2750		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture")
2751		return
2752	}
2753	ar.Response = future.Response()
2754	return
2755}
2756
2757// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running
2758// operation.
2759type RegistriesImportImageFuture struct {
2760	azure.FutureAPI
2761	// Result returns the result of the asynchronous operation.
2762	// If the operation has not completed it will return an error.
2763	Result func(RegistriesClient) (autorest.Response, error)
2764}
2765
2766// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2767func (future *RegistriesImportImageFuture) UnmarshalJSON(body []byte) error {
2768	var azFuture azure.Future
2769	if err := json.Unmarshal(body, &azFuture); err != nil {
2770		return err
2771	}
2772	future.FutureAPI = &azFuture
2773	future.Result = future.result
2774	return nil
2775}
2776
2777// result is the default implementation for RegistriesImportImageFuture.Result.
2778func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) {
2779	var done bool
2780	done, err = future.DoneWithContext(context.Background(), client)
2781	if err != nil {
2782		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure")
2783		return
2784	}
2785	if !done {
2786		ar.Response = future.Response()
2787		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture")
2788		return
2789	}
2790	ar.Response = future.Response()
2791	return
2792}
2793
2794// RegistriesQueueBuildFuture an abstraction for monitoring and retrieving the results of a long-running
2795// operation.
2796type RegistriesQueueBuildFuture struct {
2797	azure.FutureAPI
2798	// Result returns the result of the asynchronous operation.
2799	// If the operation has not completed it will return an error.
2800	Result func(RegistriesClient) (Build, error)
2801}
2802
2803// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2804func (future *RegistriesQueueBuildFuture) UnmarshalJSON(body []byte) error {
2805	var azFuture azure.Future
2806	if err := json.Unmarshal(body, &azFuture); err != nil {
2807		return err
2808	}
2809	future.FutureAPI = &azFuture
2810	future.Result = future.result
2811	return nil
2812}
2813
2814// result is the default implementation for RegistriesQueueBuildFuture.Result.
2815func (future *RegistriesQueueBuildFuture) result(client RegistriesClient) (b Build, err error) {
2816	var done bool
2817	done, err = future.DoneWithContext(context.Background(), client)
2818	if err != nil {
2819		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", future.Response(), "Polling failure")
2820		return
2821	}
2822	if !done {
2823		b.Response.Response = future.Response()
2824		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesQueueBuildFuture")
2825		return
2826	}
2827	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2828	if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent {
2829		b, err = client.QueueBuildResponder(b.Response.Response)
2830		if err != nil {
2831			err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", b.Response.Response, "Failure responding to request")
2832		}
2833	}
2834	return
2835}
2836
2837// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
2838// operation.
2839type RegistriesUpdateFuture struct {
2840	azure.FutureAPI
2841	// Result returns the result of the asynchronous operation.
2842	// If the operation has not completed it will return an error.
2843	Result func(RegistriesClient) (Registry, error)
2844}
2845
2846// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2847func (future *RegistriesUpdateFuture) UnmarshalJSON(body []byte) error {
2848	var azFuture azure.Future
2849	if err := json.Unmarshal(body, &azFuture); err != nil {
2850		return err
2851	}
2852	future.FutureAPI = &azFuture
2853	future.Result = future.result
2854	return nil
2855}
2856
2857// result is the default implementation for RegistriesUpdateFuture.Result.
2858func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) {
2859	var done bool
2860	done, err = future.DoneWithContext(context.Background(), client)
2861	if err != nil {
2862		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure")
2863		return
2864	}
2865	if !done {
2866		r.Response.Response = future.Response()
2867		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture")
2868		return
2869	}
2870	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2871	if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {
2872		r, err = client.UpdateResponder(r.Response.Response)
2873		if err != nil {
2874			err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request")
2875		}
2876	}
2877	return
2878}
2879
2880// RegistriesUpdatePoliciesFuture an abstraction for monitoring and retrieving the results of a
2881// long-running operation.
2882type RegistriesUpdatePoliciesFuture struct {
2883	azure.FutureAPI
2884	// Result returns the result of the asynchronous operation.
2885	// If the operation has not completed it will return an error.
2886	Result func(RegistriesClient) (RegistryPolicies, error)
2887}
2888
2889// UnmarshalJSON is the custom unmarshaller for CreateFuture.
2890func (future *RegistriesUpdatePoliciesFuture) UnmarshalJSON(body []byte) error {
2891	var azFuture azure.Future
2892	if err := json.Unmarshal(body, &azFuture); err != nil {
2893		return err
2894	}
2895	future.FutureAPI = &azFuture
2896	future.Result = future.result
2897	return nil
2898}
2899
2900// result is the default implementation for RegistriesUpdatePoliciesFuture.Result.
2901func (future *RegistriesUpdatePoliciesFuture) result(client RegistriesClient) (rp RegistryPolicies, err error) {
2902	var done bool
2903	done, err = future.DoneWithContext(context.Background(), client)
2904	if err != nil {
2905		err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdatePoliciesFuture", "Result", future.Response(), "Polling failure")
2906		return
2907	}
2908	if !done {
2909		rp.Response.Response = future.Response()
2910		err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdatePoliciesFuture")
2911		return
2912	}
2913	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2914	if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent {
2915		rp, err = client.UpdatePoliciesResponder(rp.Response.Response)
2916		if err != nil {
2917			err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdatePoliciesFuture", "Result", rp.Response.Response, "Failure responding to request")
2918		}
2919	}
2920	return
2921}
2922
2923// Registry an object that represents a container registry.
2924type Registry struct {
2925	autorest.Response `json:"-"`
2926	// Sku - The SKU of the container registry.
2927	Sku *Sku `json:"sku,omitempty"`
2928	// RegistryProperties - The properties of the container registry.
2929	*RegistryProperties `json:"properties,omitempty"`
2930	// ID - READ-ONLY; The resource ID.
2931	ID *string `json:"id,omitempty"`
2932	// Name - READ-ONLY; The name of the resource.
2933	Name *string `json:"name,omitempty"`
2934	// Type - READ-ONLY; The type of the resource.
2935	Type *string `json:"type,omitempty"`
2936	// Location - The location of the resource. This cannot be changed after the resource is created.
2937	Location *string `json:"location,omitempty"`
2938	// Tags - The tags of the resource.
2939	Tags map[string]*string `json:"tags"`
2940}
2941
2942// MarshalJSON is the custom marshaler for Registry.
2943func (r Registry) MarshalJSON() ([]byte, error) {
2944	objectMap := make(map[string]interface{})
2945	if r.Sku != nil {
2946		objectMap["sku"] = r.Sku
2947	}
2948	if r.RegistryProperties != nil {
2949		objectMap["properties"] = r.RegistryProperties
2950	}
2951	if r.Location != nil {
2952		objectMap["location"] = r.Location
2953	}
2954	if r.Tags != nil {
2955		objectMap["tags"] = r.Tags
2956	}
2957	return json.Marshal(objectMap)
2958}
2959
2960// UnmarshalJSON is the custom unmarshaler for Registry struct.
2961func (r *Registry) UnmarshalJSON(body []byte) error {
2962	var m map[string]*json.RawMessage
2963	err := json.Unmarshal(body, &m)
2964	if err != nil {
2965		return err
2966	}
2967	for k, v := range m {
2968		switch k {
2969		case "sku":
2970			if v != nil {
2971				var sku Sku
2972				err = json.Unmarshal(*v, &sku)
2973				if err != nil {
2974					return err
2975				}
2976				r.Sku = &sku
2977			}
2978		case "properties":
2979			if v != nil {
2980				var registryProperties RegistryProperties
2981				err = json.Unmarshal(*v, &registryProperties)
2982				if err != nil {
2983					return err
2984				}
2985				r.RegistryProperties = &registryProperties
2986			}
2987		case "id":
2988			if v != nil {
2989				var ID string
2990				err = json.Unmarshal(*v, &ID)
2991				if err != nil {
2992					return err
2993				}
2994				r.ID = &ID
2995			}
2996		case "name":
2997			if v != nil {
2998				var name string
2999				err = json.Unmarshal(*v, &name)
3000				if err != nil {
3001					return err
3002				}
3003				r.Name = &name
3004			}
3005		case "type":
3006			if v != nil {
3007				var typeVar string
3008				err = json.Unmarshal(*v, &typeVar)
3009				if err != nil {
3010					return err
3011				}
3012				r.Type = &typeVar
3013			}
3014		case "location":
3015			if v != nil {
3016				var location string
3017				err = json.Unmarshal(*v, &location)
3018				if err != nil {
3019					return err
3020				}
3021				r.Location = &location
3022			}
3023		case "tags":
3024			if v != nil {
3025				var tags map[string]*string
3026				err = json.Unmarshal(*v, &tags)
3027				if err != nil {
3028					return err
3029				}
3030				r.Tags = tags
3031			}
3032		}
3033	}
3034
3035	return nil
3036}
3037
3038// RegistryListCredentialsResult the response from the ListCredentials operation.
3039type RegistryListCredentialsResult struct {
3040	autorest.Response `json:"-"`
3041	// Username - The username for a container registry.
3042	Username *string `json:"username,omitempty"`
3043	// Passwords - The list of passwords for a container registry.
3044	Passwords *[]RegistryPassword `json:"passwords,omitempty"`
3045}
3046
3047// RegistryListResult the result of a request to list container registries.
3048type RegistryListResult struct {
3049	autorest.Response `json:"-"`
3050	// 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.
3051	Value *[]Registry `json:"value,omitempty"`
3052	// NextLink - The URI that can be used to request the next list of container registries.
3053	NextLink *string `json:"nextLink,omitempty"`
3054}
3055
3056// RegistryListResultIterator provides access to a complete listing of Registry values.
3057type RegistryListResultIterator struct {
3058	i    int
3059	page RegistryListResultPage
3060}
3061
3062// NextWithContext advances to the next value.  If there was an error making
3063// the request the iterator does not advance and the error is returned.
3064func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) {
3065	if tracing.IsEnabled() {
3066		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext")
3067		defer func() {
3068			sc := -1
3069			if iter.Response().Response.Response != nil {
3070				sc = iter.Response().Response.Response.StatusCode
3071			}
3072			tracing.EndSpan(ctx, sc, err)
3073		}()
3074	}
3075	iter.i++
3076	if iter.i < len(iter.page.Values()) {
3077		return nil
3078	}
3079	err = iter.page.NextWithContext(ctx)
3080	if err != nil {
3081		iter.i--
3082		return err
3083	}
3084	iter.i = 0
3085	return nil
3086}
3087
3088// Next advances to the next value.  If there was an error making
3089// the request the iterator does not advance and the error is returned.
3090// Deprecated: Use NextWithContext() instead.
3091func (iter *RegistryListResultIterator) Next() error {
3092	return iter.NextWithContext(context.Background())
3093}
3094
3095// NotDone returns true if the enumeration should be started or is not yet complete.
3096func (iter RegistryListResultIterator) NotDone() bool {
3097	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3098}
3099
3100// Response returns the raw server response from the last page request.
3101func (iter RegistryListResultIterator) Response() RegistryListResult {
3102	return iter.page.Response()
3103}
3104
3105// Value returns the current value or a zero-initialized value if the
3106// iterator has advanced beyond the end of the collection.
3107func (iter RegistryListResultIterator) Value() Registry {
3108	if !iter.page.NotDone() {
3109		return Registry{}
3110	}
3111	return iter.page.Values()[iter.i]
3112}
3113
3114// Creates a new instance of the RegistryListResultIterator type.
3115func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator {
3116	return RegistryListResultIterator{page: page}
3117}
3118
3119// IsEmpty returns true if the ListResult contains no values.
3120func (rlr RegistryListResult) IsEmpty() bool {
3121	return rlr.Value == nil || len(*rlr.Value) == 0
3122}
3123
3124// hasNextLink returns true if the NextLink is not empty.
3125func (rlr RegistryListResult) hasNextLink() bool {
3126	return rlr.NextLink != nil && len(*rlr.NextLink) != 0
3127}
3128
3129// registryListResultPreparer prepares a request to retrieve the next set of results.
3130// It returns nil if no more results exist.
3131func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) {
3132	if !rlr.hasNextLink() {
3133		return nil, nil
3134	}
3135	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3136		autorest.AsJSON(),
3137		autorest.AsGet(),
3138		autorest.WithBaseURL(to.String(rlr.NextLink)))
3139}
3140
3141// RegistryListResultPage contains a page of Registry values.
3142type RegistryListResultPage struct {
3143	fn  func(context.Context, RegistryListResult) (RegistryListResult, error)
3144	rlr RegistryListResult
3145}
3146
3147// NextWithContext advances to the next page of values.  If there was an error making
3148// the request the page does not advance and the error is returned.
3149func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) {
3150	if tracing.IsEnabled() {
3151		ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext")
3152		defer func() {
3153			sc := -1
3154			if page.Response().Response.Response != nil {
3155				sc = page.Response().Response.Response.StatusCode
3156			}
3157			tracing.EndSpan(ctx, sc, err)
3158		}()
3159	}
3160	for {
3161		next, err := page.fn(ctx, page.rlr)
3162		if err != nil {
3163			return err
3164		}
3165		page.rlr = next
3166		if !next.hasNextLink() || !next.IsEmpty() {
3167			break
3168		}
3169	}
3170	return nil
3171}
3172
3173// Next advances to the next page of values.  If there was an error making
3174// the request the page does not advance and the error is returned.
3175// Deprecated: Use NextWithContext() instead.
3176func (page *RegistryListResultPage) Next() error {
3177	return page.NextWithContext(context.Background())
3178}
3179
3180// NotDone returns true if the page enumeration should be started or is not yet complete.
3181func (page RegistryListResultPage) NotDone() bool {
3182	return !page.rlr.IsEmpty()
3183}
3184
3185// Response returns the raw server response from the last page request.
3186func (page RegistryListResultPage) Response() RegistryListResult {
3187	return page.rlr
3188}
3189
3190// Values returns the slice of values for the current page or nil if there are no values.
3191func (page RegistryListResultPage) Values() []Registry {
3192	if page.rlr.IsEmpty() {
3193		return nil
3194	}
3195	return *page.rlr.Value
3196}
3197
3198// Creates a new instance of the RegistryListResultPage type.
3199func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage {
3200	return RegistryListResultPage{
3201		fn:  getNextPage,
3202		rlr: cur,
3203	}
3204}
3205
3206// RegistryNameCheckRequest a request to check whether a container registry name is available.
3207type RegistryNameCheckRequest struct {
3208	// Name - The name of the container registry.
3209	Name *string `json:"name,omitempty"`
3210	// Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'.
3211	Type *string `json:"type,omitempty"`
3212}
3213
3214// RegistryNameStatus the result of a request to check the availability of a container registry name.
3215type RegistryNameStatus struct {
3216	autorest.Response `json:"-"`
3217	// NameAvailable - The value that indicates whether the name is available.
3218	NameAvailable *bool `json:"nameAvailable,omitempty"`
3219	// Reason - If any, the reason that the name is not available.
3220	Reason *string `json:"reason,omitempty"`
3221	// Message - If any, the error message that provides more detail for the reason that the name is not available.
3222	Message *string `json:"message,omitempty"`
3223}
3224
3225// RegistryPassword the login password for the container registry.
3226type RegistryPassword struct {
3227	// Name - The password name. Possible values include: 'Password', 'Password2'
3228	Name PasswordName `json:"name,omitempty"`
3229	// Value - The password value.
3230	Value *string `json:"value,omitempty"`
3231}
3232
3233// RegistryPolicies an object that represents policies for a container registry.
3234type RegistryPolicies struct {
3235	autorest.Response `json:"-"`
3236	// QuarantinePolicy - An object that represents quarantine policy for a container registry.
3237	QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"`
3238	// TrustPolicy - An object that represents content trust policy for a container registry.
3239	TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"`
3240}
3241
3242// RegistryProperties the properties of a container registry.
3243type RegistryProperties struct {
3244	// LoginServer - READ-ONLY; The URL that can be used to log into the container registry.
3245	LoginServer *string `json:"loginServer,omitempty"`
3246	// CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format.
3247	CreationDate *date.Time `json:"creationDate,omitempty"`
3248	// ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
3249	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
3250	// Status - READ-ONLY; The status of the container registry at the time the operation was called.
3251	Status *Status `json:"status,omitempty"`
3252	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
3253	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
3254	// StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU.
3255	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
3256	// NetworkRuleSet - The network rule set for a container registry.
3257	NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"`
3258}
3259
3260// MarshalJSON is the custom marshaler for RegistryProperties.
3261func (rp RegistryProperties) MarshalJSON() ([]byte, error) {
3262	objectMap := make(map[string]interface{})
3263	if rp.AdminUserEnabled != nil {
3264		objectMap["adminUserEnabled"] = rp.AdminUserEnabled
3265	}
3266	if rp.StorageAccount != nil {
3267		objectMap["storageAccount"] = rp.StorageAccount
3268	}
3269	if rp.NetworkRuleSet != nil {
3270		objectMap["networkRuleSet"] = rp.NetworkRuleSet
3271	}
3272	return json.Marshal(objectMap)
3273}
3274
3275// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry.
3276type RegistryPropertiesUpdateParameters struct {
3277	// AdminUserEnabled - The value that indicates whether the admin user is enabled.
3278	AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
3279	// StorageAccount - The parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry.
3280	StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
3281	// NetworkRuleSet - The network rule set for a container registry.
3282	NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"`
3283}
3284
3285// RegistryUpdateParameters the parameters for updating a container registry.
3286type RegistryUpdateParameters struct {
3287	// Tags - The tags for the container registry.
3288	Tags map[string]*string `json:"tags"`
3289	// Sku - The SKU of the container registry.
3290	Sku *Sku `json:"sku,omitempty"`
3291	// RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with.
3292	*RegistryPropertiesUpdateParameters `json:"properties,omitempty"`
3293}
3294
3295// MarshalJSON is the custom marshaler for RegistryUpdateParameters.
3296func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) {
3297	objectMap := make(map[string]interface{})
3298	if rup.Tags != nil {
3299		objectMap["tags"] = rup.Tags
3300	}
3301	if rup.Sku != nil {
3302		objectMap["sku"] = rup.Sku
3303	}
3304	if rup.RegistryPropertiesUpdateParameters != nil {
3305		objectMap["properties"] = rup.RegistryPropertiesUpdateParameters
3306	}
3307	return json.Marshal(objectMap)
3308}
3309
3310// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct.
3311func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error {
3312	var m map[string]*json.RawMessage
3313	err := json.Unmarshal(body, &m)
3314	if err != nil {
3315		return err
3316	}
3317	for k, v := range m {
3318		switch k {
3319		case "tags":
3320			if v != nil {
3321				var tags map[string]*string
3322				err = json.Unmarshal(*v, &tags)
3323				if err != nil {
3324					return err
3325				}
3326				rup.Tags = tags
3327			}
3328		case "sku":
3329			if v != nil {
3330				var sku Sku
3331				err = json.Unmarshal(*v, &sku)
3332				if err != nil {
3333					return err
3334				}
3335				rup.Sku = &sku
3336			}
3337		case "properties":
3338			if v != nil {
3339				var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters
3340				err = json.Unmarshal(*v, &registryPropertiesUpdateParameters)
3341				if err != nil {
3342					return err
3343				}
3344				rup.RegistryPropertiesUpdateParameters = &registryPropertiesUpdateParameters
3345			}
3346		}
3347	}
3348
3349	return nil
3350}
3351
3352// RegistryUsage the quota usage for a container registry.
3353type RegistryUsage struct {
3354	// Name - The name of the usage.
3355	Name *string `json:"name,omitempty"`
3356	// Limit - The limit of the usage.
3357	Limit *int64 `json:"limit,omitempty"`
3358	// CurrentValue - The current value of the usage.
3359	CurrentValue *int64 `json:"currentValue,omitempty"`
3360	// Unit - The unit of measurement. Possible values include: 'Count', 'Bytes'
3361	Unit RegistryUsageUnit `json:"unit,omitempty"`
3362}
3363
3364// RegistryUsageListResult the result of a request to get container registry quota usages.
3365type RegistryUsageListResult struct {
3366	autorest.Response `json:"-"`
3367	// Value - The list of container registry quota usages.
3368	Value *[]RegistryUsage `json:"value,omitempty"`
3369}
3370
3371// Replication an object that represents a replication for a container registry.
3372type Replication struct {
3373	autorest.Response `json:"-"`
3374	// ReplicationProperties - The properties of the replication.
3375	*ReplicationProperties `json:"properties,omitempty"`
3376	// ID - READ-ONLY; The resource ID.
3377	ID *string `json:"id,omitempty"`
3378	// Name - READ-ONLY; The name of the resource.
3379	Name *string `json:"name,omitempty"`
3380	// Type - READ-ONLY; The type of the resource.
3381	Type *string `json:"type,omitempty"`
3382	// Location - The location of the resource. This cannot be changed after the resource is created.
3383	Location *string `json:"location,omitempty"`
3384	// Tags - The tags of the resource.
3385	Tags map[string]*string `json:"tags"`
3386}
3387
3388// MarshalJSON is the custom marshaler for Replication.
3389func (r Replication) MarshalJSON() ([]byte, error) {
3390	objectMap := make(map[string]interface{})
3391	if r.ReplicationProperties != nil {
3392		objectMap["properties"] = r.ReplicationProperties
3393	}
3394	if r.Location != nil {
3395		objectMap["location"] = r.Location
3396	}
3397	if r.Tags != nil {
3398		objectMap["tags"] = r.Tags
3399	}
3400	return json.Marshal(objectMap)
3401}
3402
3403// UnmarshalJSON is the custom unmarshaler for Replication struct.
3404func (r *Replication) UnmarshalJSON(body []byte) error {
3405	var m map[string]*json.RawMessage
3406	err := json.Unmarshal(body, &m)
3407	if err != nil {
3408		return err
3409	}
3410	for k, v := range m {
3411		switch k {
3412		case "properties":
3413			if v != nil {
3414				var replicationProperties ReplicationProperties
3415				err = json.Unmarshal(*v, &replicationProperties)
3416				if err != nil {
3417					return err
3418				}
3419				r.ReplicationProperties = &replicationProperties
3420			}
3421		case "id":
3422			if v != nil {
3423				var ID string
3424				err = json.Unmarshal(*v, &ID)
3425				if err != nil {
3426					return err
3427				}
3428				r.ID = &ID
3429			}
3430		case "name":
3431			if v != nil {
3432				var name string
3433				err = json.Unmarshal(*v, &name)
3434				if err != nil {
3435					return err
3436				}
3437				r.Name = &name
3438			}
3439		case "type":
3440			if v != nil {
3441				var typeVar string
3442				err = json.Unmarshal(*v, &typeVar)
3443				if err != nil {
3444					return err
3445				}
3446				r.Type = &typeVar
3447			}
3448		case "location":
3449			if v != nil {
3450				var location string
3451				err = json.Unmarshal(*v, &location)
3452				if err != nil {
3453					return err
3454				}
3455				r.Location = &location
3456			}
3457		case "tags":
3458			if v != nil {
3459				var tags map[string]*string
3460				err = json.Unmarshal(*v, &tags)
3461				if err != nil {
3462					return err
3463				}
3464				r.Tags = tags
3465			}
3466		}
3467	}
3468
3469	return nil
3470}
3471
3472// ReplicationListResult the result of a request to list replications for a container registry.
3473type ReplicationListResult struct {
3474	autorest.Response `json:"-"`
3475	// Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications.
3476	Value *[]Replication `json:"value,omitempty"`
3477	// NextLink - The URI that can be used to request the next list of replications.
3478	NextLink *string `json:"nextLink,omitempty"`
3479}
3480
3481// ReplicationListResultIterator provides access to a complete listing of Replication values.
3482type ReplicationListResultIterator struct {
3483	i    int
3484	page ReplicationListResultPage
3485}
3486
3487// NextWithContext advances to the next value.  If there was an error making
3488// the request the iterator does not advance and the error is returned.
3489func (iter *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
3490	if tracing.IsEnabled() {
3491		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.NextWithContext")
3492		defer func() {
3493			sc := -1
3494			if iter.Response().Response.Response != nil {
3495				sc = iter.Response().Response.Response.StatusCode
3496			}
3497			tracing.EndSpan(ctx, sc, err)
3498		}()
3499	}
3500	iter.i++
3501	if iter.i < len(iter.page.Values()) {
3502		return nil
3503	}
3504	err = iter.page.NextWithContext(ctx)
3505	if err != nil {
3506		iter.i--
3507		return err
3508	}
3509	iter.i = 0
3510	return nil
3511}
3512
3513// Next advances to the next value.  If there was an error making
3514// the request the iterator does not advance and the error is returned.
3515// Deprecated: Use NextWithContext() instead.
3516func (iter *ReplicationListResultIterator) Next() error {
3517	return iter.NextWithContext(context.Background())
3518}
3519
3520// NotDone returns true if the enumeration should be started or is not yet complete.
3521func (iter ReplicationListResultIterator) NotDone() bool {
3522	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3523}
3524
3525// Response returns the raw server response from the last page request.
3526func (iter ReplicationListResultIterator) Response() ReplicationListResult {
3527	return iter.page.Response()
3528}
3529
3530// Value returns the current value or a zero-initialized value if the
3531// iterator has advanced beyond the end of the collection.
3532func (iter ReplicationListResultIterator) Value() Replication {
3533	if !iter.page.NotDone() {
3534		return Replication{}
3535	}
3536	return iter.page.Values()[iter.i]
3537}
3538
3539// Creates a new instance of the ReplicationListResultIterator type.
3540func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator {
3541	return ReplicationListResultIterator{page: page}
3542}
3543
3544// IsEmpty returns true if the ListResult contains no values.
3545func (rlr ReplicationListResult) IsEmpty() bool {
3546	return rlr.Value == nil || len(*rlr.Value) == 0
3547}
3548
3549// hasNextLink returns true if the NextLink is not empty.
3550func (rlr ReplicationListResult) hasNextLink() bool {
3551	return rlr.NextLink != nil && len(*rlr.NextLink) != 0
3552}
3553
3554// replicationListResultPreparer prepares a request to retrieve the next set of results.
3555// It returns nil if no more results exist.
3556func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) {
3557	if !rlr.hasNextLink() {
3558		return nil, nil
3559	}
3560	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3561		autorest.AsJSON(),
3562		autorest.AsGet(),
3563		autorest.WithBaseURL(to.String(rlr.NextLink)))
3564}
3565
3566// ReplicationListResultPage contains a page of Replication values.
3567type ReplicationListResultPage struct {
3568	fn  func(context.Context, ReplicationListResult) (ReplicationListResult, error)
3569	rlr ReplicationListResult
3570}
3571
3572// NextWithContext advances to the next page of values.  If there was an error making
3573// the request the page does not advance and the error is returned.
3574func (page *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
3575	if tracing.IsEnabled() {
3576		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.NextWithContext")
3577		defer func() {
3578			sc := -1
3579			if page.Response().Response.Response != nil {
3580				sc = page.Response().Response.Response.StatusCode
3581			}
3582			tracing.EndSpan(ctx, sc, err)
3583		}()
3584	}
3585	for {
3586		next, err := page.fn(ctx, page.rlr)
3587		if err != nil {
3588			return err
3589		}
3590		page.rlr = next
3591		if !next.hasNextLink() || !next.IsEmpty() {
3592			break
3593		}
3594	}
3595	return nil
3596}
3597
3598// Next advances to the next page of values.  If there was an error making
3599// the request the page does not advance and the error is returned.
3600// Deprecated: Use NextWithContext() instead.
3601func (page *ReplicationListResultPage) Next() error {
3602	return page.NextWithContext(context.Background())
3603}
3604
3605// NotDone returns true if the page enumeration should be started or is not yet complete.
3606func (page ReplicationListResultPage) NotDone() bool {
3607	return !page.rlr.IsEmpty()
3608}
3609
3610// Response returns the raw server response from the last page request.
3611func (page ReplicationListResultPage) Response() ReplicationListResult {
3612	return page.rlr
3613}
3614
3615// Values returns the slice of values for the current page or nil if there are no values.
3616func (page ReplicationListResultPage) Values() []Replication {
3617	if page.rlr.IsEmpty() {
3618		return nil
3619	}
3620	return *page.rlr.Value
3621}
3622
3623// Creates a new instance of the ReplicationListResultPage type.
3624func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage {
3625	return ReplicationListResultPage{
3626		fn:  getNextPage,
3627		rlr: cur,
3628	}
3629}
3630
3631// ReplicationProperties the properties of a replication.
3632type ReplicationProperties struct {
3633	// ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
3634	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
3635	// Status - READ-ONLY; The status of the replication at the time the operation was called.
3636	Status *Status `json:"status,omitempty"`
3637}
3638
3639// MarshalJSON is the custom marshaler for ReplicationProperties.
3640func (rp ReplicationProperties) MarshalJSON() ([]byte, error) {
3641	objectMap := make(map[string]interface{})
3642	return json.Marshal(objectMap)
3643}
3644
3645// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
3646// operation.
3647type ReplicationsCreateFuture struct {
3648	azure.FutureAPI
3649	// Result returns the result of the asynchronous operation.
3650	// If the operation has not completed it will return an error.
3651	Result func(ReplicationsClient) (Replication, error)
3652}
3653
3654// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3655func (future *ReplicationsCreateFuture) UnmarshalJSON(body []byte) error {
3656	var azFuture azure.Future
3657	if err := json.Unmarshal(body, &azFuture); err != nil {
3658		return err
3659	}
3660	future.FutureAPI = &azFuture
3661	future.Result = future.result
3662	return nil
3663}
3664
3665// result is the default implementation for ReplicationsCreateFuture.Result.
3666func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) {
3667	var done bool
3668	done, err = future.DoneWithContext(context.Background(), client)
3669	if err != nil {
3670		err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure")
3671		return
3672	}
3673	if !done {
3674		r.Response.Response = future.Response()
3675		err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture")
3676		return
3677	}
3678	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3679	if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {
3680		r, err = client.CreateResponder(r.Response.Response)
3681		if err != nil {
3682			err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request")
3683		}
3684	}
3685	return
3686}
3687
3688// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
3689// operation.
3690type ReplicationsDeleteFuture struct {
3691	azure.FutureAPI
3692	// Result returns the result of the asynchronous operation.
3693	// If the operation has not completed it will return an error.
3694	Result func(ReplicationsClient) (autorest.Response, error)
3695}
3696
3697// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3698func (future *ReplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
3699	var azFuture azure.Future
3700	if err := json.Unmarshal(body, &azFuture); err != nil {
3701		return err
3702	}
3703	future.FutureAPI = &azFuture
3704	future.Result = future.result
3705	return nil
3706}
3707
3708// result is the default implementation for ReplicationsDeleteFuture.Result.
3709func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) {
3710	var done bool
3711	done, err = future.DoneWithContext(context.Background(), client)
3712	if err != nil {
3713		err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
3714		return
3715	}
3716	if !done {
3717		ar.Response = future.Response()
3718		err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture")
3719		return
3720	}
3721	ar.Response = future.Response()
3722	return
3723}
3724
3725// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
3726// operation.
3727type ReplicationsUpdateFuture struct {
3728	azure.FutureAPI
3729	// Result returns the result of the asynchronous operation.
3730	// If the operation has not completed it will return an error.
3731	Result func(ReplicationsClient) (Replication, error)
3732}
3733
3734// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3735func (future *ReplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
3736	var azFuture azure.Future
3737	if err := json.Unmarshal(body, &azFuture); err != nil {
3738		return err
3739	}
3740	future.FutureAPI = &azFuture
3741	future.Result = future.result
3742	return nil
3743}
3744
3745// result is the default implementation for ReplicationsUpdateFuture.Result.
3746func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) {
3747	var done bool
3748	done, err = future.DoneWithContext(context.Background(), client)
3749	if err != nil {
3750		err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
3751		return
3752	}
3753	if !done {
3754		r.Response.Response = future.Response()
3755		err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture")
3756		return
3757	}
3758	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3759	if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {
3760		r, err = client.UpdateResponder(r.Response.Response)
3761		if err != nil {
3762			err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request")
3763		}
3764	}
3765	return
3766}
3767
3768// ReplicationUpdateParameters the parameters for updating a replication.
3769type ReplicationUpdateParameters struct {
3770	// Tags - The tags for the replication.
3771	Tags map[string]*string `json:"tags"`
3772}
3773
3774// MarshalJSON is the custom marshaler for ReplicationUpdateParameters.
3775func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) {
3776	objectMap := make(map[string]interface{})
3777	if rup.Tags != nil {
3778		objectMap["tags"] = rup.Tags
3779	}
3780	return json.Marshal(objectMap)
3781}
3782
3783// Request the request that generated the event.
3784type Request struct {
3785	// ID - The ID of the request that initiated the event.
3786	ID *string `json:"id,omitempty"`
3787	// 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.
3788	Addr *string `json:"addr,omitempty"`
3789	// Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests.
3790	Host *string `json:"host,omitempty"`
3791	// Method - The request method that generated the event.
3792	Method *string `json:"method,omitempty"`
3793	// Useragent - The user agent header of the request.
3794	Useragent *string `json:"useragent,omitempty"`
3795}
3796
3797// Resource an Azure resource.
3798type Resource struct {
3799	// ID - READ-ONLY; The resource ID.
3800	ID *string `json:"id,omitempty"`
3801	// Name - READ-ONLY; The name of the resource.
3802	Name *string `json:"name,omitempty"`
3803	// Type - READ-ONLY; The type of the resource.
3804	Type *string `json:"type,omitempty"`
3805	// Location - The location of the resource. This cannot be changed after the resource is created.
3806	Location *string `json:"location,omitempty"`
3807	// Tags - The tags of the resource.
3808	Tags map[string]*string `json:"tags"`
3809}
3810
3811// MarshalJSON is the custom marshaler for Resource.
3812func (r Resource) MarshalJSON() ([]byte, error) {
3813	objectMap := make(map[string]interface{})
3814	if r.Location != nil {
3815		objectMap["location"] = r.Location
3816	}
3817	if r.Tags != nil {
3818		objectMap["tags"] = r.Tags
3819	}
3820	return json.Marshal(objectMap)
3821}
3822
3823// Sku the SKU of a container registry.
3824type Sku struct {
3825	// Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium'
3826	Name SkuName `json:"name,omitempty"`
3827	// Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium'
3828	Tier SkuTier `json:"tier,omitempty"`
3829}
3830
3831// MarshalJSON is the custom marshaler for Sku.
3832func (s Sku) MarshalJSON() ([]byte, error) {
3833	objectMap := make(map[string]interface{})
3834	if s.Name != "" {
3835		objectMap["name"] = s.Name
3836	}
3837	return json.Marshal(objectMap)
3838}
3839
3840// Source the registry node that generated the event. Put differently, while the actor initiates the event,
3841// the source generates it.
3842type Source struct {
3843	// 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.
3844	Addr *string `json:"addr,omitempty"`
3845	// InstanceID - The running instance of an application. Changes after each restart.
3846	InstanceID *string `json:"instanceID,omitempty"`
3847}
3848
3849// SourceControlAuthInfo the authorization properties for accessing the source code repository.
3850type SourceControlAuthInfo struct {
3851	// TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth'
3852	TokenType TokenType `json:"tokenType,omitempty"`
3853	// Token - The access token used to access the source control provider.
3854	Token *string `json:"token,omitempty"`
3855	// RefreshToken - The refresh token used to refresh the access token.
3856	RefreshToken *string `json:"refreshToken,omitempty"`
3857	// Scope - The scope of the access token.
3858	Scope *string `json:"scope,omitempty"`
3859	// ExpiresIn - Time in seconds that the token remains valid
3860	ExpiresIn *int32 `json:"expiresIn,omitempty"`
3861}
3862
3863// SourceRepositoryProperties the properties of the source code repository.
3864type SourceRepositoryProperties struct {
3865	autorest.Response `json:"-"`
3866	// SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService'
3867	SourceControlType SourceControlType `json:"sourceControlType,omitempty"`
3868	// RepositoryURL - The full URL to the source code repository
3869	RepositoryURL *string `json:"repositoryUrl,omitempty"`
3870	// IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not.
3871	IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"`
3872	// SourceControlAuthProperties - The authorization properties for accessing the source code repository.
3873	SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"`
3874}
3875
3876// SourceRepositoryUpdateParameters the properties for updating the source code repository configuration.
3877type SourceRepositoryUpdateParameters struct {
3878	// SourceControlAuthProperties - The authorization properties for accessing the source code repository.
3879	SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"`
3880	// IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not.
3881	IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"`
3882}
3883
3884// SourceUploadDefinition the properties of a response to source upload request.
3885type SourceUploadDefinition struct {
3886	autorest.Response `json:"-"`
3887	// UploadURL - The URL where the client can upload the source.
3888	UploadURL *string `json:"uploadUrl,omitempty"`
3889	// RelativePath - The relative path to the source. This is used to submit the subsequent queue build request.
3890	RelativePath *string `json:"relativePath,omitempty"`
3891}
3892
3893// Status the status of an Azure resource at the time the operation was called.
3894type Status struct {
3895	// DisplayStatus - READ-ONLY; The short label for the status.
3896	DisplayStatus *string `json:"displayStatus,omitempty"`
3897	// Message - READ-ONLY; The detailed message for the status, including alerts and error messages.
3898	Message *string `json:"message,omitempty"`
3899	// Timestamp - READ-ONLY; The timestamp when the status was changed to the current value.
3900	Timestamp *date.Time `json:"timestamp,omitempty"`
3901}
3902
3903// MarshalJSON is the custom marshaler for Status.
3904func (s Status) MarshalJSON() ([]byte, error) {
3905	objectMap := make(map[string]interface{})
3906	return json.Marshal(objectMap)
3907}
3908
3909// StorageAccountProperties the properties of a storage account for a container registry. Only applicable
3910// to Classic SKU.
3911type StorageAccountProperties struct {
3912	// ID - The resource ID of the storage account.
3913	ID *string `json:"id,omitempty"`
3914}
3915
3916// Target the target of the event.
3917type Target struct {
3918	// MediaType - The MIME type of the referenced object.
3919	MediaType *string `json:"mediaType,omitempty"`
3920	// Size - The number of bytes of the content. Same as Length field.
3921	Size *int64 `json:"size,omitempty"`
3922	// Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification.
3923	Digest *string `json:"digest,omitempty"`
3924	// Length - The number of bytes of the content. Same as Size field.
3925	Length *int64 `json:"length,omitempty"`
3926	// Repository - The repository name.
3927	Repository *string `json:"repository,omitempty"`
3928	// URL - The direct URL to the content.
3929	URL *string `json:"url,omitempty"`
3930	// Tag - The tag name.
3931	Tag *string `json:"tag,omitempty"`
3932	// Name - The name of the artifact.
3933	Name *string `json:"name,omitempty"`
3934	// Version - The version of the artifact.
3935	Version *string `json:"version,omitempty"`
3936}
3937
3938// TrustPolicy an object that represents content trust policy for a container registry.
3939type TrustPolicy struct {
3940	// Type - The type of trust policy. Possible values include: 'Notary'
3941	Type TrustPolicyType `json:"type,omitempty"`
3942	// Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled'
3943	Status PolicyStatus `json:"status,omitempty"`
3944}
3945
3946// VirtualNetworkRule virtual network rule.
3947type VirtualNetworkRule struct {
3948	// Action - The action of virtual network rule. Possible values include: 'Allow'
3949	Action Action `json:"action,omitempty"`
3950	// VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}.
3951	VirtualNetworkResourceID *string `json:"id,omitempty"`
3952}
3953
3954// Webhook an object that represents a webhook for a container registry.
3955type Webhook struct {
3956	autorest.Response `json:"-"`
3957	// WebhookProperties - The properties of the webhook.
3958	*WebhookProperties `json:"properties,omitempty"`
3959	// ID - READ-ONLY; The resource ID.
3960	ID *string `json:"id,omitempty"`
3961	// Name - READ-ONLY; The name of the resource.
3962	Name *string `json:"name,omitempty"`
3963	// Type - READ-ONLY; The type of the resource.
3964	Type *string `json:"type,omitempty"`
3965	// Location - The location of the resource. This cannot be changed after the resource is created.
3966	Location *string `json:"location,omitempty"`
3967	// Tags - The tags of the resource.
3968	Tags map[string]*string `json:"tags"`
3969}
3970
3971// MarshalJSON is the custom marshaler for Webhook.
3972func (w Webhook) MarshalJSON() ([]byte, error) {
3973	objectMap := make(map[string]interface{})
3974	if w.WebhookProperties != nil {
3975		objectMap["properties"] = w.WebhookProperties
3976	}
3977	if w.Location != nil {
3978		objectMap["location"] = w.Location
3979	}
3980	if w.Tags != nil {
3981		objectMap["tags"] = w.Tags
3982	}
3983	return json.Marshal(objectMap)
3984}
3985
3986// UnmarshalJSON is the custom unmarshaler for Webhook struct.
3987func (w *Webhook) UnmarshalJSON(body []byte) error {
3988	var m map[string]*json.RawMessage
3989	err := json.Unmarshal(body, &m)
3990	if err != nil {
3991		return err
3992	}
3993	for k, v := range m {
3994		switch k {
3995		case "properties":
3996			if v != nil {
3997				var webhookProperties WebhookProperties
3998				err = json.Unmarshal(*v, &webhookProperties)
3999				if err != nil {
4000					return err
4001				}
4002				w.WebhookProperties = &webhookProperties
4003			}
4004		case "id":
4005			if v != nil {
4006				var ID string
4007				err = json.Unmarshal(*v, &ID)
4008				if err != nil {
4009					return err
4010				}
4011				w.ID = &ID
4012			}
4013		case "name":
4014			if v != nil {
4015				var name string
4016				err = json.Unmarshal(*v, &name)
4017				if err != nil {
4018					return err
4019				}
4020				w.Name = &name
4021			}
4022		case "type":
4023			if v != nil {
4024				var typeVar string
4025				err = json.Unmarshal(*v, &typeVar)
4026				if err != nil {
4027					return err
4028				}
4029				w.Type = &typeVar
4030			}
4031		case "location":
4032			if v != nil {
4033				var location string
4034				err = json.Unmarshal(*v, &location)
4035				if err != nil {
4036					return err
4037				}
4038				w.Location = &location
4039			}
4040		case "tags":
4041			if v != nil {
4042				var tags map[string]*string
4043				err = json.Unmarshal(*v, &tags)
4044				if err != nil {
4045					return err
4046				}
4047				w.Tags = tags
4048			}
4049		}
4050	}
4051
4052	return nil
4053}
4054
4055// WebhookCreateParameters the parameters for creating a webhook.
4056type WebhookCreateParameters struct {
4057	// Tags - The tags for the webhook.
4058	Tags map[string]*string `json:"tags"`
4059	// Location - The location of the webhook. This cannot be changed after the resource is created.
4060	Location *string `json:"location,omitempty"`
4061	// WebhookPropertiesCreateParameters - The properties that the webhook will be created with.
4062	*WebhookPropertiesCreateParameters `json:"properties,omitempty"`
4063}
4064
4065// MarshalJSON is the custom marshaler for WebhookCreateParameters.
4066func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) {
4067	objectMap := make(map[string]interface{})
4068	if wcp.Tags != nil {
4069		objectMap["tags"] = wcp.Tags
4070	}
4071	if wcp.Location != nil {
4072		objectMap["location"] = wcp.Location
4073	}
4074	if wcp.WebhookPropertiesCreateParameters != nil {
4075		objectMap["properties"] = wcp.WebhookPropertiesCreateParameters
4076	}
4077	return json.Marshal(objectMap)
4078}
4079
4080// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct.
4081func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error {
4082	var m map[string]*json.RawMessage
4083	err := json.Unmarshal(body, &m)
4084	if err != nil {
4085		return err
4086	}
4087	for k, v := range m {
4088		switch k {
4089		case "tags":
4090			if v != nil {
4091				var tags map[string]*string
4092				err = json.Unmarshal(*v, &tags)
4093				if err != nil {
4094					return err
4095				}
4096				wcp.Tags = tags
4097			}
4098		case "location":
4099			if v != nil {
4100				var location string
4101				err = json.Unmarshal(*v, &location)
4102				if err != nil {
4103					return err
4104				}
4105				wcp.Location = &location
4106			}
4107		case "properties":
4108			if v != nil {
4109				var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters
4110				err = json.Unmarshal(*v, &webhookPropertiesCreateParameters)
4111				if err != nil {
4112					return err
4113				}
4114				wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters
4115			}
4116		}
4117	}
4118
4119	return nil
4120}
4121
4122// WebhookListResult the result of a request to list webhooks for a container registry.
4123type WebhookListResult struct {
4124	autorest.Response `json:"-"`
4125	// Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks.
4126	Value *[]Webhook `json:"value,omitempty"`
4127	// NextLink - The URI that can be used to request the next list of webhooks.
4128	NextLink *string `json:"nextLink,omitempty"`
4129}
4130
4131// WebhookListResultIterator provides access to a complete listing of Webhook values.
4132type WebhookListResultIterator struct {
4133	i    int
4134	page WebhookListResultPage
4135}
4136
4137// NextWithContext advances to the next value.  If there was an error making
4138// the request the iterator does not advance and the error is returned.
4139func (iter *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) {
4140	if tracing.IsEnabled() {
4141		ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.NextWithContext")
4142		defer func() {
4143			sc := -1
4144			if iter.Response().Response.Response != nil {
4145				sc = iter.Response().Response.Response.StatusCode
4146			}
4147			tracing.EndSpan(ctx, sc, err)
4148		}()
4149	}
4150	iter.i++
4151	if iter.i < len(iter.page.Values()) {
4152		return nil
4153	}
4154	err = iter.page.NextWithContext(ctx)
4155	if err != nil {
4156		iter.i--
4157		return err
4158	}
4159	iter.i = 0
4160	return nil
4161}
4162
4163// Next advances to the next value.  If there was an error making
4164// the request the iterator does not advance and the error is returned.
4165// Deprecated: Use NextWithContext() instead.
4166func (iter *WebhookListResultIterator) Next() error {
4167	return iter.NextWithContext(context.Background())
4168}
4169
4170// NotDone returns true if the enumeration should be started or is not yet complete.
4171func (iter WebhookListResultIterator) NotDone() bool {
4172	return iter.page.NotDone() && iter.i < len(iter.page.Values())
4173}
4174
4175// Response returns the raw server response from the last page request.
4176func (iter WebhookListResultIterator) Response() WebhookListResult {
4177	return iter.page.Response()
4178}
4179
4180// Value returns the current value or a zero-initialized value if the
4181// iterator has advanced beyond the end of the collection.
4182func (iter WebhookListResultIterator) Value() Webhook {
4183	if !iter.page.NotDone() {
4184		return Webhook{}
4185	}
4186	return iter.page.Values()[iter.i]
4187}
4188
4189// Creates a new instance of the WebhookListResultIterator type.
4190func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator {
4191	return WebhookListResultIterator{page: page}
4192}
4193
4194// IsEmpty returns true if the ListResult contains no values.
4195func (wlr WebhookListResult) IsEmpty() bool {
4196	return wlr.Value == nil || len(*wlr.Value) == 0
4197}
4198
4199// hasNextLink returns true if the NextLink is not empty.
4200func (wlr WebhookListResult) hasNextLink() bool {
4201	return wlr.NextLink != nil && len(*wlr.NextLink) != 0
4202}
4203
4204// webhookListResultPreparer prepares a request to retrieve the next set of results.
4205// It returns nil if no more results exist.
4206func (wlr WebhookListResult) webhookListResultPreparer(ctx context.Context) (*http.Request, error) {
4207	if !wlr.hasNextLink() {
4208		return nil, nil
4209	}
4210	return autorest.Prepare((&http.Request{}).WithContext(ctx),
4211		autorest.AsJSON(),
4212		autorest.AsGet(),
4213		autorest.WithBaseURL(to.String(wlr.NextLink)))
4214}
4215
4216// WebhookListResultPage contains a page of Webhook values.
4217type WebhookListResultPage struct {
4218	fn  func(context.Context, WebhookListResult) (WebhookListResult, error)
4219	wlr WebhookListResult
4220}
4221
4222// NextWithContext advances to the next page of values.  If there was an error making
4223// the request the page does not advance and the error is returned.
4224func (page *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) {
4225	if tracing.IsEnabled() {
4226		ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.NextWithContext")
4227		defer func() {
4228			sc := -1
4229			if page.Response().Response.Response != nil {
4230				sc = page.Response().Response.Response.StatusCode
4231			}
4232			tracing.EndSpan(ctx, sc, err)
4233		}()
4234	}
4235	for {
4236		next, err := page.fn(ctx, page.wlr)
4237		if err != nil {
4238			return err
4239		}
4240		page.wlr = next
4241		if !next.hasNextLink() || !next.IsEmpty() {
4242			break
4243		}
4244	}
4245	return nil
4246}
4247
4248// Next advances to the next page of values.  If there was an error making
4249// the request the page does not advance and the error is returned.
4250// Deprecated: Use NextWithContext() instead.
4251func (page *WebhookListResultPage) Next() error {
4252	return page.NextWithContext(context.Background())
4253}
4254
4255// NotDone returns true if the page enumeration should be started or is not yet complete.
4256func (page WebhookListResultPage) NotDone() bool {
4257	return !page.wlr.IsEmpty()
4258}
4259
4260// Response returns the raw server response from the last page request.
4261func (page WebhookListResultPage) Response() WebhookListResult {
4262	return page.wlr
4263}
4264
4265// Values returns the slice of values for the current page or nil if there are no values.
4266func (page WebhookListResultPage) Values() []Webhook {
4267	if page.wlr.IsEmpty() {
4268		return nil
4269	}
4270	return *page.wlr.Value
4271}
4272
4273// Creates a new instance of the WebhookListResultPage type.
4274func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage {
4275	return WebhookListResultPage{
4276		fn:  getNextPage,
4277		wlr: cur,
4278	}
4279}
4280
4281// WebhookProperties the properties of a webhook.
4282type WebhookProperties struct {
4283	// Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled'
4284	Status WebhookStatus `json:"status,omitempty"`
4285	// 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.
4286	Scope *string `json:"scope,omitempty"`
4287	// Actions - The list of actions that trigger the webhook to post notifications.
4288	Actions *[]WebhookAction `json:"actions,omitempty"`
4289	// ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled'
4290	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
4291}
4292
4293// MarshalJSON is the custom marshaler for WebhookProperties.
4294func (wp WebhookProperties) MarshalJSON() ([]byte, error) {
4295	objectMap := make(map[string]interface{})
4296	if wp.Status != "" {
4297		objectMap["status"] = wp.Status
4298	}
4299	if wp.Scope != nil {
4300		objectMap["scope"] = wp.Scope
4301	}
4302	if wp.Actions != nil {
4303		objectMap["actions"] = wp.Actions
4304	}
4305	return json.Marshal(objectMap)
4306}
4307
4308// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook.
4309type WebhookPropertiesCreateParameters struct {
4310	// ServiceURI - The service URI for the webhook to post notifications.
4311	ServiceURI *string `json:"serviceUri,omitempty"`
4312	// CustomHeaders - Custom headers that will be added to the webhook notifications.
4313	CustomHeaders map[string]*string `json:"customHeaders"`
4314	// Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled'
4315	Status WebhookStatus `json:"status,omitempty"`
4316	// 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.
4317	Scope *string `json:"scope,omitempty"`
4318	// Actions - The list of actions that trigger the webhook to post notifications.
4319	Actions *[]WebhookAction `json:"actions,omitempty"`
4320}
4321
4322// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters.
4323func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) {
4324	objectMap := make(map[string]interface{})
4325	if wpcp.ServiceURI != nil {
4326		objectMap["serviceUri"] = wpcp.ServiceURI
4327	}
4328	if wpcp.CustomHeaders != nil {
4329		objectMap["customHeaders"] = wpcp.CustomHeaders
4330	}
4331	if wpcp.Status != "" {
4332		objectMap["status"] = wpcp.Status
4333	}
4334	if wpcp.Scope != nil {
4335		objectMap["scope"] = wpcp.Scope
4336	}
4337	if wpcp.Actions != nil {
4338		objectMap["actions"] = wpcp.Actions
4339	}
4340	return json.Marshal(objectMap)
4341}
4342
4343// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook.
4344type WebhookPropertiesUpdateParameters struct {
4345	// ServiceURI - The service URI for the webhook to post notifications.
4346	ServiceURI *string `json:"serviceUri,omitempty"`
4347	// CustomHeaders - Custom headers that will be added to the webhook notifications.
4348	CustomHeaders map[string]*string `json:"customHeaders"`
4349	// Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled'
4350	Status WebhookStatus `json:"status,omitempty"`
4351	// 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.
4352	Scope *string `json:"scope,omitempty"`
4353	// Actions - The list of actions that trigger the webhook to post notifications.
4354	Actions *[]WebhookAction `json:"actions,omitempty"`
4355}
4356
4357// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters.
4358func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) {
4359	objectMap := make(map[string]interface{})
4360	if wpup.ServiceURI != nil {
4361		objectMap["serviceUri"] = wpup.ServiceURI
4362	}
4363	if wpup.CustomHeaders != nil {
4364		objectMap["customHeaders"] = wpup.CustomHeaders
4365	}
4366	if wpup.Status != "" {
4367		objectMap["status"] = wpup.Status
4368	}
4369	if wpup.Scope != nil {
4370		objectMap["scope"] = wpup.Scope
4371	}
4372	if wpup.Actions != nil {
4373		objectMap["actions"] = wpup.Actions
4374	}
4375	return json.Marshal(objectMap)
4376}
4377
4378// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running
4379// operation.
4380type WebhooksCreateFuture struct {
4381	azure.FutureAPI
4382	// Result returns the result of the asynchronous operation.
4383	// If the operation has not completed it will return an error.
4384	Result func(WebhooksClient) (Webhook, error)
4385}
4386
4387// UnmarshalJSON is the custom unmarshaller for CreateFuture.
4388func (future *WebhooksCreateFuture) UnmarshalJSON(body []byte) error {
4389	var azFuture azure.Future
4390	if err := json.Unmarshal(body, &azFuture); err != nil {
4391		return err
4392	}
4393	future.FutureAPI = &azFuture
4394	future.Result = future.result
4395	return nil
4396}
4397
4398// result is the default implementation for WebhooksCreateFuture.Result.
4399func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) {
4400	var done bool
4401	done, err = future.DoneWithContext(context.Background(), client)
4402	if err != nil {
4403		err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure")
4404		return
4405	}
4406	if !done {
4407		w.Response.Response = future.Response()
4408		err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture")
4409		return
4410	}
4411	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4412	if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent {
4413		w, err = client.CreateResponder(w.Response.Response)
4414		if err != nil {
4415			err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request")
4416		}
4417	}
4418	return
4419}
4420
4421// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
4422// operation.
4423type WebhooksDeleteFuture struct {
4424	azure.FutureAPI
4425	// Result returns the result of the asynchronous operation.
4426	// If the operation has not completed it will return an error.
4427	Result func(WebhooksClient) (autorest.Response, error)
4428}
4429
4430// UnmarshalJSON is the custom unmarshaller for CreateFuture.
4431func (future *WebhooksDeleteFuture) UnmarshalJSON(body []byte) error {
4432	var azFuture azure.Future
4433	if err := json.Unmarshal(body, &azFuture); err != nil {
4434		return err
4435	}
4436	future.FutureAPI = &azFuture
4437	future.Result = future.result
4438	return nil
4439}
4440
4441// result is the default implementation for WebhooksDeleteFuture.Result.
4442func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) {
4443	var done bool
4444	done, err = future.DoneWithContext(context.Background(), client)
4445	if err != nil {
4446		err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure")
4447		return
4448	}
4449	if !done {
4450		ar.Response = future.Response()
4451		err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture")
4452		return
4453	}
4454	ar.Response = future.Response()
4455	return
4456}
4457
4458// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
4459// operation.
4460type WebhooksUpdateFuture struct {
4461	azure.FutureAPI
4462	// Result returns the result of the asynchronous operation.
4463	// If the operation has not completed it will return an error.
4464	Result func(WebhooksClient) (Webhook, error)
4465}
4466
4467// UnmarshalJSON is the custom unmarshaller for CreateFuture.
4468func (future *WebhooksUpdateFuture) UnmarshalJSON(body []byte) error {
4469	var azFuture azure.Future
4470	if err := json.Unmarshal(body, &azFuture); err != nil {
4471		return err
4472	}
4473	future.FutureAPI = &azFuture
4474	future.Result = future.result
4475	return nil
4476}
4477
4478// result is the default implementation for WebhooksUpdateFuture.Result.
4479func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) {
4480	var done bool
4481	done, err = future.DoneWithContext(context.Background(), client)
4482	if err != nil {
4483		err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure")
4484		return
4485	}
4486	if !done {
4487		w.Response.Response = future.Response()
4488		err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture")
4489		return
4490	}
4491	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4492	if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent {
4493		w, err = client.UpdateResponder(w.Response.Response)
4494		if err != nil {
4495			err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request")
4496		}
4497	}
4498	return
4499}
4500
4501// WebhookUpdateParameters the parameters for updating a webhook.
4502type WebhookUpdateParameters struct {
4503	// Tags - The tags for the webhook.
4504	Tags map[string]*string `json:"tags"`
4505	// WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with.
4506	*WebhookPropertiesUpdateParameters `json:"properties,omitempty"`
4507}
4508
4509// MarshalJSON is the custom marshaler for WebhookUpdateParameters.
4510func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) {
4511	objectMap := make(map[string]interface{})
4512	if wup.Tags != nil {
4513		objectMap["tags"] = wup.Tags
4514	}
4515	if wup.WebhookPropertiesUpdateParameters != nil {
4516		objectMap["properties"] = wup.WebhookPropertiesUpdateParameters
4517	}
4518	return json.Marshal(objectMap)
4519}
4520
4521// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct.
4522func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error {
4523	var m map[string]*json.RawMessage
4524	err := json.Unmarshal(body, &m)
4525	if err != nil {
4526		return err
4527	}
4528	for k, v := range m {
4529		switch k {
4530		case "tags":
4531			if v != nil {
4532				var tags map[string]*string
4533				err = json.Unmarshal(*v, &tags)
4534				if err != nil {
4535					return err
4536				}
4537				wup.Tags = tags
4538			}
4539		case "properties":
4540			if v != nil {
4541				var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters
4542				err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters)
4543				if err != nil {
4544					return err
4545				}
4546				wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters
4547			}
4548		}
4549	}
4550
4551	return nil
4552}
4553