1package batch
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/batch/mgmt/2017-01-01/batch"
33
34// AccountKeyType enumerates the values for account key type.
35type AccountKeyType string
36
37const (
38	// Primary ...
39	Primary AccountKeyType = "Primary"
40	// Secondary ...
41	Secondary AccountKeyType = "Secondary"
42)
43
44// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type.
45func PossibleAccountKeyTypeValues() []AccountKeyType {
46	return []AccountKeyType{Primary, Secondary}
47}
48
49// PackageState enumerates the values for package state.
50type PackageState string
51
52const (
53	// Active ...
54	Active PackageState = "active"
55	// Pending ...
56	Pending PackageState = "pending"
57	// Unmapped ...
58	Unmapped PackageState = "unmapped"
59)
60
61// PossiblePackageStateValues returns an array of possible values for the PackageState const type.
62func PossiblePackageStateValues() []PackageState {
63	return []PackageState{Active, Pending, Unmapped}
64}
65
66// PoolAllocationMode enumerates the values for pool allocation mode.
67type PoolAllocationMode string
68
69const (
70	// BatchService ...
71	BatchService PoolAllocationMode = "BatchService"
72	// UserSubscription ...
73	UserSubscription PoolAllocationMode = "UserSubscription"
74)
75
76// PossiblePoolAllocationModeValues returns an array of possible values for the PoolAllocationMode const type.
77func PossiblePoolAllocationModeValues() []PoolAllocationMode {
78	return []PoolAllocationMode{BatchService, UserSubscription}
79}
80
81// ProvisioningState enumerates the values for provisioning state.
82type ProvisioningState string
83
84const (
85	// Cancelled ...
86	Cancelled ProvisioningState = "Cancelled"
87	// Creating ...
88	Creating ProvisioningState = "Creating"
89	// Deleting ...
90	Deleting ProvisioningState = "Deleting"
91	// Failed ...
92	Failed ProvisioningState = "Failed"
93	// Invalid ...
94	Invalid ProvisioningState = "Invalid"
95	// Succeeded ...
96	Succeeded ProvisioningState = "Succeeded"
97)
98
99// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
100func PossibleProvisioningStateValues() []ProvisioningState {
101	return []ProvisioningState{Cancelled, Creating, Deleting, Failed, Invalid, Succeeded}
102}
103
104// Account contains information about an Azure Batch account.
105type Account struct {
106	autorest.Response `json:"-"`
107	// AccountProperties - The properties associated with the account.
108	*AccountProperties `json:"properties,omitempty"`
109	// ID - READ-ONLY; The ID of the resource
110	ID *string `json:"id,omitempty"`
111	// Name - READ-ONLY; The name of the resource
112	Name *string `json:"name,omitempty"`
113	// Type - READ-ONLY; The type of the resource
114	Type *string `json:"type,omitempty"`
115	// Location - READ-ONLY; The location of the resource
116	Location *string `json:"location,omitempty"`
117	// Tags - READ-ONLY; The tags of the resource
118	Tags map[string]*string `json:"tags"`
119}
120
121// MarshalJSON is the custom marshaler for Account.
122func (a Account) MarshalJSON() ([]byte, error) {
123	objectMap := make(map[string]interface{})
124	if a.AccountProperties != nil {
125		objectMap["properties"] = a.AccountProperties
126	}
127	return json.Marshal(objectMap)
128}
129
130// UnmarshalJSON is the custom unmarshaler for Account struct.
131func (a *Account) UnmarshalJSON(body []byte) error {
132	var m map[string]*json.RawMessage
133	err := json.Unmarshal(body, &m)
134	if err != nil {
135		return err
136	}
137	for k, v := range m {
138		switch k {
139		case "properties":
140			if v != nil {
141				var accountProperties AccountProperties
142				err = json.Unmarshal(*v, &accountProperties)
143				if err != nil {
144					return err
145				}
146				a.AccountProperties = &accountProperties
147			}
148		case "id":
149			if v != nil {
150				var ID string
151				err = json.Unmarshal(*v, &ID)
152				if err != nil {
153					return err
154				}
155				a.ID = &ID
156			}
157		case "name":
158			if v != nil {
159				var name string
160				err = json.Unmarshal(*v, &name)
161				if err != nil {
162					return err
163				}
164				a.Name = &name
165			}
166		case "type":
167			if v != nil {
168				var typeVar string
169				err = json.Unmarshal(*v, &typeVar)
170				if err != nil {
171					return err
172				}
173				a.Type = &typeVar
174			}
175		case "location":
176			if v != nil {
177				var location string
178				err = json.Unmarshal(*v, &location)
179				if err != nil {
180					return err
181				}
182				a.Location = &location
183			}
184		case "tags":
185			if v != nil {
186				var tags map[string]*string
187				err = json.Unmarshal(*v, &tags)
188				if err != nil {
189					return err
190				}
191				a.Tags = tags
192			}
193		}
194	}
195
196	return nil
197}
198
199// AccountBaseProperties the properties of a Batch account.
200type AccountBaseProperties struct {
201	// AutoStorage - The properties related to auto storage account.
202	AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"`
203	// PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription'
204	PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"`
205	// KeyVaultReference - A reference to the Azure key vault associated with the Batch account.
206	KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"`
207}
208
209// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running
210// operation.
211type AccountCreateFuture struct {
212	azure.Future
213}
214
215// Result returns the result of the asynchronous operation.
216// If the operation has not completed it will return an error.
217func (future *AccountCreateFuture) Result(client AccountClient) (a Account, err error) {
218	var done bool
219	done, err = future.DoneWithContext(context.Background(), client)
220	if err != nil {
221		err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure")
222		return
223	}
224	if !done {
225		err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture")
226		return
227	}
228	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
229	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
230		a, err = client.CreateResponder(a.Response.Response)
231		if err != nil {
232			err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request")
233		}
234	}
235	return
236}
237
238// AccountCreateParameters parameters supplied to the Create operation.
239type AccountCreateParameters struct {
240	// Location - The region in which to create the account.
241	Location *string `json:"location,omitempty"`
242	// Tags - The user specified tags associated with the account.
243	Tags map[string]*string `json:"tags"`
244	// AccountBaseProperties - The properties of the Batch account.
245	*AccountBaseProperties `json:"properties,omitempty"`
246}
247
248// MarshalJSON is the custom marshaler for AccountCreateParameters.
249func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) {
250	objectMap := make(map[string]interface{})
251	if acp.Location != nil {
252		objectMap["location"] = acp.Location
253	}
254	if acp.Tags != nil {
255		objectMap["tags"] = acp.Tags
256	}
257	if acp.AccountBaseProperties != nil {
258		objectMap["properties"] = acp.AccountBaseProperties
259	}
260	return json.Marshal(objectMap)
261}
262
263// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct.
264func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error {
265	var m map[string]*json.RawMessage
266	err := json.Unmarshal(body, &m)
267	if err != nil {
268		return err
269	}
270	for k, v := range m {
271		switch k {
272		case "location":
273			if v != nil {
274				var location string
275				err = json.Unmarshal(*v, &location)
276				if err != nil {
277					return err
278				}
279				acp.Location = &location
280			}
281		case "tags":
282			if v != nil {
283				var tags map[string]*string
284				err = json.Unmarshal(*v, &tags)
285				if err != nil {
286					return err
287				}
288				acp.Tags = tags
289			}
290		case "properties":
291			if v != nil {
292				var accountBaseProperties AccountBaseProperties
293				err = json.Unmarshal(*v, &accountBaseProperties)
294				if err != nil {
295					return err
296				}
297				acp.AccountBaseProperties = &accountBaseProperties
298			}
299		}
300	}
301
302	return nil
303}
304
305// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
306// operation.
307type AccountDeleteFuture struct {
308	azure.Future
309}
310
311// Result returns the result of the asynchronous operation.
312// If the operation has not completed it will return an error.
313func (future *AccountDeleteFuture) Result(client AccountClient) (ar autorest.Response, err error) {
314	var done bool
315	done, err = future.DoneWithContext(context.Background(), client)
316	if err != nil {
317		err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure")
318		return
319	}
320	if !done {
321		err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture")
322		return
323	}
324	ar.Response = future.Response()
325	return
326}
327
328// AccountKeys a set of Azure Batch account keys.
329type AccountKeys struct {
330	autorest.Response `json:"-"`
331	// Primary - READ-ONLY; The primary key associated with the account.
332	Primary *string `json:"primary,omitempty"`
333	// Secondary - READ-ONLY; The secondary key associated with the account.
334	Secondary *string `json:"secondary,omitempty"`
335}
336
337// AccountListResult values returned by the List operation.
338type AccountListResult struct {
339	autorest.Response `json:"-"`
340	// Value - The collection of returned Batch accounts.
341	Value *[]Account `json:"value,omitempty"`
342	// NextLink - The continuation token.
343	NextLink *string `json:"nextLink,omitempty"`
344}
345
346// AccountListResultIterator provides access to a complete listing of Account values.
347type AccountListResultIterator struct {
348	i    int
349	page AccountListResultPage
350}
351
352// NextWithContext advances to the next value.  If there was an error making
353// the request the iterator does not advance and the error is returned.
354func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
355	if tracing.IsEnabled() {
356		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext")
357		defer func() {
358			sc := -1
359			if iter.Response().Response.Response != nil {
360				sc = iter.Response().Response.Response.StatusCode
361			}
362			tracing.EndSpan(ctx, sc, err)
363		}()
364	}
365	iter.i++
366	if iter.i < len(iter.page.Values()) {
367		return nil
368	}
369	err = iter.page.NextWithContext(ctx)
370	if err != nil {
371		iter.i--
372		return err
373	}
374	iter.i = 0
375	return nil
376}
377
378// Next advances to the next value.  If there was an error making
379// the request the iterator does not advance and the error is returned.
380// Deprecated: Use NextWithContext() instead.
381func (iter *AccountListResultIterator) Next() error {
382	return iter.NextWithContext(context.Background())
383}
384
385// NotDone returns true if the enumeration should be started or is not yet complete.
386func (iter AccountListResultIterator) NotDone() bool {
387	return iter.page.NotDone() && iter.i < len(iter.page.Values())
388}
389
390// Response returns the raw server response from the last page request.
391func (iter AccountListResultIterator) Response() AccountListResult {
392	return iter.page.Response()
393}
394
395// Value returns the current value or a zero-initialized value if the
396// iterator has advanced beyond the end of the collection.
397func (iter AccountListResultIterator) Value() Account {
398	if !iter.page.NotDone() {
399		return Account{}
400	}
401	return iter.page.Values()[iter.i]
402}
403
404// Creates a new instance of the AccountListResultIterator type.
405func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator {
406	return AccountListResultIterator{page: page}
407}
408
409// IsEmpty returns true if the ListResult contains no values.
410func (alr AccountListResult) IsEmpty() bool {
411	return alr.Value == nil || len(*alr.Value) == 0
412}
413
414// accountListResultPreparer prepares a request to retrieve the next set of results.
415// It returns nil if no more results exist.
416func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) {
417	if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 {
418		return nil, nil
419	}
420	return autorest.Prepare((&http.Request{}).WithContext(ctx),
421		autorest.AsJSON(),
422		autorest.AsGet(),
423		autorest.WithBaseURL(to.String(alr.NextLink)))
424}
425
426// AccountListResultPage contains a page of Account values.
427type AccountListResultPage struct {
428	fn  func(context.Context, AccountListResult) (AccountListResult, error)
429	alr AccountListResult
430}
431
432// NextWithContext advances to the next page of values.  If there was an error making
433// the request the page does not advance and the error is returned.
434func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) {
435	if tracing.IsEnabled() {
436		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext")
437		defer func() {
438			sc := -1
439			if page.Response().Response.Response != nil {
440				sc = page.Response().Response.Response.StatusCode
441			}
442			tracing.EndSpan(ctx, sc, err)
443		}()
444	}
445	next, err := page.fn(ctx, page.alr)
446	if err != nil {
447		return err
448	}
449	page.alr = next
450	return nil
451}
452
453// Next advances to the next page of values.  If there was an error making
454// the request the page does not advance and the error is returned.
455// Deprecated: Use NextWithContext() instead.
456func (page *AccountListResultPage) Next() error {
457	return page.NextWithContext(context.Background())
458}
459
460// NotDone returns true if the page enumeration should be started or is not yet complete.
461func (page AccountListResultPage) NotDone() bool {
462	return !page.alr.IsEmpty()
463}
464
465// Response returns the raw server response from the last page request.
466func (page AccountListResultPage) Response() AccountListResult {
467	return page.alr
468}
469
470// Values returns the slice of values for the current page or nil if there are no values.
471func (page AccountListResultPage) Values() []Account {
472	if page.alr.IsEmpty() {
473		return nil
474	}
475	return *page.alr.Value
476}
477
478// Creates a new instance of the AccountListResultPage type.
479func NewAccountListResultPage(getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage {
480	return AccountListResultPage{fn: getNextPage}
481}
482
483// AccountProperties account specific properties.
484type AccountProperties struct {
485	// AccountEndpoint - READ-ONLY; The endpoint used by this account to interact with the Batch services.
486	AccountEndpoint *string `json:"accountEndpoint,omitempty"`
487	// ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled'
488	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
489	// PoolAllocationMode - READ-ONLY; Possible values include: 'BatchService', 'UserSubscription'
490	PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"`
491	// KeyVaultReference - READ-ONLY
492	KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"`
493	// AutoStorage - READ-ONLY
494	AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"`
495	// CoreQuota - READ-ONLY
496	CoreQuota *int32 `json:"coreQuota,omitempty"`
497	// PoolQuota - READ-ONLY
498	PoolQuota *int32 `json:"poolQuota,omitempty"`
499	// ActiveJobAndJobScheduleQuota - READ-ONLY
500	ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"`
501}
502
503// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation.
504type AccountRegenerateKeyParameters struct {
505	// KeyName - The type of account key to regenerate. Possible values include: 'Primary', 'Secondary'
506	KeyName AccountKeyType `json:"keyName,omitempty"`
507}
508
509// AccountUpdateBaseProperties the properties for a Batch account update.
510type AccountUpdateBaseProperties struct {
511	// AutoStorage - The properties related to auto storage account.
512	AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"`
513}
514
515// AccountUpdateParameters parameters supplied to the Update operation.
516type AccountUpdateParameters struct {
517	// Tags - The user specified tags associated with the account.
518	Tags map[string]*string `json:"tags"`
519	// AccountUpdateBaseProperties - The properties of the account.
520	*AccountUpdateBaseProperties `json:"properties,omitempty"`
521}
522
523// MarshalJSON is the custom marshaler for AccountUpdateParameters.
524func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
525	objectMap := make(map[string]interface{})
526	if aup.Tags != nil {
527		objectMap["tags"] = aup.Tags
528	}
529	if aup.AccountUpdateBaseProperties != nil {
530		objectMap["properties"] = aup.AccountUpdateBaseProperties
531	}
532	return json.Marshal(objectMap)
533}
534
535// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
536func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error {
537	var m map[string]*json.RawMessage
538	err := json.Unmarshal(body, &m)
539	if err != nil {
540		return err
541	}
542	for k, v := range m {
543		switch k {
544		case "tags":
545			if v != nil {
546				var tags map[string]*string
547				err = json.Unmarshal(*v, &tags)
548				if err != nil {
549					return err
550				}
551				aup.Tags = tags
552			}
553		case "properties":
554			if v != nil {
555				var accountUpdateBaseProperties AccountUpdateBaseProperties
556				err = json.Unmarshal(*v, &accountUpdateBaseProperties)
557				if err != nil {
558					return err
559				}
560				aup.AccountUpdateBaseProperties = &accountUpdateBaseProperties
561			}
562		}
563	}
564
565	return nil
566}
567
568// ActivateApplicationPackageParameters parameters for an ApplicationOperations.ActivateApplicationPackage
569// request.
570type ActivateApplicationPackageParameters struct {
571	// Format - The format of the application package binary file.
572	Format *string `json:"format,omitempty"`
573}
574
575// AddApplicationParameters parameters for an ApplicationOperations.AddApplication request.
576type AddApplicationParameters struct {
577	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
578	AllowUpdates *bool `json:"allowUpdates,omitempty"`
579	// DisplayName - The display name for the application.
580	DisplayName *string `json:"displayName,omitempty"`
581}
582
583// Application contains information about an application in a Batch account.
584type Application struct {
585	autorest.Response `json:"-"`
586	// ID - A string that uniquely identifies the application within the account.
587	ID *string `json:"id,omitempty"`
588	// DisplayName - The display name for the application.
589	DisplayName *string `json:"displayName,omitempty"`
590	// Packages - The list of packages under this application.
591	Packages *[]ApplicationPackage `json:"packages,omitempty"`
592	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
593	AllowUpdates *bool `json:"allowUpdates,omitempty"`
594	// DefaultVersion - The package to use if a client requests the application but does not specify a version.
595	DefaultVersion *string `json:"defaultVersion,omitempty"`
596}
597
598// ApplicationPackage an application package which represents a particular version of an application.
599type ApplicationPackage struct {
600	autorest.Response `json:"-"`
601	// ID - READ-ONLY; The ID of the application.
602	ID *string `json:"id,omitempty"`
603	// Version - READ-ONLY; The version of the application package.
604	Version *string `json:"version,omitempty"`
605	// State - READ-ONLY; The current state of the application package. Possible values include: 'Pending', 'Active', 'Unmapped'
606	State PackageState `json:"state,omitempty"`
607	// Format - READ-ONLY; The format of the application package, if the package is active.
608	Format *string `json:"format,omitempty"`
609	// StorageURL - READ-ONLY; The storage URL at which the application package is stored.
610	StorageURL *string `json:"storageUrl,omitempty"`
611	// StorageURLExpiry - READ-ONLY; The UTC time at which the storage URL will expire.
612	StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"`
613	// LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active.
614	LastActivationTime *date.Time `json:"lastActivationTime,omitempty"`
615}
616
617// AutoStorageBaseProperties the properties related to auto storage account.
618type AutoStorageBaseProperties struct {
619	// StorageAccountID - The resource ID of the storage account to be used for auto storage account.
620	StorageAccountID *string `json:"storageAccountId,omitempty"`
621}
622
623// AutoStorageProperties contains information about the auto storage account associated with a Batch
624// account.
625type AutoStorageProperties struct {
626	// StorageAccountID - The resource ID of the storage account to be used for auto storage account.
627	StorageAccountID *string `json:"storageAccountId,omitempty"`
628	// LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account.
629	LastKeySync *date.Time `json:"lastKeySync,omitempty"`
630}
631
632// CloudError an error response from the Batch service.
633type CloudError struct {
634	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
635	Code *string `json:"code,omitempty"`
636	// Message - A message describing the error, intended to be suitable for display in a user interface.
637	Message *string `json:"message,omitempty"`
638	// Target - The target of the particular error. For example, the name of the property in error.
639	Target *string `json:"target,omitempty"`
640	// Details - A list of additional details about the error.
641	Details *[]CloudError `json:"details,omitempty"`
642}
643
644// KeyVaultReference identifies the Azure key vault associated with a Batch account.
645type KeyVaultReference struct {
646	// ID - The resource ID of the Azure key vault associated with the Batch account.
647	ID *string `json:"id,omitempty"`
648	// URL - The Url of the Azure key vault associated with the Batch account.
649	URL *string `json:"url,omitempty"`
650}
651
652// ListApplicationsResult response to an ApplicationOperations.ListApplications request.
653type ListApplicationsResult struct {
654	autorest.Response `json:"-"`
655	// Value - The list of applications.
656	Value *[]Application `json:"value,omitempty"`
657	// NextLink - The URL to get the next set of results.
658	NextLink *string `json:"nextLink,omitempty"`
659}
660
661// ListApplicationsResultIterator provides access to a complete listing of Application values.
662type ListApplicationsResultIterator struct {
663	i    int
664	page ListApplicationsResultPage
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 *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) {
670	if tracing.IsEnabled() {
671		ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.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 *ListApplicationsResultIterator) 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 ListApplicationsResultIterator) 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 ListApplicationsResultIterator) Response() ListApplicationsResult {
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 ListApplicationsResultIterator) Value() Application {
713	if !iter.page.NotDone() {
714		return Application{}
715	}
716	return iter.page.Values()[iter.i]
717}
718
719// Creates a new instance of the ListApplicationsResultIterator type.
720func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator {
721	return ListApplicationsResultIterator{page: page}
722}
723
724// IsEmpty returns true if the ListResult contains no values.
725func (lar ListApplicationsResult) IsEmpty() bool {
726	return lar.Value == nil || len(*lar.Value) == 0
727}
728
729// listApplicationsResultPreparer prepares a request to retrieve the next set of results.
730// It returns nil if no more results exist.
731func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) {
732	if lar.NextLink == nil || len(to.String(lar.NextLink)) < 1 {
733		return nil, nil
734	}
735	return autorest.Prepare((&http.Request{}).WithContext(ctx),
736		autorest.AsJSON(),
737		autorest.AsGet(),
738		autorest.WithBaseURL(to.String(lar.NextLink)))
739}
740
741// ListApplicationsResultPage contains a page of Application values.
742type ListApplicationsResultPage struct {
743	fn  func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)
744	lar ListApplicationsResult
745}
746
747// NextWithContext advances to the next page of values.  If there was an error making
748// the request the page does not advance and the error is returned.
749func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) {
750	if tracing.IsEnabled() {
751		ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext")
752		defer func() {
753			sc := -1
754			if page.Response().Response.Response != nil {
755				sc = page.Response().Response.Response.StatusCode
756			}
757			tracing.EndSpan(ctx, sc, err)
758		}()
759	}
760	next, err := page.fn(ctx, page.lar)
761	if err != nil {
762		return err
763	}
764	page.lar = next
765	return nil
766}
767
768// Next advances to the next page of values.  If there was an error making
769// the request the page does not advance and the error is returned.
770// Deprecated: Use NextWithContext() instead.
771func (page *ListApplicationsResultPage) Next() error {
772	return page.NextWithContext(context.Background())
773}
774
775// NotDone returns true if the page enumeration should be started or is not yet complete.
776func (page ListApplicationsResultPage) NotDone() bool {
777	return !page.lar.IsEmpty()
778}
779
780// Response returns the raw server response from the last page request.
781func (page ListApplicationsResultPage) Response() ListApplicationsResult {
782	return page.lar
783}
784
785// Values returns the slice of values for the current page or nil if there are no values.
786func (page ListApplicationsResultPage) Values() []Application {
787	if page.lar.IsEmpty() {
788		return nil
789	}
790	return *page.lar.Value
791}
792
793// Creates a new instance of the ListApplicationsResultPage type.
794func NewListApplicationsResultPage(getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage {
795	return ListApplicationsResultPage{fn: getNextPage}
796}
797
798// LocationQuota quotas associated with a Batch region for a particular subscription.
799type LocationQuota struct {
800	autorest.Response `json:"-"`
801	// AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region.
802	AccountQuota *int32 `json:"accountQuota,omitempty"`
803}
804
805// Resource a definition of an Azure resource.
806type Resource struct {
807	// ID - READ-ONLY; The ID of the resource
808	ID *string `json:"id,omitempty"`
809	// Name - READ-ONLY; The name of the resource
810	Name *string `json:"name,omitempty"`
811	// Type - READ-ONLY; The type of the resource
812	Type *string `json:"type,omitempty"`
813	// Location - READ-ONLY; The location of the resource
814	Location *string `json:"location,omitempty"`
815	// Tags - READ-ONLY; The tags of the resource
816	Tags map[string]*string `json:"tags"`
817}
818
819// MarshalJSON is the custom marshaler for Resource.
820func (r Resource) MarshalJSON() ([]byte, error) {
821	objectMap := make(map[string]interface{})
822	return json.Marshal(objectMap)
823}
824
825// UpdateApplicationParameters parameters for an ApplicationOperations.UpdateApplication request.
826type UpdateApplicationParameters struct {
827	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
828	AllowUpdates *bool `json:"allowUpdates,omitempty"`
829	// DefaultVersion - The package to use if a client requests the application but does not specify a version.
830	DefaultVersion *string `json:"defaultVersion,omitempty"`
831	// DisplayName - The display name for the application.
832	DisplayName *string `json:"displayName,omitempty"`
833}
834