1package hybridcompute 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/hybridcompute/mgmt/2019-12-12/hybridcompute" 22 23// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 24type AzureEntityResource struct { 25 // Etag - READ-ONLY; Resource Etag. 26 Etag *string `json:"etag,omitempty"` 27 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 28 ID *string `json:"id,omitempty"` 29 // Name - READ-ONLY; The name of the resource 30 Name *string `json:"name,omitempty"` 31 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 32 Type *string `json:"type,omitempty"` 33} 34 35// MarshalJSON is the custom marshaler for AzureEntityResource. 36func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 37 objectMap := make(map[string]interface{}) 38 return json.Marshal(objectMap) 39} 40 41// ErrorAdditionalInfo the resource management error additional info. 42type ErrorAdditionalInfo struct { 43 // Type - READ-ONLY; The additional info type. 44 Type *string `json:"type,omitempty"` 45 // Info - READ-ONLY; The additional info. 46 Info interface{} `json:"info,omitempty"` 47} 48 49// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 50func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 51 objectMap := make(map[string]interface{}) 52 return json.Marshal(objectMap) 53} 54 55// ErrorDetail ... 56type ErrorDetail struct { 57 // Code - The error's code. 58 Code *string `json:"code,omitempty"` 59 // Message - A human readable error message. 60 Message *string `json:"message,omitempty"` 61 // Target - Indicates which property in the request is responsible for the error. 62 Target *string `json:"target,omitempty"` 63 // Details - Additional error details. 64 Details *[]ErrorDetail `json:"details,omitempty"` 65} 66 67// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 68// failed operations. (This also follows the OData error response format.) 69type ErrorResponse struct { 70 // Code - READ-ONLY; The error code. 71 Code *string `json:"code,omitempty"` 72 // Message - READ-ONLY; The error message. 73 Message *string `json:"message,omitempty"` 74 // Target - READ-ONLY; The error target. 75 Target *string `json:"target,omitempty"` 76 // Details - READ-ONLY; The error details. 77 Details *[]ErrorResponse `json:"details,omitempty"` 78 // AdditionalInfo - READ-ONLY; The error additional info. 79 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 80} 81 82// MarshalJSON is the custom marshaler for ErrorResponse. 83func (er ErrorResponse) MarshalJSON() ([]byte, error) { 84 objectMap := make(map[string]interface{}) 85 return json.Marshal(objectMap) 86} 87 88// Identity identity for the resource. 89type Identity struct { 90 // PrincipalID - READ-ONLY; The principal ID of resource identity. 91 PrincipalID *string `json:"principalId,omitempty"` 92 // TenantID - READ-ONLY; The tenant ID of resource. 93 TenantID *string `json:"tenantId,omitempty"` 94 // Type - The identity type. Possible values include: 'SystemAssigned' 95 Type ResourceIdentityType `json:"type,omitempty"` 96} 97 98// MarshalJSON is the custom marshaler for Identity. 99func (i Identity) MarshalJSON() ([]byte, error) { 100 objectMap := make(map[string]interface{}) 101 if i.Type != "" { 102 objectMap["type"] = i.Type 103 } 104 return json.Marshal(objectMap) 105} 106 107// LocationData metadata pertaining to the geographic location of the resource. 108type LocationData struct { 109 // Name - A canonical name for the geographic or physical location. 110 Name *string `json:"name,omitempty"` 111 // City - The city or locality where the resource is located. 112 City *string `json:"city,omitempty"` 113 // District - The district, state, or province where the resource is located. 114 District *string `json:"district,omitempty"` 115 // CountryOrRegion - The country or region where the resource is located 116 CountryOrRegion *string `json:"countryOrRegion,omitempty"` 117} 118 119// Machine describes a hybrid machine. 120type Machine struct { 121 autorest.Response `json:"-"` 122 // MachinePropertiesModel - Hybrid Compute Machine properties 123 *MachinePropertiesModel `json:"properties,omitempty"` 124 Identity *MachineIdentity `json:"identity,omitempty"` 125 // Tags - Resource tags. 126 Tags map[string]*string `json:"tags"` 127 // Location - The geo-location where the resource lives 128 Location *string `json:"location,omitempty"` 129 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 130 ID *string `json:"id,omitempty"` 131 // Name - READ-ONLY; The name of the resource 132 Name *string `json:"name,omitempty"` 133 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 134 Type *string `json:"type,omitempty"` 135} 136 137// MarshalJSON is the custom marshaler for Machine. 138func (mVar Machine) MarshalJSON() ([]byte, error) { 139 objectMap := make(map[string]interface{}) 140 if mVar.MachinePropertiesModel != nil { 141 objectMap["properties"] = mVar.MachinePropertiesModel 142 } 143 if mVar.Identity != nil { 144 objectMap["identity"] = mVar.Identity 145 } 146 if mVar.Tags != nil { 147 objectMap["tags"] = mVar.Tags 148 } 149 if mVar.Location != nil { 150 objectMap["location"] = mVar.Location 151 } 152 return json.Marshal(objectMap) 153} 154 155// UnmarshalJSON is the custom unmarshaler for Machine struct. 156func (mVar *Machine) UnmarshalJSON(body []byte) error { 157 var m map[string]*json.RawMessage 158 err := json.Unmarshal(body, &m) 159 if err != nil { 160 return err 161 } 162 for k, v := range m { 163 switch k { 164 case "properties": 165 if v != nil { 166 var machinePropertiesModel MachinePropertiesModel 167 err = json.Unmarshal(*v, &machinePropertiesModel) 168 if err != nil { 169 return err 170 } 171 mVar.MachinePropertiesModel = &machinePropertiesModel 172 } 173 case "identity": 174 if v != nil { 175 var identity MachineIdentity 176 err = json.Unmarshal(*v, &identity) 177 if err != nil { 178 return err 179 } 180 mVar.Identity = &identity 181 } 182 case "tags": 183 if v != nil { 184 var tags map[string]*string 185 err = json.Unmarshal(*v, &tags) 186 if err != nil { 187 return err 188 } 189 mVar.Tags = tags 190 } 191 case "location": 192 if v != nil { 193 var location string 194 err = json.Unmarshal(*v, &location) 195 if err != nil { 196 return err 197 } 198 mVar.Location = &location 199 } 200 case "id": 201 if v != nil { 202 var ID string 203 err = json.Unmarshal(*v, &ID) 204 if err != nil { 205 return err 206 } 207 mVar.ID = &ID 208 } 209 case "name": 210 if v != nil { 211 var name string 212 err = json.Unmarshal(*v, &name) 213 if err != nil { 214 return err 215 } 216 mVar.Name = &name 217 } 218 case "type": 219 if v != nil { 220 var typeVar string 221 err = json.Unmarshal(*v, &typeVar) 222 if err != nil { 223 return err 224 } 225 mVar.Type = &typeVar 226 } 227 } 228 } 229 230 return nil 231} 232 233// MachineExtension describes a Machine Extension. 234type MachineExtension struct { 235 autorest.Response `json:"-"` 236 // MachineExtensionProperties - Describes Machine Extension Properties. 237 *MachineExtensionProperties `json:"properties,omitempty"` 238 // Tags - Resource tags. 239 Tags map[string]*string `json:"tags"` 240 // Location - The geo-location where the resource lives 241 Location *string `json:"location,omitempty"` 242 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 243 ID *string `json:"id,omitempty"` 244 // Name - READ-ONLY; The name of the resource 245 Name *string `json:"name,omitempty"` 246 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 247 Type *string `json:"type,omitempty"` 248} 249 250// MarshalJSON is the custom marshaler for MachineExtension. 251func (me MachineExtension) MarshalJSON() ([]byte, error) { 252 objectMap := make(map[string]interface{}) 253 if me.MachineExtensionProperties != nil { 254 objectMap["properties"] = me.MachineExtensionProperties 255 } 256 if me.Tags != nil { 257 objectMap["tags"] = me.Tags 258 } 259 if me.Location != nil { 260 objectMap["location"] = me.Location 261 } 262 return json.Marshal(objectMap) 263} 264 265// UnmarshalJSON is the custom unmarshaler for MachineExtension struct. 266func (me *MachineExtension) UnmarshalJSON(body []byte) error { 267 var m map[string]*json.RawMessage 268 err := json.Unmarshal(body, &m) 269 if err != nil { 270 return err 271 } 272 for k, v := range m { 273 switch k { 274 case "properties": 275 if v != nil { 276 var machineExtensionProperties MachineExtensionProperties 277 err = json.Unmarshal(*v, &machineExtensionProperties) 278 if err != nil { 279 return err 280 } 281 me.MachineExtensionProperties = &machineExtensionProperties 282 } 283 case "tags": 284 if v != nil { 285 var tags map[string]*string 286 err = json.Unmarshal(*v, &tags) 287 if err != nil { 288 return err 289 } 290 me.Tags = tags 291 } 292 case "location": 293 if v != nil { 294 var location string 295 err = json.Unmarshal(*v, &location) 296 if err != nil { 297 return err 298 } 299 me.Location = &location 300 } 301 case "id": 302 if v != nil { 303 var ID string 304 err = json.Unmarshal(*v, &ID) 305 if err != nil { 306 return err 307 } 308 me.ID = &ID 309 } 310 case "name": 311 if v != nil { 312 var name string 313 err = json.Unmarshal(*v, &name) 314 if err != nil { 315 return err 316 } 317 me.Name = &name 318 } 319 case "type": 320 if v != nil { 321 var typeVar string 322 err = json.Unmarshal(*v, &typeVar) 323 if err != nil { 324 return err 325 } 326 me.Type = &typeVar 327 } 328 } 329 } 330 331 return nil 332} 333 334// MachineExtensionInstanceView describes the Machine Extension Instance View. 335type MachineExtensionInstanceView struct { 336 // Name - The machine extension name. 337 Name *string `json:"name,omitempty"` 338 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 339 Type *string `json:"type,omitempty"` 340 // TypeHandlerVersion - Specifies the version of the script handler. 341 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 342 // Status - Instance view status. 343 Status *MachineExtensionInstanceViewStatus `json:"status,omitempty"` 344} 345 346// MachineExtensionInstanceViewStatus instance view status. 347type MachineExtensionInstanceViewStatus struct { 348 // Code - The status code. 349 Code *string `json:"code,omitempty"` 350 // Level - The level code. Possible values include: 'Info', 'Warning', 'Error' 351 Level StatusLevelTypes `json:"level,omitempty"` 352 // DisplayStatus - The short localizable label for the status. 353 DisplayStatus *string `json:"displayStatus,omitempty"` 354 // Message - The detailed status message, including for alerts and error messages. 355 Message *string `json:"message,omitempty"` 356 // Time - The time of the status. 357 Time *date.Time `json:"time,omitempty"` 358} 359 360// MachineExtensionProperties describes Machine Extension Properties. 361type MachineExtensionProperties struct { 362 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 363 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 364 // Publisher - The name of the extension handler publisher. 365 Publisher *string `json:"publisher,omitempty"` 366 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 367 Type *string `json:"type,omitempty"` 368 // TypeHandlerVersion - Specifies the version of the script handler. 369 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 370 // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. 371 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 372 // Settings - Json formatted public settings for the extension. 373 Settings interface{} `json:"settings,omitempty"` 374 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 375 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 376 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 377 ProvisioningState *string `json:"provisioningState,omitempty"` 378 // InstanceView - The machine extension instance view. 379 InstanceView *MachineExtensionPropertiesInstanceView `json:"instanceView,omitempty"` 380} 381 382// MarshalJSON is the custom marshaler for MachineExtensionProperties. 383func (me MachineExtensionProperties) MarshalJSON() ([]byte, error) { 384 objectMap := make(map[string]interface{}) 385 if me.ForceUpdateTag != nil { 386 objectMap["forceUpdateTag"] = me.ForceUpdateTag 387 } 388 if me.Publisher != nil { 389 objectMap["publisher"] = me.Publisher 390 } 391 if me.Type != nil { 392 objectMap["type"] = me.Type 393 } 394 if me.TypeHandlerVersion != nil { 395 objectMap["typeHandlerVersion"] = me.TypeHandlerVersion 396 } 397 if me.AutoUpgradeMinorVersion != nil { 398 objectMap["autoUpgradeMinorVersion"] = me.AutoUpgradeMinorVersion 399 } 400 if me.Settings != nil { 401 objectMap["settings"] = me.Settings 402 } 403 if me.ProtectedSettings != nil { 404 objectMap["protectedSettings"] = me.ProtectedSettings 405 } 406 if me.InstanceView != nil { 407 objectMap["instanceView"] = me.InstanceView 408 } 409 return json.Marshal(objectMap) 410} 411 412// MachineExtensionPropertiesInstanceView the machine extension instance view. 413type MachineExtensionPropertiesInstanceView struct { 414 // Name - The machine extension name. 415 Name *string `json:"name,omitempty"` 416 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 417 Type *string `json:"type,omitempty"` 418 // TypeHandlerVersion - Specifies the version of the script handler. 419 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 420 // Status - Instance view status. 421 Status *MachineExtensionInstanceViewStatus `json:"status,omitempty"` 422} 423 424// MachineExtensionPropertiesModel describes the properties of a Machine Extension. 425type MachineExtensionPropertiesModel struct { 426 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 427 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 428 // Publisher - The name of the extension handler publisher. 429 Publisher *string `json:"publisher,omitempty"` 430 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 431 Type *string `json:"type,omitempty"` 432 // TypeHandlerVersion - Specifies the version of the script handler. 433 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 434 // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. 435 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 436 // Settings - Json formatted public settings for the extension. 437 Settings interface{} `json:"settings,omitempty"` 438 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 439 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 440 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 441 ProvisioningState *string `json:"provisioningState,omitempty"` 442 // InstanceView - The machine extension instance view. 443 InstanceView *MachineExtensionPropertiesInstanceView `json:"instanceView,omitempty"` 444} 445 446// MarshalJSON is the custom marshaler for MachineExtensionPropertiesModel. 447func (mepm MachineExtensionPropertiesModel) MarshalJSON() ([]byte, error) { 448 objectMap := make(map[string]interface{}) 449 if mepm.ForceUpdateTag != nil { 450 objectMap["forceUpdateTag"] = mepm.ForceUpdateTag 451 } 452 if mepm.Publisher != nil { 453 objectMap["publisher"] = mepm.Publisher 454 } 455 if mepm.Type != nil { 456 objectMap["type"] = mepm.Type 457 } 458 if mepm.TypeHandlerVersion != nil { 459 objectMap["typeHandlerVersion"] = mepm.TypeHandlerVersion 460 } 461 if mepm.AutoUpgradeMinorVersion != nil { 462 objectMap["autoUpgradeMinorVersion"] = mepm.AutoUpgradeMinorVersion 463 } 464 if mepm.Settings != nil { 465 objectMap["settings"] = mepm.Settings 466 } 467 if mepm.ProtectedSettings != nil { 468 objectMap["protectedSettings"] = mepm.ProtectedSettings 469 } 470 if mepm.InstanceView != nil { 471 objectMap["instanceView"] = mepm.InstanceView 472 } 473 return json.Marshal(objectMap) 474} 475 476// MachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 477// long-running operation. 478type MachineExtensionsCreateOrUpdateFuture struct { 479 azure.FutureAPI 480 // Result returns the result of the asynchronous operation. 481 // If the operation has not completed it will return an error. 482 Result func(MachineExtensionsClient) (MachineExtension, error) 483} 484 485// UnmarshalJSON is the custom unmarshaller for CreateFuture. 486func (future *MachineExtensionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 487 var azFuture azure.Future 488 if err := json.Unmarshal(body, &azFuture); err != nil { 489 return err 490 } 491 future.FutureAPI = &azFuture 492 future.Result = future.result 493 return nil 494} 495 496// result is the default implementation for MachineExtensionsCreateOrUpdateFuture.Result. 497func (future *MachineExtensionsCreateOrUpdateFuture) result(client MachineExtensionsClient) (me MachineExtension, err error) { 498 var done bool 499 done, err = future.DoneWithContext(context.Background(), client) 500 if err != nil { 501 err = autorest.NewErrorWithError(err, "hybridcompute.MachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 502 return 503 } 504 if !done { 505 me.Response.Response = future.Response() 506 err = azure.NewAsyncOpIncompleteError("hybridcompute.MachineExtensionsCreateOrUpdateFuture") 507 return 508 } 509 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 510 if me.Response.Response, err = future.GetResult(sender); err == nil && me.Response.Response.StatusCode != http.StatusNoContent { 511 me, err = client.CreateOrUpdateResponder(me.Response.Response) 512 if err != nil { 513 err = autorest.NewErrorWithError(err, "hybridcompute.MachineExtensionsCreateOrUpdateFuture", "Result", me.Response.Response, "Failure responding to request") 514 } 515 } 516 return 517} 518 519// MachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 520// operation. 521type MachineExtensionsDeleteFuture struct { 522 azure.FutureAPI 523 // Result returns the result of the asynchronous operation. 524 // If the operation has not completed it will return an error. 525 Result func(MachineExtensionsClient) (autorest.Response, error) 526} 527 528// UnmarshalJSON is the custom unmarshaller for CreateFuture. 529func (future *MachineExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { 530 var azFuture azure.Future 531 if err := json.Unmarshal(body, &azFuture); err != nil { 532 return err 533 } 534 future.FutureAPI = &azFuture 535 future.Result = future.result 536 return nil 537} 538 539// result is the default implementation for MachineExtensionsDeleteFuture.Result. 540func (future *MachineExtensionsDeleteFuture) result(client MachineExtensionsClient) (ar autorest.Response, err error) { 541 var done bool 542 done, err = future.DoneWithContext(context.Background(), client) 543 if err != nil { 544 err = autorest.NewErrorWithError(err, "hybridcompute.MachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") 545 return 546 } 547 if !done { 548 ar.Response = future.Response() 549 err = azure.NewAsyncOpIncompleteError("hybridcompute.MachineExtensionsDeleteFuture") 550 return 551 } 552 ar.Response = future.Response() 553 return 554} 555 556// MachineExtensionsListResult describes the Machine Extensions List Result. 557type MachineExtensionsListResult struct { 558 autorest.Response `json:"-"` 559 // Value - The list of extensions 560 Value *[]MachineExtension `json:"value,omitempty"` 561 // NextLink - The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. 562 NextLink *string `json:"nextLink,omitempty"` 563} 564 565// MachineExtensionsListResultIterator provides access to a complete listing of MachineExtension values. 566type MachineExtensionsListResultIterator struct { 567 i int 568 page MachineExtensionsListResultPage 569} 570 571// NextWithContext advances to the next value. If there was an error making 572// the request the iterator does not advance and the error is returned. 573func (iter *MachineExtensionsListResultIterator) NextWithContext(ctx context.Context) (err error) { 574 if tracing.IsEnabled() { 575 ctx = tracing.StartSpan(ctx, fqdn+"/MachineExtensionsListResultIterator.NextWithContext") 576 defer func() { 577 sc := -1 578 if iter.Response().Response.Response != nil { 579 sc = iter.Response().Response.Response.StatusCode 580 } 581 tracing.EndSpan(ctx, sc, err) 582 }() 583 } 584 iter.i++ 585 if iter.i < len(iter.page.Values()) { 586 return nil 587 } 588 err = iter.page.NextWithContext(ctx) 589 if err != nil { 590 iter.i-- 591 return err 592 } 593 iter.i = 0 594 return nil 595} 596 597// Next advances to the next value. If there was an error making 598// the request the iterator does not advance and the error is returned. 599// Deprecated: Use NextWithContext() instead. 600func (iter *MachineExtensionsListResultIterator) Next() error { 601 return iter.NextWithContext(context.Background()) 602} 603 604// NotDone returns true if the enumeration should be started or is not yet complete. 605func (iter MachineExtensionsListResultIterator) NotDone() bool { 606 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 607} 608 609// Response returns the raw server response from the last page request. 610func (iter MachineExtensionsListResultIterator) Response() MachineExtensionsListResult { 611 return iter.page.Response() 612} 613 614// Value returns the current value or a zero-initialized value if the 615// iterator has advanced beyond the end of the collection. 616func (iter MachineExtensionsListResultIterator) Value() MachineExtension { 617 if !iter.page.NotDone() { 618 return MachineExtension{} 619 } 620 return iter.page.Values()[iter.i] 621} 622 623// Creates a new instance of the MachineExtensionsListResultIterator type. 624func NewMachineExtensionsListResultIterator(page MachineExtensionsListResultPage) MachineExtensionsListResultIterator { 625 return MachineExtensionsListResultIterator{page: page} 626} 627 628// IsEmpty returns true if the ListResult contains no values. 629func (melr MachineExtensionsListResult) IsEmpty() bool { 630 return melr.Value == nil || len(*melr.Value) == 0 631} 632 633// hasNextLink returns true if the NextLink is not empty. 634func (melr MachineExtensionsListResult) hasNextLink() bool { 635 return melr.NextLink != nil && len(*melr.NextLink) != 0 636} 637 638// machineExtensionsListResultPreparer prepares a request to retrieve the next set of results. 639// It returns nil if no more results exist. 640func (melr MachineExtensionsListResult) machineExtensionsListResultPreparer(ctx context.Context) (*http.Request, error) { 641 if !melr.hasNextLink() { 642 return nil, nil 643 } 644 return autorest.Prepare((&http.Request{}).WithContext(ctx), 645 autorest.AsJSON(), 646 autorest.AsGet(), 647 autorest.WithBaseURL(to.String(melr.NextLink))) 648} 649 650// MachineExtensionsListResultPage contains a page of MachineExtension values. 651type MachineExtensionsListResultPage struct { 652 fn func(context.Context, MachineExtensionsListResult) (MachineExtensionsListResult, error) 653 melr MachineExtensionsListResult 654} 655 656// NextWithContext advances to the next page of values. If there was an error making 657// the request the page does not advance and the error is returned. 658func (page *MachineExtensionsListResultPage) NextWithContext(ctx context.Context) (err error) { 659 if tracing.IsEnabled() { 660 ctx = tracing.StartSpan(ctx, fqdn+"/MachineExtensionsListResultPage.NextWithContext") 661 defer func() { 662 sc := -1 663 if page.Response().Response.Response != nil { 664 sc = page.Response().Response.Response.StatusCode 665 } 666 tracing.EndSpan(ctx, sc, err) 667 }() 668 } 669 for { 670 next, err := page.fn(ctx, page.melr) 671 if err != nil { 672 return err 673 } 674 page.melr = next 675 if !next.hasNextLink() || !next.IsEmpty() { 676 break 677 } 678 } 679 return nil 680} 681 682// Next advances to the next page of values. If there was an error making 683// the request the page does not advance and the error is returned. 684// Deprecated: Use NextWithContext() instead. 685func (page *MachineExtensionsListResultPage) Next() error { 686 return page.NextWithContext(context.Background()) 687} 688 689// NotDone returns true if the page enumeration should be started or is not yet complete. 690func (page MachineExtensionsListResultPage) NotDone() bool { 691 return !page.melr.IsEmpty() 692} 693 694// Response returns the raw server response from the last page request. 695func (page MachineExtensionsListResultPage) Response() MachineExtensionsListResult { 696 return page.melr 697} 698 699// Values returns the slice of values for the current page or nil if there are no values. 700func (page MachineExtensionsListResultPage) Values() []MachineExtension { 701 if page.melr.IsEmpty() { 702 return nil 703 } 704 return *page.melr.Value 705} 706 707// Creates a new instance of the MachineExtensionsListResultPage type. 708func NewMachineExtensionsListResultPage(cur MachineExtensionsListResult, getNextPage func(context.Context, MachineExtensionsListResult) (MachineExtensionsListResult, error)) MachineExtensionsListResultPage { 709 return MachineExtensionsListResultPage{ 710 fn: getNextPage, 711 melr: cur, 712 } 713} 714 715// MachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 716// operation. 717type MachineExtensionsUpdateFuture struct { 718 azure.FutureAPI 719 // Result returns the result of the asynchronous operation. 720 // If the operation has not completed it will return an error. 721 Result func(MachineExtensionsClient) (MachineExtension, error) 722} 723 724// UnmarshalJSON is the custom unmarshaller for CreateFuture. 725func (future *MachineExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { 726 var azFuture azure.Future 727 if err := json.Unmarshal(body, &azFuture); err != nil { 728 return err 729 } 730 future.FutureAPI = &azFuture 731 future.Result = future.result 732 return nil 733} 734 735// result is the default implementation for MachineExtensionsUpdateFuture.Result. 736func (future *MachineExtensionsUpdateFuture) result(client MachineExtensionsClient) (me MachineExtension, err error) { 737 var done bool 738 done, err = future.DoneWithContext(context.Background(), client) 739 if err != nil { 740 err = autorest.NewErrorWithError(err, "hybridcompute.MachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") 741 return 742 } 743 if !done { 744 me.Response.Response = future.Response() 745 err = azure.NewAsyncOpIncompleteError("hybridcompute.MachineExtensionsUpdateFuture") 746 return 747 } 748 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 749 if me.Response.Response, err = future.GetResult(sender); err == nil && me.Response.Response.StatusCode != http.StatusNoContent { 750 me, err = client.UpdateResponder(me.Response.Response) 751 if err != nil { 752 err = autorest.NewErrorWithError(err, "hybridcompute.MachineExtensionsUpdateFuture", "Result", me.Response.Response, "Failure responding to request") 753 } 754 } 755 return 756} 757 758// MachineExtensionUpdate describes a Machine Extension Update. 759type MachineExtensionUpdate struct { 760 // MachineExtensionUpdateProperties - Describes Machine Extension Update Properties. 761 *MachineExtensionUpdateProperties `json:"properties,omitempty"` 762 // Tags - Resource tags 763 Tags map[string]*string `json:"tags"` 764} 765 766// MarshalJSON is the custom marshaler for MachineExtensionUpdate. 767func (meu MachineExtensionUpdate) MarshalJSON() ([]byte, error) { 768 objectMap := make(map[string]interface{}) 769 if meu.MachineExtensionUpdateProperties != nil { 770 objectMap["properties"] = meu.MachineExtensionUpdateProperties 771 } 772 if meu.Tags != nil { 773 objectMap["tags"] = meu.Tags 774 } 775 return json.Marshal(objectMap) 776} 777 778// UnmarshalJSON is the custom unmarshaler for MachineExtensionUpdate struct. 779func (meu *MachineExtensionUpdate) UnmarshalJSON(body []byte) error { 780 var m map[string]*json.RawMessage 781 err := json.Unmarshal(body, &m) 782 if err != nil { 783 return err 784 } 785 for k, v := range m { 786 switch k { 787 case "properties": 788 if v != nil { 789 var machineExtensionUpdateProperties MachineExtensionUpdateProperties 790 err = json.Unmarshal(*v, &machineExtensionUpdateProperties) 791 if err != nil { 792 return err 793 } 794 meu.MachineExtensionUpdateProperties = &machineExtensionUpdateProperties 795 } 796 case "tags": 797 if v != nil { 798 var tags map[string]*string 799 err = json.Unmarshal(*v, &tags) 800 if err != nil { 801 return err 802 } 803 meu.Tags = tags 804 } 805 } 806 } 807 808 return nil 809} 810 811// MachineExtensionUpdateProperties describes Machine Extension Update Properties. 812type MachineExtensionUpdateProperties struct { 813 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 814 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 815 // Publisher - The name of the extension handler publisher. 816 Publisher *string `json:"publisher,omitempty"` 817 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 818 Type *string `json:"type,omitempty"` 819 // TypeHandlerVersion - Specifies the version of the script handler. 820 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 821 // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. 822 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 823 // Settings - Json formatted public settings for the extension. 824 Settings interface{} `json:"settings,omitempty"` 825 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 826 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 827} 828 829// MachineExtensionUpdatePropertiesModel describes the properties of a Machine Extension. 830type MachineExtensionUpdatePropertiesModel struct { 831 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 832 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 833 // Publisher - The name of the extension handler publisher. 834 Publisher *string `json:"publisher,omitempty"` 835 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 836 Type *string `json:"type,omitempty"` 837 // TypeHandlerVersion - Specifies the version of the script handler. 838 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 839 // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. 840 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 841 // Settings - Json formatted public settings for the extension. 842 Settings interface{} `json:"settings,omitempty"` 843 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 844 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 845} 846 847// MachineIdentity ... 848type MachineIdentity struct { 849 // PrincipalID - READ-ONLY; The principal ID of resource identity. 850 PrincipalID *string `json:"principalId,omitempty"` 851 // TenantID - READ-ONLY; The tenant ID of resource. 852 TenantID *string `json:"tenantId,omitempty"` 853 // Type - The identity type. Possible values include: 'SystemAssigned' 854 Type ResourceIdentityType `json:"type,omitempty"` 855} 856 857// MarshalJSON is the custom marshaler for MachineIdentity. 858func (mVar MachineIdentity) MarshalJSON() ([]byte, error) { 859 objectMap := make(map[string]interface{}) 860 if mVar.Type != "" { 861 objectMap["type"] = mVar.Type 862 } 863 return json.Marshal(objectMap) 864} 865 866// MachineListResult the List hybrid machine operation response. 867type MachineListResult struct { 868 autorest.Response `json:"-"` 869 // Value - The list of hybrid machines. 870 Value *[]Machine `json:"value,omitempty"` 871 // NextLink - The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines. 872 NextLink *string `json:"nextLink,omitempty"` 873} 874 875// MachineListResultIterator provides access to a complete listing of Machine values. 876type MachineListResultIterator struct { 877 i int 878 page MachineListResultPage 879} 880 881// NextWithContext advances to the next value. If there was an error making 882// the request the iterator does not advance and the error is returned. 883func (iter *MachineListResultIterator) NextWithContext(ctx context.Context) (err error) { 884 if tracing.IsEnabled() { 885 ctx = tracing.StartSpan(ctx, fqdn+"/MachineListResultIterator.NextWithContext") 886 defer func() { 887 sc := -1 888 if iter.Response().Response.Response != nil { 889 sc = iter.Response().Response.Response.StatusCode 890 } 891 tracing.EndSpan(ctx, sc, err) 892 }() 893 } 894 iter.i++ 895 if iter.i < len(iter.page.Values()) { 896 return nil 897 } 898 err = iter.page.NextWithContext(ctx) 899 if err != nil { 900 iter.i-- 901 return err 902 } 903 iter.i = 0 904 return nil 905} 906 907// Next advances to the next value. If there was an error making 908// the request the iterator does not advance and the error is returned. 909// Deprecated: Use NextWithContext() instead. 910func (iter *MachineListResultIterator) Next() error { 911 return iter.NextWithContext(context.Background()) 912} 913 914// NotDone returns true if the enumeration should be started or is not yet complete. 915func (iter MachineListResultIterator) NotDone() bool { 916 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 917} 918 919// Response returns the raw server response from the last page request. 920func (iter MachineListResultIterator) Response() MachineListResult { 921 return iter.page.Response() 922} 923 924// Value returns the current value or a zero-initialized value if the 925// iterator has advanced beyond the end of the collection. 926func (iter MachineListResultIterator) Value() Machine { 927 if !iter.page.NotDone() { 928 return Machine{} 929 } 930 return iter.page.Values()[iter.i] 931} 932 933// Creates a new instance of the MachineListResultIterator type. 934func NewMachineListResultIterator(page MachineListResultPage) MachineListResultIterator { 935 return MachineListResultIterator{page: page} 936} 937 938// IsEmpty returns true if the ListResult contains no values. 939func (mlr MachineListResult) IsEmpty() bool { 940 return mlr.Value == nil || len(*mlr.Value) == 0 941} 942 943// hasNextLink returns true if the NextLink is not empty. 944func (mlr MachineListResult) hasNextLink() bool { 945 return mlr.NextLink != nil && len(*mlr.NextLink) != 0 946} 947 948// machineListResultPreparer prepares a request to retrieve the next set of results. 949// It returns nil if no more results exist. 950func (mlr MachineListResult) machineListResultPreparer(ctx context.Context) (*http.Request, error) { 951 if !mlr.hasNextLink() { 952 return nil, nil 953 } 954 return autorest.Prepare((&http.Request{}).WithContext(ctx), 955 autorest.AsJSON(), 956 autorest.AsGet(), 957 autorest.WithBaseURL(to.String(mlr.NextLink))) 958} 959 960// MachineListResultPage contains a page of Machine values. 961type MachineListResultPage struct { 962 fn func(context.Context, MachineListResult) (MachineListResult, error) 963 mlr MachineListResult 964} 965 966// NextWithContext advances to the next page of values. If there was an error making 967// the request the page does not advance and the error is returned. 968func (page *MachineListResultPage) NextWithContext(ctx context.Context) (err error) { 969 if tracing.IsEnabled() { 970 ctx = tracing.StartSpan(ctx, fqdn+"/MachineListResultPage.NextWithContext") 971 defer func() { 972 sc := -1 973 if page.Response().Response.Response != nil { 974 sc = page.Response().Response.Response.StatusCode 975 } 976 tracing.EndSpan(ctx, sc, err) 977 }() 978 } 979 for { 980 next, err := page.fn(ctx, page.mlr) 981 if err != nil { 982 return err 983 } 984 page.mlr = next 985 if !next.hasNextLink() || !next.IsEmpty() { 986 break 987 } 988 } 989 return nil 990} 991 992// Next advances to the next page of values. If there was an error making 993// the request the page does not advance and the error is returned. 994// Deprecated: Use NextWithContext() instead. 995func (page *MachineListResultPage) Next() error { 996 return page.NextWithContext(context.Background()) 997} 998 999// NotDone returns true if the page enumeration should be started or is not yet complete. 1000func (page MachineListResultPage) NotDone() bool { 1001 return !page.mlr.IsEmpty() 1002} 1003 1004// Response returns the raw server response from the last page request. 1005func (page MachineListResultPage) Response() MachineListResult { 1006 return page.mlr 1007} 1008 1009// Values returns the slice of values for the current page or nil if there are no values. 1010func (page MachineListResultPage) Values() []Machine { 1011 if page.mlr.IsEmpty() { 1012 return nil 1013 } 1014 return *page.mlr.Value 1015} 1016 1017// Creates a new instance of the MachineListResultPage type. 1018func NewMachineListResultPage(cur MachineListResult, getNextPage func(context.Context, MachineListResult) (MachineListResult, error)) MachineListResultPage { 1019 return MachineListResultPage{ 1020 fn: getNextPage, 1021 mlr: cur, 1022 } 1023} 1024 1025// MachineProperties describes the properties of a hybrid machine. 1026type MachineProperties struct { 1027 LocationData *LocationData `json:"locationData,omitempty"` 1028 // OsProfile - Specifies the operating system settings for the hybrid machine. 1029 OsProfile *MachinePropertiesOsProfile `json:"osProfile,omitempty"` 1030 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 1031 ProvisioningState *string `json:"provisioningState,omitempty"` 1032 // Status - READ-ONLY; The status of the hybrid machine agent. Possible values include: 'StatusTypesConnected', 'StatusTypesDisconnected', 'StatusTypesError' 1033 Status StatusTypes `json:"status,omitempty"` 1034 // LastStatusChange - READ-ONLY; The time of the last status change. 1035 LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` 1036 // ErrorDetails - READ-ONLY; Details about the error state. 1037 ErrorDetails *[]ErrorDetail `json:"errorDetails,omitempty"` 1038 // AgentVersion - READ-ONLY; The hybrid machine agent full version. 1039 AgentVersion *string `json:"agentVersion,omitempty"` 1040 // VMID - Specifies the hybrid machine unique ID. 1041 VMID *string `json:"vmId,omitempty"` 1042 // DisplayName - READ-ONLY; Specifies the hybrid machine display name. 1043 DisplayName *string `json:"displayName,omitempty"` 1044 // MachineFqdn - READ-ONLY; Specifies the hybrid machine FQDN. 1045 MachineFqdn *string `json:"machineFqdn,omitempty"` 1046 // ClientPublicKey - Public Key that the client provides to be used during initial resource onboarding 1047 ClientPublicKey *string `json:"clientPublicKey,omitempty"` 1048 // OsName - READ-ONLY; The Operating System running on the hybrid machine. 1049 OsName *string `json:"osName,omitempty"` 1050 // OsVersion - READ-ONLY; The version of Operating System running on the hybrid machine. 1051 OsVersion *string `json:"osVersion,omitempty"` 1052 // Extensions - Machine Extensions information 1053 Extensions *[]MachineExtensionInstanceView `json:"extensions,omitempty"` 1054} 1055 1056// MarshalJSON is the custom marshaler for MachineProperties. 1057func (mp MachineProperties) MarshalJSON() ([]byte, error) { 1058 objectMap := make(map[string]interface{}) 1059 if mp.LocationData != nil { 1060 objectMap["locationData"] = mp.LocationData 1061 } 1062 if mp.OsProfile != nil { 1063 objectMap["osProfile"] = mp.OsProfile 1064 } 1065 if mp.VMID != nil { 1066 objectMap["vmId"] = mp.VMID 1067 } 1068 if mp.ClientPublicKey != nil { 1069 objectMap["clientPublicKey"] = mp.ClientPublicKey 1070 } 1071 if mp.Extensions != nil { 1072 objectMap["extensions"] = mp.Extensions 1073 } 1074 return json.Marshal(objectMap) 1075} 1076 1077// MachinePropertiesModel hybrid Compute Machine properties 1078type MachinePropertiesModel struct { 1079 LocationData *LocationData `json:"locationData,omitempty"` 1080 // OsProfile - Specifies the operating system settings for the hybrid machine. 1081 OsProfile *MachinePropertiesOsProfile `json:"osProfile,omitempty"` 1082 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 1083 ProvisioningState *string `json:"provisioningState,omitempty"` 1084 // Status - READ-ONLY; The status of the hybrid machine agent. Possible values include: 'StatusTypesConnected', 'StatusTypesDisconnected', 'StatusTypesError' 1085 Status StatusTypes `json:"status,omitempty"` 1086 // LastStatusChange - READ-ONLY; The time of the last status change. 1087 LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` 1088 // ErrorDetails - READ-ONLY; Details about the error state. 1089 ErrorDetails *[]ErrorDetail `json:"errorDetails,omitempty"` 1090 // AgentVersion - READ-ONLY; The hybrid machine agent full version. 1091 AgentVersion *string `json:"agentVersion,omitempty"` 1092 // VMID - Specifies the hybrid machine unique ID. 1093 VMID *string `json:"vmId,omitempty"` 1094 // DisplayName - READ-ONLY; Specifies the hybrid machine display name. 1095 DisplayName *string `json:"displayName,omitempty"` 1096 // MachineFqdn - READ-ONLY; Specifies the hybrid machine FQDN. 1097 MachineFqdn *string `json:"machineFqdn,omitempty"` 1098 // ClientPublicKey - Public Key that the client provides to be used during initial resource onboarding 1099 ClientPublicKey *string `json:"clientPublicKey,omitempty"` 1100 // OsName - READ-ONLY; The Operating System running on the hybrid machine. 1101 OsName *string `json:"osName,omitempty"` 1102 // OsVersion - READ-ONLY; The version of Operating System running on the hybrid machine. 1103 OsVersion *string `json:"osVersion,omitempty"` 1104 // Extensions - Machine Extensions information 1105 Extensions *[]MachineExtensionInstanceView `json:"extensions,omitempty"` 1106} 1107 1108// MarshalJSON is the custom marshaler for MachinePropertiesModel. 1109func (mpm MachinePropertiesModel) MarshalJSON() ([]byte, error) { 1110 objectMap := make(map[string]interface{}) 1111 if mpm.LocationData != nil { 1112 objectMap["locationData"] = mpm.LocationData 1113 } 1114 if mpm.OsProfile != nil { 1115 objectMap["osProfile"] = mpm.OsProfile 1116 } 1117 if mpm.VMID != nil { 1118 objectMap["vmId"] = mpm.VMID 1119 } 1120 if mpm.ClientPublicKey != nil { 1121 objectMap["clientPublicKey"] = mpm.ClientPublicKey 1122 } 1123 if mpm.Extensions != nil { 1124 objectMap["extensions"] = mpm.Extensions 1125 } 1126 return json.Marshal(objectMap) 1127} 1128 1129// MachinePropertiesOsProfile specifies the operating system settings for the hybrid machine. 1130type MachinePropertiesOsProfile struct { 1131 // ComputerName - READ-ONLY; Specifies the host OS name of the hybrid machine. 1132 ComputerName *string `json:"computerName,omitempty"` 1133} 1134 1135// MarshalJSON is the custom marshaler for MachinePropertiesOsProfile. 1136func (mpP MachinePropertiesOsProfile) MarshalJSON() ([]byte, error) { 1137 objectMap := make(map[string]interface{}) 1138 return json.Marshal(objectMap) 1139} 1140 1141// MachineReconnect describes a hybrid machine reconnect. 1142type MachineReconnect struct { 1143 // MachineReconnectPropertiesModel - Hybrid Compute Machine properties 1144 *MachineReconnectPropertiesModel `json:"properties,omitempty"` 1145} 1146 1147// MarshalJSON is the custom marshaler for MachineReconnect. 1148func (mr MachineReconnect) MarshalJSON() ([]byte, error) { 1149 objectMap := make(map[string]interface{}) 1150 if mr.MachineReconnectPropertiesModel != nil { 1151 objectMap["properties"] = mr.MachineReconnectPropertiesModel 1152 } 1153 return json.Marshal(objectMap) 1154} 1155 1156// UnmarshalJSON is the custom unmarshaler for MachineReconnect struct. 1157func (mr *MachineReconnect) UnmarshalJSON(body []byte) error { 1158 var m map[string]*json.RawMessage 1159 err := json.Unmarshal(body, &m) 1160 if err != nil { 1161 return err 1162 } 1163 for k, v := range m { 1164 switch k { 1165 case "properties": 1166 if v != nil { 1167 var machineReconnectPropertiesModel MachineReconnectPropertiesModel 1168 err = json.Unmarshal(*v, &machineReconnectPropertiesModel) 1169 if err != nil { 1170 return err 1171 } 1172 mr.MachineReconnectPropertiesModel = &machineReconnectPropertiesModel 1173 } 1174 } 1175 } 1176 1177 return nil 1178} 1179 1180// MachineReconnectProperties describes the properties required to reconnect a hybrid machine. 1181type MachineReconnectProperties struct { 1182 // VMID - Specifies the hybrid machine unique ID. 1183 VMID *string `json:"vmId,omitempty"` 1184 // ClientPublicKey - Public Key that the client provides to be used during initial resource onboarding. 1185 ClientPublicKey *string `json:"clientPublicKey,omitempty"` 1186} 1187 1188// MachineReconnectPropertiesModel hybrid Compute Machine properties 1189type MachineReconnectPropertiesModel struct { 1190 // VMID - Specifies the hybrid machine unique ID. 1191 VMID *string `json:"vmId,omitempty"` 1192 // ClientPublicKey - Public Key that the client provides to be used during initial resource onboarding. 1193 ClientPublicKey *string `json:"clientPublicKey,omitempty"` 1194} 1195 1196// MachineUpdate describes a hybrid machine Update. 1197type MachineUpdate struct { 1198 // MachineUpdateIdentity - Hybrid Compute Machine Managed Identity 1199 *MachineUpdateIdentity `json:"identity,omitempty"` 1200 // MachineUpdatePropertiesModel - Hybrid Compute Machine properties 1201 *MachineUpdatePropertiesModel `json:"properties,omitempty"` 1202 // Tags - Resource tags 1203 Tags map[string]*string `json:"tags"` 1204} 1205 1206// MarshalJSON is the custom marshaler for MachineUpdate. 1207func (mu MachineUpdate) MarshalJSON() ([]byte, error) { 1208 objectMap := make(map[string]interface{}) 1209 if mu.MachineUpdateIdentity != nil { 1210 objectMap["identity"] = mu.MachineUpdateIdentity 1211 } 1212 if mu.MachineUpdatePropertiesModel != nil { 1213 objectMap["properties"] = mu.MachineUpdatePropertiesModel 1214 } 1215 if mu.Tags != nil { 1216 objectMap["tags"] = mu.Tags 1217 } 1218 return json.Marshal(objectMap) 1219} 1220 1221// UnmarshalJSON is the custom unmarshaler for MachineUpdate struct. 1222func (mu *MachineUpdate) UnmarshalJSON(body []byte) error { 1223 var m map[string]*json.RawMessage 1224 err := json.Unmarshal(body, &m) 1225 if err != nil { 1226 return err 1227 } 1228 for k, v := range m { 1229 switch k { 1230 case "identity": 1231 if v != nil { 1232 var machineUpdateIdentity MachineUpdateIdentity 1233 err = json.Unmarshal(*v, &machineUpdateIdentity) 1234 if err != nil { 1235 return err 1236 } 1237 mu.MachineUpdateIdentity = &machineUpdateIdentity 1238 } 1239 case "properties": 1240 if v != nil { 1241 var machineUpdatePropertiesModel MachineUpdatePropertiesModel 1242 err = json.Unmarshal(*v, &machineUpdatePropertiesModel) 1243 if err != nil { 1244 return err 1245 } 1246 mu.MachineUpdatePropertiesModel = &machineUpdatePropertiesModel 1247 } 1248 case "tags": 1249 if v != nil { 1250 var tags map[string]*string 1251 err = json.Unmarshal(*v, &tags) 1252 if err != nil { 1253 return err 1254 } 1255 mu.Tags = tags 1256 } 1257 } 1258 } 1259 1260 return nil 1261} 1262 1263// MachineUpdateIdentity hybrid Compute Machine Managed Identity 1264type MachineUpdateIdentity struct { 1265 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1266 PrincipalID *string `json:"principalId,omitempty"` 1267 // TenantID - READ-ONLY; The tenant ID of resource. 1268 TenantID *string `json:"tenantId,omitempty"` 1269 // Type - The identity type. Possible values include: 'SystemAssigned' 1270 Type ResourceIdentityType `json:"type,omitempty"` 1271} 1272 1273// MarshalJSON is the custom marshaler for MachineUpdateIdentity. 1274func (mu MachineUpdateIdentity) MarshalJSON() ([]byte, error) { 1275 objectMap := make(map[string]interface{}) 1276 if mu.Type != "" { 1277 objectMap["type"] = mu.Type 1278 } 1279 return json.Marshal(objectMap) 1280} 1281 1282// MachineUpdateProperties describes the ARM updatable properties of a hybrid machine. 1283type MachineUpdateProperties struct { 1284 LocationData *LocationData `json:"locationData,omitempty"` 1285} 1286 1287// MachineUpdatePropertiesModel hybrid Compute Machine properties 1288type MachineUpdatePropertiesModel struct { 1289 LocationData *LocationData `json:"locationData,omitempty"` 1290} 1291 1292// OperationListResult the List Compute Operation operation response. 1293type OperationListResult struct { 1294 autorest.Response `json:"-"` 1295 // Value - READ-ONLY; The list of compute operations 1296 Value *[]OperationValue `json:"value,omitempty"` 1297} 1298 1299// MarshalJSON is the custom marshaler for OperationListResult. 1300func (olr OperationListResult) MarshalJSON() ([]byte, error) { 1301 objectMap := make(map[string]interface{}) 1302 return json.Marshal(objectMap) 1303} 1304 1305// OperationValue describes the properties of a Compute Operation value. 1306type OperationValue struct { 1307 // Origin - READ-ONLY; The origin of the compute operation. 1308 Origin *string `json:"origin,omitempty"` 1309 // Name - READ-ONLY; The name of the compute operation. 1310 Name *string `json:"name,omitempty"` 1311 // OperationValueDisplay - Display properties 1312 *OperationValueDisplay `json:"display,omitempty"` 1313} 1314 1315// MarshalJSON is the custom marshaler for OperationValue. 1316func (ov OperationValue) MarshalJSON() ([]byte, error) { 1317 objectMap := make(map[string]interface{}) 1318 if ov.OperationValueDisplay != nil { 1319 objectMap["display"] = ov.OperationValueDisplay 1320 } 1321 return json.Marshal(objectMap) 1322} 1323 1324// UnmarshalJSON is the custom unmarshaler for OperationValue struct. 1325func (ov *OperationValue) UnmarshalJSON(body []byte) error { 1326 var m map[string]*json.RawMessage 1327 err := json.Unmarshal(body, &m) 1328 if err != nil { 1329 return err 1330 } 1331 for k, v := range m { 1332 switch k { 1333 case "origin": 1334 if v != nil { 1335 var origin string 1336 err = json.Unmarshal(*v, &origin) 1337 if err != nil { 1338 return err 1339 } 1340 ov.Origin = &origin 1341 } 1342 case "name": 1343 if v != nil { 1344 var name string 1345 err = json.Unmarshal(*v, &name) 1346 if err != nil { 1347 return err 1348 } 1349 ov.Name = &name 1350 } 1351 case "display": 1352 if v != nil { 1353 var operationValueDisplay OperationValueDisplay 1354 err = json.Unmarshal(*v, &operationValueDisplay) 1355 if err != nil { 1356 return err 1357 } 1358 ov.OperationValueDisplay = &operationValueDisplay 1359 } 1360 } 1361 } 1362 1363 return nil 1364} 1365 1366// OperationValueDisplay display properties 1367type OperationValueDisplay struct { 1368 // Operation - READ-ONLY; The display name of the compute operation. 1369 Operation *string `json:"operation,omitempty"` 1370 // Resource - READ-ONLY; The display name of the resource the operation applies to. 1371 Resource *string `json:"resource,omitempty"` 1372 // Description - READ-ONLY; The description of the operation. 1373 Description *string `json:"description,omitempty"` 1374 // Provider - READ-ONLY; The resource provider for the operation. 1375 Provider *string `json:"provider,omitempty"` 1376} 1377 1378// MarshalJSON is the custom marshaler for OperationValueDisplay. 1379func (ov OperationValueDisplay) MarshalJSON() ([]byte, error) { 1380 objectMap := make(map[string]interface{}) 1381 return json.Marshal(objectMap) 1382} 1383 1384// OperationValueDisplayModel describes the properties of a Hybrid Compute Operation Value Display. 1385type OperationValueDisplayModel struct { 1386 // Operation - READ-ONLY; The display name of the compute operation. 1387 Operation *string `json:"operation,omitempty"` 1388 // Resource - READ-ONLY; The display name of the resource the operation applies to. 1389 Resource *string `json:"resource,omitempty"` 1390 // Description - READ-ONLY; The description of the operation. 1391 Description *string `json:"description,omitempty"` 1392 // Provider - READ-ONLY; The resource provider for the operation. 1393 Provider *string `json:"provider,omitempty"` 1394} 1395 1396// MarshalJSON is the custom marshaler for OperationValueDisplayModel. 1397func (ovdm OperationValueDisplayModel) MarshalJSON() ([]byte, error) { 1398 objectMap := make(map[string]interface{}) 1399 return json.Marshal(objectMap) 1400} 1401 1402// OSProfile specifies the operating system settings for the hybrid machine. 1403type OSProfile struct { 1404 // ComputerName - READ-ONLY; Specifies the host OS name of the hybrid machine. 1405 ComputerName *string `json:"computerName,omitempty"` 1406} 1407 1408// MarshalJSON is the custom marshaler for OSProfile. 1409func (op OSProfile) MarshalJSON() ([]byte, error) { 1410 objectMap := make(map[string]interface{}) 1411 return json.Marshal(objectMap) 1412} 1413 1414// Plan plan for the resource. 1415type Plan struct { 1416 // Name - A user defined name of the 3rd Party Artifact that is being procured. 1417 Name *string `json:"name,omitempty"` 1418 // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic 1419 Publisher *string `json:"publisher,omitempty"` 1420 // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. 1421 Product *string `json:"product,omitempty"` 1422 // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. 1423 PromotionCode *string `json:"promotionCode,omitempty"` 1424 // Version - The version of the desired product/artifact. 1425 Version *string `json:"version,omitempty"` 1426} 1427 1428// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 1429// have tags and a location 1430type ProxyResource struct { 1431 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1432 ID *string `json:"id,omitempty"` 1433 // Name - READ-ONLY; The name of the resource 1434 Name *string `json:"name,omitempty"` 1435 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1436 Type *string `json:"type,omitempty"` 1437} 1438 1439// MarshalJSON is the custom marshaler for ProxyResource. 1440func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1441 objectMap := make(map[string]interface{}) 1442 return json.Marshal(objectMap) 1443} 1444 1445// Resource common fields that are returned in the response for all Azure Resource Manager resources 1446type Resource struct { 1447 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1448 ID *string `json:"id,omitempty"` 1449 // Name - READ-ONLY; The name of the resource 1450 Name *string `json:"name,omitempty"` 1451 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1452 Type *string `json:"type,omitempty"` 1453} 1454 1455// MarshalJSON is the custom marshaler for Resource. 1456func (r Resource) MarshalJSON() ([]byte, error) { 1457 objectMap := make(map[string]interface{}) 1458 return json.Marshal(objectMap) 1459} 1460 1461// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed 1462// properties for a resource. Except properties bag, there cannot be a top level property outside of this 1463// set. 1464type ResourceModelWithAllowedPropertySet struct { 1465 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1466 ID *string `json:"id,omitempty"` 1467 // Name - READ-ONLY; The name of the resource 1468 Name *string `json:"name,omitempty"` 1469 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1470 Type *string `json:"type,omitempty"` 1471 // Location - The geo-location where the resource lives 1472 Location *string `json:"location,omitempty"` 1473 // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. 1474 ManagedBy *string `json:"managedBy,omitempty"` 1475 // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 1476 Kind *string `json:"kind,omitempty"` 1477 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 1478 Etag *string `json:"etag,omitempty"` 1479 // Tags - Resource tags. 1480 Tags map[string]*string `json:"tags"` 1481 Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` 1482 Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` 1483 Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` 1484} 1485 1486// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. 1487func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { 1488 objectMap := make(map[string]interface{}) 1489 if rmwaps.Location != nil { 1490 objectMap["location"] = rmwaps.Location 1491 } 1492 if rmwaps.ManagedBy != nil { 1493 objectMap["managedBy"] = rmwaps.ManagedBy 1494 } 1495 if rmwaps.Kind != nil { 1496 objectMap["kind"] = rmwaps.Kind 1497 } 1498 if rmwaps.Tags != nil { 1499 objectMap["tags"] = rmwaps.Tags 1500 } 1501 if rmwaps.Identity != nil { 1502 objectMap["identity"] = rmwaps.Identity 1503 } 1504 if rmwaps.Sku != nil { 1505 objectMap["sku"] = rmwaps.Sku 1506 } 1507 if rmwaps.Plan != nil { 1508 objectMap["plan"] = rmwaps.Plan 1509 } 1510 return json.Marshal(objectMap) 1511} 1512 1513// ResourceModelWithAllowedPropertySetIdentity ... 1514type ResourceModelWithAllowedPropertySetIdentity struct { 1515 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1516 PrincipalID *string `json:"principalId,omitempty"` 1517 // TenantID - READ-ONLY; The tenant ID of resource. 1518 TenantID *string `json:"tenantId,omitempty"` 1519 // Type - The identity type. Possible values include: 'SystemAssigned' 1520 Type ResourceIdentityType `json:"type,omitempty"` 1521} 1522 1523// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. 1524func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { 1525 objectMap := make(map[string]interface{}) 1526 if rmwaps.Type != "" { 1527 objectMap["type"] = rmwaps.Type 1528 } 1529 return json.Marshal(objectMap) 1530} 1531 1532// ResourceModelWithAllowedPropertySetPlan ... 1533type ResourceModelWithAllowedPropertySetPlan struct { 1534 // Name - A user defined name of the 3rd Party Artifact that is being procured. 1535 Name *string `json:"name,omitempty"` 1536 // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic 1537 Publisher *string `json:"publisher,omitempty"` 1538 // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. 1539 Product *string `json:"product,omitempty"` 1540 // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. 1541 PromotionCode *string `json:"promotionCode,omitempty"` 1542 // Version - The version of the desired product/artifact. 1543 Version *string `json:"version,omitempty"` 1544} 1545 1546// ResourceModelWithAllowedPropertySetSku ... 1547type ResourceModelWithAllowedPropertySetSku struct { 1548 // Name - The name of the SKU. Ex - P3. It is typically a letter+number code 1549 Name *string `json:"name,omitempty"` 1550 // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' 1551 Tier SkuTier `json:"tier,omitempty"` 1552 // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. 1553 Size *string `json:"size,omitempty"` 1554 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 1555 Family *string `json:"family,omitempty"` 1556 // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. 1557 Capacity *int32 `json:"capacity,omitempty"` 1558} 1559 1560// Sku the resource model definition representing SKU 1561type Sku struct { 1562 // Name - The name of the SKU. Ex - P3. It is typically a letter+number code 1563 Name *string `json:"name,omitempty"` 1564 // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' 1565 Tier SkuTier `json:"tier,omitempty"` 1566 // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. 1567 Size *string `json:"size,omitempty"` 1568 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 1569 Family *string `json:"family,omitempty"` 1570 // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. 1571 Capacity *int32 `json:"capacity,omitempty"` 1572} 1573 1574// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 1575// which has 'tags' and a 'location' 1576type TrackedResource struct { 1577 // Tags - Resource tags. 1578 Tags map[string]*string `json:"tags"` 1579 // Location - The geo-location where the resource lives 1580 Location *string `json:"location,omitempty"` 1581 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1582 ID *string `json:"id,omitempty"` 1583 // Name - READ-ONLY; The name of the resource 1584 Name *string `json:"name,omitempty"` 1585 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1586 Type *string `json:"type,omitempty"` 1587} 1588 1589// MarshalJSON is the custom marshaler for TrackedResource. 1590func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1591 objectMap := make(map[string]interface{}) 1592 if tr.Tags != nil { 1593 objectMap["tags"] = tr.Tags 1594 } 1595 if tr.Location != nil { 1596 objectMap["location"] = tr.Location 1597 } 1598 return json.Marshal(objectMap) 1599} 1600 1601// UpdateResource the Update Resource model definition. 1602type UpdateResource struct { 1603 // Tags - Resource tags 1604 Tags map[string]*string `json:"tags"` 1605} 1606 1607// MarshalJSON is the custom marshaler for UpdateResource. 1608func (ur UpdateResource) MarshalJSON() ([]byte, error) { 1609 objectMap := make(map[string]interface{}) 1610 if ur.Tags != nil { 1611 objectMap["tags"] = ur.Tags 1612 } 1613 return json.Marshal(objectMap) 1614} 1615