-
Notifications
You must be signed in to change notification settings - Fork 801
/
models.go
394 lines (359 loc) · 15.1 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
package operationsmanagement
// 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/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement"
// ArmTemplateParameter parameter to pass to ARM template
type ArmTemplateParameter struct {
// Name - name of the parameter.
Name *string `json:"name,omitempty"`
// Value - value for the parameter. In Jtoken
Value *string `json:"value,omitempty"`
}
// CodeMessageError the error body contract.
type CodeMessageError struct {
// Error - The error details for a failed request.
Error *CodeMessageErrorError `json:"error,omitempty"`
}
// CodeMessageErrorError the error details for a failed request.
type CodeMessageErrorError struct {
// Code - The error type.
Code *string `json:"code,omitempty"`
// Message - The error message.
Message *string `json:"message,omitempty"`
}
// ManagementAssociation the container for solution.
type ManagementAssociation struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Properties - Properties for ManagementAssociation object supported by the OperationsManagement resource provider.
Properties *ManagementAssociationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ManagementAssociation.
func (ma ManagementAssociation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ma.Location != nil {
objectMap["location"] = ma.Location
}
if ma.Properties != nil {
objectMap["properties"] = ma.Properties
}
return json.Marshal(objectMap)
}
// ManagementAssociationProperties managementAssociation properties supported by the OperationsManagement
// resource provider.
type ManagementAssociationProperties struct {
// ApplicationID - The applicationId of the appliance for this association.
ApplicationID *string `json:"applicationId,omitempty"`
}
// ManagementAssociationPropertiesList the list of ManagementAssociation response
type ManagementAssociationPropertiesList struct {
autorest.Response `json:"-"`
// Value - List of Management Association properties within the subscription.
Value *[]ManagementAssociation `json:"value,omitempty"`
}
// ManagementConfiguration the container for solution.
type ManagementConfiguration struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Properties - Properties for ManagementConfiguration object supported by the OperationsManagement resource provider.
Properties *ManagementConfigurationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ManagementConfiguration.
func (mc ManagementConfiguration) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if mc.Location != nil {
objectMap["location"] = mc.Location
}
if mc.Properties != nil {
objectMap["properties"] = mc.Properties
}
return json.Marshal(objectMap)
}
// ManagementConfigurationProperties managementConfiguration properties supported by the
// OperationsManagement resource provider.
type ManagementConfigurationProperties struct {
// ApplicationID - The applicationId of the appliance for this Management.
ApplicationID *string `json:"applicationId,omitempty"`
// ParentResourceType - The type of the parent resource.
ParentResourceType *string `json:"parentResourceType,omitempty"`
// Parameters - Parameters to run the ARM template
Parameters *[]ArmTemplateParameter `json:"parameters,omitempty"`
// ProvisioningState - READ-ONLY; The provisioning state for the ManagementConfiguration.
ProvisioningState *string `json:"provisioningState,omitempty"`
// Template - The Json object containing the ARM template to deploy
Template interface{} `json:"template,omitempty"`
}
// MarshalJSON is the custom marshaler for ManagementConfigurationProperties.
func (mcp ManagementConfigurationProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if mcp.ApplicationID != nil {
objectMap["applicationId"] = mcp.ApplicationID
}
if mcp.ParentResourceType != nil {
objectMap["parentResourceType"] = mcp.ParentResourceType
}
if mcp.Parameters != nil {
objectMap["parameters"] = mcp.Parameters
}
if mcp.Template != nil {
objectMap["template"] = mcp.Template
}
return json.Marshal(objectMap)
}
// ManagementConfigurationPropertiesList the list of ManagementConfiguration response
type ManagementConfigurationPropertiesList struct {
autorest.Response `json:"-"`
// Value - List of Management Configuration properties within the subscription.
Value *[]ManagementConfiguration `json:"value,omitempty"`
}
// Operation supported operation of OperationsManagement resource provider.
type Operation struct {
// Name - Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
// Display - Display metadata associated with the operation.
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay display metadata associated with the operation.
type OperationDisplay struct {
// Provider - Service provider: Microsoft OperationsManagement.
Provider *string `json:"provider,omitempty"`
// Resource - Resource on which the operation is performed etc.
Resource *string `json:"resource,omitempty"`
// Operation - Type of operation: get, read, delete, etc.
Operation *string `json:"operation,omitempty"`
}
// OperationListResult result of the request to list solution operations.
type OperationListResult struct {
autorest.Response `json:"-"`
// Value - List of solution operations supported by the OperationsManagement resource provider.
Value *[]Operation `json:"value,omitempty"`
}
// Solution the container for solution.
type Solution struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
// Plan - Plan for solution object supported by the OperationsManagement resource provider.
Plan *SolutionPlan `json:"plan,omitempty"`
// Properties - Properties for solution object supported by the OperationsManagement resource provider.
Properties *SolutionProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Solution.
func (s Solution) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if s.Location != nil {
objectMap["location"] = s.Location
}
if s.Tags != nil {
objectMap["tags"] = s.Tags
}
if s.Plan != nil {
objectMap["plan"] = s.Plan
}
if s.Properties != nil {
objectMap["properties"] = s.Properties
}
return json.Marshal(objectMap)
}
// SolutionPatch the properties of a Solution that can be patched.
type SolutionPatch struct {
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for SolutionPatch.
func (sp SolutionPatch) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sp.Tags != nil {
objectMap["tags"] = sp.Tags
}
return json.Marshal(objectMap)
}
// SolutionPlan plan for solution object supported by the OperationsManagement resource provider.
type SolutionPlan struct {
// Name - name of the solution to be created. For Microsoft published solution it should be in the format of solutionType(workspaceName). SolutionType part is case sensitive. For third party solution, it can be anything.
Name *string `json:"name,omitempty"`
// Publisher - Publisher name. For gallery solution, it is Microsoft.
Publisher *string `json:"publisher,omitempty"`
// PromotionCode - promotionCode, Not really used now, can you left as empty
PromotionCode *string `json:"promotionCode,omitempty"`
// Product - name of the solution to enabled/add. For Microsoft published gallery solution it should be in the format of OMSGallery/<solutionType>. This is case sensitive
Product *string `json:"product,omitempty"`
}
// SolutionProperties solution properties supported by the OperationsManagement resource provider.
type SolutionProperties struct {
// WorkspaceResourceID - The azure resourceId for the workspace where the solution will be deployed/enabled.
WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"`
// ProvisioningState - READ-ONLY; The provisioning state for the solution.
ProvisioningState *string `json:"provisioningState,omitempty"`
// ContainedResources - The azure resources that will be contained within the solutions. They will be locked and gets deleted automatically when the solution is deleted.
ContainedResources *[]string `json:"containedResources,omitempty"`
// ReferencedResources - The resources that will be referenced from this solution. Deleting any of those solution out of band will break the solution.
ReferencedResources *[]string `json:"referencedResources,omitempty"`
}
// MarshalJSON is the custom marshaler for SolutionProperties.
func (sp SolutionProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sp.WorkspaceResourceID != nil {
objectMap["workspaceResourceId"] = sp.WorkspaceResourceID
}
if sp.ContainedResources != nil {
objectMap["containedResources"] = sp.ContainedResources
}
if sp.ReferencedResources != nil {
objectMap["referencedResources"] = sp.ReferencedResources
}
return json.Marshal(objectMap)
}
// SolutionPropertiesList the list of solution response
type SolutionPropertiesList struct {
autorest.Response `json:"-"`
// Value - List of solution properties within the subscription.
Value *[]Solution `json:"value,omitempty"`
}
// SolutionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type SolutionsCreateOrUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(SolutionsClient) (Solution, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *SolutionsCreateOrUpdateFuture) 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 SolutionsCreateOrUpdateFuture.Result.
func (future *SolutionsCreateOrUpdateFuture) result(client SolutionsClient) (s Solution, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "operationsmanagement.SolutionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
s.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("operationsmanagement.SolutionsCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
s, err = client.CreateOrUpdateResponder(s.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "operationsmanagement.SolutionsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
}
}
return
}
// SolutionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type SolutionsDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(SolutionsClient) (autorest.Response, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *SolutionsDeleteFuture) 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 SolutionsDeleteFuture.Result.
func (future *SolutionsDeleteFuture) result(client SolutionsClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "operationsmanagement.SolutionsDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("operationsmanagement.SolutionsDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// SolutionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type SolutionsUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(SolutionsClient) (Solution, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *SolutionsUpdateFuture) 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 SolutionsUpdateFuture.Result.
func (future *SolutionsUpdateFuture) result(client SolutionsClient) (s Solution, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "operationsmanagement.SolutionsUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
s.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("operationsmanagement.SolutionsUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
s, err = client.UpdateResponder(s.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "operationsmanagement.SolutionsUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
}
}
return
}