1package azurestackhci
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/date"
14	"github.com/Azure/go-autorest/autorest/to"
15	"github.com/Azure/go-autorest/tracing"
16	"net/http"
17)
18
19// The package's fully qualified name.
20const fqdn = "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci"
21
22// AvailableOperations available operations of the service
23type AvailableOperations struct {
24	autorest.Response `json:"-"`
25	// Value - Collection of available operation details
26	Value *[]OperationDetail `json:"value,omitempty"`
27	// NextLink - URL client should use to fetch the next page (per server side paging).
28	// It's null for now, added for future use.
29	NextLink *string `json:"nextLink,omitempty"`
30}
31
32// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
33type AzureEntityResource struct {
34	// Etag - READ-ONLY; Resource Etag.
35	Etag *string `json:"etag,omitempty"`
36	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
37	ID *string `json:"id,omitempty"`
38	// Name - READ-ONLY; The name of the resource
39	Name *string `json:"name,omitempty"`
40	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
41	Type *string `json:"type,omitempty"`
42}
43
44// MarshalJSON is the custom marshaler for AzureEntityResource.
45func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
46	objectMap := make(map[string]interface{})
47	return json.Marshal(objectMap)
48}
49
50// Cluster cluster details.
51type Cluster struct {
52	autorest.Response `json:"-"`
53	// ClusterProperties - Cluster properties.
54	*ClusterProperties `json:"properties,omitempty"`
55	// Tags - Resource tags.
56	Tags map[string]*string `json:"tags"`
57	// Location - The geo-location where the resource lives
58	Location *string `json:"location,omitempty"`
59	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
60	ID *string `json:"id,omitempty"`
61	// Name - READ-ONLY; The name of the resource
62	Name *string `json:"name,omitempty"`
63	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
64	Type *string `json:"type,omitempty"`
65}
66
67// MarshalJSON is the custom marshaler for Cluster.
68func (c Cluster) MarshalJSON() ([]byte, error) {
69	objectMap := make(map[string]interface{})
70	if c.ClusterProperties != nil {
71		objectMap["properties"] = c.ClusterProperties
72	}
73	if c.Tags != nil {
74		objectMap["tags"] = c.Tags
75	}
76	if c.Location != nil {
77		objectMap["location"] = c.Location
78	}
79	return json.Marshal(objectMap)
80}
81
82// UnmarshalJSON is the custom unmarshaler for Cluster struct.
83func (c *Cluster) UnmarshalJSON(body []byte) error {
84	var m map[string]*json.RawMessage
85	err := json.Unmarshal(body, &m)
86	if err != nil {
87		return err
88	}
89	for k, v := range m {
90		switch k {
91		case "properties":
92			if v != nil {
93				var clusterProperties ClusterProperties
94				err = json.Unmarshal(*v, &clusterProperties)
95				if err != nil {
96					return err
97				}
98				c.ClusterProperties = &clusterProperties
99			}
100		case "tags":
101			if v != nil {
102				var tags map[string]*string
103				err = json.Unmarshal(*v, &tags)
104				if err != nil {
105					return err
106				}
107				c.Tags = tags
108			}
109		case "location":
110			if v != nil {
111				var location string
112				err = json.Unmarshal(*v, &location)
113				if err != nil {
114					return err
115				}
116				c.Location = &location
117			}
118		case "id":
119			if v != nil {
120				var ID string
121				err = json.Unmarshal(*v, &ID)
122				if err != nil {
123					return err
124				}
125				c.ID = &ID
126			}
127		case "name":
128			if v != nil {
129				var name string
130				err = json.Unmarshal(*v, &name)
131				if err != nil {
132					return err
133				}
134				c.Name = &name
135			}
136		case "type":
137			if v != nil {
138				var typeVar string
139				err = json.Unmarshal(*v, &typeVar)
140				if err != nil {
141					return err
142				}
143				c.Type = &typeVar
144			}
145		}
146	}
147
148	return nil
149}
150
151// ClusterList list of clusters.
152type ClusterList struct {
153	autorest.Response `json:"-"`
154	// Value - List of clusters.
155	Value *[]Cluster `json:"value,omitempty"`
156	// NextLink - READ-ONLY; Link to the next set of results.
157	NextLink *string `json:"nextLink,omitempty"`
158}
159
160// MarshalJSON is the custom marshaler for ClusterList.
161func (cl ClusterList) MarshalJSON() ([]byte, error) {
162	objectMap := make(map[string]interface{})
163	if cl.Value != nil {
164		objectMap["value"] = cl.Value
165	}
166	return json.Marshal(objectMap)
167}
168
169// ClusterListIterator provides access to a complete listing of Cluster values.
170type ClusterListIterator struct {
171	i    int
172	page ClusterListPage
173}
174
175// NextWithContext advances to the next value.  If there was an error making
176// the request the iterator does not advance and the error is returned.
177func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) {
178	if tracing.IsEnabled() {
179		ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext")
180		defer func() {
181			sc := -1
182			if iter.Response().Response.Response != nil {
183				sc = iter.Response().Response.Response.StatusCode
184			}
185			tracing.EndSpan(ctx, sc, err)
186		}()
187	}
188	iter.i++
189	if iter.i < len(iter.page.Values()) {
190		return nil
191	}
192	err = iter.page.NextWithContext(ctx)
193	if err != nil {
194		iter.i--
195		return err
196	}
197	iter.i = 0
198	return nil
199}
200
201// Next advances to the next value.  If there was an error making
202// the request the iterator does not advance and the error is returned.
203// Deprecated: Use NextWithContext() instead.
204func (iter *ClusterListIterator) Next() error {
205	return iter.NextWithContext(context.Background())
206}
207
208// NotDone returns true if the enumeration should be started or is not yet complete.
209func (iter ClusterListIterator) NotDone() bool {
210	return iter.page.NotDone() && iter.i < len(iter.page.Values())
211}
212
213// Response returns the raw server response from the last page request.
214func (iter ClusterListIterator) Response() ClusterList {
215	return iter.page.Response()
216}
217
218// Value returns the current value or a zero-initialized value if the
219// iterator has advanced beyond the end of the collection.
220func (iter ClusterListIterator) Value() Cluster {
221	if !iter.page.NotDone() {
222		return Cluster{}
223	}
224	return iter.page.Values()[iter.i]
225}
226
227// Creates a new instance of the ClusterListIterator type.
228func NewClusterListIterator(page ClusterListPage) ClusterListIterator {
229	return ClusterListIterator{page: page}
230}
231
232// IsEmpty returns true if the ListResult contains no values.
233func (cl ClusterList) IsEmpty() bool {
234	return cl.Value == nil || len(*cl.Value) == 0
235}
236
237// hasNextLink returns true if the NextLink is not empty.
238func (cl ClusterList) hasNextLink() bool {
239	return cl.NextLink != nil && len(*cl.NextLink) != 0
240}
241
242// clusterListPreparer prepares a request to retrieve the next set of results.
243// It returns nil if no more results exist.
244func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) {
245	if !cl.hasNextLink() {
246		return nil, nil
247	}
248	return autorest.Prepare((&http.Request{}).WithContext(ctx),
249		autorest.AsJSON(),
250		autorest.AsGet(),
251		autorest.WithBaseURL(to.String(cl.NextLink)))
252}
253
254// ClusterListPage contains a page of Cluster values.
255type ClusterListPage struct {
256	fn func(context.Context, ClusterList) (ClusterList, error)
257	cl ClusterList
258}
259
260// NextWithContext advances to the next page of values.  If there was an error making
261// the request the page does not advance and the error is returned.
262func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) {
263	if tracing.IsEnabled() {
264		ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext")
265		defer func() {
266			sc := -1
267			if page.Response().Response.Response != nil {
268				sc = page.Response().Response.Response.StatusCode
269			}
270			tracing.EndSpan(ctx, sc, err)
271		}()
272	}
273	for {
274		next, err := page.fn(ctx, page.cl)
275		if err != nil {
276			return err
277		}
278		page.cl = next
279		if !next.hasNextLink() || !next.IsEmpty() {
280			break
281		}
282	}
283	return nil
284}
285
286// Next advances to the next page of values.  If there was an error making
287// the request the page does not advance and the error is returned.
288// Deprecated: Use NextWithContext() instead.
289func (page *ClusterListPage) Next() error {
290	return page.NextWithContext(context.Background())
291}
292
293// NotDone returns true if the page enumeration should be started or is not yet complete.
294func (page ClusterListPage) NotDone() bool {
295	return !page.cl.IsEmpty()
296}
297
298// Response returns the raw server response from the last page request.
299func (page ClusterListPage) Response() ClusterList {
300	return page.cl
301}
302
303// Values returns the slice of values for the current page or nil if there are no values.
304func (page ClusterListPage) Values() []Cluster {
305	if page.cl.IsEmpty() {
306		return nil
307	}
308	return *page.cl.Value
309}
310
311// Creates a new instance of the ClusterListPage type.
312func NewClusterListPage(cur ClusterList, getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage {
313	return ClusterListPage{
314		fn: getNextPage,
315		cl: cur,
316	}
317}
318
319// ClusterNode cluster node details.
320type ClusterNode struct {
321	// Name - READ-ONLY; Name of the cluster node.
322	Name *string `json:"name,omitempty"`
323	// ID - READ-ONLY; Id of the node in the cluster.
324	ID *float64 `json:"id,omitempty"`
325	// Manufacturer - READ-ONLY; Manufacturer of the cluster node hardware.
326	Manufacturer *string `json:"manufacturer,omitempty"`
327	// Model - READ-ONLY; Model name of the cluster node hardware.
328	Model *string `json:"model,omitempty"`
329	// OsName - READ-ONLY; Operating system running on the cluster node.
330	OsName *string `json:"osName,omitempty"`
331	// OsVersion - READ-ONLY; Version of the operating system running on the cluster node.
332	OsVersion *string `json:"osVersion,omitempty"`
333	// SerialNumber - READ-ONLY; Immutable id of the cluster node.
334	SerialNumber *string `json:"serialNumber,omitempty"`
335	// CoreCount - READ-ONLY; Number of physical cores on the cluster node.
336	CoreCount *float64 `json:"coreCount,omitempty"`
337	// MemoryInGiB - READ-ONLY; Total available memory on the cluster node (in GiB).
338	MemoryInGiB *float64 `json:"memoryInGiB,omitempty"`
339}
340
341// MarshalJSON is the custom marshaler for ClusterNode.
342func (cn ClusterNode) MarshalJSON() ([]byte, error) {
343	objectMap := make(map[string]interface{})
344	return json.Marshal(objectMap)
345}
346
347// ClusterProperties cluster properties.
348type ClusterProperties struct {
349	// ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Accepted', 'Provisioning'
350	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
351	// Status - READ-ONLY; Status of the cluster agent. Possible values include: 'NotYetRegistered', 'ConnectedRecently', 'NotConnectedRecently', 'Disconnected', 'Error'
352	Status Status `json:"status,omitempty"`
353	// CloudID - READ-ONLY; Unique, immutable resource id.
354	CloudID *string `json:"cloudId,omitempty"`
355	// AadClientID - App id of cluster AAD identity.
356	AadClientID *string `json:"aadClientId,omitempty"`
357	// AadTenantID - Tenant id of cluster AAD identity.
358	AadTenantID *string `json:"aadTenantId,omitempty"`
359	// ReportedProperties - Properties reported by cluster agent.
360	ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"`
361	// TrialDaysRemaining - READ-ONLY; Number of days remaining in the trial period.
362	TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"`
363	// BillingModel - READ-ONLY; Type of billing applied to the resource.
364	BillingModel *string `json:"billingModel,omitempty"`
365	// RegistrationTimestamp - READ-ONLY; First cluster sync timestamp.
366	RegistrationTimestamp *date.Time `json:"registrationTimestamp,omitempty"`
367	// LastSyncTimestamp - READ-ONLY; Most recent cluster sync timestamp.
368	LastSyncTimestamp *date.Time `json:"lastSyncTimestamp,omitempty"`
369	// LastBillingTimestamp - READ-ONLY; Most recent billing meter timestamp.
370	LastBillingTimestamp *date.Time `json:"lastBillingTimestamp,omitempty"`
371}
372
373// MarshalJSON is the custom marshaler for ClusterProperties.
374func (cp ClusterProperties) MarshalJSON() ([]byte, error) {
375	objectMap := make(map[string]interface{})
376	if cp.AadClientID != nil {
377		objectMap["aadClientId"] = cp.AadClientID
378	}
379	if cp.AadTenantID != nil {
380		objectMap["aadTenantId"] = cp.AadTenantID
381	}
382	if cp.ReportedProperties != nil {
383		objectMap["reportedProperties"] = cp.ReportedProperties
384	}
385	return json.Marshal(objectMap)
386}
387
388// ClusterReportedProperties properties reported by cluster agent.
389type ClusterReportedProperties struct {
390	// ClusterName - READ-ONLY; Name of the on-prem cluster connected to this resource.
391	ClusterName *string `json:"clusterName,omitempty"`
392	// ClusterID - READ-ONLY; Unique id generated by the on-prem cluster.
393	ClusterID *string `json:"clusterId,omitempty"`
394	// ClusterVersion - READ-ONLY; Version of the cluster software.
395	ClusterVersion *string `json:"clusterVersion,omitempty"`
396	// Nodes - READ-ONLY; List of nodes reported by the cluster.
397	Nodes *[]ClusterNode `json:"nodes,omitempty"`
398	// LastUpdated - READ-ONLY; Last time the cluster reported the data.
399	LastUpdated *date.Time `json:"lastUpdated,omitempty"`
400}
401
402// MarshalJSON is the custom marshaler for ClusterReportedProperties.
403func (crp ClusterReportedProperties) MarshalJSON() ([]byte, error) {
404	objectMap := make(map[string]interface{})
405	return json.Marshal(objectMap)
406}
407
408// ClusterUpdate cluster details to update.
409type ClusterUpdate struct {
410	// Tags - Resource tags.
411	Tags map[string]*string `json:"tags"`
412}
413
414// MarshalJSON is the custom marshaler for ClusterUpdate.
415func (cu ClusterUpdate) MarshalJSON() ([]byte, error) {
416	objectMap := make(map[string]interface{})
417	if cu.Tags != nil {
418		objectMap["tags"] = cu.Tags
419	}
420	return json.Marshal(objectMap)
421}
422
423// ErrorAdditionalInfo the resource management error additional info.
424type ErrorAdditionalInfo struct {
425	// Type - READ-ONLY; The additional info type.
426	Type *string `json:"type,omitempty"`
427	// Info - READ-ONLY; The additional info.
428	Info interface{} `json:"info,omitempty"`
429}
430
431// MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
432func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
433	objectMap := make(map[string]interface{})
434	return json.Marshal(objectMap)
435}
436
437// ErrorDetail the error detail.
438type ErrorDetail struct {
439	// Code - READ-ONLY; The error code.
440	Code *string `json:"code,omitempty"`
441	// Message - READ-ONLY; The error message.
442	Message *string `json:"message,omitempty"`
443	// Target - READ-ONLY; The error target.
444	Target *string `json:"target,omitempty"`
445	// Details - READ-ONLY; The error details.
446	Details *[]ErrorDetail `json:"details,omitempty"`
447	// AdditionalInfo - READ-ONLY; The error additional info.
448	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
449}
450
451// MarshalJSON is the custom marshaler for ErrorDetail.
452func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
453	objectMap := make(map[string]interface{})
454	return json.Marshal(objectMap)
455}
456
457// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
458// failed operations. (This also follows the OData error response format.).
459type ErrorResponse struct {
460	// Error - The error object.
461	Error *ErrorDetail `json:"error,omitempty"`
462}
463
464// OperationDetail operation detail payload
465type OperationDetail struct {
466	// Name - Name of the operation
467	Name *string `json:"name,omitempty"`
468	// IsDataAction - Indicates whether the operation is a data action
469	IsDataAction *bool `json:"isDataAction,omitempty"`
470	// Display - Display of the operation
471	Display *OperationDisplay `json:"display,omitempty"`
472	// Origin - Origin of the operation
473	Origin *string `json:"origin,omitempty"`
474	// Properties - Properties of the operation
475	Properties interface{} `json:"properties,omitempty"`
476}
477
478// OperationDisplay operation display payload
479type OperationDisplay struct {
480	// Provider - Resource provider of the operation
481	Provider *string `json:"provider,omitempty"`
482	// Resource - Resource of the operation
483	Resource *string `json:"resource,omitempty"`
484	// Operation - Localized friendly name for the operation
485	Operation *string `json:"operation,omitempty"`
486	// Description - Localized friendly description for the operation
487	Description *string `json:"description,omitempty"`
488}
489
490// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have
491// everything other than required location and tags
492type ProxyResource struct {
493	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
494	ID *string `json:"id,omitempty"`
495	// Name - READ-ONLY; The name of the resource
496	Name *string `json:"name,omitempty"`
497	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
498	Type *string `json:"type,omitempty"`
499}
500
501// MarshalJSON is the custom marshaler for ProxyResource.
502func (pr ProxyResource) MarshalJSON() ([]byte, error) {
503	objectMap := make(map[string]interface{})
504	return json.Marshal(objectMap)
505}
506
507// Resource common fields that are returned in the response for all Azure Resource Manager resources
508type Resource struct {
509	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
510	ID *string `json:"id,omitempty"`
511	// Name - READ-ONLY; The name of the resource
512	Name *string `json:"name,omitempty"`
513	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
514	Type *string `json:"type,omitempty"`
515}
516
517// MarshalJSON is the custom marshaler for Resource.
518func (r Resource) MarshalJSON() ([]byte, error) {
519	objectMap := make(map[string]interface{})
520	return json.Marshal(objectMap)
521}
522
523// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
524type TrackedResource struct {
525	// Tags - Resource tags.
526	Tags map[string]*string `json:"tags"`
527	// Location - The geo-location where the resource lives
528	Location *string `json:"location,omitempty"`
529	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
530	ID *string `json:"id,omitempty"`
531	// Name - READ-ONLY; The name of the resource
532	Name *string `json:"name,omitempty"`
533	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
534	Type *string `json:"type,omitempty"`
535}
536
537// MarshalJSON is the custom marshaler for TrackedResource.
538func (tr TrackedResource) MarshalJSON() ([]byte, error) {
539	objectMap := make(map[string]interface{})
540	if tr.Tags != nil {
541		objectMap["tags"] = tr.Tags
542	}
543	if tr.Location != nil {
544		objectMap["location"] = tr.Location
545	}
546	return json.Marshal(objectMap)
547}
548