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/preview/containerinstance/mgmt/2018-02-01-preview/containerinstance"
33
34// ContainerGroupNetworkProtocol enumerates the values for container group network protocol.
35type ContainerGroupNetworkProtocol string
36
37const (
38	// TCP ...
39	TCP ContainerGroupNetworkProtocol = "TCP"
40	// UDP ...
41	UDP ContainerGroupNetworkProtocol = "UDP"
42)
43
44// PossibleContainerGroupNetworkProtocolValues returns an array of possible values for the ContainerGroupNetworkProtocol const type.
45func PossibleContainerGroupNetworkProtocolValues() []ContainerGroupNetworkProtocol {
46	return []ContainerGroupNetworkProtocol{TCP, UDP}
47}
48
49// ContainerGroupRestartPolicy enumerates the values for container group restart policy.
50type ContainerGroupRestartPolicy string
51
52const (
53	// Always ...
54	Always ContainerGroupRestartPolicy = "Always"
55	// Never ...
56	Never ContainerGroupRestartPolicy = "Never"
57	// OnFailure ...
58	OnFailure ContainerGroupRestartPolicy = "OnFailure"
59)
60
61// PossibleContainerGroupRestartPolicyValues returns an array of possible values for the ContainerGroupRestartPolicy const type.
62func PossibleContainerGroupRestartPolicyValues() []ContainerGroupRestartPolicy {
63	return []ContainerGroupRestartPolicy{Always, Never, OnFailure}
64}
65
66// ContainerNetworkProtocol enumerates the values for container network protocol.
67type ContainerNetworkProtocol string
68
69const (
70	// ContainerNetworkProtocolTCP ...
71	ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP"
72	// ContainerNetworkProtocolUDP ...
73	ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP"
74)
75
76// PossibleContainerNetworkProtocolValues returns an array of possible values for the ContainerNetworkProtocol const type.
77func PossibleContainerNetworkProtocolValues() []ContainerNetworkProtocol {
78	return []ContainerNetworkProtocol{ContainerNetworkProtocolTCP, ContainerNetworkProtocolUDP}
79}
80
81// OperatingSystemTypes enumerates the values for operating system types.
82type OperatingSystemTypes string
83
84const (
85	// Linux ...
86	Linux OperatingSystemTypes = "Linux"
87	// Windows ...
88	Windows OperatingSystemTypes = "Windows"
89)
90
91// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type.
92func PossibleOperatingSystemTypesValues() []OperatingSystemTypes {
93	return []OperatingSystemTypes{Linux, Windows}
94}
95
96// OperationsOrigin enumerates the values for operations origin.
97type OperationsOrigin string
98
99const (
100	// System ...
101	System OperationsOrigin = "System"
102	// User ...
103	User OperationsOrigin = "User"
104)
105
106// PossibleOperationsOriginValues returns an array of possible values for the OperationsOrigin const type.
107func PossibleOperationsOriginValues() []OperationsOrigin {
108	return []OperationsOrigin{System, User}
109}
110
111// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes.
112type AzureFileVolume struct {
113	// ShareName - The name of the Azure File share to be mounted as a volume.
114	ShareName *string `json:"shareName,omitempty"`
115	// ReadOnly - The flag indicating whether the Azure File shared mounted as a volume is read-only.
116	ReadOnly *bool `json:"readOnly,omitempty"`
117	// StorageAccountName - The name of the storage account that contains the Azure File share.
118	StorageAccountName *string `json:"storageAccountName,omitempty"`
119	// StorageAccountKey - The storage account access key used to access the Azure File share.
120	StorageAccountKey *string `json:"storageAccountKey,omitempty"`
121}
122
123// Container a container instance.
124type Container struct {
125	// Name - The user-provided name of the container instance.
126	Name *string `json:"name,omitempty"`
127	// ContainerProperties - The properties of the container instance.
128	*ContainerProperties `json:"properties,omitempty"`
129}
130
131// MarshalJSON is the custom marshaler for Container.
132func (c Container) MarshalJSON() ([]byte, error) {
133	objectMap := make(map[string]interface{})
134	if c.Name != nil {
135		objectMap["name"] = c.Name
136	}
137	if c.ContainerProperties != nil {
138		objectMap["properties"] = c.ContainerProperties
139	}
140	return json.Marshal(objectMap)
141}
142
143// UnmarshalJSON is the custom unmarshaler for Container struct.
144func (c *Container) UnmarshalJSON(body []byte) error {
145	var m map[string]*json.RawMessage
146	err := json.Unmarshal(body, &m)
147	if err != nil {
148		return err
149	}
150	for k, v := range m {
151		switch k {
152		case "name":
153			if v != nil {
154				var name string
155				err = json.Unmarshal(*v, &name)
156				if err != nil {
157					return err
158				}
159				c.Name = &name
160			}
161		case "properties":
162			if v != nil {
163				var containerProperties ContainerProperties
164				err = json.Unmarshal(*v, &containerProperties)
165				if err != nil {
166					return err
167				}
168				c.ContainerProperties = &containerProperties
169			}
170		}
171	}
172
173	return nil
174}
175
176// ContainerExecRequest the start container exec request.
177type ContainerExecRequest struct {
178	// Command - The command to be executed.
179	Command *string `json:"command,omitempty"`
180	// TerminalSize - The size of the terminal.
181	TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"`
182}
183
184// ContainerExecRequestTerminalSize the size of the terminal.
185type ContainerExecRequestTerminalSize struct {
186	// Rows - The row size of the terminal
187	Rows *int32 `json:"rows,omitempty"`
188	// Cols - The column size of the terminal
189	Cols *int32 `json:"cols,omitempty"`
190}
191
192// ContainerExecResponse the information for the container exec command.
193type ContainerExecResponse struct {
194	autorest.Response `json:"-"`
195	// WebSocketURI - The uri for the exec websocket.
196	WebSocketURI *string `json:"webSocketUri,omitempty"`
197	// Password - The password to start the exec command.
198	Password *string `json:"password,omitempty"`
199}
200
201// ContainerGroup a container group.
202type ContainerGroup struct {
203	autorest.Response         `json:"-"`
204	*ContainerGroupProperties `json:"properties,omitempty"`
205	// ID - READ-ONLY; The resource id.
206	ID *string `json:"id,omitempty"`
207	// Name - READ-ONLY; The resource name.
208	Name *string `json:"name,omitempty"`
209	// Type - READ-ONLY; The resource type.
210	Type *string `json:"type,omitempty"`
211	// Location - The resource location.
212	Location *string `json:"location,omitempty"`
213	// Tags - The resource tags.
214	Tags map[string]*string `json:"tags"`
215}
216
217// MarshalJSON is the custom marshaler for ContainerGroup.
218func (cg ContainerGroup) MarshalJSON() ([]byte, error) {
219	objectMap := make(map[string]interface{})
220	if cg.ContainerGroupProperties != nil {
221		objectMap["properties"] = cg.ContainerGroupProperties
222	}
223	if cg.Location != nil {
224		objectMap["location"] = cg.Location
225	}
226	if cg.Tags != nil {
227		objectMap["tags"] = cg.Tags
228	}
229	return json.Marshal(objectMap)
230}
231
232// UnmarshalJSON is the custom unmarshaler for ContainerGroup struct.
233func (cg *ContainerGroup) UnmarshalJSON(body []byte) error {
234	var m map[string]*json.RawMessage
235	err := json.Unmarshal(body, &m)
236	if err != nil {
237		return err
238	}
239	for k, v := range m {
240		switch k {
241		case "properties":
242			if v != nil {
243				var containerGroupProperties ContainerGroupProperties
244				err = json.Unmarshal(*v, &containerGroupProperties)
245				if err != nil {
246					return err
247				}
248				cg.ContainerGroupProperties = &containerGroupProperties
249			}
250		case "id":
251			if v != nil {
252				var ID string
253				err = json.Unmarshal(*v, &ID)
254				if err != nil {
255					return err
256				}
257				cg.ID = &ID
258			}
259		case "name":
260			if v != nil {
261				var name string
262				err = json.Unmarshal(*v, &name)
263				if err != nil {
264					return err
265				}
266				cg.Name = &name
267			}
268		case "type":
269			if v != nil {
270				var typeVar string
271				err = json.Unmarshal(*v, &typeVar)
272				if err != nil {
273					return err
274				}
275				cg.Type = &typeVar
276			}
277		case "location":
278			if v != nil {
279				var location string
280				err = json.Unmarshal(*v, &location)
281				if err != nil {
282					return err
283				}
284				cg.Location = &location
285			}
286		case "tags":
287			if v != nil {
288				var tags map[string]*string
289				err = json.Unmarshal(*v, &tags)
290				if err != nil {
291					return err
292				}
293				cg.Tags = tags
294			}
295		}
296	}
297
298	return nil
299}
300
301// ContainerGroupListResult the container group list response that contains the container group properties.
302type ContainerGroupListResult struct {
303	autorest.Response `json:"-"`
304	// Value - The list of container groups.
305	Value *[]ContainerGroup `json:"value,omitempty"`
306	// NextLink - The URI to fetch the next page of container groups.
307	NextLink *string `json:"nextLink,omitempty"`
308}
309
310// ContainerGroupListResultIterator provides access to a complete listing of ContainerGroup values.
311type ContainerGroupListResultIterator struct {
312	i    int
313	page ContainerGroupListResultPage
314}
315
316// NextWithContext advances to the next value.  If there was an error making
317// the request the iterator does not advance and the error is returned.
318func (iter *ContainerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) {
319	if tracing.IsEnabled() {
320		ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultIterator.NextWithContext")
321		defer func() {
322			sc := -1
323			if iter.Response().Response.Response != nil {
324				sc = iter.Response().Response.Response.StatusCode
325			}
326			tracing.EndSpan(ctx, sc, err)
327		}()
328	}
329	iter.i++
330	if iter.i < len(iter.page.Values()) {
331		return nil
332	}
333	err = iter.page.NextWithContext(ctx)
334	if err != nil {
335		iter.i--
336		return err
337	}
338	iter.i = 0
339	return nil
340}
341
342// Next advances to the next value.  If there was an error making
343// the request the iterator does not advance and the error is returned.
344// Deprecated: Use NextWithContext() instead.
345func (iter *ContainerGroupListResultIterator) Next() error {
346	return iter.NextWithContext(context.Background())
347}
348
349// NotDone returns true if the enumeration should be started or is not yet complete.
350func (iter ContainerGroupListResultIterator) NotDone() bool {
351	return iter.page.NotDone() && iter.i < len(iter.page.Values())
352}
353
354// Response returns the raw server response from the last page request.
355func (iter ContainerGroupListResultIterator) Response() ContainerGroupListResult {
356	return iter.page.Response()
357}
358
359// Value returns the current value or a zero-initialized value if the
360// iterator has advanced beyond the end of the collection.
361func (iter ContainerGroupListResultIterator) Value() ContainerGroup {
362	if !iter.page.NotDone() {
363		return ContainerGroup{}
364	}
365	return iter.page.Values()[iter.i]
366}
367
368// Creates a new instance of the ContainerGroupListResultIterator type.
369func NewContainerGroupListResultIterator(page ContainerGroupListResultPage) ContainerGroupListResultIterator {
370	return ContainerGroupListResultIterator{page: page}
371}
372
373// IsEmpty returns true if the ListResult contains no values.
374func (cglr ContainerGroupListResult) IsEmpty() bool {
375	return cglr.Value == nil || len(*cglr.Value) == 0
376}
377
378// containerGroupListResultPreparer prepares a request to retrieve the next set of results.
379// It returns nil if no more results exist.
380func (cglr ContainerGroupListResult) containerGroupListResultPreparer(ctx context.Context) (*http.Request, error) {
381	if cglr.NextLink == nil || len(to.String(cglr.NextLink)) < 1 {
382		return nil, nil
383	}
384	return autorest.Prepare((&http.Request{}).WithContext(ctx),
385		autorest.AsJSON(),
386		autorest.AsGet(),
387		autorest.WithBaseURL(to.String(cglr.NextLink)))
388}
389
390// ContainerGroupListResultPage contains a page of ContainerGroup values.
391type ContainerGroupListResultPage struct {
392	fn   func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)
393	cglr ContainerGroupListResult
394}
395
396// NextWithContext advances to the next page of values.  If there was an error making
397// the request the page does not advance and the error is returned.
398func (page *ContainerGroupListResultPage) NextWithContext(ctx context.Context) (err error) {
399	if tracing.IsEnabled() {
400		ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultPage.NextWithContext")
401		defer func() {
402			sc := -1
403			if page.Response().Response.Response != nil {
404				sc = page.Response().Response.Response.StatusCode
405			}
406			tracing.EndSpan(ctx, sc, err)
407		}()
408	}
409	next, err := page.fn(ctx, page.cglr)
410	if err != nil {
411		return err
412	}
413	page.cglr = next
414	return nil
415}
416
417// Next advances to the next page of values.  If there was an error making
418// the request the page does not advance and the error is returned.
419// Deprecated: Use NextWithContext() instead.
420func (page *ContainerGroupListResultPage) Next() error {
421	return page.NextWithContext(context.Background())
422}
423
424// NotDone returns true if the page enumeration should be started or is not yet complete.
425func (page ContainerGroupListResultPage) NotDone() bool {
426	return !page.cglr.IsEmpty()
427}
428
429// Response returns the raw server response from the last page request.
430func (page ContainerGroupListResultPage) Response() ContainerGroupListResult {
431	return page.cglr
432}
433
434// Values returns the slice of values for the current page or nil if there are no values.
435func (page ContainerGroupListResultPage) Values() []ContainerGroup {
436	if page.cglr.IsEmpty() {
437		return nil
438	}
439	return *page.cglr.Value
440}
441
442// Creates a new instance of the ContainerGroupListResultPage type.
443func NewContainerGroupListResultPage(getNextPage func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)) ContainerGroupListResultPage {
444	return ContainerGroupListResultPage{fn: getNextPage}
445}
446
447// ContainerGroupProperties ...
448type ContainerGroupProperties struct {
449	// ProvisioningState - READ-ONLY; The provisioning state of the container group. This only appears in the response.
450	ProvisioningState *string `json:"provisioningState,omitempty"`
451	// Containers - The containers within the container group.
452	Containers *[]Container `json:"containers,omitempty"`
453	// ImageRegistryCredentials - The image registry credentials by which the container group is created from.
454	ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"`
455	// RestartPolicy - Restart policy for all containers within the container group.
456	// - `Always` Always restart
457	// - `OnFailure` Restart on failure
458	// - `Never` Never restart
459	// . Possible values include: 'Always', 'OnFailure', 'Never'
460	RestartPolicy ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"`
461	// IPAddress - The IP address type of the container group.
462	IPAddress *IPAddress `json:"ipAddress,omitempty"`
463	// OsType - The operating system type required by the containers in the container group. Possible values include: 'Windows', 'Linux'
464	OsType OperatingSystemTypes `json:"osType,omitempty"`
465	// Volumes - The list of volumes that can be mounted by containers in this container group.
466	Volumes *[]Volume `json:"volumes,omitempty"`
467	// InstanceView - READ-ONLY; The instance view of the container group. Only valid in response.
468	InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"`
469}
470
471// ContainerGroupPropertiesInstanceView the instance view of the container group. Only valid in response.
472type ContainerGroupPropertiesInstanceView struct {
473	// Events - READ-ONLY; The events of this container group.
474	Events *[]Event `json:"events,omitempty"`
475	// State - READ-ONLY; The state of the container group. Only valid in response.
476	State *string `json:"state,omitempty"`
477}
478
479// ContainerGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
480// long-running operation.
481type ContainerGroupsCreateOrUpdateFuture struct {
482	azure.Future
483}
484
485// Result returns the result of the asynchronous operation.
486// If the operation has not completed it will return an error.
487func (future *ContainerGroupsCreateOrUpdateFuture) Result(client ContainerGroupsClient) (cg ContainerGroup, err error) {
488	var done bool
489	done, err = future.DoneWithContext(context.Background(), client)
490	if err != nil {
491		err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
492		return
493	}
494	if !done {
495		err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsCreateOrUpdateFuture")
496		return
497	}
498	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
499	if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent {
500		cg, err = client.CreateOrUpdateResponder(cg.Response.Response)
501		if err != nil {
502			err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", cg.Response.Response, "Failure responding to request")
503		}
504	}
505	return
506}
507
508// ContainerPort the port exposed on the container instance.
509type ContainerPort struct {
510	// Protocol - The protocol associated with the port. Possible values include: 'ContainerNetworkProtocolTCP', 'ContainerNetworkProtocolUDP'
511	Protocol ContainerNetworkProtocol `json:"protocol,omitempty"`
512	// Port - The port number exposed within the container group.
513	Port *int32 `json:"port,omitempty"`
514}
515
516// ContainerProperties the container instance properties.
517type ContainerProperties struct {
518	// Image - The name of the image used to create the container instance.
519	Image *string `json:"image,omitempty"`
520	// Command - The commands to execute within the container instance in exec form.
521	Command *[]string `json:"command,omitempty"`
522	// Ports - The exposed ports on the container instance.
523	Ports *[]ContainerPort `json:"ports,omitempty"`
524	// EnvironmentVariables - The environment variables to set in the container instance.
525	EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"`
526	// InstanceView - READ-ONLY; The instance view of the container instance. Only valid in response.
527	InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"`
528	// Resources - The resource requirements of the container instance.
529	Resources *ResourceRequirements `json:"resources,omitempty"`
530	// VolumeMounts - The volume mounts available to the container instance.
531	VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"`
532}
533
534// ContainerPropertiesInstanceView the instance view of the container instance. Only valid in response.
535type ContainerPropertiesInstanceView struct {
536	// RestartCount - READ-ONLY; The number of times that the container instance has been restarted.
537	RestartCount *int32 `json:"restartCount,omitempty"`
538	// CurrentState - READ-ONLY; Current container instance state.
539	CurrentState *ContainerState `json:"currentState,omitempty"`
540	// PreviousState - READ-ONLY; Previous container instance state.
541	PreviousState *ContainerState `json:"previousState,omitempty"`
542	// Events - READ-ONLY; The events of the container instance.
543	Events *[]Event `json:"events,omitempty"`
544}
545
546// ContainerState the container instance state.
547type ContainerState struct {
548	// State - The state of the container instance.
549	State *string `json:"state,omitempty"`
550	// StartTime - The date-time when the container instance state started.
551	StartTime *date.Time `json:"startTime,omitempty"`
552	// ExitCode - The container instance exit codes correspond to those from the `docker run` command.
553	ExitCode *int32 `json:"exitCode,omitempty"`
554	// FinishTime - The date-time when the container instance state finished.
555	FinishTime *date.Time `json:"finishTime,omitempty"`
556	// DetailStatus - The human-readable status of the container instance state.
557	DetailStatus *string `json:"detailStatus,omitempty"`
558}
559
560// EnvironmentVariable the environment variable to set within the container instance.
561type EnvironmentVariable struct {
562	// Name - The name of the environment variable.
563	Name *string `json:"name,omitempty"`
564	// Value - The value of the environment variable.
565	Value *string `json:"value,omitempty"`
566}
567
568// Event a container group or container instance event.
569type Event struct {
570	// Count - The count of the event.
571	Count *int32 `json:"count,omitempty"`
572	// FirstTimestamp - The date-time of the earliest logged event.
573	FirstTimestamp *date.Time `json:"firstTimestamp,omitempty"`
574	// LastTimestamp - The date-time of the latest logged event.
575	LastTimestamp *date.Time `json:"lastTimestamp,omitempty"`
576	// Name - The event name.
577	Name *string `json:"name,omitempty"`
578	// Message - The event message.
579	Message *string `json:"message,omitempty"`
580	// Type - The event type.
581	Type *string `json:"type,omitempty"`
582}
583
584// GitRepoVolume represents a volume that is populated with the contents of a git repository
585type GitRepoVolume struct {
586	// 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.
587	Directory *string `json:"directory,omitempty"`
588	// Repository - Repository URL
589	Repository *string `json:"repository,omitempty"`
590	// Revision - Commit hash for the specified revision.
591	Revision *string `json:"revision,omitempty"`
592}
593
594// ImageRegistryCredential image registry credential.
595type ImageRegistryCredential struct {
596	// Server - The Docker image registry server without a protocol such as "http" and "https".
597	Server *string `json:"server,omitempty"`
598	// Username - The username for the private registry.
599	Username *string `json:"username,omitempty"`
600	// Password - The password for the private registry.
601	Password *string `json:"password,omitempty"`
602}
603
604// IPAddress IP address for the container group.
605type IPAddress struct {
606	// Ports - The list of ports exposed on the container group.
607	Ports *[]Port `json:"ports,omitempty"`
608	// Type - Specifies if the IP is exposed to the public internet.
609	Type *string `json:"type,omitempty"`
610	// IP - The IP exposed to the public internet.
611	IP *string `json:"ip,omitempty"`
612	// DNSNameLabel - The Dns name label for the IP.
613	DNSNameLabel *string `json:"dnsNameLabel,omitempty"`
614	// Fqdn - READ-ONLY; The FQDN for the IP.
615	Fqdn *string `json:"fqdn,omitempty"`
616}
617
618// Logs the logs.
619type Logs struct {
620	autorest.Response `json:"-"`
621	// Content - The content of the log.
622	Content *string `json:"content,omitempty"`
623}
624
625// Operation an operation for Azure Container Instance service.
626type Operation struct {
627	// Name - The name of the operation.
628	Name *string `json:"name,omitempty"`
629	// Display - The display information of the operation.
630	Display *OperationDisplay `json:"display,omitempty"`
631	// Origin - The intended executor of the operation. Possible values include: 'User', 'System'
632	Origin OperationsOrigin `json:"origin,omitempty"`
633}
634
635// OperationDisplay the display information of the operation.
636type OperationDisplay struct {
637	// Provider - The name of the provider of the operation.
638	Provider *string `json:"provider,omitempty"`
639	// Resource - The name of the resource type of the operation.
640	Resource *string `json:"resource,omitempty"`
641	// Operation - The friendly name of the operation.
642	Operation *string `json:"operation,omitempty"`
643	// Description - The description of the operation.
644	Description *string `json:"description,omitempty"`
645}
646
647// OperationListResult the operation list response that contains all operations for Azure Container
648// Instance service.
649type OperationListResult struct {
650	autorest.Response `json:"-"`
651	// Value - The list of operations.
652	Value *[]Operation `json:"value,omitempty"`
653	// NextLink - The URI to fetch the next page of operations.
654	NextLink *string `json:"nextLink,omitempty"`
655}
656
657// Port the port exposed on the container group.
658type Port struct {
659	// Protocol - The protocol associated with the port. Possible values include: 'TCP', 'UDP'
660	Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"`
661	// Port - The port number.
662	Port *int32 `json:"port,omitempty"`
663}
664
665// Resource the Resource model definition.
666type Resource struct {
667	// ID - READ-ONLY; The resource id.
668	ID *string `json:"id,omitempty"`
669	// Name - READ-ONLY; The resource name.
670	Name *string `json:"name,omitempty"`
671	// Type - READ-ONLY; The resource type.
672	Type *string `json:"type,omitempty"`
673	// Location - The resource location.
674	Location *string `json:"location,omitempty"`
675	// Tags - The resource tags.
676	Tags map[string]*string `json:"tags"`
677}
678
679// MarshalJSON is the custom marshaler for Resource.
680func (r Resource) MarshalJSON() ([]byte, error) {
681	objectMap := make(map[string]interface{})
682	if r.Location != nil {
683		objectMap["location"] = r.Location
684	}
685	if r.Tags != nil {
686		objectMap["tags"] = r.Tags
687	}
688	return json.Marshal(objectMap)
689}
690
691// ResourceLimits the resource limits.
692type ResourceLimits struct {
693	// MemoryInGB - The memory limit in GB of this container instance.
694	MemoryInGB *float64 `json:"memoryInGB,omitempty"`
695	// CPU - The CPU limit of this container instance.
696	CPU *float64 `json:"cpu,omitempty"`
697}
698
699// ResourceRequests the resource requests.
700type ResourceRequests struct {
701	// MemoryInGB - The memory request in GB of this container instance.
702	MemoryInGB *float64 `json:"memoryInGB,omitempty"`
703	// CPU - The CPU request of this container instance.
704	CPU *float64 `json:"cpu,omitempty"`
705}
706
707// ResourceRequirements the resource requirements.
708type ResourceRequirements struct {
709	// Requests - The resource requests of this container instance.
710	Requests *ResourceRequests `json:"requests,omitempty"`
711	// Limits - The resource limits of this container instance.
712	Limits *ResourceLimits `json:"limits,omitempty"`
713}
714
715// Usage a single usage result
716type Usage struct {
717	// Unit - READ-ONLY; Unit of the usage result
718	Unit *string `json:"unit,omitempty"`
719	// CurrentValue - READ-ONLY; The current usage of the resource
720	CurrentValue *int32 `json:"currentValue,omitempty"`
721	// Limit - READ-ONLY; The maximum permitted usage of the resource.
722	Limit *int32 `json:"limit,omitempty"`
723	// Name - READ-ONLY; The name object of the resource
724	Name *UsageName `json:"name,omitempty"`
725}
726
727// UsageListResult the response containing the usage data
728type UsageListResult struct {
729	autorest.Response `json:"-"`
730	// Value - READ-ONLY
731	Value *[]Usage `json:"value,omitempty"`
732}
733
734// UsageName the name object of the resource
735type UsageName struct {
736	// Value - READ-ONLY; The name of the resource
737	Value *string `json:"value,omitempty"`
738	// LocalizedValue - READ-ONLY; The localized name of the resource
739	LocalizedValue *string `json:"localizedValue,omitempty"`
740}
741
742// Volume the properties of the volume.
743type Volume struct {
744	// Name - The name of the volume.
745	Name *string `json:"name,omitempty"`
746	// AzureFile - The Azure File volume.
747	AzureFile *AzureFileVolume `json:"azureFile,omitempty"`
748	// EmptyDir - The empty directory volume.
749	EmptyDir interface{} `json:"emptyDir,omitempty"`
750	// Secret - The secret volume.
751	Secret map[string]*string `json:"secret"`
752	// GitRepo - The git repo volume.
753	GitRepo *GitRepoVolume `json:"gitRepo,omitempty"`
754}
755
756// MarshalJSON is the custom marshaler for Volume.
757func (vVar Volume) MarshalJSON() ([]byte, error) {
758	objectMap := make(map[string]interface{})
759	if vVar.Name != nil {
760		objectMap["name"] = vVar.Name
761	}
762	if vVar.AzureFile != nil {
763		objectMap["azureFile"] = vVar.AzureFile
764	}
765	if vVar.EmptyDir != nil {
766		objectMap["emptyDir"] = vVar.EmptyDir
767	}
768	if vVar.Secret != nil {
769		objectMap["secret"] = vVar.Secret
770	}
771	if vVar.GitRepo != nil {
772		objectMap["gitRepo"] = vVar.GitRepo
773	}
774	return json.Marshal(objectMap)
775}
776
777// VolumeMount the properties of the volume mount.
778type VolumeMount struct {
779	// Name - The name of the volume mount.
780	Name *string `json:"name,omitempty"`
781	// MountPath - The path within the container where the volume should be mounted. Must not contain colon (:).
782	MountPath *string `json:"mountPath,omitempty"`
783	// ReadOnly - The flag indicating whether the volume mount is read-only.
784	ReadOnly *bool `json:"readOnly,omitempty"`
785}
786