forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 2
/
models.go
277 lines (250 loc) · 10.5 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
package addons
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// 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/2017-05-15/addons"
// PlanTypeName enumerates the values for plan type name.
type PlanTypeName string
const (
// Advanced ...
Advanced PlanTypeName = "Advanced"
// Essential ...
Essential PlanTypeName = "Essential"
// Standard ...
Standard PlanTypeName = "Standard"
)
// PossiblePlanTypeNameValues returns an array of possible values for the PlanTypeName const type.
func PossiblePlanTypeNameValues() []PlanTypeName {
return []PlanTypeName{Advanced, Essential, Standard}
}
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Cancelled ...
Cancelled ProvisioningState = "Cancelled"
// Cancelling ...
Cancelling ProvisioningState = "Cancelling"
// Downgrading ...
Downgrading ProvisioningState = "Downgrading"
// Failed ...
Failed ProvisioningState = "Failed"
// Purchasing ...
Purchasing ProvisioningState = "Purchasing"
// Succeeded ...
Succeeded ProvisioningState = "Succeeded"
// Upgrading ...
Upgrading ProvisioningState = "Upgrading"
)
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{Cancelled, Cancelling, Downgrading, Failed, Purchasing, Succeeded, Upgrading}
}
// SupportPlanType enumerates the values for support plan type.
type SupportPlanType string
const (
// SupportPlanTypeAdvanced ...
SupportPlanTypeAdvanced SupportPlanType = "advanced"
// SupportPlanTypeEssential ...
SupportPlanTypeEssential SupportPlanType = "essential"
// SupportPlanTypeStandard ...
SupportPlanTypeStandard SupportPlanType = "standard"
)
// PossibleSupportPlanTypeValues returns an array of possible values for the SupportPlanType const type.
func PossibleSupportPlanTypeValues() []SupportPlanType {
return []SupportPlanType{SupportPlanTypeAdvanced, SupportPlanTypeEssential, SupportPlanTypeStandard}
}
// 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
}
// CanonicalSupportPlanStatusItem ...
type CanonicalSupportPlanStatusItem struct {
// SupportPlanType - Support plan type. Possible values include: 'SupportPlanTypeEssential', 'SupportPlanTypeStandard', 'SupportPlanTypeAdvanced'
SupportPlanType SupportPlanType `json:"supportPlanType,omitempty"`
// Enabled - Whether the support plan is enabled for this subscription.
Enabled *bool `json:"enabled,omitempty"`
// WillEmitOneTimeChargeWhenEnabled - This indicates that when this support plan is enabled if AddonsRP will emit a one-time charge.
WillEmitOneTimeChargeWhenEnabled *bool `json:"willEmitOneTimeChargeWhenEnabled,omitempty"`
// WillEmitOneTimeChargeIfReEnabled - This indicates that when this support plan is cancelled and then enabled that AddonsRP will emit a one-time charge.
WillEmitOneTimeChargeIfReEnabled *bool `json:"willEmitOneTimeChargeIfReEnabled,omitempty"`
}
// 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"`
}
// ListCanonicalSupportPlanStatusItem ...
type ListCanonicalSupportPlanStatusItem struct {
autorest.Response `json:"-"`
Value *[]CanonicalSupportPlanStatusItem `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.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
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 {
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.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
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 {
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
}