forked from Azure/azure-sdk-for-go
/
models.go
233 lines (213 loc) · 9.01 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
package addons
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/addons/mgmt/2018-03-01/addons"
// CanonicalSupportPlanInfoDefinition definition object with the properties of a canonical plan
type CanonicalSupportPlanInfoDefinition struct {
// SupportPlanType - Support plan type. Possible values include: 'SupportPlanTypeEssential', 'SupportPlanTypeStandard', 'SupportPlanTypeAdvanced'
SupportPlanType SupportPlanType `json:"supportPlanType,omitempty"`
// Enabled - Flag to indicate if this support plan type is currently enabled for the subscription.
Enabled *bool `json:"enabled,omitempty"`
// OneTimeCharge - The one time charge status for the subscription. Possible values include: 'No', 'OnEnabled', 'OnReenabled'
OneTimeCharge OneTimeCharge `json:"oneTimeCharge,omitempty"`
}
// CanonicalSupportPlanProperties the properties of the Canonical support plan.
type CanonicalSupportPlanProperties struct {
// ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Purchasing', 'Downgrading', 'Cancelling', 'Upgrading'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// CanonicalSupportPlanResponseEnvelope the status of the Canonical support plan.
type CanonicalSupportPlanResponseEnvelope struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; The id of the ARM resource, e.g. "/subscriptions/{id}/providers/Microsoft.Addons/supportProvider/{supportProviderName}/supportPlanTypes/{planTypeName}".
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the Canonical support plan, i.e. "essential", "standard" or "advanced".
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Microsoft.Addons/supportProvider
Type *string `json:"type,omitempty"`
// CanonicalSupportPlanProperties - Describes Canonical support plan type and status.
*CanonicalSupportPlanProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for CanonicalSupportPlanResponseEnvelope.
func (cspre CanonicalSupportPlanResponseEnvelope) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cspre.CanonicalSupportPlanProperties != nil {
objectMap["properties"] = cspre.CanonicalSupportPlanProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CanonicalSupportPlanResponseEnvelope struct.
func (cspre *CanonicalSupportPlanResponseEnvelope) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
cspre.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
cspre.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
cspre.Type = &typeVar
}
case "properties":
if v != nil {
var canonicalSupportPlanProperties CanonicalSupportPlanProperties
err = json.Unmarshal(*v, &canonicalSupportPlanProperties)
if err != nil {
return err
}
cspre.CanonicalSupportPlanProperties = &canonicalSupportPlanProperties
}
}
}
return nil
}
// ErrorDefinition error description and code explaining why an operation failed.
type ErrorDefinition struct {
// Message - Description of the error.
Message *string `json:"message,omitempty"`
// Code - Service specific error code which serves as the substatus for the HTTP error code.
Code *int32 `json:"code,omitempty"`
}
// ListCanonicalSupportPlanInfoDefinition ...
type ListCanonicalSupportPlanInfoDefinition struct {
autorest.Response `json:"-"`
Value *[]CanonicalSupportPlanInfoDefinition `json:"value,omitempty"`
}
// ListOperationsDefinition ...
type ListOperationsDefinition struct {
autorest.Response `json:"-"`
Value *[]OperationsDefinition `json:"value,omitempty"`
}
// OperationsDefinition definition object with the name and properties of an operation.
type OperationsDefinition struct {
// Name - Name of the operation.
Name *string `json:"name,omitempty"`
// Display - Display object with properties of the operation.
Display *OperationsDisplayDefinition `json:"display,omitempty"`
}
// OperationsDisplayDefinition display object with properties of the operation.
type OperationsDisplayDefinition struct {
// Provider - Resource provider of the operation.
Provider *string `json:"provider,omitempty"`
// Resource - Resource for the operation.
Resource *string `json:"resource,omitempty"`
// Operation - Short description of the operation.
Operation *string `json:"operation,omitempty"`
// Description - Description of the operation.
Description *string `json:"description,omitempty"`
}
// SupportPlanTypesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type SupportPlanTypesCreateOrUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(SupportPlanTypesClient) (CanonicalSupportPlanResponseEnvelope, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *SupportPlanTypesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for SupportPlanTypesCreateOrUpdateFuture.Result.
func (future *SupportPlanTypesCreateOrUpdateFuture) result(client SupportPlanTypesClient) (cspre CanonicalSupportPlanResponseEnvelope, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "addons.SupportPlanTypesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
cspre.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("addons.SupportPlanTypesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if cspre.Response.Response, err = future.GetResult(sender); err == nil && cspre.Response.Response.StatusCode != http.StatusNoContent {
cspre, err = client.CreateOrUpdateResponder(cspre.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "addons.SupportPlanTypesCreateOrUpdateFuture", "Result", cspre.Response.Response, "Failure responding to request")
}
}
return
}
// SupportPlanTypesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type SupportPlanTypesDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(SupportPlanTypesClient) (CanonicalSupportPlanResponseEnvelope, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *SupportPlanTypesDeleteFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for SupportPlanTypesDeleteFuture.Result.
func (future *SupportPlanTypesDeleteFuture) result(client SupportPlanTypesClient) (cspre CanonicalSupportPlanResponseEnvelope, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "addons.SupportPlanTypesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
cspre.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("addons.SupportPlanTypesDeleteFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if cspre.Response.Response, err = future.GetResult(sender); err == nil && cspre.Response.Response.StatusCode != http.StatusNoContent {
cspre, err = client.DeleteResponder(cspre.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "addons.SupportPlanTypesDeleteFuture", "Result", cspre.Response.Response, "Failure responding to request")
}
}
return
}