1package containerinstance
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"net/http"
29)
30
31// The package's fully qualified name.
32const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance"
33
34// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes.
35type AzureFileVolume struct {
36	// ShareName - The name of the Azure File share to be mounted as a volume.
37	ShareName *string `json:"shareName,omitempty"`
38	// ReadOnly - The flag indicating whether the Azure File shared mounted as a volume is read-only.
39	ReadOnly *bool `json:"readOnly,omitempty"`
40	// StorageAccountName - The name of the storage account that contains the Azure File share.
41	StorageAccountName *string `json:"storageAccountName,omitempty"`
42	// StorageAccountKey - The storage account access key used to access the Azure File share.
43	StorageAccountKey *string `json:"storageAccountKey,omitempty"`
44}
45
46// CachedImages the cached image and OS type.
47type CachedImages struct {
48	// OsType - The OS type of the cached image.
49	OsType *string `json:"osType,omitempty"`
50	// Image - The cached image name.
51	Image *string `json:"image,omitempty"`
52}
53
54// CachedImagesListResult the response containing cached images.
55type CachedImagesListResult struct {
56	autorest.Response `json:"-"`
57	// Value - The list of cached images.
58	Value *[]CachedImages `json:"value,omitempty"`
59	// NextLink - The URI to fetch the next page of cached images.
60	NextLink *string `json:"nextLink,omitempty"`
61}
62
63// CachedImagesListResultIterator provides access to a complete listing of CachedImages values.
64type CachedImagesListResultIterator struct {
65	i    int
66	page CachedImagesListResultPage
67}
68
69// NextWithContext advances to the next value.  If there was an error making
70// the request the iterator does not advance and the error is returned.
71func (iter *CachedImagesListResultIterator) NextWithContext(ctx context.Context) (err error) {
72	if tracing.IsEnabled() {
73		ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultIterator.NextWithContext")
74		defer func() {
75			sc := -1
76			if iter.Response().Response.Response != nil {
77				sc = iter.Response().Response.Response.StatusCode
78			}
79			tracing.EndSpan(ctx, sc, err)
80		}()
81	}
82	iter.i++
83	if iter.i < len(iter.page.Values()) {
84		return nil
85	}
86	err = iter.page.NextWithContext(ctx)
87	if err != nil {
88		iter.i--
89		return err
90	}
91	iter.i = 0
92	return nil
93}
94
95// Next advances to the next value.  If there was an error making
96// the request the iterator does not advance and the error is returned.
97// Deprecated: Use NextWithContext() instead.
98func (iter *CachedImagesListResultIterator) Next() error {
99	return iter.NextWithContext(context.Background())
100}
101
102// NotDone returns true if the enumeration should be started or is not yet complete.
103func (iter CachedImagesListResultIterator) NotDone() bool {
104	return iter.page.NotDone() && iter.i < len(iter.page.Values())
105}
106
107// Response returns the raw server response from the last page request.
108func (iter CachedImagesListResultIterator) Response() CachedImagesListResult {
109	return iter.page.Response()
110}
111
112// Value returns the current value or a zero-initialized value if the
113// iterator has advanced beyond the end of the collection.
114func (iter CachedImagesListResultIterator) Value() CachedImages {
115	if !iter.page.NotDone() {
116		return CachedImages{}
117	}
118	return iter.page.Values()[iter.i]
119}
120
121// Creates a new instance of the CachedImagesListResultIterator type.
122func NewCachedImagesListResultIterator(page CachedImagesListResultPage) CachedImagesListResultIterator {
123	return CachedImagesListResultIterator{page: page}
124}
125
126// IsEmpty returns true if the ListResult contains no values.
127func (cilr CachedImagesListResult) IsEmpty() bool {
128	return cilr.Value == nil || len(*cilr.Value) == 0
129}
130
131// hasNextLink returns true if the NextLink is not empty.
132func (cilr CachedImagesListResult) hasNextLink() bool {
133	return cilr.NextLink != nil && len(*cilr.NextLink) != 0
134}
135
136// cachedImagesListResultPreparer prepares a request to retrieve the next set of results.
137// It returns nil if no more results exist.
138func (cilr CachedImagesListResult) cachedImagesListResultPreparer(ctx context.Context) (*http.Request, error) {
139	if !cilr.hasNextLink() {
140		return nil, nil
141	}
142	return autorest.Prepare((&http.Request{}).WithContext(ctx),
143		autorest.AsJSON(),
144		autorest.AsGet(),
145		autorest.WithBaseURL(to.String(cilr.NextLink)))
146}
147
148// CachedImagesListResultPage contains a page of CachedImages values.
149type CachedImagesListResultPage struct {
150	fn   func(context.Context, CachedImagesListResult) (CachedImagesListResult, error)
151	cilr CachedImagesListResult
152}
153
154// NextWithContext advances to the next page of values.  If there was an error making
155// the request the page does not advance and the error is returned.
156func (page *CachedImagesListResultPage) NextWithContext(ctx context.Context) (err error) {
157	if tracing.IsEnabled() {
158		ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultPage.NextWithContext")
159		defer func() {
160			sc := -1
161			if page.Response().Response.Response != nil {
162				sc = page.Response().Response.Response.StatusCode
163			}
164			tracing.EndSpan(ctx, sc, err)
165		}()
166	}
167	for {
168		next, err := page.fn(ctx, page.cilr)
169		if err != nil {
170			return err
171		}
172		page.cilr = next
173		if !next.hasNextLink() || !next.IsEmpty() {
174			break
175		}
176	}
177	return nil
178}
179
180// Next advances to the next page of values.  If there was an error making
181// the request the page does not advance and the error is returned.
182// Deprecated: Use NextWithContext() instead.
183func (page *CachedImagesListResultPage) Next() error {
184	return page.NextWithContext(context.Background())
185}
186
187// NotDone returns true if the page enumeration should be started or is not yet complete.
188func (page CachedImagesListResultPage) NotDone() bool {
189	return !page.cilr.IsEmpty()
190}
191
192// Response returns the raw server response from the last page request.
193func (page CachedImagesListResultPage) Response() CachedImagesListResult {
194	return page.cilr
195}
196
197// Values returns the slice of values for the current page or nil if there are no values.
198func (page CachedImagesListResultPage) Values() []CachedImages {
199	if page.cilr.IsEmpty() {
200		return nil
201	}
202	return *page.cilr.Value
203}
204
205// Creates a new instance of the CachedImagesListResultPage type.
206func NewCachedImagesListResultPage(cur CachedImagesListResult, getNextPage func(context.Context, CachedImagesListResult) (CachedImagesListResult, error)) CachedImagesListResultPage {
207	return CachedImagesListResultPage{
208		fn:   getNextPage,
209		cilr: cur,
210	}
211}
212
213// Capabilities the regional capabilities.
214type Capabilities struct {
215	// ResourceType - READ-ONLY; The resource type that this capability describes.
216	ResourceType *string `json:"resourceType,omitempty"`
217	// OsType - READ-ONLY; The OS type that this capability describes.
218	OsType *string `json:"osType,omitempty"`
219	// Location - READ-ONLY; The resource location.
220	Location *string `json:"location,omitempty"`
221	// IPAddressType - READ-ONLY; The ip address type that this capability describes.
222	IPAddressType *string `json:"ipAddressType,omitempty"`
223	// Gpu - READ-ONLY; The GPU sku that this capability describes.
224	Gpu *string `json:"gpu,omitempty"`
225	// Capabilities - READ-ONLY; The supported capabilities.
226	Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"`
227}
228
229// CapabilitiesCapabilities the supported capabilities.
230type CapabilitiesCapabilities struct {
231	// MaxMemoryInGB - READ-ONLY; The maximum allowed memory request in GB.
232	MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"`
233	// MaxCPU - READ-ONLY; The maximum allowed CPU request in cores.
234	MaxCPU *float64 `json:"maxCpu,omitempty"`
235	// MaxGpuCount - READ-ONLY; The maximum allowed GPU count.
236	MaxGpuCount *float64 `json:"maxGpuCount,omitempty"`
237}
238
239// CapabilitiesListResult the response containing list of capabilities.
240type CapabilitiesListResult struct {
241	autorest.Response `json:"-"`
242	// Value - The list of capabilities.
243	Value *[]Capabilities `json:"value,omitempty"`
244	// NextLink - The URI to fetch the next page of capabilities.
245	NextLink *string `json:"nextLink,omitempty"`
246}
247
248// CapabilitiesListResultIterator provides access to a complete listing of Capabilities values.
249type CapabilitiesListResultIterator struct {
250	i    int
251	page CapabilitiesListResultPage
252}
253
254// NextWithContext advances to the next value.  If there was an error making
255// the request the iterator does not advance and the error is returned.
256func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) {
257	if tracing.IsEnabled() {
258		ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext")
259		defer func() {
260			sc := -1
261			if iter.Response().Response.Response != nil {
262				sc = iter.Response().Response.Response.StatusCode
263			}
264			tracing.EndSpan(ctx, sc, err)
265		}()
266	}
267	iter.i++
268	if iter.i < len(iter.page.Values()) {
269		return nil
270	}
271	err = iter.page.NextWithContext(ctx)
272	if err != nil {
273		iter.i--
274		return err
275	}
276	iter.i = 0
277	return nil
278}
279
280// Next advances to the next value.  If there was an error making
281// the request the iterator does not advance and the error is returned.
282// Deprecated: Use NextWithContext() instead.
283func (iter *CapabilitiesListResultIterator) Next() error {
284	return iter.NextWithContext(context.Background())
285}
286
287// NotDone returns true if the enumeration should be started or is not yet complete.
288func (iter CapabilitiesListResultIterator) NotDone() bool {
289	return iter.page.NotDone() && iter.i < len(iter.page.Values())
290}
291
292// Response returns the raw server response from the last page request.
293func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult {
294	return iter.page.Response()
295}
296
297// Value returns the current value or a zero-initialized value if the
298// iterator has advanced beyond the end of the collection.
299func (iter CapabilitiesListResultIterator) Value() Capabilities {
300	if !iter.page.NotDone() {
301		return Capabilities{}
302	}
303	return iter.page.Values()[iter.i]
304}
305
306// Creates a new instance of the CapabilitiesListResultIterator type.
307func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator {
308	return CapabilitiesListResultIterator{page: page}
309}
310
311// IsEmpty returns true if the ListResult contains no values.
312func (clr CapabilitiesListResult) IsEmpty() bool {
313	return clr.Value == nil || len(*clr.Value) == 0
314}
315
316// hasNextLink returns true if the NextLink is not empty.
317func (clr CapabilitiesListResult) hasNextLink() bool {
318	return clr.NextLink != nil && len(*clr.NextLink) != 0
319}
320
321// capabilitiesListResultPreparer prepares a request to retrieve the next set of results.
322// It returns nil if no more results exist.
323func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) {
324	if !clr.hasNextLink() {
325		return nil, nil
326	}
327	return autorest.Prepare((&http.Request{}).WithContext(ctx),
328		autorest.AsJSON(),
329		autorest.AsGet(),
330		autorest.WithBaseURL(to.String(clr.NextLink)))
331}
332
333// CapabilitiesListResultPage contains a page of Capabilities values.
334type CapabilitiesListResultPage struct {
335	fn  func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)
336	clr CapabilitiesListResult
337}
338
339// NextWithContext advances to the next page of values.  If there was an error making
340// the request the page does not advance and the error is returned.
341func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) {
342	if tracing.IsEnabled() {
343		ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext")
344		defer func() {
345			sc := -1
346			if page.Response().Response.Response != nil {
347				sc = page.Response().Response.Response.StatusCode
348			}
349			tracing.EndSpan(ctx, sc, err)
350		}()
351	}
352	for {
353		next, err := page.fn(ctx, page.clr)
354		if err != nil {
355			return err
356		}
357		page.clr = next
358		if !next.hasNextLink() || !next.IsEmpty() {
359			break
360		}
361	}
362	return nil
363}
364
365// Next advances to the next page of values.  If there was an error making
366// the request the page does not advance and the error is returned.
367// Deprecated: Use NextWithContext() instead.
368func (page *CapabilitiesListResultPage) Next() error {
369	return page.NextWithContext(context.Background())
370}
371
372// NotDone returns true if the page enumeration should be started or is not yet complete.
373func (page CapabilitiesListResultPage) NotDone() bool {
374	return !page.clr.IsEmpty()
375}
376
377// Response returns the raw server response from the last page request.
378func (page CapabilitiesListResultPage) Response() CapabilitiesListResult {
379	return page.clr
380}
381
382// Values returns the slice of values for the current page or nil if there are no values.
383func (page CapabilitiesListResultPage) Values() []Capabilities {
384	if page.clr.IsEmpty() {
385		return nil
386	}
387	return *page.clr.Value
388}
389
390// Creates a new instance of the CapabilitiesListResultPage type.
391func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage {
392	return CapabilitiesListResultPage{
393		fn:  getNextPage,
394		clr: cur,
395	}
396}
397
398// CloudError an error response from the Container Instance service.
399type CloudError struct {
400	Error *CloudErrorBody `json:"error,omitempty"`
401}
402
403// CloudErrorBody an error response from the Container Instance service.
404type CloudErrorBody struct {
405	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
406	Code *string `json:"code,omitempty"`
407	// Message - A message describing the error, intended to be suitable for display in a user interface.
408	Message *string `json:"message,omitempty"`
409	// Target - The target of the particular error. For example, the name of the property in error.
410	Target *string `json:"target,omitempty"`
411	// Details - A list of additional details about the error.
412	Details *[]CloudErrorBody `json:"details,omitempty"`
413}
414
415// Container a container instance.
416type Container struct {
417	// Name - The user-provided name of the container instance.
418	Name *string `json:"name,omitempty"`
419	// ContainerProperties - The properties of the container instance.
420	*ContainerProperties `json:"properties,omitempty"`
421}
422
423// MarshalJSON is the custom marshaler for Container.
424func (c Container) MarshalJSON() ([]byte, error) {
425	objectMap := make(map[string]interface{})
426	if c.Name != nil {
427		objectMap["name"] = c.Name
428	}
429	if c.ContainerProperties != nil {
430		objectMap["properties"] = c.ContainerProperties
431	}
432	return json.Marshal(objectMap)
433}
434
435// UnmarshalJSON is the custom unmarshaler for Container struct.
436func (c *Container) UnmarshalJSON(body []byte) error {
437	var m map[string]*json.RawMessage
438	err := json.Unmarshal(body, &m)
439	if err != nil {
440		return err
441	}
442	for k, v := range m {
443		switch k {
444		case "name":
445			if v != nil {
446				var name string
447				err = json.Unmarshal(*v, &name)
448				if err != nil {
449					return err
450				}
451				c.Name = &name
452			}
453		case "properties":
454			if v != nil {
455				var containerProperties ContainerProperties
456				err = json.Unmarshal(*v, &containerProperties)
457				if err != nil {
458					return err
459				}
460				c.ContainerProperties = &containerProperties
461			}
462		}
463	}
464
465	return nil
466}
467
468// ContainerExec the container execution command, for liveness or readiness probe
469type ContainerExec struct {
470	// Command - The commands to execute within the container.
471	Command *[]string `json:"command,omitempty"`
472}
473
474// ContainerExecRequest the container exec request.
475type ContainerExecRequest struct {
476	// Command - The command to be executed.
477	Command *string `json:"command,omitempty"`
478	// TerminalSize - The size of the terminal.
479	TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"`
480}
481
482// ContainerExecRequestTerminalSize the size of the terminal.
483type ContainerExecRequestTerminalSize struct {
484	// Rows - The row size of the terminal
485	Rows *int32 `json:"rows,omitempty"`
486	// Cols - The column size of the terminal
487	Cols *int32 `json:"cols,omitempty"`
488}
489
490// ContainerExecResponse the information for the container exec command.
491type ContainerExecResponse struct {
492	autorest.Response `json:"-"`
493	// WebSocketURI - The uri for the exec websocket.
494	WebSocketURI *string `json:"webSocketUri,omitempty"`
495	// Password - The password to start the exec command.
496	Password *string `json:"password,omitempty"`
497}
498
499// ContainerGroup a container group.
500type ContainerGroup struct {
501	autorest.Response `json:"-"`
502	// Identity - The identity of the container group, if configured.
503	Identity *ContainerGroupIdentity `json:"identity,omitempty"`
504	// ContainerGroupProperties - The container group properties
505	*ContainerGroupProperties `json:"properties,omitempty"`
506	// ID - READ-ONLY; The resource id.
507	ID *string `json:"id,omitempty"`
508	// Name - READ-ONLY; The resource name.
509	Name *string `json:"name,omitempty"`
510	// Type - READ-ONLY; The resource type.
511	Type *string `json:"type,omitempty"`
512	// Location - The resource location.
513	Location *string `json:"location,omitempty"`
514	// Tags - The resource tags.
515	Tags map[string]*string `json:"tags"`
516}
517
518// MarshalJSON is the custom marshaler for ContainerGroup.
519func (cg ContainerGroup) MarshalJSON() ([]byte, error) {
520	objectMap := make(map[string]interface{})
521	if cg.Identity != nil {
522		objectMap["identity"] = cg.Identity
523	}
524	if cg.ContainerGroupProperties != nil {
525		objectMap["properties"] = cg.ContainerGroupProperties
526	}
527	if cg.Location != nil {
528		objectMap["location"] = cg.Location
529	}
530	if cg.Tags != nil {
531		objectMap["tags"] = cg.Tags
532	}
533	return json.Marshal(objectMap)
534}
535
536// UnmarshalJSON is the custom unmarshaler for ContainerGroup struct.
537func (cg *ContainerGroup) UnmarshalJSON(body []byte) error {
538	var m map[string]*json.RawMessage
539	err := json.Unmarshal(body, &m)
540	if err != nil {
541		return err
542	}
543	for k, v := range m {
544		switch k {
545		case "identity":
546			if v != nil {
547				var identity ContainerGroupIdentity
548				err = json.Unmarshal(*v, &identity)
549				if err != nil {
550					return err
551				}
552				cg.Identity = &identity
553			}
554		case "properties":
555			if v != nil {
556				var containerGroupProperties ContainerGroupProperties
557				err = json.Unmarshal(*v, &containerGroupProperties)
558				if err != nil {
559					return err
560				}
561				cg.ContainerGroupProperties = &containerGroupProperties
562			}
563		case "id":
564			if v != nil {
565				var ID string
566				err = json.Unmarshal(*v, &ID)
567				if err != nil {
568					return err
569				}
570				cg.ID = &ID
571			}
572		case "name":
573			if v != nil {
574				var name string
575				err = json.Unmarshal(*v, &name)
576				if err != nil {
577					return err
578				}
579				cg.Name = &name
580			}
581		case "type":
582			if v != nil {
583				var typeVar string
584				err = json.Unmarshal(*v, &typeVar)
585				if err != nil {
586					return err
587				}
588				cg.Type = &typeVar
589			}
590		case "location":
591			if v != nil {
592				var location string
593				err = json.Unmarshal(*v, &location)
594				if err != nil {
595					return err
596				}
597				cg.Location = &location
598			}
599		case "tags":
600			if v != nil {
601				var tags map[string]*string
602				err = json.Unmarshal(*v, &tags)
603				if err != nil {
604					return err
605				}
606				cg.Tags = tags
607			}
608		}
609	}
610
611	return nil
612}
613
614// ContainerGroupDiagnostics container group diagnostic information.
615type ContainerGroupDiagnostics struct {
616	// LogAnalytics - Container group log analytics information.
617	LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"`
618}
619
620// ContainerGroupIdentity identity for the container group.
621type ContainerGroupIdentity struct {
622	// PrincipalID - READ-ONLY; The principal id of the container group identity. This property will only be provided for a system assigned identity.
623	PrincipalID *string `json:"principalId,omitempty"`
624	// TenantID - READ-ONLY; The tenant id associated with the container group. This property will only be provided for a system assigned identity.
625	TenantID *string `json:"tenantId,omitempty"`
626	// Type - The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None'
627	Type ResourceIdentityType `json:"type,omitempty"`
628	// UserAssignedIdentities - The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
629	UserAssignedIdentities map[string]*ContainerGroupIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"`
630}
631
632// MarshalJSON is the custom marshaler for ContainerGroupIdentity.
633func (cgiVar ContainerGroupIdentity) MarshalJSON() ([]byte, error) {
634	objectMap := make(map[string]interface{})
635	if cgiVar.Type != "" {
636		objectMap["type"] = cgiVar.Type
637	}
638	if cgiVar.UserAssignedIdentities != nil {
639		objectMap["userAssignedIdentities"] = cgiVar.UserAssignedIdentities
640	}
641	return json.Marshal(objectMap)
642}
643
644// ContainerGroupIdentityUserAssignedIdentitiesValue ...
645type ContainerGroupIdentityUserAssignedIdentitiesValue struct {
646	// PrincipalID - READ-ONLY; The principal id of user assigned identity.
647	PrincipalID *string `json:"principalId,omitempty"`
648	// ClientID - READ-ONLY; The client id of user assigned identity.
649	ClientID *string `json:"clientId,omitempty"`
650}
651
652// ContainerGroupListResult the container group list response that contains the container group properties.
653type ContainerGroupListResult struct {
654	autorest.Response `json:"-"`
655	// Value - The list of container groups.
656	Value *[]ContainerGroup `json:"value,omitempty"`
657	// NextLink - The URI to fetch the next page of container groups.
658	NextLink *string `json:"nextLink,omitempty"`
659}
660
661// ContainerGroupListResultIterator provides access to a complete listing of ContainerGroup values.
662type ContainerGroupListResultIterator struct {
663	i    int
664	page ContainerGroupListResultPage
665}
666
667// NextWithContext advances to the next value.  If there was an error making
668// the request the iterator does not advance and the error is returned.
669func (iter *ContainerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) {
670	if tracing.IsEnabled() {
671		ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultIterator.NextWithContext")
672		defer func() {
673			sc := -1
674			if iter.Response().Response.Response != nil {
675				sc = iter.Response().Response.Response.StatusCode
676			}
677			tracing.EndSpan(ctx, sc, err)
678		}()
679	}
680	iter.i++
681	if iter.i < len(iter.page.Values()) {
682		return nil
683	}
684	err = iter.page.NextWithContext(ctx)
685	if err != nil {
686		iter.i--
687		return err
688	}
689	iter.i = 0
690	return nil
691}
692
693// Next advances to the next value.  If there was an error making
694// the request the iterator does not advance and the error is returned.
695// Deprecated: Use NextWithContext() instead.
696func (iter *ContainerGroupListResultIterator) Next() error {
697	return iter.NextWithContext(context.Background())
698}
699
700// NotDone returns true if the enumeration should be started or is not yet complete.
701func (iter ContainerGroupListResultIterator) NotDone() bool {
702	return iter.page.NotDone() && iter.i < len(iter.page.Values())
703}
704
705// Response returns the raw server response from the last page request.
706func (iter ContainerGroupListResultIterator) Response() ContainerGroupListResult {
707	return iter.page.Response()
708}
709
710// Value returns the current value or a zero-initialized value if the
711// iterator has advanced beyond the end of the collection.
712func (iter ContainerGroupListResultIterator) Value() ContainerGroup {
713	if !iter.page.NotDone() {
714		return ContainerGroup{}
715	}
716	return iter.page.Values()[iter.i]
717}
718
719// Creates a new instance of the ContainerGroupListResultIterator type.
720func NewContainerGroupListResultIterator(page ContainerGroupListResultPage) ContainerGroupListResultIterator {
721	return ContainerGroupListResultIterator{page: page}
722}
723
724// IsEmpty returns true if the ListResult contains no values.
725func (cglr ContainerGroupListResult) IsEmpty() bool {
726	return cglr.Value == nil || len(*cglr.Value) == 0
727}
728
729// hasNextLink returns true if the NextLink is not empty.
730func (cglr ContainerGroupListResult) hasNextLink() bool {
731	return cglr.NextLink != nil && len(*cglr.NextLink) != 0
732}
733
734// containerGroupListResultPreparer prepares a request to retrieve the next set of results.
735// It returns nil if no more results exist.
736func (cglr ContainerGroupListResult) containerGroupListResultPreparer(ctx context.Context) (*http.Request, error) {
737	if !cglr.hasNextLink() {
738		return nil, nil
739	}
740	return autorest.Prepare((&http.Request{}).WithContext(ctx),
741		autorest.AsJSON(),
742		autorest.AsGet(),
743		autorest.WithBaseURL(to.String(cglr.NextLink)))
744}
745
746// ContainerGroupListResultPage contains a page of ContainerGroup values.
747type ContainerGroupListResultPage struct {
748	fn   func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)
749	cglr ContainerGroupListResult
750}
751
752// NextWithContext advances to the next page of values.  If there was an error making
753// the request the page does not advance and the error is returned.
754func (page *ContainerGroupListResultPage) NextWithContext(ctx context.Context) (err error) {
755	if tracing.IsEnabled() {
756		ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultPage.NextWithContext")
757		defer func() {
758			sc := -1
759			if page.Response().Response.Response != nil {
760				sc = page.Response().Response.Response.StatusCode
761			}
762			tracing.EndSpan(ctx, sc, err)
763		}()
764	}
765	for {
766		next, err := page.fn(ctx, page.cglr)
767		if err != nil {
768			return err
769		}
770		page.cglr = next
771		if !next.hasNextLink() || !next.IsEmpty() {
772			break
773		}
774	}
775	return nil
776}
777
778// Next advances to the next page of values.  If there was an error making
779// the request the page does not advance and the error is returned.
780// Deprecated: Use NextWithContext() instead.
781func (page *ContainerGroupListResultPage) Next() error {
782	return page.NextWithContext(context.Background())
783}
784
785// NotDone returns true if the page enumeration should be started or is not yet complete.
786func (page ContainerGroupListResultPage) NotDone() bool {
787	return !page.cglr.IsEmpty()
788}
789
790// Response returns the raw server response from the last page request.
791func (page ContainerGroupListResultPage) Response() ContainerGroupListResult {
792	return page.cglr
793}
794
795// Values returns the slice of values for the current page or nil if there are no values.
796func (page ContainerGroupListResultPage) Values() []ContainerGroup {
797	if page.cglr.IsEmpty() {
798		return nil
799	}
800	return *page.cglr.Value
801}
802
803// Creates a new instance of the ContainerGroupListResultPage type.
804func NewContainerGroupListResultPage(cur ContainerGroupListResult, getNextPage func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)) ContainerGroupListResultPage {
805	return ContainerGroupListResultPage{
806		fn:   getNextPage,
807		cglr: cur,
808	}
809}
810
811// ContainerGroupNetworkProfile container group network profile information.
812type ContainerGroupNetworkProfile struct {
813	// ID - The identifier for a network profile.
814	ID *string `json:"id,omitempty"`
815}
816
817// ContainerGroupProperties the container group properties
818type ContainerGroupProperties struct {
819	// ProvisioningState - READ-ONLY; The provisioning state of the container group. This only appears in the response.
820	ProvisioningState *string `json:"provisioningState,omitempty"`
821	// Containers - The containers within the container group.
822	Containers *[]Container `json:"containers,omitempty"`
823	// ImageRegistryCredentials - The image registry credentials by which the container group is created from.
824	ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"`
825	// RestartPolicy - Restart policy for all containers within the container group.
826	// - `Always` Always restart
827	// - `OnFailure` Restart on failure
828	// - `Never` Never restart
829	// . Possible values include: 'Always', 'OnFailure', 'Never'
830	RestartPolicy ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"`
831	// IPAddress - The IP address type of the container group.
832	IPAddress *IPAddress `json:"ipAddress,omitempty"`
833	// OsType - The operating system type required by the containers in the container group. Possible values include: 'Windows', 'Linux'
834	OsType OperatingSystemTypes `json:"osType,omitempty"`
835	// Volumes - The list of volumes that can be mounted by containers in this container group.
836	Volumes *[]Volume `json:"volumes,omitempty"`
837	// InstanceView - READ-ONLY; The instance view of the container group. Only valid in response.
838	InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"`
839	// Diagnostics - The diagnostic information for a container group.
840	Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"`
841	// NetworkProfile - The network profile information for a container group.
842	NetworkProfile *ContainerGroupNetworkProfile `json:"networkProfile,omitempty"`
843	// DNSConfig - The DNS config information for a container group.
844	DNSConfig *DNSConfiguration `json:"dnsConfig,omitempty"`
845	// Sku - The SKU for a container group. Possible values include: 'Standard', 'Dedicated'
846	Sku ContainerGroupSku `json:"sku,omitempty"`
847	// EncryptionProperties - The encryption properties for a container group.
848	EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"`
849	// InitContainers - The init containers for a container group.
850	InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"`
851}
852
853// MarshalJSON is the custom marshaler for ContainerGroupProperties.
854func (cg ContainerGroupProperties) MarshalJSON() ([]byte, error) {
855	objectMap := make(map[string]interface{})
856	if cg.Containers != nil {
857		objectMap["containers"] = cg.Containers
858	}
859	if cg.ImageRegistryCredentials != nil {
860		objectMap["imageRegistryCredentials"] = cg.ImageRegistryCredentials
861	}
862	if cg.RestartPolicy != "" {
863		objectMap["restartPolicy"] = cg.RestartPolicy
864	}
865	if cg.IPAddress != nil {
866		objectMap["ipAddress"] = cg.IPAddress
867	}
868	if cg.OsType != "" {
869		objectMap["osType"] = cg.OsType
870	}
871	if cg.Volumes != nil {
872		objectMap["volumes"] = cg.Volumes
873	}
874	if cg.Diagnostics != nil {
875		objectMap["diagnostics"] = cg.Diagnostics
876	}
877	if cg.NetworkProfile != nil {
878		objectMap["networkProfile"] = cg.NetworkProfile
879	}
880	if cg.DNSConfig != nil {
881		objectMap["dnsConfig"] = cg.DNSConfig
882	}
883	if cg.Sku != "" {
884		objectMap["sku"] = cg.Sku
885	}
886	if cg.EncryptionProperties != nil {
887		objectMap["encryptionProperties"] = cg.EncryptionProperties
888	}
889	if cg.InitContainers != nil {
890		objectMap["initContainers"] = cg.InitContainers
891	}
892	return json.Marshal(objectMap)
893}
894
895// ContainerGroupPropertiesInstanceView the instance view of the container group. Only valid in response.
896type ContainerGroupPropertiesInstanceView struct {
897	// Events - READ-ONLY; The events of this container group.
898	Events *[]Event `json:"events,omitempty"`
899	// State - READ-ONLY; The state of the container group. Only valid in response.
900	State *string `json:"state,omitempty"`
901}
902
903// ContainerGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
904// long-running operation.
905type ContainerGroupsCreateOrUpdateFuture struct {
906	azure.FutureAPI
907	// Result returns the result of the asynchronous operation.
908	// If the operation has not completed it will return an error.
909	Result func(ContainerGroupsClient) (ContainerGroup, error)
910}
911
912// ContainerGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
913// operation.
914type ContainerGroupsDeleteFuture struct {
915	azure.FutureAPI
916	// Result returns the result of the asynchronous operation.
917	// If the operation has not completed it will return an error.
918	Result func(ContainerGroupsClient) (ContainerGroup, error)
919}
920
921// ContainerGroupsRestartFuture an abstraction for monitoring and retrieving the results of a long-running
922// operation.
923type ContainerGroupsRestartFuture 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(ContainerGroupsClient) (autorest.Response, error)
928}
929
930// ContainerGroupsStartFuture an abstraction for monitoring and retrieving the results of a long-running
931// operation.
932type ContainerGroupsStartFuture struct {
933	azure.FutureAPI
934	// Result returns the result of the asynchronous operation.
935	// If the operation has not completed it will return an error.
936	Result func(ContainerGroupsClient) (autorest.Response, error)
937}
938
939// ContainerHTTPGet the container Http Get settings, for liveness or readiness probe
940type ContainerHTTPGet struct {
941	// Path - The path to probe.
942	Path *string `json:"path,omitempty"`
943	// Port - The port number to probe.
944	Port *int32 `json:"port,omitempty"`
945	// Scheme - The scheme. Possible values include: 'HTTP', 'HTTPS'
946	Scheme Scheme `json:"scheme,omitempty"`
947}
948
949// ContainerPort the port exposed on the container instance.
950type ContainerPort struct {
951	// Protocol - The protocol associated with the port. Possible values include: 'ContainerNetworkProtocolTCP', 'ContainerNetworkProtocolUDP'
952	Protocol ContainerNetworkProtocol `json:"protocol,omitempty"`
953	// Port - The port number exposed within the container group.
954	Port *int32 `json:"port,omitempty"`
955}
956
957// ContainerProbe the container probe, for liveness or readiness
958type ContainerProbe struct {
959	// Exec - The execution command to probe
960	Exec *ContainerExec `json:"exec,omitempty"`
961	// HTTPGet - The Http Get settings to probe
962	HTTPGet *ContainerHTTPGet `json:"httpGet,omitempty"`
963	// InitialDelaySeconds - The initial delay seconds.
964	InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
965	// PeriodSeconds - The period seconds.
966	PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
967	// FailureThreshold - The failure threshold.
968	FailureThreshold *int32 `json:"failureThreshold,omitempty"`
969	// SuccessThreshold - The success threshold.
970	SuccessThreshold *int32 `json:"successThreshold,omitempty"`
971	// TimeoutSeconds - The timeout seconds.
972	TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
973}
974
975// ContainerProperties the container instance properties.
976type ContainerProperties struct {
977	// Image - The name of the image used to create the container instance.
978	Image *string `json:"image,omitempty"`
979	// Command - The commands to execute within the container instance in exec form.
980	Command *[]string `json:"command,omitempty"`
981	// Ports - The exposed ports on the container instance.
982	Ports *[]ContainerPort `json:"ports,omitempty"`
983	// EnvironmentVariables - The environment variables to set in the container instance.
984	EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"`
985	// InstanceView - READ-ONLY; The instance view of the container instance. Only valid in response.
986	InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"`
987	// Resources - The resource requirements of the container instance.
988	Resources *ResourceRequirements `json:"resources,omitempty"`
989	// VolumeMounts - The volume mounts available to the container instance.
990	VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"`
991	// LivenessProbe - The liveness probe.
992	LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"`
993	// ReadinessProbe - The readiness probe.
994	ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"`
995}
996
997// MarshalJSON is the custom marshaler for ContainerProperties.
998func (cp ContainerProperties) MarshalJSON() ([]byte, error) {
999	objectMap := make(map[string]interface{})
1000	if cp.Image != nil {
1001		objectMap["image"] = cp.Image
1002	}
1003	if cp.Command != nil {
1004		objectMap["command"] = cp.Command
1005	}
1006	if cp.Ports != nil {
1007		objectMap["ports"] = cp.Ports
1008	}
1009	if cp.EnvironmentVariables != nil {
1010		objectMap["environmentVariables"] = cp.EnvironmentVariables
1011	}
1012	if cp.Resources != nil {
1013		objectMap["resources"] = cp.Resources
1014	}
1015	if cp.VolumeMounts != nil {
1016		objectMap["volumeMounts"] = cp.VolumeMounts
1017	}
1018	if cp.LivenessProbe != nil {
1019		objectMap["livenessProbe"] = cp.LivenessProbe
1020	}
1021	if cp.ReadinessProbe != nil {
1022		objectMap["readinessProbe"] = cp.ReadinessProbe
1023	}
1024	return json.Marshal(objectMap)
1025}
1026
1027// ContainerPropertiesInstanceView the instance view of the container instance. Only valid in response.
1028type ContainerPropertiesInstanceView struct {
1029	// RestartCount - READ-ONLY; The number of times that the container instance has been restarted.
1030	RestartCount *int32 `json:"restartCount,omitempty"`
1031	// CurrentState - READ-ONLY; Current container instance state.
1032	CurrentState *ContainerState `json:"currentState,omitempty"`
1033	// PreviousState - READ-ONLY; Previous container instance state.
1034	PreviousState *ContainerState `json:"previousState,omitempty"`
1035	// Events - READ-ONLY; The events of the container instance.
1036	Events *[]Event `json:"events,omitempty"`
1037}
1038
1039// ContainerState the container instance state.
1040type ContainerState struct {
1041	// State - READ-ONLY; The state of the container instance.
1042	State *string `json:"state,omitempty"`
1043	// StartTime - READ-ONLY; The date-time when the container instance state started.
1044	StartTime *date.Time `json:"startTime,omitempty"`
1045	// ExitCode - READ-ONLY; The container instance exit codes correspond to those from the `docker run` command.
1046	ExitCode *int32 `json:"exitCode,omitempty"`
1047	// FinishTime - READ-ONLY; The date-time when the container instance state finished.
1048	FinishTime *date.Time `json:"finishTime,omitempty"`
1049	// DetailStatus - READ-ONLY; The human-readable status of the container instance state.
1050	DetailStatus *string `json:"detailStatus,omitempty"`
1051}
1052
1053// DNSConfiguration DNS configuration for the container group.
1054type DNSConfiguration struct {
1055	// NameServers - The DNS servers for the container group.
1056	NameServers *[]string `json:"nameServers,omitempty"`
1057	// SearchDomains - The DNS search domains for hostname lookup in the container group.
1058	SearchDomains *string `json:"searchDomains,omitempty"`
1059	// Options - The DNS options for the container group.
1060	Options *string `json:"options,omitempty"`
1061}
1062
1063// EncryptionProperties the container group encryption properties.
1064type EncryptionProperties struct {
1065	// VaultBaseURL - The keyvault base url.
1066	VaultBaseURL *string `json:"vaultBaseUrl,omitempty"`
1067	// KeyName - The encryption key name.
1068	KeyName *string `json:"keyName,omitempty"`
1069	// KeyVersion - The encryption key version.
1070	KeyVersion *string `json:"keyVersion,omitempty"`
1071}
1072
1073// EnvironmentVariable the environment variable to set within the container instance.
1074type EnvironmentVariable struct {
1075	// Name - The name of the environment variable.
1076	Name *string `json:"name,omitempty"`
1077	// Value - The value of the environment variable.
1078	Value *string `json:"value,omitempty"`
1079	// SecureValue - The value of the secure environment variable.
1080	SecureValue *string `json:"secureValue,omitempty"`
1081}
1082
1083// Event a container group or container instance event.
1084type Event struct {
1085	// Count - READ-ONLY; The count of the event.
1086	Count *int32 `json:"count,omitempty"`
1087	// FirstTimestamp - READ-ONLY; The date-time of the earliest logged event.
1088	FirstTimestamp *date.Time `json:"firstTimestamp,omitempty"`
1089	// LastTimestamp - READ-ONLY; The date-time of the latest logged event.
1090	LastTimestamp *date.Time `json:"lastTimestamp,omitempty"`
1091	// Name - READ-ONLY; The event name.
1092	Name *string `json:"name,omitempty"`
1093	// Message - READ-ONLY; The event message.
1094	Message *string `json:"message,omitempty"`
1095	// Type - READ-ONLY; The event type.
1096	Type *string `json:"type,omitempty"`
1097}
1098
1099// GitRepoVolume represents a volume that is populated with the contents of a git repository
1100type GitRepoVolume struct {
1101	// Directory - Target directory name. Must not contain or start with '..'.  If '.' is supplied, the volume directory will be the git repository.  Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.
1102	Directory *string `json:"directory,omitempty"`
1103	// Repository - Repository URL
1104	Repository *string `json:"repository,omitempty"`
1105	// Revision - Commit hash for the specified revision.
1106	Revision *string `json:"revision,omitempty"`
1107}
1108
1109// GpuResource the GPU resource.
1110type GpuResource struct {
1111	// Count - The count of the GPU resource.
1112	Count *int32 `json:"count,omitempty"`
1113	// Sku - The SKU of the GPU resource. Possible values include: 'K80', 'P100', 'V100'
1114	Sku GpuSku `json:"sku,omitempty"`
1115}
1116
1117// ImageRegistryCredential image registry credential.
1118type ImageRegistryCredential struct {
1119	// Server - The Docker image registry server without a protocol such as "http" and "https".
1120	Server *string `json:"server,omitempty"`
1121	// Username - The username for the private registry.
1122	Username *string `json:"username,omitempty"`
1123	// Password - The password for the private registry.
1124	Password *string `json:"password,omitempty"`
1125}
1126
1127// InitContainerDefinition the init container definition.
1128type InitContainerDefinition struct {
1129	// Name - The name for the init container.
1130	Name *string `json:"name,omitempty"`
1131	// InitContainerPropertiesDefinition - The properties for the init container.
1132	*InitContainerPropertiesDefinition `json:"properties,omitempty"`
1133}
1134
1135// MarshalJSON is the custom marshaler for InitContainerDefinition.
1136func (icd InitContainerDefinition) MarshalJSON() ([]byte, error) {
1137	objectMap := make(map[string]interface{})
1138	if icd.Name != nil {
1139		objectMap["name"] = icd.Name
1140	}
1141	if icd.InitContainerPropertiesDefinition != nil {
1142		objectMap["properties"] = icd.InitContainerPropertiesDefinition
1143	}
1144	return json.Marshal(objectMap)
1145}
1146
1147// UnmarshalJSON is the custom unmarshaler for InitContainerDefinition struct.
1148func (icd *InitContainerDefinition) UnmarshalJSON(body []byte) error {
1149	var m map[string]*json.RawMessage
1150	err := json.Unmarshal(body, &m)
1151	if err != nil {
1152		return err
1153	}
1154	for k, v := range m {
1155		switch k {
1156		case "name":
1157			if v != nil {
1158				var name string
1159				err = json.Unmarshal(*v, &name)
1160				if err != nil {
1161					return err
1162				}
1163				icd.Name = &name
1164			}
1165		case "properties":
1166			if v != nil {
1167				var initContainerPropertiesDefinition InitContainerPropertiesDefinition
1168				err = json.Unmarshal(*v, &initContainerPropertiesDefinition)
1169				if err != nil {
1170					return err
1171				}
1172				icd.InitContainerPropertiesDefinition = &initContainerPropertiesDefinition
1173			}
1174		}
1175	}
1176
1177	return nil
1178}
1179
1180// InitContainerPropertiesDefinition the init container definition properties.
1181type InitContainerPropertiesDefinition struct {
1182	// Image - The image of the init container.
1183	Image *string `json:"image,omitempty"`
1184	// Command - The command to execute within the init container in exec form.
1185	Command *[]string `json:"command,omitempty"`
1186	// EnvironmentVariables - The environment variables to set in the init container.
1187	EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"`
1188	// InstanceView - READ-ONLY; The instance view of the init container. Only valid in response.
1189	InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"`
1190	// VolumeMounts - The volume mounts available to the init container.
1191	VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"`
1192}
1193
1194// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinition.
1195func (icpd InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) {
1196	objectMap := make(map[string]interface{})
1197	if icpd.Image != nil {
1198		objectMap["image"] = icpd.Image
1199	}
1200	if icpd.Command != nil {
1201		objectMap["command"] = icpd.Command
1202	}
1203	if icpd.EnvironmentVariables != nil {
1204		objectMap["environmentVariables"] = icpd.EnvironmentVariables
1205	}
1206	if icpd.VolumeMounts != nil {
1207		objectMap["volumeMounts"] = icpd.VolumeMounts
1208	}
1209	return json.Marshal(objectMap)
1210}
1211
1212// InitContainerPropertiesDefinitionInstanceView the instance view of the init container. Only valid in
1213// response.
1214type InitContainerPropertiesDefinitionInstanceView struct {
1215	// RestartCount - READ-ONLY; The number of times that the init container has been restarted.
1216	RestartCount *int32 `json:"restartCount,omitempty"`
1217	// CurrentState - READ-ONLY; The current state of the init container.
1218	CurrentState *ContainerState `json:"currentState,omitempty"`
1219	// PreviousState - READ-ONLY; The previous state of the init container.
1220	PreviousState *ContainerState `json:"previousState,omitempty"`
1221	// Events - READ-ONLY; The events of the init container.
1222	Events *[]Event `json:"events,omitempty"`
1223}
1224
1225// IPAddress IP address for the container group.
1226type IPAddress struct {
1227	// Ports - The list of ports exposed on the container group.
1228	Ports *[]Port `json:"ports,omitempty"`
1229	// Type - Specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'Public', 'Private'
1230	Type ContainerGroupIPAddressType `json:"type,omitempty"`
1231	// IP - The IP exposed to the public internet.
1232	IP *string `json:"ip,omitempty"`
1233	// DNSNameLabel - The Dns name label for the IP.
1234	DNSNameLabel *string `json:"dnsNameLabel,omitempty"`
1235	// Fqdn - READ-ONLY; The FQDN for the IP.
1236	Fqdn *string `json:"fqdn,omitempty"`
1237}
1238
1239// MarshalJSON is the custom marshaler for IPAddress.
1240func (ia IPAddress) MarshalJSON() ([]byte, error) {
1241	objectMap := make(map[string]interface{})
1242	if ia.Ports != nil {
1243		objectMap["ports"] = ia.Ports
1244	}
1245	if ia.Type != "" {
1246		objectMap["type"] = ia.Type
1247	}
1248	if ia.IP != nil {
1249		objectMap["ip"] = ia.IP
1250	}
1251	if ia.DNSNameLabel != nil {
1252		objectMap["dnsNameLabel"] = ia.DNSNameLabel
1253	}
1254	return json.Marshal(objectMap)
1255}
1256
1257// LogAnalytics container group log analytics information.
1258type LogAnalytics struct {
1259	// WorkspaceID - The workspace id for log analytics
1260	WorkspaceID *string `json:"workspaceId,omitempty"`
1261	// WorkspaceKey - The workspace key for log analytics
1262	WorkspaceKey *string `json:"workspaceKey,omitempty"`
1263	// LogType - The log type to be used. Possible values include: 'ContainerInsights', 'ContainerInstanceLogs'
1264	LogType LogAnalyticsLogType `json:"logType,omitempty"`
1265	// Metadata - Metadata for log analytics.
1266	Metadata map[string]*string `json:"metadata"`
1267}
1268
1269// MarshalJSON is the custom marshaler for LogAnalytics.
1270func (la LogAnalytics) MarshalJSON() ([]byte, error) {
1271	objectMap := make(map[string]interface{})
1272	if la.WorkspaceID != nil {
1273		objectMap["workspaceId"] = la.WorkspaceID
1274	}
1275	if la.WorkspaceKey != nil {
1276		objectMap["workspaceKey"] = la.WorkspaceKey
1277	}
1278	if la.LogType != "" {
1279		objectMap["logType"] = la.LogType
1280	}
1281	if la.Metadata != nil {
1282		objectMap["metadata"] = la.Metadata
1283	}
1284	return json.Marshal(objectMap)
1285}
1286
1287// Logs the logs.
1288type Logs struct {
1289	autorest.Response `json:"-"`
1290	// Content - The content of the log.
1291	Content *string `json:"content,omitempty"`
1292}
1293
1294// Operation an operation for Azure Container Instance service.
1295type Operation struct {
1296	// Name - The name of the operation.
1297	Name *string `json:"name,omitempty"`
1298	// Display - The display information of the operation.
1299	Display *OperationDisplay `json:"display,omitempty"`
1300	// Properties - The additional properties.
1301	Properties interface{} `json:"properties,omitempty"`
1302	// Origin - The intended executor of the operation. Possible values include: 'User', 'System'
1303	Origin OperationsOrigin `json:"origin,omitempty"`
1304}
1305
1306// OperationDisplay the display information of the operation.
1307type OperationDisplay struct {
1308	// Provider - The name of the provider of the operation.
1309	Provider *string `json:"provider,omitempty"`
1310	// Resource - The name of the resource type of the operation.
1311	Resource *string `json:"resource,omitempty"`
1312	// Operation - The friendly name of the operation.
1313	Operation *string `json:"operation,omitempty"`
1314	// Description - The description of the operation.
1315	Description *string `json:"description,omitempty"`
1316}
1317
1318// OperationListResult the operation list response that contains all operations for Azure Container
1319// Instance service.
1320type OperationListResult struct {
1321	autorest.Response `json:"-"`
1322	// Value - The list of operations.
1323	Value *[]Operation `json:"value,omitempty"`
1324	// NextLink - The URI to fetch the next page of operations.
1325	NextLink *string `json:"nextLink,omitempty"`
1326}
1327
1328// OperationListResultIterator provides access to a complete listing of Operation values.
1329type OperationListResultIterator struct {
1330	i    int
1331	page OperationListResultPage
1332}
1333
1334// NextWithContext advances to the next value.  If there was an error making
1335// the request the iterator does not advance and the error is returned.
1336func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1337	if tracing.IsEnabled() {
1338		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1339		defer func() {
1340			sc := -1
1341			if iter.Response().Response.Response != nil {
1342				sc = iter.Response().Response.Response.StatusCode
1343			}
1344			tracing.EndSpan(ctx, sc, err)
1345		}()
1346	}
1347	iter.i++
1348	if iter.i < len(iter.page.Values()) {
1349		return nil
1350	}
1351	err = iter.page.NextWithContext(ctx)
1352	if err != nil {
1353		iter.i--
1354		return err
1355	}
1356	iter.i = 0
1357	return nil
1358}
1359
1360// Next advances to the next value.  If there was an error making
1361// the request the iterator does not advance and the error is returned.
1362// Deprecated: Use NextWithContext() instead.
1363func (iter *OperationListResultIterator) Next() error {
1364	return iter.NextWithContext(context.Background())
1365}
1366
1367// NotDone returns true if the enumeration should be started or is not yet complete.
1368func (iter OperationListResultIterator) NotDone() bool {
1369	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1370}
1371
1372// Response returns the raw server response from the last page request.
1373func (iter OperationListResultIterator) Response() OperationListResult {
1374	return iter.page.Response()
1375}
1376
1377// Value returns the current value or a zero-initialized value if the
1378// iterator has advanced beyond the end of the collection.
1379func (iter OperationListResultIterator) Value() Operation {
1380	if !iter.page.NotDone() {
1381		return Operation{}
1382	}
1383	return iter.page.Values()[iter.i]
1384}
1385
1386// Creates a new instance of the OperationListResultIterator type.
1387func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1388	return OperationListResultIterator{page: page}
1389}
1390
1391// IsEmpty returns true if the ListResult contains no values.
1392func (olr OperationListResult) IsEmpty() bool {
1393	return olr.Value == nil || len(*olr.Value) == 0
1394}
1395
1396// hasNextLink returns true if the NextLink is not empty.
1397func (olr OperationListResult) hasNextLink() bool {
1398	return olr.NextLink != nil && len(*olr.NextLink) != 0
1399}
1400
1401// operationListResultPreparer prepares a request to retrieve the next set of results.
1402// It returns nil if no more results exist.
1403func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1404	if !olr.hasNextLink() {
1405		return nil, nil
1406	}
1407	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1408		autorest.AsJSON(),
1409		autorest.AsGet(),
1410		autorest.WithBaseURL(to.String(olr.NextLink)))
1411}
1412
1413// OperationListResultPage contains a page of Operation values.
1414type OperationListResultPage struct {
1415	fn  func(context.Context, OperationListResult) (OperationListResult, error)
1416	olr OperationListResult
1417}
1418
1419// NextWithContext advances to the next page of values.  If there was an error making
1420// the request the page does not advance and the error is returned.
1421func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1422	if tracing.IsEnabled() {
1423		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1424		defer func() {
1425			sc := -1
1426			if page.Response().Response.Response != nil {
1427				sc = page.Response().Response.Response.StatusCode
1428			}
1429			tracing.EndSpan(ctx, sc, err)
1430		}()
1431	}
1432	for {
1433		next, err := page.fn(ctx, page.olr)
1434		if err != nil {
1435			return err
1436		}
1437		page.olr = next
1438		if !next.hasNextLink() || !next.IsEmpty() {
1439			break
1440		}
1441	}
1442	return nil
1443}
1444
1445// Next advances to the next page of values.  If there was an error making
1446// the request the page does not advance and the error is returned.
1447// Deprecated: Use NextWithContext() instead.
1448func (page *OperationListResultPage) Next() error {
1449	return page.NextWithContext(context.Background())
1450}
1451
1452// NotDone returns true if the page enumeration should be started or is not yet complete.
1453func (page OperationListResultPage) NotDone() bool {
1454	return !page.olr.IsEmpty()
1455}
1456
1457// Response returns the raw server response from the last page request.
1458func (page OperationListResultPage) Response() OperationListResult {
1459	return page.olr
1460}
1461
1462// Values returns the slice of values for the current page or nil if there are no values.
1463func (page OperationListResultPage) Values() []Operation {
1464	if page.olr.IsEmpty() {
1465		return nil
1466	}
1467	return *page.olr.Value
1468}
1469
1470// Creates a new instance of the OperationListResultPage type.
1471func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1472	return OperationListResultPage{
1473		fn:  getNextPage,
1474		olr: cur,
1475	}
1476}
1477
1478// Port the port exposed on the container group.
1479type Port struct {
1480	// Protocol - The protocol associated with the port. Possible values include: 'TCP', 'UDP'
1481	Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"`
1482	// Port - The port number.
1483	Port *int32 `json:"port,omitempty"`
1484}
1485
1486// Resource the Resource model definition.
1487type Resource struct {
1488	// ID - READ-ONLY; The resource id.
1489	ID *string `json:"id,omitempty"`
1490	// Name - READ-ONLY; The resource name.
1491	Name *string `json:"name,omitempty"`
1492	// Type - READ-ONLY; The resource type.
1493	Type *string `json:"type,omitempty"`
1494	// Location - The resource location.
1495	Location *string `json:"location,omitempty"`
1496	// Tags - The resource tags.
1497	Tags map[string]*string `json:"tags"`
1498}
1499
1500// MarshalJSON is the custom marshaler for Resource.
1501func (r Resource) MarshalJSON() ([]byte, error) {
1502	objectMap := make(map[string]interface{})
1503	if r.Location != nil {
1504		objectMap["location"] = r.Location
1505	}
1506	if r.Tags != nil {
1507		objectMap["tags"] = r.Tags
1508	}
1509	return json.Marshal(objectMap)
1510}
1511
1512// ResourceLimits the resource limits.
1513type ResourceLimits struct {
1514	// MemoryInGB - The memory limit in GB of this container instance.
1515	MemoryInGB *float64 `json:"memoryInGB,omitempty"`
1516	// CPU - The CPU limit of this container instance.
1517	CPU *float64 `json:"cpu,omitempty"`
1518	// Gpu - The GPU limit of this container instance.
1519	Gpu *GpuResource `json:"gpu,omitempty"`
1520}
1521
1522// ResourceRequests the resource requests.
1523type ResourceRequests struct {
1524	// MemoryInGB - The memory request in GB of this container instance.
1525	MemoryInGB *float64 `json:"memoryInGB,omitempty"`
1526	// CPU - The CPU request of this container instance.
1527	CPU *float64 `json:"cpu,omitempty"`
1528	// Gpu - The GPU request of this container instance.
1529	Gpu *GpuResource `json:"gpu,omitempty"`
1530}
1531
1532// ResourceRequirements the resource requirements.
1533type ResourceRequirements struct {
1534	// Requests - The resource requests of this container instance.
1535	Requests *ResourceRequests `json:"requests,omitempty"`
1536	// Limits - The resource limits of this container instance.
1537	Limits *ResourceLimits `json:"limits,omitempty"`
1538}
1539
1540// Usage a single usage result
1541type Usage struct {
1542	// Unit - READ-ONLY; Unit of the usage result
1543	Unit *string `json:"unit,omitempty"`
1544	// CurrentValue - READ-ONLY; The current usage of the resource
1545	CurrentValue *int32 `json:"currentValue,omitempty"`
1546	// Limit - READ-ONLY; The maximum permitted usage of the resource.
1547	Limit *int32 `json:"limit,omitempty"`
1548	// Name - READ-ONLY; The name object of the resource
1549	Name *UsageName `json:"name,omitempty"`
1550}
1551
1552// UsageListResult the response containing the usage data
1553type UsageListResult struct {
1554	autorest.Response `json:"-"`
1555	// Value - READ-ONLY; The usage data.
1556	Value *[]Usage `json:"value,omitempty"`
1557}
1558
1559// UsageName the name object of the resource
1560type UsageName struct {
1561	// Value - READ-ONLY; The name of the resource
1562	Value *string `json:"value,omitempty"`
1563	// LocalizedValue - READ-ONLY; The localized name of the resource
1564	LocalizedValue *string `json:"localizedValue,omitempty"`
1565}
1566
1567// Volume the properties of the volume.
1568type Volume struct {
1569	// Name - The name of the volume.
1570	Name *string `json:"name,omitempty"`
1571	// AzureFile - The Azure File volume.
1572	AzureFile *AzureFileVolume `json:"azureFile,omitempty"`
1573	// EmptyDir - The empty directory volume.
1574	EmptyDir interface{} `json:"emptyDir,omitempty"`
1575	// Secret - The secret volume.
1576	Secret map[string]*string `json:"secret"`
1577	// GitRepo - The git repo volume.
1578	GitRepo *GitRepoVolume `json:"gitRepo,omitempty"`
1579}
1580
1581// MarshalJSON is the custom marshaler for Volume.
1582func (vVar Volume) MarshalJSON() ([]byte, error) {
1583	objectMap := make(map[string]interface{})
1584	if vVar.Name != nil {
1585		objectMap["name"] = vVar.Name
1586	}
1587	if vVar.AzureFile != nil {
1588		objectMap["azureFile"] = vVar.AzureFile
1589	}
1590	if vVar.EmptyDir != nil {
1591		objectMap["emptyDir"] = vVar.EmptyDir
1592	}
1593	if vVar.Secret != nil {
1594		objectMap["secret"] = vVar.Secret
1595	}
1596	if vVar.GitRepo != nil {
1597		objectMap["gitRepo"] = vVar.GitRepo
1598	}
1599	return json.Marshal(objectMap)
1600}
1601
1602// VolumeMount the properties of the volume mount.
1603type VolumeMount struct {
1604	// Name - The name of the volume mount.
1605	Name *string `json:"name,omitempty"`
1606	// MountPath - The path within the container where the volume should be mounted. Must not contain colon (:).
1607	MountPath *string `json:"mountPath,omitempty"`
1608	// ReadOnly - The flag indicating whether the volume mount is read-only.
1609	ReadOnly *bool `json:"readOnly,omitempty"`
1610}
1611