1package batch
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/date"
15	"github.com/Azure/go-autorest/autorest/to"
16	"github.com/Azure/go-autorest/tracing"
17	"net/http"
18)
19
20// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-05-01/batch"
22
23// Account contains information about an Azure Batch account.
24type Account struct {
25	autorest.Response `json:"-"`
26	// AccountProperties - The properties associated with the account.
27	*AccountProperties `json:"properties,omitempty"`
28	// ID - READ-ONLY; The ID of the resource.
29	ID *string `json:"id,omitempty"`
30	// Name - READ-ONLY; The name of the resource.
31	Name *string `json:"name,omitempty"`
32	// Type - READ-ONLY; The type of the resource.
33	Type *string `json:"type,omitempty"`
34	// Location - READ-ONLY; The location of the resource.
35	Location *string `json:"location,omitempty"`
36	// Tags - READ-ONLY; The tags of the resource.
37	Tags map[string]*string `json:"tags"`
38}
39
40// MarshalJSON is the custom marshaler for Account.
41func (a Account) MarshalJSON() ([]byte, error) {
42	objectMap := make(map[string]interface{})
43	if a.AccountProperties != nil {
44		objectMap["properties"] = a.AccountProperties
45	}
46	return json.Marshal(objectMap)
47}
48
49// UnmarshalJSON is the custom unmarshaler for Account struct.
50func (a *Account) UnmarshalJSON(body []byte) error {
51	var m map[string]*json.RawMessage
52	err := json.Unmarshal(body, &m)
53	if err != nil {
54		return err
55	}
56	for k, v := range m {
57		switch k {
58		case "properties":
59			if v != nil {
60				var accountProperties AccountProperties
61				err = json.Unmarshal(*v, &accountProperties)
62				if err != nil {
63					return err
64				}
65				a.AccountProperties = &accountProperties
66			}
67		case "id":
68			if v != nil {
69				var ID string
70				err = json.Unmarshal(*v, &ID)
71				if err != nil {
72					return err
73				}
74				a.ID = &ID
75			}
76		case "name":
77			if v != nil {
78				var name string
79				err = json.Unmarshal(*v, &name)
80				if err != nil {
81					return err
82				}
83				a.Name = &name
84			}
85		case "type":
86			if v != nil {
87				var typeVar string
88				err = json.Unmarshal(*v, &typeVar)
89				if err != nil {
90					return err
91				}
92				a.Type = &typeVar
93			}
94		case "location":
95			if v != nil {
96				var location string
97				err = json.Unmarshal(*v, &location)
98				if err != nil {
99					return err
100				}
101				a.Location = &location
102			}
103		case "tags":
104			if v != nil {
105				var tags map[string]*string
106				err = json.Unmarshal(*v, &tags)
107				if err != nil {
108					return err
109				}
110				a.Tags = tags
111			}
112		}
113	}
114
115	return nil
116}
117
118// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running
119// operation.
120type AccountCreateFuture struct {
121	azure.FutureAPI
122	// Result returns the result of the asynchronous operation.
123	// If the operation has not completed it will return an error.
124	Result func(AccountClient) (Account, error)
125}
126
127// UnmarshalJSON is the custom unmarshaller for CreateFuture.
128func (future *AccountCreateFuture) UnmarshalJSON(body []byte) error {
129	var azFuture azure.Future
130	if err := json.Unmarshal(body, &azFuture); err != nil {
131		return err
132	}
133	future.FutureAPI = &azFuture
134	future.Result = future.result
135	return nil
136}
137
138// result is the default implementation for AccountCreateFuture.Result.
139func (future *AccountCreateFuture) result(client AccountClient) (a Account, err error) {
140	var done bool
141	done, err = future.DoneWithContext(context.Background(), client)
142	if err != nil {
143		err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure")
144		return
145	}
146	if !done {
147		a.Response.Response = future.Response()
148		err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture")
149		return
150	}
151	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
152	if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
153		a, err = client.CreateResponder(a.Response.Response)
154		if err != nil {
155			err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request")
156		}
157	}
158	return
159}
160
161// AccountCreateParameters parameters supplied to the Create operation.
162type AccountCreateParameters struct {
163	// Location - The region in which to create the account.
164	Location *string `json:"location,omitempty"`
165	// Tags - The user-specified tags associated with the account.
166	Tags map[string]*string `json:"tags"`
167	// AccountCreateProperties - The properties of the Batch account.
168	*AccountCreateProperties `json:"properties,omitempty"`
169}
170
171// MarshalJSON is the custom marshaler for AccountCreateParameters.
172func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) {
173	objectMap := make(map[string]interface{})
174	if acp.Location != nil {
175		objectMap["location"] = acp.Location
176	}
177	if acp.Tags != nil {
178		objectMap["tags"] = acp.Tags
179	}
180	if acp.AccountCreateProperties != nil {
181		objectMap["properties"] = acp.AccountCreateProperties
182	}
183	return json.Marshal(objectMap)
184}
185
186// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct.
187func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error {
188	var m map[string]*json.RawMessage
189	err := json.Unmarshal(body, &m)
190	if err != nil {
191		return err
192	}
193	for k, v := range m {
194		switch k {
195		case "location":
196			if v != nil {
197				var location string
198				err = json.Unmarshal(*v, &location)
199				if err != nil {
200					return err
201				}
202				acp.Location = &location
203			}
204		case "tags":
205			if v != nil {
206				var tags map[string]*string
207				err = json.Unmarshal(*v, &tags)
208				if err != nil {
209					return err
210				}
211				acp.Tags = tags
212			}
213		case "properties":
214			if v != nil {
215				var accountCreateProperties AccountCreateProperties
216				err = json.Unmarshal(*v, &accountCreateProperties)
217				if err != nil {
218					return err
219				}
220				acp.AccountCreateProperties = &accountCreateProperties
221			}
222		}
223	}
224
225	return nil
226}
227
228// AccountCreateProperties the properties of a Batch account.
229type AccountCreateProperties struct {
230	// AutoStorage - The properties related to the auto-storage account.
231	AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"`
232	// 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'
233	PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"`
234	// KeyVaultReference - A reference to the Azure key vault associated with the Batch account.
235	KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"`
236}
237
238// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
239// operation.
240type AccountDeleteFuture struct {
241	azure.FutureAPI
242	// Result returns the result of the asynchronous operation.
243	// If the operation has not completed it will return an error.
244	Result func(AccountClient) (autorest.Response, error)
245}
246
247// UnmarshalJSON is the custom unmarshaller for CreateFuture.
248func (future *AccountDeleteFuture) UnmarshalJSON(body []byte) error {
249	var azFuture azure.Future
250	if err := json.Unmarshal(body, &azFuture); err != nil {
251		return err
252	}
253	future.FutureAPI = &azFuture
254	future.Result = future.result
255	return nil
256}
257
258// result is the default implementation for AccountDeleteFuture.Result.
259func (future *AccountDeleteFuture) result(client AccountClient) (ar autorest.Response, err error) {
260	var done bool
261	done, err = future.DoneWithContext(context.Background(), client)
262	if err != nil {
263		err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure")
264		return
265	}
266	if !done {
267		ar.Response = future.Response()
268		err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture")
269		return
270	}
271	ar.Response = future.Response()
272	return
273}
274
275// AccountKeys a set of Azure Batch account keys.
276type AccountKeys struct {
277	autorest.Response `json:"-"`
278	// AccountName - READ-ONLY; The Batch account name.
279	AccountName *string `json:"accountName,omitempty"`
280	// Primary - READ-ONLY; The primary key associated with the account.
281	Primary *string `json:"primary,omitempty"`
282	// Secondary - READ-ONLY; The secondary key associated with the account.
283	Secondary *string `json:"secondary,omitempty"`
284}
285
286// MarshalJSON is the custom marshaler for AccountKeys.
287func (ak AccountKeys) MarshalJSON() ([]byte, error) {
288	objectMap := make(map[string]interface{})
289	return json.Marshal(objectMap)
290}
291
292// AccountListResult values returned by the List operation.
293type AccountListResult struct {
294	autorest.Response `json:"-"`
295	// Value - The collection of Batch accounts returned by the listing operation.
296	Value *[]Account `json:"value,omitempty"`
297	// NextLink - The continuation token.
298	NextLink *string `json:"nextLink,omitempty"`
299}
300
301// AccountListResultIterator provides access to a complete listing of Account values.
302type AccountListResultIterator struct {
303	i    int
304	page AccountListResultPage
305}
306
307// NextWithContext advances to the next value.  If there was an error making
308// the request the iterator does not advance and the error is returned.
309func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
310	if tracing.IsEnabled() {
311		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext")
312		defer func() {
313			sc := -1
314			if iter.Response().Response.Response != nil {
315				sc = iter.Response().Response.Response.StatusCode
316			}
317			tracing.EndSpan(ctx, sc, err)
318		}()
319	}
320	iter.i++
321	if iter.i < len(iter.page.Values()) {
322		return nil
323	}
324	err = iter.page.NextWithContext(ctx)
325	if err != nil {
326		iter.i--
327		return err
328	}
329	iter.i = 0
330	return nil
331}
332
333// Next advances to the next value.  If there was an error making
334// the request the iterator does not advance and the error is returned.
335// Deprecated: Use NextWithContext() instead.
336func (iter *AccountListResultIterator) Next() error {
337	return iter.NextWithContext(context.Background())
338}
339
340// NotDone returns true if the enumeration should be started or is not yet complete.
341func (iter AccountListResultIterator) NotDone() bool {
342	return iter.page.NotDone() && iter.i < len(iter.page.Values())
343}
344
345// Response returns the raw server response from the last page request.
346func (iter AccountListResultIterator) Response() AccountListResult {
347	return iter.page.Response()
348}
349
350// Value returns the current value or a zero-initialized value if the
351// iterator has advanced beyond the end of the collection.
352func (iter AccountListResultIterator) Value() Account {
353	if !iter.page.NotDone() {
354		return Account{}
355	}
356	return iter.page.Values()[iter.i]
357}
358
359// Creates a new instance of the AccountListResultIterator type.
360func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator {
361	return AccountListResultIterator{page: page}
362}
363
364// IsEmpty returns true if the ListResult contains no values.
365func (alr AccountListResult) IsEmpty() bool {
366	return alr.Value == nil || len(*alr.Value) == 0
367}
368
369// hasNextLink returns true if the NextLink is not empty.
370func (alr AccountListResult) hasNextLink() bool {
371	return alr.NextLink != nil && len(*alr.NextLink) != 0
372}
373
374// accountListResultPreparer prepares a request to retrieve the next set of results.
375// It returns nil if no more results exist.
376func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) {
377	if !alr.hasNextLink() {
378		return nil, nil
379	}
380	return autorest.Prepare((&http.Request{}).WithContext(ctx),
381		autorest.AsJSON(),
382		autorest.AsGet(),
383		autorest.WithBaseURL(to.String(alr.NextLink)))
384}
385
386// AccountListResultPage contains a page of Account values.
387type AccountListResultPage struct {
388	fn  func(context.Context, AccountListResult) (AccountListResult, error)
389	alr AccountListResult
390}
391
392// NextWithContext advances to the next page of values.  If there was an error making
393// the request the page does not advance and the error is returned.
394func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) {
395	if tracing.IsEnabled() {
396		ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext")
397		defer func() {
398			sc := -1
399			if page.Response().Response.Response != nil {
400				sc = page.Response().Response.Response.StatusCode
401			}
402			tracing.EndSpan(ctx, sc, err)
403		}()
404	}
405	for {
406		next, err := page.fn(ctx, page.alr)
407		if err != nil {
408			return err
409		}
410		page.alr = next
411		if !next.hasNextLink() || !next.IsEmpty() {
412			break
413		}
414	}
415	return nil
416}
417
418// Next advances to the next page of values.  If there was an error making
419// the request the page does not advance and the error is returned.
420// Deprecated: Use NextWithContext() instead.
421func (page *AccountListResultPage) Next() error {
422	return page.NextWithContext(context.Background())
423}
424
425// NotDone returns true if the page enumeration should be started or is not yet complete.
426func (page AccountListResultPage) NotDone() bool {
427	return !page.alr.IsEmpty()
428}
429
430// Response returns the raw server response from the last page request.
431func (page AccountListResultPage) Response() AccountListResult {
432	return page.alr
433}
434
435// Values returns the slice of values for the current page or nil if there are no values.
436func (page AccountListResultPage) Values() []Account {
437	if page.alr.IsEmpty() {
438		return nil
439	}
440	return *page.alr.Value
441}
442
443// Creates a new instance of the AccountListResultPage type.
444func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage {
445	return AccountListResultPage{
446		fn:  getNextPage,
447		alr: cur,
448	}
449}
450
451// AccountProperties account specific properties.
452type AccountProperties struct {
453	// AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service.
454	AccountEndpoint *string `json:"accountEndpoint,omitempty"`
455	// ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled'
456	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
457	// PoolAllocationMode - READ-ONLY; Possible values include: 'BatchService', 'UserSubscription'
458	PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"`
459	// KeyVaultReference - READ-ONLY
460	KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"`
461	// AutoStorage - READ-ONLY
462	AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"`
463	// DedicatedCoreQuota - READ-ONLY
464	DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"`
465	// LowPriorityCoreQuota - READ-ONLY
466	LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"`
467	// PoolQuota - READ-ONLY
468	PoolQuota *int32 `json:"poolQuota,omitempty"`
469	// ActiveJobAndJobScheduleQuota - READ-ONLY
470	ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"`
471}
472
473// MarshalJSON is the custom marshaler for AccountProperties.
474func (ap AccountProperties) MarshalJSON() ([]byte, error) {
475	objectMap := make(map[string]interface{})
476	return json.Marshal(objectMap)
477}
478
479// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation.
480type AccountRegenerateKeyParameters struct {
481	// KeyName - The type of account key to regenerate. Possible values include: 'Primary', 'Secondary'
482	KeyName AccountKeyType `json:"keyName,omitempty"`
483}
484
485// AccountUpdateParameters parameters for updating an Azure Batch account.
486type AccountUpdateParameters struct {
487	// Tags - The user-specified tags associated with the account.
488	Tags map[string]*string `json:"tags"`
489	// AccountUpdateProperties - The properties of the account.
490	*AccountUpdateProperties `json:"properties,omitempty"`
491}
492
493// MarshalJSON is the custom marshaler for AccountUpdateParameters.
494func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
495	objectMap := make(map[string]interface{})
496	if aup.Tags != nil {
497		objectMap["tags"] = aup.Tags
498	}
499	if aup.AccountUpdateProperties != nil {
500		objectMap["properties"] = aup.AccountUpdateProperties
501	}
502	return json.Marshal(objectMap)
503}
504
505// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
506func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error {
507	var m map[string]*json.RawMessage
508	err := json.Unmarshal(body, &m)
509	if err != nil {
510		return err
511	}
512	for k, v := range m {
513		switch k {
514		case "tags":
515			if v != nil {
516				var tags map[string]*string
517				err = json.Unmarshal(*v, &tags)
518				if err != nil {
519					return err
520				}
521				aup.Tags = tags
522			}
523		case "properties":
524			if v != nil {
525				var accountUpdateProperties AccountUpdateProperties
526				err = json.Unmarshal(*v, &accountUpdateProperties)
527				if err != nil {
528					return err
529				}
530				aup.AccountUpdateProperties = &accountUpdateProperties
531			}
532		}
533	}
534
535	return nil
536}
537
538// AccountUpdateProperties the properties of a Batch account.
539type AccountUpdateProperties struct {
540	// AutoStorage - The properties related to the auto-storage account.
541	AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"`
542}
543
544// ActivateApplicationPackageParameters parameters for an activating an application package.
545type ActivateApplicationPackageParameters struct {
546	// Format - The format of the application package binary file.
547	Format *string `json:"format,omitempty"`
548}
549
550// Application contains information about an application in a Batch account.
551type Application struct {
552	autorest.Response `json:"-"`
553	// ID - A string that uniquely identifies the application within the account.
554	ID *string `json:"id,omitempty"`
555	// DisplayName - The display name for the application.
556	DisplayName *string `json:"displayName,omitempty"`
557	// Packages - The list of packages under this application.
558	Packages *[]ApplicationPackage `json:"packages,omitempty"`
559	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
560	AllowUpdates *bool `json:"allowUpdates,omitempty"`
561	// DefaultVersion - The package to use if a client requests the application but does not specify a version.
562	DefaultVersion *string `json:"defaultVersion,omitempty"`
563}
564
565// ApplicationCreateParameters parameters for adding an Application.
566type ApplicationCreateParameters struct {
567	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
568	AllowUpdates *bool `json:"allowUpdates,omitempty"`
569	// DisplayName - The display name for the application.
570	DisplayName *string `json:"displayName,omitempty"`
571}
572
573// ApplicationPackage an application package which represents a particular version of an application.
574type ApplicationPackage struct {
575	autorest.Response `json:"-"`
576	// ID - READ-ONLY; The ID of the application.
577	ID *string `json:"id,omitempty"`
578	// Version - READ-ONLY; The version of the application package.
579	Version *string `json:"version,omitempty"`
580	// State - READ-ONLY; The current state of the application package. Possible values include: 'Pending', 'Active', 'Unmapped'
581	State PackageState `json:"state,omitempty"`
582	// Format - READ-ONLY; The format of the application package, if the package is active.
583	Format *string `json:"format,omitempty"`
584	// StorageURL - READ-ONLY; The URL for the application package in Azure Storage.
585	StorageURL *string `json:"storageUrl,omitempty"`
586	// StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire.
587	StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"`
588	// LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active.
589	LastActivationTime *date.Time `json:"lastActivationTime,omitempty"`
590}
591
592// MarshalJSON is the custom marshaler for ApplicationPackage.
593func (ap ApplicationPackage) MarshalJSON() ([]byte, error) {
594	objectMap := make(map[string]interface{})
595	return json.Marshal(objectMap)
596}
597
598// ApplicationUpdateParameters parameters for an update application request.
599type ApplicationUpdateParameters struct {
600	// AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string.
601	AllowUpdates *bool `json:"allowUpdates,omitempty"`
602	// DefaultVersion - The package to use if a client requests the application but does not specify a version.
603	DefaultVersion *string `json:"defaultVersion,omitempty"`
604	// DisplayName - The display name for the application.
605	DisplayName *string `json:"displayName,omitempty"`
606}
607
608// AutoStorageBaseProperties the properties related to the auto-storage account.
609type AutoStorageBaseProperties struct {
610	// StorageAccountID - The resource ID of the storage account to be used for auto-storage account.
611	StorageAccountID *string `json:"storageAccountId,omitempty"`
612}
613
614// AutoStorageProperties contains information about the auto-storage account associated with a Batch
615// account.
616type AutoStorageProperties struct {
617	// LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account.
618	LastKeySync *date.Time `json:"lastKeySync,omitempty"`
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// CheckNameAvailabilityParameters parameters for a check name availability request.
624type CheckNameAvailabilityParameters struct {
625	// Name - The name to check for availability
626	Name *string `json:"name,omitempty"`
627	// Type - The resource type. Must be set to Microsoft.Batch/batchAccounts
628	Type *string `json:"type,omitempty"`
629}
630
631// CheckNameAvailabilityResult the CheckNameAvailability operation response.
632type CheckNameAvailabilityResult struct {
633	autorest.Response `json:"-"`
634	// NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used.
635	NameAvailable *bool `json:"nameAvailable,omitempty"`
636	// Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'Invalid', 'AlreadyExists'
637	Reason NameAvailabilityReason `json:"reason,omitempty"`
638	// Message - READ-ONLY; Gets an error message explaining the Reason value in more detail.
639	Message *string `json:"message,omitempty"`
640}
641
642// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult.
643func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) {
644	objectMap := make(map[string]interface{})
645	return json.Marshal(objectMap)
646}
647
648// CloudError an error response from the Batch service.
649type CloudError struct {
650	Error *CloudErrorBody `json:"error,omitempty"`
651}
652
653// CloudErrorBody an error response from the Batch service.
654type CloudErrorBody struct {
655	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
656	Code *string `json:"code,omitempty"`
657	// Message - A message describing the error, intended to be suitable for display in a user interface.
658	Message *string `json:"message,omitempty"`
659	// Target - The target of the particular error. For example, the name of the property in error.
660	Target *string `json:"target,omitempty"`
661	// Details - A list of additional details about the error.
662	Details *[]CloudErrorBody `json:"details,omitempty"`
663}
664
665// KeyVaultReference identifies the Azure key vault associated with a Batch account.
666type KeyVaultReference struct {
667	// ID - The resource ID of the Azure key vault associated with the Batch account.
668	ID *string `json:"id,omitempty"`
669	// URL - The URL of the Azure key vault associated with the Batch account.
670	URL *string `json:"url,omitempty"`
671}
672
673// ListApplicationsResult the result of performing list applications.
674type ListApplicationsResult struct {
675	autorest.Response `json:"-"`
676	// Value - The list of applications.
677	Value *[]Application `json:"value,omitempty"`
678	// NextLink - The URL to get the next set of results.
679	NextLink *string `json:"nextLink,omitempty"`
680}
681
682// ListApplicationsResultIterator provides access to a complete listing of Application values.
683type ListApplicationsResultIterator struct {
684	i    int
685	page ListApplicationsResultPage
686}
687
688// NextWithContext advances to the next value.  If there was an error making
689// the request the iterator does not advance and the error is returned.
690func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) {
691	if tracing.IsEnabled() {
692		ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext")
693		defer func() {
694			sc := -1
695			if iter.Response().Response.Response != nil {
696				sc = iter.Response().Response.Response.StatusCode
697			}
698			tracing.EndSpan(ctx, sc, err)
699		}()
700	}
701	iter.i++
702	if iter.i < len(iter.page.Values()) {
703		return nil
704	}
705	err = iter.page.NextWithContext(ctx)
706	if err != nil {
707		iter.i--
708		return err
709	}
710	iter.i = 0
711	return nil
712}
713
714// Next advances to the next value.  If there was an error making
715// the request the iterator does not advance and the error is returned.
716// Deprecated: Use NextWithContext() instead.
717func (iter *ListApplicationsResultIterator) Next() error {
718	return iter.NextWithContext(context.Background())
719}
720
721// NotDone returns true if the enumeration should be started or is not yet complete.
722func (iter ListApplicationsResultIterator) NotDone() bool {
723	return iter.page.NotDone() && iter.i < len(iter.page.Values())
724}
725
726// Response returns the raw server response from the last page request.
727func (iter ListApplicationsResultIterator) Response() ListApplicationsResult {
728	return iter.page.Response()
729}
730
731// Value returns the current value or a zero-initialized value if the
732// iterator has advanced beyond the end of the collection.
733func (iter ListApplicationsResultIterator) Value() Application {
734	if !iter.page.NotDone() {
735		return Application{}
736	}
737	return iter.page.Values()[iter.i]
738}
739
740// Creates a new instance of the ListApplicationsResultIterator type.
741func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator {
742	return ListApplicationsResultIterator{page: page}
743}
744
745// IsEmpty returns true if the ListResult contains no values.
746func (lar ListApplicationsResult) IsEmpty() bool {
747	return lar.Value == nil || len(*lar.Value) == 0
748}
749
750// hasNextLink returns true if the NextLink is not empty.
751func (lar ListApplicationsResult) hasNextLink() bool {
752	return lar.NextLink != nil && len(*lar.NextLink) != 0
753}
754
755// listApplicationsResultPreparer prepares a request to retrieve the next set of results.
756// It returns nil if no more results exist.
757func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) {
758	if !lar.hasNextLink() {
759		return nil, nil
760	}
761	return autorest.Prepare((&http.Request{}).WithContext(ctx),
762		autorest.AsJSON(),
763		autorest.AsGet(),
764		autorest.WithBaseURL(to.String(lar.NextLink)))
765}
766
767// ListApplicationsResultPage contains a page of Application values.
768type ListApplicationsResultPage struct {
769	fn  func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)
770	lar ListApplicationsResult
771}
772
773// NextWithContext advances to the next page of values.  If there was an error making
774// the request the page does not advance and the error is returned.
775func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) {
776	if tracing.IsEnabled() {
777		ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext")
778		defer func() {
779			sc := -1
780			if page.Response().Response.Response != nil {
781				sc = page.Response().Response.Response.StatusCode
782			}
783			tracing.EndSpan(ctx, sc, err)
784		}()
785	}
786	for {
787		next, err := page.fn(ctx, page.lar)
788		if err != nil {
789			return err
790		}
791		page.lar = next
792		if !next.hasNextLink() || !next.IsEmpty() {
793			break
794		}
795	}
796	return nil
797}
798
799// Next advances to the next page of values.  If there was an error making
800// the request the page does not advance and the error is returned.
801// Deprecated: Use NextWithContext() instead.
802func (page *ListApplicationsResultPage) Next() error {
803	return page.NextWithContext(context.Background())
804}
805
806// NotDone returns true if the page enumeration should be started or is not yet complete.
807func (page ListApplicationsResultPage) NotDone() bool {
808	return !page.lar.IsEmpty()
809}
810
811// Response returns the raw server response from the last page request.
812func (page ListApplicationsResultPage) Response() ListApplicationsResult {
813	return page.lar
814}
815
816// Values returns the slice of values for the current page or nil if there are no values.
817func (page ListApplicationsResultPage) Values() []Application {
818	if page.lar.IsEmpty() {
819		return nil
820	}
821	return *page.lar.Value
822}
823
824// Creates a new instance of the ListApplicationsResultPage type.
825func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage {
826	return ListApplicationsResultPage{
827		fn:  getNextPage,
828		lar: cur,
829	}
830}
831
832// LocationQuota quotas associated with a Batch region for a particular subscription.
833type LocationQuota struct {
834	autorest.Response `json:"-"`
835	// AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region.
836	AccountQuota *int32 `json:"accountQuota,omitempty"`
837}
838
839// MarshalJSON is the custom marshaler for LocationQuota.
840func (lq LocationQuota) MarshalJSON() ([]byte, error) {
841	objectMap := make(map[string]interface{})
842	return json.Marshal(objectMap)
843}
844
845// Operation ...
846type Operation struct {
847	// Name - This is of the format {provider}/{resource}/{operation}
848	Name       *string           `json:"name,omitempty"`
849	Display    *OperationDisplay `json:"display,omitempty"`
850	Origin     *string           `json:"origin,omitempty"`
851	Properties interface{}       `json:"properties,omitempty"`
852}
853
854// OperationDisplay ...
855type OperationDisplay struct {
856	Provider *string `json:"provider,omitempty"`
857	// Operation - For example: read, write, delete, or listKeys/action
858	Operation   *string `json:"operation,omitempty"`
859	Resource    *string `json:"resource,omitempty"`
860	Description *string `json:"description,omitempty"`
861}
862
863// OperationListResult ...
864type OperationListResult struct {
865	autorest.Response `json:"-"`
866	Value             *[]Operation `json:"value,omitempty"`
867	NextLink          *string      `json:"nextLink,omitempty"`
868}
869
870// OperationListResultIterator provides access to a complete listing of Operation values.
871type OperationListResultIterator struct {
872	i    int
873	page OperationListResultPage
874}
875
876// NextWithContext advances to the next value.  If there was an error making
877// the request the iterator does not advance and the error is returned.
878func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
879	if tracing.IsEnabled() {
880		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
881		defer func() {
882			sc := -1
883			if iter.Response().Response.Response != nil {
884				sc = iter.Response().Response.Response.StatusCode
885			}
886			tracing.EndSpan(ctx, sc, err)
887		}()
888	}
889	iter.i++
890	if iter.i < len(iter.page.Values()) {
891		return nil
892	}
893	err = iter.page.NextWithContext(ctx)
894	if err != nil {
895		iter.i--
896		return err
897	}
898	iter.i = 0
899	return nil
900}
901
902// Next advances to the next value.  If there was an error making
903// the request the iterator does not advance and the error is returned.
904// Deprecated: Use NextWithContext() instead.
905func (iter *OperationListResultIterator) Next() error {
906	return iter.NextWithContext(context.Background())
907}
908
909// NotDone returns true if the enumeration should be started or is not yet complete.
910func (iter OperationListResultIterator) NotDone() bool {
911	return iter.page.NotDone() && iter.i < len(iter.page.Values())
912}
913
914// Response returns the raw server response from the last page request.
915func (iter OperationListResultIterator) Response() OperationListResult {
916	return iter.page.Response()
917}
918
919// Value returns the current value or a zero-initialized value if the
920// iterator has advanced beyond the end of the collection.
921func (iter OperationListResultIterator) Value() Operation {
922	if !iter.page.NotDone() {
923		return Operation{}
924	}
925	return iter.page.Values()[iter.i]
926}
927
928// Creates a new instance of the OperationListResultIterator type.
929func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
930	return OperationListResultIterator{page: page}
931}
932
933// IsEmpty returns true if the ListResult contains no values.
934func (olr OperationListResult) IsEmpty() bool {
935	return olr.Value == nil || len(*olr.Value) == 0
936}
937
938// hasNextLink returns true if the NextLink is not empty.
939func (olr OperationListResult) hasNextLink() bool {
940	return olr.NextLink != nil && len(*olr.NextLink) != 0
941}
942
943// operationListResultPreparer prepares a request to retrieve the next set of results.
944// It returns nil if no more results exist.
945func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
946	if !olr.hasNextLink() {
947		return nil, nil
948	}
949	return autorest.Prepare((&http.Request{}).WithContext(ctx),
950		autorest.AsJSON(),
951		autorest.AsGet(),
952		autorest.WithBaseURL(to.String(olr.NextLink)))
953}
954
955// OperationListResultPage contains a page of Operation values.
956type OperationListResultPage struct {
957	fn  func(context.Context, OperationListResult) (OperationListResult, error)
958	olr OperationListResult
959}
960
961// NextWithContext advances to the next page of values.  If there was an error making
962// the request the page does not advance and the error is returned.
963func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
964	if tracing.IsEnabled() {
965		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
966		defer func() {
967			sc := -1
968			if page.Response().Response.Response != nil {
969				sc = page.Response().Response.Response.StatusCode
970			}
971			tracing.EndSpan(ctx, sc, err)
972		}()
973	}
974	for {
975		next, err := page.fn(ctx, page.olr)
976		if err != nil {
977			return err
978		}
979		page.olr = next
980		if !next.hasNextLink() || !next.IsEmpty() {
981			break
982		}
983	}
984	return nil
985}
986
987// Next advances to the next page of values.  If there was an error making
988// the request the page does not advance and the error is returned.
989// Deprecated: Use NextWithContext() instead.
990func (page *OperationListResultPage) Next() error {
991	return page.NextWithContext(context.Background())
992}
993
994// NotDone returns true if the page enumeration should be started or is not yet complete.
995func (page OperationListResultPage) NotDone() bool {
996	return !page.olr.IsEmpty()
997}
998
999// Response returns the raw server response from the last page request.
1000func (page OperationListResultPage) Response() OperationListResult {
1001	return page.olr
1002}
1003
1004// Values returns the slice of values for the current page or nil if there are no values.
1005func (page OperationListResultPage) Values() []Operation {
1006	if page.olr.IsEmpty() {
1007		return nil
1008	}
1009	return *page.olr.Value
1010}
1011
1012// Creates a new instance of the OperationListResultPage type.
1013func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1014	return OperationListResultPage{
1015		fn:  getNextPage,
1016		olr: cur,
1017	}
1018}
1019
1020// Resource a definition of an Azure resource.
1021type Resource struct {
1022	// ID - READ-ONLY; The ID of the resource.
1023	ID *string `json:"id,omitempty"`
1024	// Name - READ-ONLY; The name of the resource.
1025	Name *string `json:"name,omitempty"`
1026	// Type - READ-ONLY; The type of the resource.
1027	Type *string `json:"type,omitempty"`
1028	// Location - READ-ONLY; The location of the resource.
1029	Location *string `json:"location,omitempty"`
1030	// Tags - READ-ONLY; The tags of the resource.
1031	Tags map[string]*string `json:"tags"`
1032}
1033
1034// MarshalJSON is the custom marshaler for Resource.
1035func (r Resource) MarshalJSON() ([]byte, error) {
1036	objectMap := make(map[string]interface{})
1037	return json.Marshal(objectMap)
1038}
1039