1package resources 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/resources/mgmt/2018-05-01/resources" 22 23// AliasPathType the type of the paths for alias. 24type AliasPathType struct { 25 // Path - The path of an alias. 26 Path *string `json:"path,omitempty"` 27 // APIVersions - The API versions. 28 APIVersions *[]string `json:"apiVersions,omitempty"` 29} 30 31// AliasType the alias type. 32type AliasType struct { 33 // Name - The alias name. 34 Name *string `json:"name,omitempty"` 35 // Paths - The paths for an alias. 36 Paths *[]AliasPathType `json:"paths,omitempty"` 37} 38 39// BasicDependency deployment dependency information. 40type BasicDependency struct { 41 // ID - The ID of the dependency. 42 ID *string `json:"id,omitempty"` 43 // ResourceType - The dependency resource type. 44 ResourceType *string `json:"resourceType,omitempty"` 45 // ResourceName - The dependency resource name. 46 ResourceName *string `json:"resourceName,omitempty"` 47} 48 49// CloudError an error response for a resource management request. 50type CloudError struct { 51 Error *ErrorResponse `json:"error,omitempty"` 52} 53 54// CreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running 55// operation. 56type CreateOrUpdateByIDFuture struct { 57 azure.FutureAPI 58 // Result returns the result of the asynchronous operation. 59 // If the operation has not completed it will return an error. 60 Result func(Client) (GenericResource, error) 61} 62 63// UnmarshalJSON is the custom unmarshaller for CreateFuture. 64func (future *CreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error { 65 var azFuture azure.Future 66 if err := json.Unmarshal(body, &azFuture); err != nil { 67 return err 68 } 69 future.FutureAPI = &azFuture 70 future.Result = future.result 71 return nil 72} 73 74// result is the default implementation for CreateOrUpdateByIDFuture.Result. 75func (future *CreateOrUpdateByIDFuture) result(client Client) (gr GenericResource, err error) { 76 var done bool 77 done, err = future.DoneWithContext(context.Background(), client) 78 if err != nil { 79 err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure") 80 return 81 } 82 if !done { 83 gr.Response.Response = future.Response() 84 err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") 85 return 86 } 87 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 88 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 89 gr, err = client.CreateOrUpdateByIDResponder(gr.Response.Response) 90 if err != nil { 91 err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") 92 } 93 } 94 return 95} 96 97// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 98// operation. 99type CreateOrUpdateFuture struct { 100 azure.FutureAPI 101 // Result returns the result of the asynchronous operation. 102 // If the operation has not completed it will return an error. 103 Result func(Client) (GenericResource, error) 104} 105 106// UnmarshalJSON is the custom unmarshaller for CreateFuture. 107func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 108 var azFuture azure.Future 109 if err := json.Unmarshal(body, &azFuture); err != nil { 110 return err 111 } 112 future.FutureAPI = &azFuture 113 future.Result = future.result 114 return nil 115} 116 117// result is the default implementation for CreateOrUpdateFuture.Result. 118func (future *CreateOrUpdateFuture) result(client Client) (gr GenericResource, err error) { 119 var done bool 120 done, err = future.DoneWithContext(context.Background(), client) 121 if err != nil { 122 err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 123 return 124 } 125 if !done { 126 gr.Response.Response = future.Response() 127 err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") 128 return 129 } 130 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 131 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 132 gr, err = client.CreateOrUpdateResponder(gr.Response.Response) 133 if err != nil { 134 err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") 135 } 136 } 137 return 138} 139 140// DebugSetting ... 141type DebugSetting struct { 142 // DetailLevel - Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. 143 DetailLevel *string `json:"detailLevel,omitempty"` 144} 145 146// DeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. 147type DeleteByIDFuture struct { 148 azure.FutureAPI 149 // Result returns the result of the asynchronous operation. 150 // If the operation has not completed it will return an error. 151 Result func(Client) (autorest.Response, error) 152} 153 154// UnmarshalJSON is the custom unmarshaller for CreateFuture. 155func (future *DeleteByIDFuture) UnmarshalJSON(body []byte) error { 156 var azFuture azure.Future 157 if err := json.Unmarshal(body, &azFuture); err != nil { 158 return err 159 } 160 future.FutureAPI = &azFuture 161 future.Result = future.result 162 return nil 163} 164 165// result is the default implementation for DeleteByIDFuture.Result. 166func (future *DeleteByIDFuture) result(client Client) (ar autorest.Response, err error) { 167 var done bool 168 done, err = future.DoneWithContext(context.Background(), client) 169 if err != nil { 170 err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", future.Response(), "Polling failure") 171 return 172 } 173 if !done { 174 ar.Response = future.Response() 175 err = azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") 176 return 177 } 178 ar.Response = future.Response() 179 return 180} 181 182// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 183type DeleteFuture struct { 184 azure.FutureAPI 185 // Result returns the result of the asynchronous operation. 186 // If the operation has not completed it will return an error. 187 Result func(Client) (autorest.Response, error) 188} 189 190// UnmarshalJSON is the custom unmarshaller for CreateFuture. 191func (future *DeleteFuture) UnmarshalJSON(body []byte) error { 192 var azFuture azure.Future 193 if err := json.Unmarshal(body, &azFuture); err != nil { 194 return err 195 } 196 future.FutureAPI = &azFuture 197 future.Result = future.result 198 return nil 199} 200 201// result is the default implementation for DeleteFuture.Result. 202func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { 203 var done bool 204 done, err = future.DoneWithContext(context.Background(), client) 205 if err != nil { 206 err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", future.Response(), "Polling failure") 207 return 208 } 209 if !done { 210 ar.Response = future.Response() 211 err = azure.NewAsyncOpIncompleteError("resources.DeleteFuture") 212 return 213 } 214 ar.Response = future.Response() 215 return 216} 217 218// Dependency deployment dependency information. 219type Dependency struct { 220 // DependsOn - The list of dependencies. 221 DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` 222 // ID - The ID of the dependency. 223 ID *string `json:"id,omitempty"` 224 // ResourceType - The dependency resource type. 225 ResourceType *string `json:"resourceType,omitempty"` 226 // ResourceName - The dependency resource name. 227 ResourceName *string `json:"resourceName,omitempty"` 228} 229 230// Deployment deployment operation parameters. 231type Deployment struct { 232 // Location - The location to store the deployment data. 233 Location *string `json:"location,omitempty"` 234 // Properties - The deployment properties. 235 Properties *DeploymentProperties `json:"properties,omitempty"` 236} 237 238// DeploymentExportResult the deployment export result. 239type DeploymentExportResult struct { 240 autorest.Response `json:"-"` 241 // Template - The template content. 242 Template interface{} `json:"template,omitempty"` 243} 244 245// DeploymentExtended deployment information. 246type DeploymentExtended struct { 247 autorest.Response `json:"-"` 248 // ID - READ-ONLY; The ID of the deployment. 249 ID *string `json:"id,omitempty"` 250 // Name - READ-ONLY; The name of the deployment. 251 Name *string `json:"name,omitempty"` 252 // Type - READ-ONLY; The type of the deployment. 253 Type *string `json:"type,omitempty"` 254 // Location - the location of the deployment. 255 Location *string `json:"location,omitempty"` 256 // Properties - Deployment properties. 257 Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` 258} 259 260// MarshalJSON is the custom marshaler for DeploymentExtended. 261func (de DeploymentExtended) MarshalJSON() ([]byte, error) { 262 objectMap := make(map[string]interface{}) 263 if de.Location != nil { 264 objectMap["location"] = de.Location 265 } 266 if de.Properties != nil { 267 objectMap["properties"] = de.Properties 268 } 269 return json.Marshal(objectMap) 270} 271 272// DeploymentExtendedFilter deployment filter. 273type DeploymentExtendedFilter struct { 274 // ProvisioningState - The provisioning state. 275 ProvisioningState *string `json:"provisioningState,omitempty"` 276} 277 278// DeploymentListResult list of deployments. 279type DeploymentListResult struct { 280 autorest.Response `json:"-"` 281 // Value - An array of deployments. 282 Value *[]DeploymentExtended `json:"value,omitempty"` 283 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 284 NextLink *string `json:"nextLink,omitempty"` 285} 286 287// MarshalJSON is the custom marshaler for DeploymentListResult. 288func (dlr DeploymentListResult) MarshalJSON() ([]byte, error) { 289 objectMap := make(map[string]interface{}) 290 if dlr.Value != nil { 291 objectMap["value"] = dlr.Value 292 } 293 return json.Marshal(objectMap) 294} 295 296// DeploymentListResultIterator provides access to a complete listing of DeploymentExtended values. 297type DeploymentListResultIterator struct { 298 i int 299 page DeploymentListResultPage 300} 301 302// NextWithContext advances to the next value. If there was an error making 303// the request the iterator does not advance and the error is returned. 304func (iter *DeploymentListResultIterator) NextWithContext(ctx context.Context) (err error) { 305 if tracing.IsEnabled() { 306 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultIterator.NextWithContext") 307 defer func() { 308 sc := -1 309 if iter.Response().Response.Response != nil { 310 sc = iter.Response().Response.Response.StatusCode 311 } 312 tracing.EndSpan(ctx, sc, err) 313 }() 314 } 315 iter.i++ 316 if iter.i < len(iter.page.Values()) { 317 return nil 318 } 319 err = iter.page.NextWithContext(ctx) 320 if err != nil { 321 iter.i-- 322 return err 323 } 324 iter.i = 0 325 return nil 326} 327 328// Next advances to the next value. If there was an error making 329// the request the iterator does not advance and the error is returned. 330// Deprecated: Use NextWithContext() instead. 331func (iter *DeploymentListResultIterator) Next() error { 332 return iter.NextWithContext(context.Background()) 333} 334 335// NotDone returns true if the enumeration should be started or is not yet complete. 336func (iter DeploymentListResultIterator) NotDone() bool { 337 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 338} 339 340// Response returns the raw server response from the last page request. 341func (iter DeploymentListResultIterator) Response() DeploymentListResult { 342 return iter.page.Response() 343} 344 345// Value returns the current value or a zero-initialized value if the 346// iterator has advanced beyond the end of the collection. 347func (iter DeploymentListResultIterator) Value() DeploymentExtended { 348 if !iter.page.NotDone() { 349 return DeploymentExtended{} 350 } 351 return iter.page.Values()[iter.i] 352} 353 354// Creates a new instance of the DeploymentListResultIterator type. 355func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { 356 return DeploymentListResultIterator{page: page} 357} 358 359// IsEmpty returns true if the ListResult contains no values. 360func (dlr DeploymentListResult) IsEmpty() bool { 361 return dlr.Value == nil || len(*dlr.Value) == 0 362} 363 364// hasNextLink returns true if the NextLink is not empty. 365func (dlr DeploymentListResult) hasNextLink() bool { 366 return dlr.NextLink != nil && len(*dlr.NextLink) != 0 367} 368 369// deploymentListResultPreparer prepares a request to retrieve the next set of results. 370// It returns nil if no more results exist. 371func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) { 372 if !dlr.hasNextLink() { 373 return nil, nil 374 } 375 return autorest.Prepare((&http.Request{}).WithContext(ctx), 376 autorest.AsJSON(), 377 autorest.AsGet(), 378 autorest.WithBaseURL(to.String(dlr.NextLink))) 379} 380 381// DeploymentListResultPage contains a page of DeploymentExtended values. 382type DeploymentListResultPage struct { 383 fn func(context.Context, DeploymentListResult) (DeploymentListResult, error) 384 dlr DeploymentListResult 385} 386 387// NextWithContext advances to the next page of values. If there was an error making 388// the request the page does not advance and the error is returned. 389func (page *DeploymentListResultPage) NextWithContext(ctx context.Context) (err error) { 390 if tracing.IsEnabled() { 391 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultPage.NextWithContext") 392 defer func() { 393 sc := -1 394 if page.Response().Response.Response != nil { 395 sc = page.Response().Response.Response.StatusCode 396 } 397 tracing.EndSpan(ctx, sc, err) 398 }() 399 } 400 for { 401 next, err := page.fn(ctx, page.dlr) 402 if err != nil { 403 return err 404 } 405 page.dlr = next 406 if !next.hasNextLink() || !next.IsEmpty() { 407 break 408 } 409 } 410 return nil 411} 412 413// Next advances to the next page of values. If there was an error making 414// the request the page does not advance and the error is returned. 415// Deprecated: Use NextWithContext() instead. 416func (page *DeploymentListResultPage) Next() error { 417 return page.NextWithContext(context.Background()) 418} 419 420// NotDone returns true if the page enumeration should be started or is not yet complete. 421func (page DeploymentListResultPage) NotDone() bool { 422 return !page.dlr.IsEmpty() 423} 424 425// Response returns the raw server response from the last page request. 426func (page DeploymentListResultPage) Response() DeploymentListResult { 427 return page.dlr 428} 429 430// Values returns the slice of values for the current page or nil if there are no values. 431func (page DeploymentListResultPage) Values() []DeploymentExtended { 432 if page.dlr.IsEmpty() { 433 return nil 434 } 435 return *page.dlr.Value 436} 437 438// Creates a new instance of the DeploymentListResultPage type. 439func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { 440 return DeploymentListResultPage{ 441 fn: getNextPage, 442 dlr: cur, 443 } 444} 445 446// DeploymentOperation deployment operation information. 447type DeploymentOperation struct { 448 autorest.Response `json:"-"` 449 // ID - READ-ONLY; Full deployment operation ID. 450 ID *string `json:"id,omitempty"` 451 // OperationID - READ-ONLY; Deployment operation ID. 452 OperationID *string `json:"operationId,omitempty"` 453 // Properties - Deployment properties. 454 Properties *DeploymentOperationProperties `json:"properties,omitempty"` 455} 456 457// MarshalJSON is the custom marshaler for DeploymentOperation. 458func (do DeploymentOperation) MarshalJSON() ([]byte, error) { 459 objectMap := make(map[string]interface{}) 460 if do.Properties != nil { 461 objectMap["properties"] = do.Properties 462 } 463 return json.Marshal(objectMap) 464} 465 466// DeploymentOperationProperties deployment operation properties. 467type DeploymentOperationProperties struct { 468 // ProvisioningState - READ-ONLY; The state of the provisioning. 469 ProvisioningState *string `json:"provisioningState,omitempty"` 470 // Timestamp - READ-ONLY; The date and time of the operation. 471 Timestamp *date.Time `json:"timestamp,omitempty"` 472 // ServiceRequestID - READ-ONLY; Deployment operation service request id. 473 ServiceRequestID *string `json:"serviceRequestId,omitempty"` 474 // StatusCode - READ-ONLY; Operation status code. 475 StatusCode *string `json:"statusCode,omitempty"` 476 // StatusMessage - READ-ONLY; Operation status message. 477 StatusMessage interface{} `json:"statusMessage,omitempty"` 478 // TargetResource - READ-ONLY; The target resource. 479 TargetResource *TargetResource `json:"targetResource,omitempty"` 480 // Request - READ-ONLY; The HTTP request message. 481 Request *HTTPMessage `json:"request,omitempty"` 482 // Response - READ-ONLY; The HTTP response message. 483 Response *HTTPMessage `json:"response,omitempty"` 484} 485 486// MarshalJSON is the custom marshaler for DeploymentOperationProperties. 487func (dop DeploymentOperationProperties) MarshalJSON() ([]byte, error) { 488 objectMap := make(map[string]interface{}) 489 return json.Marshal(objectMap) 490} 491 492// DeploymentOperationsListResult list of deployment operations. 493type DeploymentOperationsListResult struct { 494 autorest.Response `json:"-"` 495 // Value - An array of deployment operations. 496 Value *[]DeploymentOperation `json:"value,omitempty"` 497 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 498 NextLink *string `json:"nextLink,omitempty"` 499} 500 501// MarshalJSON is the custom marshaler for DeploymentOperationsListResult. 502func (dolr DeploymentOperationsListResult) MarshalJSON() ([]byte, error) { 503 objectMap := make(map[string]interface{}) 504 if dolr.Value != nil { 505 objectMap["value"] = dolr.Value 506 } 507 return json.Marshal(objectMap) 508} 509 510// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation 511// values. 512type DeploymentOperationsListResultIterator struct { 513 i int 514 page DeploymentOperationsListResultPage 515} 516 517// NextWithContext advances to the next value. If there was an error making 518// the request the iterator does not advance and the error is returned. 519func (iter *DeploymentOperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { 520 if tracing.IsEnabled() { 521 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultIterator.NextWithContext") 522 defer func() { 523 sc := -1 524 if iter.Response().Response.Response != nil { 525 sc = iter.Response().Response.Response.StatusCode 526 } 527 tracing.EndSpan(ctx, sc, err) 528 }() 529 } 530 iter.i++ 531 if iter.i < len(iter.page.Values()) { 532 return nil 533 } 534 err = iter.page.NextWithContext(ctx) 535 if err != nil { 536 iter.i-- 537 return err 538 } 539 iter.i = 0 540 return nil 541} 542 543// Next advances to the next value. If there was an error making 544// the request the iterator does not advance and the error is returned. 545// Deprecated: Use NextWithContext() instead. 546func (iter *DeploymentOperationsListResultIterator) Next() error { 547 return iter.NextWithContext(context.Background()) 548} 549 550// NotDone returns true if the enumeration should be started or is not yet complete. 551func (iter DeploymentOperationsListResultIterator) NotDone() bool { 552 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 553} 554 555// Response returns the raw server response from the last page request. 556func (iter DeploymentOperationsListResultIterator) Response() DeploymentOperationsListResult { 557 return iter.page.Response() 558} 559 560// Value returns the current value or a zero-initialized value if the 561// iterator has advanced beyond the end of the collection. 562func (iter DeploymentOperationsListResultIterator) Value() DeploymentOperation { 563 if !iter.page.NotDone() { 564 return DeploymentOperation{} 565 } 566 return iter.page.Values()[iter.i] 567} 568 569// Creates a new instance of the DeploymentOperationsListResultIterator type. 570func NewDeploymentOperationsListResultIterator(page DeploymentOperationsListResultPage) DeploymentOperationsListResultIterator { 571 return DeploymentOperationsListResultIterator{page: page} 572} 573 574// IsEmpty returns true if the ListResult contains no values. 575func (dolr DeploymentOperationsListResult) IsEmpty() bool { 576 return dolr.Value == nil || len(*dolr.Value) == 0 577} 578 579// hasNextLink returns true if the NextLink is not empty. 580func (dolr DeploymentOperationsListResult) hasNextLink() bool { 581 return dolr.NextLink != nil && len(*dolr.NextLink) != 0 582} 583 584// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. 585// It returns nil if no more results exist. 586func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer(ctx context.Context) (*http.Request, error) { 587 if !dolr.hasNextLink() { 588 return nil, nil 589 } 590 return autorest.Prepare((&http.Request{}).WithContext(ctx), 591 autorest.AsJSON(), 592 autorest.AsGet(), 593 autorest.WithBaseURL(to.String(dolr.NextLink))) 594} 595 596// DeploymentOperationsListResultPage contains a page of DeploymentOperation values. 597type DeploymentOperationsListResultPage struct { 598 fn func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error) 599 dolr DeploymentOperationsListResult 600} 601 602// NextWithContext advances to the next page of values. If there was an error making 603// the request the page does not advance and the error is returned. 604func (page *DeploymentOperationsListResultPage) NextWithContext(ctx context.Context) (err error) { 605 if tracing.IsEnabled() { 606 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultPage.NextWithContext") 607 defer func() { 608 sc := -1 609 if page.Response().Response.Response != nil { 610 sc = page.Response().Response.Response.StatusCode 611 } 612 tracing.EndSpan(ctx, sc, err) 613 }() 614 } 615 for { 616 next, err := page.fn(ctx, page.dolr) 617 if err != nil { 618 return err 619 } 620 page.dolr = next 621 if !next.hasNextLink() || !next.IsEmpty() { 622 break 623 } 624 } 625 return nil 626} 627 628// Next advances to the next page of values. If there was an error making 629// the request the page does not advance and the error is returned. 630// Deprecated: Use NextWithContext() instead. 631func (page *DeploymentOperationsListResultPage) Next() error { 632 return page.NextWithContext(context.Background()) 633} 634 635// NotDone returns true if the page enumeration should be started or is not yet complete. 636func (page DeploymentOperationsListResultPage) NotDone() bool { 637 return !page.dolr.IsEmpty() 638} 639 640// Response returns the raw server response from the last page request. 641func (page DeploymentOperationsListResultPage) Response() DeploymentOperationsListResult { 642 return page.dolr 643} 644 645// Values returns the slice of values for the current page or nil if there are no values. 646func (page DeploymentOperationsListResultPage) Values() []DeploymentOperation { 647 if page.dolr.IsEmpty() { 648 return nil 649 } 650 return *page.dolr.Value 651} 652 653// Creates a new instance of the DeploymentOperationsListResultPage type. 654func NewDeploymentOperationsListResultPage(cur DeploymentOperationsListResult, getNextPage func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error)) DeploymentOperationsListResultPage { 655 return DeploymentOperationsListResultPage{ 656 fn: getNextPage, 657 dolr: cur, 658 } 659} 660 661// DeploymentProperties deployment properties. 662type DeploymentProperties struct { 663 // Template - The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. 664 Template interface{} `json:"template,omitempty"` 665 // TemplateLink - The URI of the template. Use either the templateLink property or the template property, but not both. 666 TemplateLink *TemplateLink `json:"templateLink,omitempty"` 667 // Parameters - Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. 668 Parameters interface{} `json:"parameters,omitempty"` 669 // ParametersLink - The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. 670 ParametersLink *ParametersLink `json:"parametersLink,omitempty"` 671 // Mode - The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete' 672 Mode DeploymentMode `json:"mode,omitempty"` 673 // DebugSetting - The debug setting of the deployment. 674 DebugSetting *DebugSetting `json:"debugSetting,omitempty"` 675 // OnErrorDeployment - The deployment on error behavior. 676 OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` 677} 678 679// DeploymentPropertiesExtended deployment properties with additional details. 680type DeploymentPropertiesExtended struct { 681 // ProvisioningState - READ-ONLY; The state of the provisioning. 682 ProvisioningState *string `json:"provisioningState,omitempty"` 683 // CorrelationID - READ-ONLY; The correlation ID of the deployment. 684 CorrelationID *string `json:"correlationId,omitempty"` 685 // Timestamp - READ-ONLY; The timestamp of the template deployment. 686 Timestamp *date.Time `json:"timestamp,omitempty"` 687 // Outputs - Key/value pairs that represent deployment output. 688 Outputs interface{} `json:"outputs,omitempty"` 689 // Providers - The list of resource providers needed for the deployment. 690 Providers *[]Provider `json:"providers,omitempty"` 691 // Dependencies - The list of deployment dependencies. 692 Dependencies *[]Dependency `json:"dependencies,omitempty"` 693 // Template - The template content. Use only one of Template or TemplateLink. 694 Template interface{} `json:"template,omitempty"` 695 // TemplateLink - The URI referencing the template. Use only one of Template or TemplateLink. 696 TemplateLink *TemplateLink `json:"templateLink,omitempty"` 697 // Parameters - Deployment parameters. Use only one of Parameters or ParametersLink. 698 Parameters interface{} `json:"parameters,omitempty"` 699 // ParametersLink - The URI referencing the parameters. Use only one of Parameters or ParametersLink. 700 ParametersLink *ParametersLink `json:"parametersLink,omitempty"` 701 // Mode - The deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete' 702 Mode DeploymentMode `json:"mode,omitempty"` 703 // DebugSetting - The debug setting of the deployment. 704 DebugSetting *DebugSetting `json:"debugSetting,omitempty"` 705 // OnErrorDeployment - The deployment on error behavior. 706 OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` 707} 708 709// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. 710func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { 711 objectMap := make(map[string]interface{}) 712 if dpe.Outputs != nil { 713 objectMap["outputs"] = dpe.Outputs 714 } 715 if dpe.Providers != nil { 716 objectMap["providers"] = dpe.Providers 717 } 718 if dpe.Dependencies != nil { 719 objectMap["dependencies"] = dpe.Dependencies 720 } 721 if dpe.Template != nil { 722 objectMap["template"] = dpe.Template 723 } 724 if dpe.TemplateLink != nil { 725 objectMap["templateLink"] = dpe.TemplateLink 726 } 727 if dpe.Parameters != nil { 728 objectMap["parameters"] = dpe.Parameters 729 } 730 if dpe.ParametersLink != nil { 731 objectMap["parametersLink"] = dpe.ParametersLink 732 } 733 if dpe.Mode != "" { 734 objectMap["mode"] = dpe.Mode 735 } 736 if dpe.DebugSetting != nil { 737 objectMap["debugSetting"] = dpe.DebugSetting 738 } 739 if dpe.OnErrorDeployment != nil { 740 objectMap["onErrorDeployment"] = dpe.OnErrorDeployment 741 } 742 return json.Marshal(objectMap) 743} 744 745// DeploymentsCreateOrUpdateAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the 746// results of a long-running operation. 747type DeploymentsCreateOrUpdateAtSubscriptionScopeFuture struct { 748 azure.FutureAPI 749 // Result returns the result of the asynchronous operation. 750 // If the operation has not completed it will return an error. 751 Result func(DeploymentsClient) (DeploymentExtended, error) 752} 753 754// UnmarshalJSON is the custom unmarshaller for CreateFuture. 755func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { 756 var azFuture azure.Future 757 if err := json.Unmarshal(body, &azFuture); err != nil { 758 return err 759 } 760 future.FutureAPI = &azFuture 761 future.Result = future.result 762 return nil 763} 764 765// result is the default implementation for DeploymentsCreateOrUpdateAtSubscriptionScopeFuture.Result. 766func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { 767 var done bool 768 done, err = future.DoneWithContext(context.Background(), client) 769 if err != nil { 770 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") 771 return 772 } 773 if !done { 774 de.Response.Response = future.Response() 775 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture") 776 return 777 } 778 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 779 if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { 780 de, err = client.CreateOrUpdateAtSubscriptionScopeResponder(de.Response.Response) 781 if err != nil { 782 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", de.Response.Response, "Failure responding to request") 783 } 784 } 785 return 786} 787 788// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 789// long-running operation. 790type DeploymentsCreateOrUpdateFuture struct { 791 azure.FutureAPI 792 // Result returns the result of the asynchronous operation. 793 // If the operation has not completed it will return an error. 794 Result func(DeploymentsClient) (DeploymentExtended, error) 795} 796 797// UnmarshalJSON is the custom unmarshaller for CreateFuture. 798func (future *DeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 799 var azFuture azure.Future 800 if err := json.Unmarshal(body, &azFuture); err != nil { 801 return err 802 } 803 future.FutureAPI = &azFuture 804 future.Result = future.result 805 return nil 806} 807 808// result is the default implementation for DeploymentsCreateOrUpdateFuture.Result. 809func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { 810 var done bool 811 done, err = future.DoneWithContext(context.Background(), client) 812 if err != nil { 813 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 814 return 815 } 816 if !done { 817 de.Response.Response = future.Response() 818 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") 819 return 820 } 821 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 822 if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { 823 de, err = client.CreateOrUpdateResponder(de.Response.Response) 824 if err != nil { 825 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") 826 } 827 } 828 return 829} 830 831// DeploymentsDeleteAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the results of a 832// long-running operation. 833type DeploymentsDeleteAtSubscriptionScopeFuture struct { 834 azure.FutureAPI 835 // Result returns the result of the asynchronous operation. 836 // If the operation has not completed it will return an error. 837 Result func(DeploymentsClient) (autorest.Response, error) 838} 839 840// UnmarshalJSON is the custom unmarshaller for CreateFuture. 841func (future *DeploymentsDeleteAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { 842 var azFuture azure.Future 843 if err := json.Unmarshal(body, &azFuture); err != nil { 844 return err 845 } 846 future.FutureAPI = &azFuture 847 future.Result = future.result 848 return nil 849} 850 851// result is the default implementation for DeploymentsDeleteAtSubscriptionScopeFuture.Result. 852func (future *DeploymentsDeleteAtSubscriptionScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { 853 var done bool 854 done, err = future.DoneWithContext(context.Background(), client) 855 if err != nil { 856 err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") 857 return 858 } 859 if !done { 860 ar.Response = future.Response() 861 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtSubscriptionScopeFuture") 862 return 863 } 864 ar.Response = future.Response() 865 return 866} 867 868// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 869// operation. 870type DeploymentsDeleteFuture struct { 871 azure.FutureAPI 872 // Result returns the result of the asynchronous operation. 873 // If the operation has not completed it will return an error. 874 Result func(DeploymentsClient) (autorest.Response, error) 875} 876 877// UnmarshalJSON is the custom unmarshaller for CreateFuture. 878func (future *DeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { 879 var azFuture azure.Future 880 if err := json.Unmarshal(body, &azFuture); err != nil { 881 return err 882 } 883 future.FutureAPI = &azFuture 884 future.Result = future.result 885 return nil 886} 887 888// result is the default implementation for DeploymentsDeleteFuture.Result. 889func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { 890 var done bool 891 done, err = future.DoneWithContext(context.Background(), client) 892 if err != nil { 893 err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") 894 return 895 } 896 if !done { 897 ar.Response = future.Response() 898 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") 899 return 900 } 901 ar.Response = future.Response() 902 return 903} 904 905// DeploymentValidateResult information from validate template deployment response. 906type DeploymentValidateResult struct { 907 autorest.Response `json:"-"` 908 // Error - Validation error. 909 Error *ManagementErrorWithDetails `json:"error,omitempty"` 910 // Properties - The template deployment properties. 911 Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` 912} 913 914// ErrorAdditionalInfo the resource management error additional info. 915type ErrorAdditionalInfo struct { 916 // Type - READ-ONLY; The additional info type. 917 Type *string `json:"type,omitempty"` 918 // Info - READ-ONLY; The additional info. 919 Info interface{} `json:"info,omitempty"` 920} 921 922// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 923func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 924 objectMap := make(map[string]interface{}) 925 return json.Marshal(objectMap) 926} 927 928// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 929// failed operations. (This also follows the OData error response format.) 930type ErrorResponse struct { 931 // Code - READ-ONLY; The error code. 932 Code *string `json:"code,omitempty"` 933 // Message - READ-ONLY; The error message. 934 Message *string `json:"message,omitempty"` 935 // Target - READ-ONLY; The error target. 936 Target *string `json:"target,omitempty"` 937 // Details - READ-ONLY; The error details. 938 Details *[]ErrorResponse `json:"details,omitempty"` 939 // AdditionalInfo - READ-ONLY; The error additional info. 940 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 941} 942 943// MarshalJSON is the custom marshaler for ErrorResponse. 944func (er ErrorResponse) MarshalJSON() ([]byte, error) { 945 objectMap := make(map[string]interface{}) 946 return json.Marshal(objectMap) 947} 948 949// ExportTemplateRequest export resource group template request parameters. 950type ExportTemplateRequest struct { 951 // ResourcesProperty - The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. 952 ResourcesProperty *[]string `json:"resources,omitempty"` 953 // Options - The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization' 954 Options *string `json:"options,omitempty"` 955} 956 957// GenericResource resource information. 958type GenericResource struct { 959 autorest.Response `json:"-"` 960 // Plan - The plan of the resource. 961 Plan *Plan `json:"plan,omitempty"` 962 // Properties - The resource properties. 963 Properties interface{} `json:"properties,omitempty"` 964 // Kind - The kind of the resource. 965 Kind *string `json:"kind,omitempty"` 966 // ManagedBy - ID of the resource that manages this resource. 967 ManagedBy *string `json:"managedBy,omitempty"` 968 // Sku - The SKU of the resource. 969 Sku *Sku `json:"sku,omitempty"` 970 // Identity - The identity of the resource. 971 Identity *Identity `json:"identity,omitempty"` 972 // ID - READ-ONLY; Resource ID 973 ID *string `json:"id,omitempty"` 974 // Name - READ-ONLY; Resource name 975 Name *string `json:"name,omitempty"` 976 // Type - READ-ONLY; Resource type 977 Type *string `json:"type,omitempty"` 978 // Location - Resource location 979 Location *string `json:"location,omitempty"` 980 // Tags - Resource tags 981 Tags map[string]*string `json:"tags"` 982} 983 984// MarshalJSON is the custom marshaler for GenericResource. 985func (gr GenericResource) MarshalJSON() ([]byte, error) { 986 objectMap := make(map[string]interface{}) 987 if gr.Plan != nil { 988 objectMap["plan"] = gr.Plan 989 } 990 if gr.Properties != nil { 991 objectMap["properties"] = gr.Properties 992 } 993 if gr.Kind != nil { 994 objectMap["kind"] = gr.Kind 995 } 996 if gr.ManagedBy != nil { 997 objectMap["managedBy"] = gr.ManagedBy 998 } 999 if gr.Sku != nil { 1000 objectMap["sku"] = gr.Sku 1001 } 1002 if gr.Identity != nil { 1003 objectMap["identity"] = gr.Identity 1004 } 1005 if gr.Location != nil { 1006 objectMap["location"] = gr.Location 1007 } 1008 if gr.Tags != nil { 1009 objectMap["tags"] = gr.Tags 1010 } 1011 return json.Marshal(objectMap) 1012} 1013 1014// GenericResourceExpanded resource information. 1015type GenericResourceExpanded struct { 1016 // CreatedTime - READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. 1017 CreatedTime *date.Time `json:"createdTime,omitempty"` 1018 // ChangedTime - READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. 1019 ChangedTime *date.Time `json:"changedTime,omitempty"` 1020 // ProvisioningState - READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. 1021 ProvisioningState *string `json:"provisioningState,omitempty"` 1022 // Plan - The plan of the resource. 1023 Plan *Plan `json:"plan,omitempty"` 1024 // Properties - The resource properties. 1025 Properties interface{} `json:"properties,omitempty"` 1026 // Kind - The kind of the resource. 1027 Kind *string `json:"kind,omitempty"` 1028 // ManagedBy - ID of the resource that manages this resource. 1029 ManagedBy *string `json:"managedBy,omitempty"` 1030 // Sku - The SKU of the resource. 1031 Sku *Sku `json:"sku,omitempty"` 1032 // Identity - The identity of the resource. 1033 Identity *Identity `json:"identity,omitempty"` 1034 // ID - READ-ONLY; Resource ID 1035 ID *string `json:"id,omitempty"` 1036 // Name - READ-ONLY; Resource name 1037 Name *string `json:"name,omitempty"` 1038 // Type - READ-ONLY; Resource type 1039 Type *string `json:"type,omitempty"` 1040 // Location - Resource location 1041 Location *string `json:"location,omitempty"` 1042 // Tags - Resource tags 1043 Tags map[string]*string `json:"tags"` 1044} 1045 1046// MarshalJSON is the custom marshaler for GenericResourceExpanded. 1047func (gre GenericResourceExpanded) MarshalJSON() ([]byte, error) { 1048 objectMap := make(map[string]interface{}) 1049 if gre.Plan != nil { 1050 objectMap["plan"] = gre.Plan 1051 } 1052 if gre.Properties != nil { 1053 objectMap["properties"] = gre.Properties 1054 } 1055 if gre.Kind != nil { 1056 objectMap["kind"] = gre.Kind 1057 } 1058 if gre.ManagedBy != nil { 1059 objectMap["managedBy"] = gre.ManagedBy 1060 } 1061 if gre.Sku != nil { 1062 objectMap["sku"] = gre.Sku 1063 } 1064 if gre.Identity != nil { 1065 objectMap["identity"] = gre.Identity 1066 } 1067 if gre.Location != nil { 1068 objectMap["location"] = gre.Location 1069 } 1070 if gre.Tags != nil { 1071 objectMap["tags"] = gre.Tags 1072 } 1073 return json.Marshal(objectMap) 1074} 1075 1076// GenericResourceFilter resource filter. 1077type GenericResourceFilter struct { 1078 // ResourceType - The resource type. 1079 ResourceType *string `json:"resourceType,omitempty"` 1080 // Tagname - The tag name. 1081 Tagname *string `json:"tagname,omitempty"` 1082 // Tagvalue - The tag value. 1083 Tagvalue *string `json:"tagvalue,omitempty"` 1084} 1085 1086// Group resource group information. 1087type Group struct { 1088 autorest.Response `json:"-"` 1089 // ID - READ-ONLY; The ID of the resource group. 1090 ID *string `json:"id,omitempty"` 1091 // Name - READ-ONLY; The name of the resource group. 1092 Name *string `json:"name,omitempty"` 1093 // Type - READ-ONLY; The type of the resource group. 1094 Type *string `json:"type,omitempty"` 1095 Properties *GroupProperties `json:"properties,omitempty"` 1096 // Location - The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. 1097 Location *string `json:"location,omitempty"` 1098 // ManagedBy - The ID of the resource that manages this resource group. 1099 ManagedBy *string `json:"managedBy,omitempty"` 1100 // Tags - The tags attached to the resource group. 1101 Tags map[string]*string `json:"tags"` 1102} 1103 1104// MarshalJSON is the custom marshaler for Group. 1105func (g Group) MarshalJSON() ([]byte, error) { 1106 objectMap := make(map[string]interface{}) 1107 if g.Properties != nil { 1108 objectMap["properties"] = g.Properties 1109 } 1110 if g.Location != nil { 1111 objectMap["location"] = g.Location 1112 } 1113 if g.ManagedBy != nil { 1114 objectMap["managedBy"] = g.ManagedBy 1115 } 1116 if g.Tags != nil { 1117 objectMap["tags"] = g.Tags 1118 } 1119 return json.Marshal(objectMap) 1120} 1121 1122// GroupExportResult resource group export result. 1123type GroupExportResult struct { 1124 autorest.Response `json:"-"` 1125 // Template - The template content. 1126 Template interface{} `json:"template,omitempty"` 1127 // Error - The error. 1128 Error *ManagementErrorWithDetails `json:"error,omitempty"` 1129} 1130 1131// GroupFilter resource group filter. 1132type GroupFilter struct { 1133 // TagName - The tag name. 1134 TagName *string `json:"tagName,omitempty"` 1135 // TagValue - The tag value. 1136 TagValue *string `json:"tagValue,omitempty"` 1137} 1138 1139// GroupListResult list of resource groups. 1140type GroupListResult struct { 1141 autorest.Response `json:"-"` 1142 // Value - An array of resource groups. 1143 Value *[]Group `json:"value,omitempty"` 1144 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1145 NextLink *string `json:"nextLink,omitempty"` 1146} 1147 1148// MarshalJSON is the custom marshaler for GroupListResult. 1149func (glr GroupListResult) MarshalJSON() ([]byte, error) { 1150 objectMap := make(map[string]interface{}) 1151 if glr.Value != nil { 1152 objectMap["value"] = glr.Value 1153 } 1154 return json.Marshal(objectMap) 1155} 1156 1157// GroupListResultIterator provides access to a complete listing of Group values. 1158type GroupListResultIterator struct { 1159 i int 1160 page GroupListResultPage 1161} 1162 1163// NextWithContext advances to the next value. If there was an error making 1164// the request the iterator does not advance and the error is returned. 1165func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 1166 if tracing.IsEnabled() { 1167 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") 1168 defer func() { 1169 sc := -1 1170 if iter.Response().Response.Response != nil { 1171 sc = iter.Response().Response.Response.StatusCode 1172 } 1173 tracing.EndSpan(ctx, sc, err) 1174 }() 1175 } 1176 iter.i++ 1177 if iter.i < len(iter.page.Values()) { 1178 return nil 1179 } 1180 err = iter.page.NextWithContext(ctx) 1181 if err != nil { 1182 iter.i-- 1183 return err 1184 } 1185 iter.i = 0 1186 return nil 1187} 1188 1189// Next advances to the next value. If there was an error making 1190// the request the iterator does not advance and the error is returned. 1191// Deprecated: Use NextWithContext() instead. 1192func (iter *GroupListResultIterator) Next() error { 1193 return iter.NextWithContext(context.Background()) 1194} 1195 1196// NotDone returns true if the enumeration should be started or is not yet complete. 1197func (iter GroupListResultIterator) NotDone() bool { 1198 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1199} 1200 1201// Response returns the raw server response from the last page request. 1202func (iter GroupListResultIterator) Response() GroupListResult { 1203 return iter.page.Response() 1204} 1205 1206// Value returns the current value or a zero-initialized value if the 1207// iterator has advanced beyond the end of the collection. 1208func (iter GroupListResultIterator) Value() Group { 1209 if !iter.page.NotDone() { 1210 return Group{} 1211 } 1212 return iter.page.Values()[iter.i] 1213} 1214 1215// Creates a new instance of the GroupListResultIterator type. 1216func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { 1217 return GroupListResultIterator{page: page} 1218} 1219 1220// IsEmpty returns true if the ListResult contains no values. 1221func (glr GroupListResult) IsEmpty() bool { 1222 return glr.Value == nil || len(*glr.Value) == 0 1223} 1224 1225// hasNextLink returns true if the NextLink is not empty. 1226func (glr GroupListResult) hasNextLink() bool { 1227 return glr.NextLink != nil && len(*glr.NextLink) != 0 1228} 1229 1230// groupListResultPreparer prepares a request to retrieve the next set of results. 1231// It returns nil if no more results exist. 1232func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { 1233 if !glr.hasNextLink() { 1234 return nil, nil 1235 } 1236 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1237 autorest.AsJSON(), 1238 autorest.AsGet(), 1239 autorest.WithBaseURL(to.String(glr.NextLink))) 1240} 1241 1242// GroupListResultPage contains a page of Group values. 1243type GroupListResultPage struct { 1244 fn func(context.Context, GroupListResult) (GroupListResult, error) 1245 glr GroupListResult 1246} 1247 1248// NextWithContext advances to the next page of values. If there was an error making 1249// the request the page does not advance and the error is returned. 1250func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { 1251 if tracing.IsEnabled() { 1252 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") 1253 defer func() { 1254 sc := -1 1255 if page.Response().Response.Response != nil { 1256 sc = page.Response().Response.Response.StatusCode 1257 } 1258 tracing.EndSpan(ctx, sc, err) 1259 }() 1260 } 1261 for { 1262 next, err := page.fn(ctx, page.glr) 1263 if err != nil { 1264 return err 1265 } 1266 page.glr = next 1267 if !next.hasNextLink() || !next.IsEmpty() { 1268 break 1269 } 1270 } 1271 return nil 1272} 1273 1274// Next advances to the next page of values. If there was an error making 1275// the request the page does not advance and the error is returned. 1276// Deprecated: Use NextWithContext() instead. 1277func (page *GroupListResultPage) Next() error { 1278 return page.NextWithContext(context.Background()) 1279} 1280 1281// NotDone returns true if the page enumeration should be started or is not yet complete. 1282func (page GroupListResultPage) NotDone() bool { 1283 return !page.glr.IsEmpty() 1284} 1285 1286// Response returns the raw server response from the last page request. 1287func (page GroupListResultPage) Response() GroupListResult { 1288 return page.glr 1289} 1290 1291// Values returns the slice of values for the current page or nil if there are no values. 1292func (page GroupListResultPage) Values() []Group { 1293 if page.glr.IsEmpty() { 1294 return nil 1295 } 1296 return *page.glr.Value 1297} 1298 1299// Creates a new instance of the GroupListResultPage type. 1300func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { 1301 return GroupListResultPage{ 1302 fn: getNextPage, 1303 glr: cur, 1304 } 1305} 1306 1307// GroupPatchable resource group information. 1308type GroupPatchable struct { 1309 // Name - The name of the resource group. 1310 Name *string `json:"name,omitempty"` 1311 Properties *GroupProperties `json:"properties,omitempty"` 1312 // ManagedBy - The ID of the resource that manages this resource group. 1313 ManagedBy *string `json:"managedBy,omitempty"` 1314 // Tags - The tags attached to the resource group. 1315 Tags map[string]*string `json:"tags"` 1316} 1317 1318// MarshalJSON is the custom marshaler for GroupPatchable. 1319func (gp GroupPatchable) MarshalJSON() ([]byte, error) { 1320 objectMap := make(map[string]interface{}) 1321 if gp.Name != nil { 1322 objectMap["name"] = gp.Name 1323 } 1324 if gp.Properties != nil { 1325 objectMap["properties"] = gp.Properties 1326 } 1327 if gp.ManagedBy != nil { 1328 objectMap["managedBy"] = gp.ManagedBy 1329 } 1330 if gp.Tags != nil { 1331 objectMap["tags"] = gp.Tags 1332 } 1333 return json.Marshal(objectMap) 1334} 1335 1336// GroupProperties the resource group properties. 1337type GroupProperties struct { 1338 // ProvisioningState - READ-ONLY; The provisioning state. 1339 ProvisioningState *string `json:"provisioningState,omitempty"` 1340} 1341 1342// MarshalJSON is the custom marshaler for GroupProperties. 1343func (gp GroupProperties) MarshalJSON() ([]byte, error) { 1344 objectMap := make(map[string]interface{}) 1345 return json.Marshal(objectMap) 1346} 1347 1348// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1349type GroupsDeleteFuture struct { 1350 azure.FutureAPI 1351 // Result returns the result of the asynchronous operation. 1352 // If the operation has not completed it will return an error. 1353 Result func(GroupsClient) (autorest.Response, error) 1354} 1355 1356// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1357func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { 1358 var azFuture azure.Future 1359 if err := json.Unmarshal(body, &azFuture); err != nil { 1360 return err 1361 } 1362 future.FutureAPI = &azFuture 1363 future.Result = future.result 1364 return nil 1365} 1366 1367// result is the default implementation for GroupsDeleteFuture.Result. 1368func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { 1369 var done bool 1370 done, err = future.DoneWithContext(context.Background(), client) 1371 if err != nil { 1372 err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") 1373 return 1374 } 1375 if !done { 1376 ar.Response = future.Response() 1377 err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") 1378 return 1379 } 1380 ar.Response = future.Response() 1381 return 1382} 1383 1384// HTTPMessage HTTP message. 1385type HTTPMessage struct { 1386 // Content - HTTP message content. 1387 Content interface{} `json:"content,omitempty"` 1388} 1389 1390// Identity identity for the resource. 1391type Identity struct { 1392 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1393 PrincipalID *string `json:"principalId,omitempty"` 1394 // TenantID - READ-ONLY; The tenant ID of resource. 1395 TenantID *string `json:"tenantId,omitempty"` 1396 // Type - The identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' 1397 Type ResourceIdentityType `json:"type,omitempty"` 1398 // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 1399 UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` 1400} 1401 1402// MarshalJSON is the custom marshaler for Identity. 1403func (i Identity) MarshalJSON() ([]byte, error) { 1404 objectMap := make(map[string]interface{}) 1405 if i.Type != "" { 1406 objectMap["type"] = i.Type 1407 } 1408 if i.UserAssignedIdentities != nil { 1409 objectMap["userAssignedIdentities"] = i.UserAssignedIdentities 1410 } 1411 return json.Marshal(objectMap) 1412} 1413 1414// IdentityUserAssignedIdentitiesValue ... 1415type IdentityUserAssignedIdentitiesValue struct { 1416 // PrincipalID - READ-ONLY; The principal id of user assigned identity. 1417 PrincipalID *string `json:"principalId,omitempty"` 1418 // ClientID - READ-ONLY; The client id of user assigned identity. 1419 ClientID *string `json:"clientId,omitempty"` 1420} 1421 1422// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. 1423func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { 1424 objectMap := make(map[string]interface{}) 1425 return json.Marshal(objectMap) 1426} 1427 1428// ListResult list of resource groups. 1429type ListResult struct { 1430 autorest.Response `json:"-"` 1431 // Value - An array of resources. 1432 Value *[]GenericResourceExpanded `json:"value,omitempty"` 1433 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1434 NextLink *string `json:"nextLink,omitempty"` 1435} 1436 1437// MarshalJSON is the custom marshaler for ListResult. 1438func (lr ListResult) MarshalJSON() ([]byte, error) { 1439 objectMap := make(map[string]interface{}) 1440 if lr.Value != nil { 1441 objectMap["value"] = lr.Value 1442 } 1443 return json.Marshal(objectMap) 1444} 1445 1446// ListResultIterator provides access to a complete listing of GenericResourceExpanded values. 1447type ListResultIterator struct { 1448 i int 1449 page ListResultPage 1450} 1451 1452// NextWithContext advances to the next value. If there was an error making 1453// the request the iterator does not advance and the error is returned. 1454func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 1455 if tracing.IsEnabled() { 1456 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 1457 defer func() { 1458 sc := -1 1459 if iter.Response().Response.Response != nil { 1460 sc = iter.Response().Response.Response.StatusCode 1461 } 1462 tracing.EndSpan(ctx, sc, err) 1463 }() 1464 } 1465 iter.i++ 1466 if iter.i < len(iter.page.Values()) { 1467 return nil 1468 } 1469 err = iter.page.NextWithContext(ctx) 1470 if err != nil { 1471 iter.i-- 1472 return err 1473 } 1474 iter.i = 0 1475 return nil 1476} 1477 1478// Next advances to the next value. If there was an error making 1479// the request the iterator does not advance and the error is returned. 1480// Deprecated: Use NextWithContext() instead. 1481func (iter *ListResultIterator) Next() error { 1482 return iter.NextWithContext(context.Background()) 1483} 1484 1485// NotDone returns true if the enumeration should be started or is not yet complete. 1486func (iter ListResultIterator) NotDone() bool { 1487 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1488} 1489 1490// Response returns the raw server response from the last page request. 1491func (iter ListResultIterator) Response() ListResult { 1492 return iter.page.Response() 1493} 1494 1495// Value returns the current value or a zero-initialized value if the 1496// iterator has advanced beyond the end of the collection. 1497func (iter ListResultIterator) Value() GenericResourceExpanded { 1498 if !iter.page.NotDone() { 1499 return GenericResourceExpanded{} 1500 } 1501 return iter.page.Values()[iter.i] 1502} 1503 1504// Creates a new instance of the ListResultIterator type. 1505func NewListResultIterator(page ListResultPage) ListResultIterator { 1506 return ListResultIterator{page: page} 1507} 1508 1509// IsEmpty returns true if the ListResult contains no values. 1510func (lr ListResult) IsEmpty() bool { 1511 return lr.Value == nil || len(*lr.Value) == 0 1512} 1513 1514// hasNextLink returns true if the NextLink is not empty. 1515func (lr ListResult) hasNextLink() bool { 1516 return lr.NextLink != nil && len(*lr.NextLink) != 0 1517} 1518 1519// listResultPreparer prepares a request to retrieve the next set of results. 1520// It returns nil if no more results exist. 1521func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 1522 if !lr.hasNextLink() { 1523 return nil, nil 1524 } 1525 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1526 autorest.AsJSON(), 1527 autorest.AsGet(), 1528 autorest.WithBaseURL(to.String(lr.NextLink))) 1529} 1530 1531// ListResultPage contains a page of GenericResourceExpanded values. 1532type ListResultPage struct { 1533 fn func(context.Context, ListResult) (ListResult, error) 1534 lr ListResult 1535} 1536 1537// NextWithContext advances to the next page of values. If there was an error making 1538// the request the page does not advance and the error is returned. 1539func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 1540 if tracing.IsEnabled() { 1541 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 1542 defer func() { 1543 sc := -1 1544 if page.Response().Response.Response != nil { 1545 sc = page.Response().Response.Response.StatusCode 1546 } 1547 tracing.EndSpan(ctx, sc, err) 1548 }() 1549 } 1550 for { 1551 next, err := page.fn(ctx, page.lr) 1552 if err != nil { 1553 return err 1554 } 1555 page.lr = next 1556 if !next.hasNextLink() || !next.IsEmpty() { 1557 break 1558 } 1559 } 1560 return nil 1561} 1562 1563// Next advances to the next page of values. If there was an error making 1564// the request the page does not advance and the error is returned. 1565// Deprecated: Use NextWithContext() instead. 1566func (page *ListResultPage) Next() error { 1567 return page.NextWithContext(context.Background()) 1568} 1569 1570// NotDone returns true if the page enumeration should be started or is not yet complete. 1571func (page ListResultPage) NotDone() bool { 1572 return !page.lr.IsEmpty() 1573} 1574 1575// Response returns the raw server response from the last page request. 1576func (page ListResultPage) Response() ListResult { 1577 return page.lr 1578} 1579 1580// Values returns the slice of values for the current page or nil if there are no values. 1581func (page ListResultPage) Values() []GenericResourceExpanded { 1582 if page.lr.IsEmpty() { 1583 return nil 1584 } 1585 return *page.lr.Value 1586} 1587 1588// Creates a new instance of the ListResultPage type. 1589func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 1590 return ListResultPage{ 1591 fn: getNextPage, 1592 lr: cur, 1593 } 1594} 1595 1596// ManagementErrorWithDetails the detailed error message of resource management. 1597type ManagementErrorWithDetails struct { 1598 // Code - READ-ONLY; The error code returned when exporting the template. 1599 Code *string `json:"code,omitempty"` 1600 // Message - READ-ONLY; The error message describing the export error. 1601 Message *string `json:"message,omitempty"` 1602 // Target - READ-ONLY; The target of the error. 1603 Target *string `json:"target,omitempty"` 1604 // Details - READ-ONLY; Validation error. 1605 Details *[]ManagementErrorWithDetails `json:"details,omitempty"` 1606} 1607 1608// MarshalJSON is the custom marshaler for ManagementErrorWithDetails. 1609func (mewd ManagementErrorWithDetails) MarshalJSON() ([]byte, error) { 1610 objectMap := make(map[string]interface{}) 1611 return json.Marshal(objectMap) 1612} 1613 1614// MoveInfo parameters of move resources. 1615type MoveInfo struct { 1616 // ResourcesProperty - The IDs of the resources. 1617 ResourcesProperty *[]string `json:"resources,omitempty"` 1618 // TargetResourceGroup - The target resource group. 1619 TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` 1620} 1621 1622// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running 1623// operation. 1624type MoveResourcesFuture struct { 1625 azure.FutureAPI 1626 // Result returns the result of the asynchronous operation. 1627 // If the operation has not completed it will return an error. 1628 Result func(Client) (autorest.Response, error) 1629} 1630 1631// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1632func (future *MoveResourcesFuture) UnmarshalJSON(body []byte) error { 1633 var azFuture azure.Future 1634 if err := json.Unmarshal(body, &azFuture); err != nil { 1635 return err 1636 } 1637 future.FutureAPI = &azFuture 1638 future.Result = future.result 1639 return nil 1640} 1641 1642// result is the default implementation for MoveResourcesFuture.Result. 1643func (future *MoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { 1644 var done bool 1645 done, err = future.DoneWithContext(context.Background(), client) 1646 if err != nil { 1647 err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Polling failure") 1648 return 1649 } 1650 if !done { 1651 ar.Response = future.Response() 1652 err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") 1653 return 1654 } 1655 ar.Response = future.Response() 1656 return 1657} 1658 1659// OnErrorDeployment deployment on error behavior. 1660type OnErrorDeployment struct { 1661 // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' 1662 Type OnErrorDeploymentType `json:"type,omitempty"` 1663 // DeploymentName - The deployment to be used on error case. 1664 DeploymentName *string `json:"deploymentName,omitempty"` 1665} 1666 1667// OnErrorDeploymentExtended deployment on error behavior with additional details. 1668type OnErrorDeploymentExtended struct { 1669 // ProvisioningState - READ-ONLY; The state of the provisioning for the on error deployment. 1670 ProvisioningState *string `json:"provisioningState,omitempty"` 1671 // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' 1672 Type OnErrorDeploymentType `json:"type,omitempty"` 1673 // DeploymentName - The deployment to be used on error case. 1674 DeploymentName *string `json:"deploymentName,omitempty"` 1675} 1676 1677// MarshalJSON is the custom marshaler for OnErrorDeploymentExtended. 1678func (oede OnErrorDeploymentExtended) MarshalJSON() ([]byte, error) { 1679 objectMap := make(map[string]interface{}) 1680 if oede.Type != "" { 1681 objectMap["type"] = oede.Type 1682 } 1683 if oede.DeploymentName != nil { 1684 objectMap["deploymentName"] = oede.DeploymentName 1685 } 1686 return json.Marshal(objectMap) 1687} 1688 1689// Operation microsoft.Resources operation 1690type Operation struct { 1691 // Name - Operation name: {provider}/{resource}/{operation} 1692 Name *string `json:"name,omitempty"` 1693 // Display - The object that represents the operation. 1694 Display *OperationDisplay `json:"display,omitempty"` 1695} 1696 1697// OperationDisplay the object that represents the operation. 1698type OperationDisplay struct { 1699 // Provider - Service provider: Microsoft.Resources 1700 Provider *string `json:"provider,omitempty"` 1701 // Resource - Resource on which the operation is performed: Profile, endpoint, etc. 1702 Resource *string `json:"resource,omitempty"` 1703 // Operation - Operation type: Read, write, delete, etc. 1704 Operation *string `json:"operation,omitempty"` 1705 // Description - Description of the operation. 1706 Description *string `json:"description,omitempty"` 1707} 1708 1709// OperationListResult result of the request to list Microsoft.Resources operations. It contains a list of 1710// operations and a URL link to get the next set of results. 1711type OperationListResult struct { 1712 autorest.Response `json:"-"` 1713 // Value - List of Microsoft.Resources operations. 1714 Value *[]Operation `json:"value,omitempty"` 1715 // NextLink - URL to get the next set of operation list results if there are any. 1716 NextLink *string `json:"nextLink,omitempty"` 1717} 1718 1719// OperationListResultIterator provides access to a complete listing of Operation values. 1720type OperationListResultIterator struct { 1721 i int 1722 page OperationListResultPage 1723} 1724 1725// NextWithContext advances to the next value. If there was an error making 1726// the request the iterator does not advance and the error is returned. 1727func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1728 if tracing.IsEnabled() { 1729 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1730 defer func() { 1731 sc := -1 1732 if iter.Response().Response.Response != nil { 1733 sc = iter.Response().Response.Response.StatusCode 1734 } 1735 tracing.EndSpan(ctx, sc, err) 1736 }() 1737 } 1738 iter.i++ 1739 if iter.i < len(iter.page.Values()) { 1740 return nil 1741 } 1742 err = iter.page.NextWithContext(ctx) 1743 if err != nil { 1744 iter.i-- 1745 return err 1746 } 1747 iter.i = 0 1748 return nil 1749} 1750 1751// Next advances to the next value. If there was an error making 1752// the request the iterator does not advance and the error is returned. 1753// Deprecated: Use NextWithContext() instead. 1754func (iter *OperationListResultIterator) Next() error { 1755 return iter.NextWithContext(context.Background()) 1756} 1757 1758// NotDone returns true if the enumeration should be started or is not yet complete. 1759func (iter OperationListResultIterator) NotDone() bool { 1760 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1761} 1762 1763// Response returns the raw server response from the last page request. 1764func (iter OperationListResultIterator) Response() OperationListResult { 1765 return iter.page.Response() 1766} 1767 1768// Value returns the current value or a zero-initialized value if the 1769// iterator has advanced beyond the end of the collection. 1770func (iter OperationListResultIterator) Value() Operation { 1771 if !iter.page.NotDone() { 1772 return Operation{} 1773 } 1774 return iter.page.Values()[iter.i] 1775} 1776 1777// Creates a new instance of the OperationListResultIterator type. 1778func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1779 return OperationListResultIterator{page: page} 1780} 1781 1782// IsEmpty returns true if the ListResult contains no values. 1783func (olr OperationListResult) IsEmpty() bool { 1784 return olr.Value == nil || len(*olr.Value) == 0 1785} 1786 1787// hasNextLink returns true if the NextLink is not empty. 1788func (olr OperationListResult) hasNextLink() bool { 1789 return olr.NextLink != nil && len(*olr.NextLink) != 0 1790} 1791 1792// operationListResultPreparer prepares a request to retrieve the next set of results. 1793// It returns nil if no more results exist. 1794func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1795 if !olr.hasNextLink() { 1796 return nil, nil 1797 } 1798 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1799 autorest.AsJSON(), 1800 autorest.AsGet(), 1801 autorest.WithBaseURL(to.String(olr.NextLink))) 1802} 1803 1804// OperationListResultPage contains a page of Operation values. 1805type OperationListResultPage struct { 1806 fn func(context.Context, OperationListResult) (OperationListResult, error) 1807 olr OperationListResult 1808} 1809 1810// NextWithContext advances to the next page of values. If there was an error making 1811// the request the page does not advance and the error is returned. 1812func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1813 if tracing.IsEnabled() { 1814 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1815 defer func() { 1816 sc := -1 1817 if page.Response().Response.Response != nil { 1818 sc = page.Response().Response.Response.StatusCode 1819 } 1820 tracing.EndSpan(ctx, sc, err) 1821 }() 1822 } 1823 for { 1824 next, err := page.fn(ctx, page.olr) 1825 if err != nil { 1826 return err 1827 } 1828 page.olr = next 1829 if !next.hasNextLink() || !next.IsEmpty() { 1830 break 1831 } 1832 } 1833 return nil 1834} 1835 1836// Next advances to the next page of values. If there was an error making 1837// the request the page does not advance and the error is returned. 1838// Deprecated: Use NextWithContext() instead. 1839func (page *OperationListResultPage) Next() error { 1840 return page.NextWithContext(context.Background()) 1841} 1842 1843// NotDone returns true if the page enumeration should be started or is not yet complete. 1844func (page OperationListResultPage) NotDone() bool { 1845 return !page.olr.IsEmpty() 1846} 1847 1848// Response returns the raw server response from the last page request. 1849func (page OperationListResultPage) Response() OperationListResult { 1850 return page.olr 1851} 1852 1853// Values returns the slice of values for the current page or nil if there are no values. 1854func (page OperationListResultPage) Values() []Operation { 1855 if page.olr.IsEmpty() { 1856 return nil 1857 } 1858 return *page.olr.Value 1859} 1860 1861// Creates a new instance of the OperationListResultPage type. 1862func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1863 return OperationListResultPage{ 1864 fn: getNextPage, 1865 olr: cur, 1866 } 1867} 1868 1869// ParametersLink entity representing the reference to the deployment parameters. 1870type ParametersLink struct { 1871 // URI - The URI of the parameters file. 1872 URI *string `json:"uri,omitempty"` 1873 // ContentVersion - If included, must match the ContentVersion in the template. 1874 ContentVersion *string `json:"contentVersion,omitempty"` 1875} 1876 1877// Plan plan for the resource. 1878type Plan struct { 1879 // Name - The plan ID. 1880 Name *string `json:"name,omitempty"` 1881 // Publisher - The publisher ID. 1882 Publisher *string `json:"publisher,omitempty"` 1883 // Product - The offer ID. 1884 Product *string `json:"product,omitempty"` 1885 // PromotionCode - The promotion code. 1886 PromotionCode *string `json:"promotionCode,omitempty"` 1887 // Version - The plan's version. 1888 Version *string `json:"version,omitempty"` 1889} 1890 1891// Provider resource provider information. 1892type Provider struct { 1893 autorest.Response `json:"-"` 1894 // ID - READ-ONLY; The provider ID. 1895 ID *string `json:"id,omitempty"` 1896 // Namespace - The namespace of the resource provider. 1897 Namespace *string `json:"namespace,omitempty"` 1898 // RegistrationState - READ-ONLY; The registration state of the provider. 1899 RegistrationState *string `json:"registrationState,omitempty"` 1900 // ResourceTypes - READ-ONLY; The collection of provider resource types. 1901 ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` 1902} 1903 1904// MarshalJSON is the custom marshaler for Provider. 1905func (p Provider) MarshalJSON() ([]byte, error) { 1906 objectMap := make(map[string]interface{}) 1907 if p.Namespace != nil { 1908 objectMap["namespace"] = p.Namespace 1909 } 1910 return json.Marshal(objectMap) 1911} 1912 1913// ProviderListResult list of resource providers. 1914type ProviderListResult struct { 1915 autorest.Response `json:"-"` 1916 // Value - An array of resource providers. 1917 Value *[]Provider `json:"value,omitempty"` 1918 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1919 NextLink *string `json:"nextLink,omitempty"` 1920} 1921 1922// MarshalJSON is the custom marshaler for ProviderListResult. 1923func (plr ProviderListResult) MarshalJSON() ([]byte, error) { 1924 objectMap := make(map[string]interface{}) 1925 if plr.Value != nil { 1926 objectMap["value"] = plr.Value 1927 } 1928 return json.Marshal(objectMap) 1929} 1930 1931// ProviderListResultIterator provides access to a complete listing of Provider values. 1932type ProviderListResultIterator struct { 1933 i int 1934 page ProviderListResultPage 1935} 1936 1937// NextWithContext advances to the next value. If there was an error making 1938// the request the iterator does not advance and the error is returned. 1939func (iter *ProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 1940 if tracing.IsEnabled() { 1941 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultIterator.NextWithContext") 1942 defer func() { 1943 sc := -1 1944 if iter.Response().Response.Response != nil { 1945 sc = iter.Response().Response.Response.StatusCode 1946 } 1947 tracing.EndSpan(ctx, sc, err) 1948 }() 1949 } 1950 iter.i++ 1951 if iter.i < len(iter.page.Values()) { 1952 return nil 1953 } 1954 err = iter.page.NextWithContext(ctx) 1955 if err != nil { 1956 iter.i-- 1957 return err 1958 } 1959 iter.i = 0 1960 return nil 1961} 1962 1963// Next advances to the next value. If there was an error making 1964// the request the iterator does not advance and the error is returned. 1965// Deprecated: Use NextWithContext() instead. 1966func (iter *ProviderListResultIterator) Next() error { 1967 return iter.NextWithContext(context.Background()) 1968} 1969 1970// NotDone returns true if the enumeration should be started or is not yet complete. 1971func (iter ProviderListResultIterator) NotDone() bool { 1972 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1973} 1974 1975// Response returns the raw server response from the last page request. 1976func (iter ProviderListResultIterator) Response() ProviderListResult { 1977 return iter.page.Response() 1978} 1979 1980// Value returns the current value or a zero-initialized value if the 1981// iterator has advanced beyond the end of the collection. 1982func (iter ProviderListResultIterator) Value() Provider { 1983 if !iter.page.NotDone() { 1984 return Provider{} 1985 } 1986 return iter.page.Values()[iter.i] 1987} 1988 1989// Creates a new instance of the ProviderListResultIterator type. 1990func NewProviderListResultIterator(page ProviderListResultPage) ProviderListResultIterator { 1991 return ProviderListResultIterator{page: page} 1992} 1993 1994// IsEmpty returns true if the ListResult contains no values. 1995func (plr ProviderListResult) IsEmpty() bool { 1996 return plr.Value == nil || len(*plr.Value) == 0 1997} 1998 1999// hasNextLink returns true if the NextLink is not empty. 2000func (plr ProviderListResult) hasNextLink() bool { 2001 return plr.NextLink != nil && len(*plr.NextLink) != 0 2002} 2003 2004// providerListResultPreparer prepares a request to retrieve the next set of results. 2005// It returns nil if no more results exist. 2006func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) { 2007 if !plr.hasNextLink() { 2008 return nil, nil 2009 } 2010 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2011 autorest.AsJSON(), 2012 autorest.AsGet(), 2013 autorest.WithBaseURL(to.String(plr.NextLink))) 2014} 2015 2016// ProviderListResultPage contains a page of Provider values. 2017type ProviderListResultPage struct { 2018 fn func(context.Context, ProviderListResult) (ProviderListResult, error) 2019 plr ProviderListResult 2020} 2021 2022// NextWithContext advances to the next page of values. If there was an error making 2023// the request the page does not advance and the error is returned. 2024func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 2025 if tracing.IsEnabled() { 2026 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultPage.NextWithContext") 2027 defer func() { 2028 sc := -1 2029 if page.Response().Response.Response != nil { 2030 sc = page.Response().Response.Response.StatusCode 2031 } 2032 tracing.EndSpan(ctx, sc, err) 2033 }() 2034 } 2035 for { 2036 next, err := page.fn(ctx, page.plr) 2037 if err != nil { 2038 return err 2039 } 2040 page.plr = next 2041 if !next.hasNextLink() || !next.IsEmpty() { 2042 break 2043 } 2044 } 2045 return nil 2046} 2047 2048// Next advances to the next page of values. If there was an error making 2049// the request the page does not advance and the error is returned. 2050// Deprecated: Use NextWithContext() instead. 2051func (page *ProviderListResultPage) Next() error { 2052 return page.NextWithContext(context.Background()) 2053} 2054 2055// NotDone returns true if the page enumeration should be started or is not yet complete. 2056func (page ProviderListResultPage) NotDone() bool { 2057 return !page.plr.IsEmpty() 2058} 2059 2060// Response returns the raw server response from the last page request. 2061func (page ProviderListResultPage) Response() ProviderListResult { 2062 return page.plr 2063} 2064 2065// Values returns the slice of values for the current page or nil if there are no values. 2066func (page ProviderListResultPage) Values() []Provider { 2067 if page.plr.IsEmpty() { 2068 return nil 2069 } 2070 return *page.plr.Value 2071} 2072 2073// Creates a new instance of the ProviderListResultPage type. 2074func NewProviderListResultPage(cur ProviderListResult, getNextPage func(context.Context, ProviderListResult) (ProviderListResult, error)) ProviderListResultPage { 2075 return ProviderListResultPage{ 2076 fn: getNextPage, 2077 plr: cur, 2078 } 2079} 2080 2081// ProviderOperationDisplayProperties resource provider operation's display properties. 2082type ProviderOperationDisplayProperties struct { 2083 // Publisher - Operation description. 2084 Publisher *string `json:"publisher,omitempty"` 2085 // Provider - Operation provider. 2086 Provider *string `json:"provider,omitempty"` 2087 // Resource - Operation resource. 2088 Resource *string `json:"resource,omitempty"` 2089 // Operation - Resource provider operation. 2090 Operation *string `json:"operation,omitempty"` 2091 // Description - Operation description. 2092 Description *string `json:"description,omitempty"` 2093} 2094 2095// ProviderResourceType resource type managed by the resource provider. 2096type ProviderResourceType struct { 2097 // ResourceType - The resource type. 2098 ResourceType *string `json:"resourceType,omitempty"` 2099 // Locations - The collection of locations where this resource type can be created. 2100 Locations *[]string `json:"locations,omitempty"` 2101 // Aliases - The aliases that are supported by this resource type. 2102 Aliases *[]AliasType `json:"aliases,omitempty"` 2103 // APIVersions - The API version. 2104 APIVersions *[]string `json:"apiVersions,omitempty"` 2105 // Properties - The properties. 2106 Properties map[string]*string `json:"properties"` 2107} 2108 2109// MarshalJSON is the custom marshaler for ProviderResourceType. 2110func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { 2111 objectMap := make(map[string]interface{}) 2112 if prt.ResourceType != nil { 2113 objectMap["resourceType"] = prt.ResourceType 2114 } 2115 if prt.Locations != nil { 2116 objectMap["locations"] = prt.Locations 2117 } 2118 if prt.Aliases != nil { 2119 objectMap["aliases"] = prt.Aliases 2120 } 2121 if prt.APIVersions != nil { 2122 objectMap["apiVersions"] = prt.APIVersions 2123 } 2124 if prt.Properties != nil { 2125 objectMap["properties"] = prt.Properties 2126 } 2127 return json.Marshal(objectMap) 2128} 2129 2130// Resource specified resource. 2131type Resource struct { 2132 // ID - READ-ONLY; Resource ID 2133 ID *string `json:"id,omitempty"` 2134 // Name - READ-ONLY; Resource name 2135 Name *string `json:"name,omitempty"` 2136 // Type - READ-ONLY; Resource type 2137 Type *string `json:"type,omitempty"` 2138 // Location - Resource location 2139 Location *string `json:"location,omitempty"` 2140 // Tags - Resource tags 2141 Tags map[string]*string `json:"tags"` 2142} 2143 2144// MarshalJSON is the custom marshaler for Resource. 2145func (r Resource) MarshalJSON() ([]byte, error) { 2146 objectMap := make(map[string]interface{}) 2147 if r.Location != nil { 2148 objectMap["location"] = r.Location 2149 } 2150 if r.Tags != nil { 2151 objectMap["tags"] = r.Tags 2152 } 2153 return json.Marshal(objectMap) 2154} 2155 2156// Sku SKU for the resource. 2157type Sku struct { 2158 // Name - The SKU name. 2159 Name *string `json:"name,omitempty"` 2160 // Tier - The SKU tier. 2161 Tier *string `json:"tier,omitempty"` 2162 // Size - The SKU size. 2163 Size *string `json:"size,omitempty"` 2164 // Family - The SKU family. 2165 Family *string `json:"family,omitempty"` 2166 // Model - The SKU model. 2167 Model *string `json:"model,omitempty"` 2168 // Capacity - The SKU capacity. 2169 Capacity *int32 `json:"capacity,omitempty"` 2170} 2171 2172// SubResource sub-resource. 2173type SubResource struct { 2174 // ID - Resource ID 2175 ID *string `json:"id,omitempty"` 2176} 2177 2178// TagCount tag count. 2179type TagCount struct { 2180 // Type - Type of count. 2181 Type *string `json:"type,omitempty"` 2182 // Value - Value of count. 2183 Value *int32 `json:"value,omitempty"` 2184} 2185 2186// TagDetails tag details. 2187type TagDetails struct { 2188 autorest.Response `json:"-"` 2189 // ID - READ-ONLY; The tag ID. 2190 ID *string `json:"id,omitempty"` 2191 // TagName - The tag name. 2192 TagName *string `json:"tagName,omitempty"` 2193 // Count - The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. 2194 Count *TagCount `json:"count,omitempty"` 2195 // Values - The list of tag values. 2196 Values *[]TagValue `json:"values,omitempty"` 2197} 2198 2199// MarshalJSON is the custom marshaler for TagDetails. 2200func (td TagDetails) MarshalJSON() ([]byte, error) { 2201 objectMap := make(map[string]interface{}) 2202 if td.TagName != nil { 2203 objectMap["tagName"] = td.TagName 2204 } 2205 if td.Count != nil { 2206 objectMap["count"] = td.Count 2207 } 2208 if td.Values != nil { 2209 objectMap["values"] = td.Values 2210 } 2211 return json.Marshal(objectMap) 2212} 2213 2214// TagsListResult list of subscription tags. 2215type TagsListResult struct { 2216 autorest.Response `json:"-"` 2217 // Value - An array of tags. 2218 Value *[]TagDetails `json:"value,omitempty"` 2219 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 2220 NextLink *string `json:"nextLink,omitempty"` 2221} 2222 2223// MarshalJSON is the custom marshaler for TagsListResult. 2224func (tlr TagsListResult) MarshalJSON() ([]byte, error) { 2225 objectMap := make(map[string]interface{}) 2226 if tlr.Value != nil { 2227 objectMap["value"] = tlr.Value 2228 } 2229 return json.Marshal(objectMap) 2230} 2231 2232// TagsListResultIterator provides access to a complete listing of TagDetails values. 2233type TagsListResultIterator struct { 2234 i int 2235 page TagsListResultPage 2236} 2237 2238// NextWithContext advances to the next value. If there was an error making 2239// the request the iterator does not advance and the error is returned. 2240func (iter *TagsListResultIterator) NextWithContext(ctx context.Context) (err error) { 2241 if tracing.IsEnabled() { 2242 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultIterator.NextWithContext") 2243 defer func() { 2244 sc := -1 2245 if iter.Response().Response.Response != nil { 2246 sc = iter.Response().Response.Response.StatusCode 2247 } 2248 tracing.EndSpan(ctx, sc, err) 2249 }() 2250 } 2251 iter.i++ 2252 if iter.i < len(iter.page.Values()) { 2253 return nil 2254 } 2255 err = iter.page.NextWithContext(ctx) 2256 if err != nil { 2257 iter.i-- 2258 return err 2259 } 2260 iter.i = 0 2261 return nil 2262} 2263 2264// Next advances to the next value. If there was an error making 2265// the request the iterator does not advance and the error is returned. 2266// Deprecated: Use NextWithContext() instead. 2267func (iter *TagsListResultIterator) Next() error { 2268 return iter.NextWithContext(context.Background()) 2269} 2270 2271// NotDone returns true if the enumeration should be started or is not yet complete. 2272func (iter TagsListResultIterator) NotDone() bool { 2273 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2274} 2275 2276// Response returns the raw server response from the last page request. 2277func (iter TagsListResultIterator) Response() TagsListResult { 2278 return iter.page.Response() 2279} 2280 2281// Value returns the current value or a zero-initialized value if the 2282// iterator has advanced beyond the end of the collection. 2283func (iter TagsListResultIterator) Value() TagDetails { 2284 if !iter.page.NotDone() { 2285 return TagDetails{} 2286 } 2287 return iter.page.Values()[iter.i] 2288} 2289 2290// Creates a new instance of the TagsListResultIterator type. 2291func NewTagsListResultIterator(page TagsListResultPage) TagsListResultIterator { 2292 return TagsListResultIterator{page: page} 2293} 2294 2295// IsEmpty returns true if the ListResult contains no values. 2296func (tlr TagsListResult) IsEmpty() bool { 2297 return tlr.Value == nil || len(*tlr.Value) == 0 2298} 2299 2300// hasNextLink returns true if the NextLink is not empty. 2301func (tlr TagsListResult) hasNextLink() bool { 2302 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 2303} 2304 2305// tagsListResultPreparer prepares a request to retrieve the next set of results. 2306// It returns nil if no more results exist. 2307func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) { 2308 if !tlr.hasNextLink() { 2309 return nil, nil 2310 } 2311 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2312 autorest.AsJSON(), 2313 autorest.AsGet(), 2314 autorest.WithBaseURL(to.String(tlr.NextLink))) 2315} 2316 2317// TagsListResultPage contains a page of TagDetails values. 2318type TagsListResultPage struct { 2319 fn func(context.Context, TagsListResult) (TagsListResult, error) 2320 tlr TagsListResult 2321} 2322 2323// NextWithContext advances to the next page of values. If there was an error making 2324// the request the page does not advance and the error is returned. 2325func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error) { 2326 if tracing.IsEnabled() { 2327 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultPage.NextWithContext") 2328 defer func() { 2329 sc := -1 2330 if page.Response().Response.Response != nil { 2331 sc = page.Response().Response.Response.StatusCode 2332 } 2333 tracing.EndSpan(ctx, sc, err) 2334 }() 2335 } 2336 for { 2337 next, err := page.fn(ctx, page.tlr) 2338 if err != nil { 2339 return err 2340 } 2341 page.tlr = next 2342 if !next.hasNextLink() || !next.IsEmpty() { 2343 break 2344 } 2345 } 2346 return nil 2347} 2348 2349// Next advances to the next page of values. If there was an error making 2350// the request the page does not advance and the error is returned. 2351// Deprecated: Use NextWithContext() instead. 2352func (page *TagsListResultPage) Next() error { 2353 return page.NextWithContext(context.Background()) 2354} 2355 2356// NotDone returns true if the page enumeration should be started or is not yet complete. 2357func (page TagsListResultPage) NotDone() bool { 2358 return !page.tlr.IsEmpty() 2359} 2360 2361// Response returns the raw server response from the last page request. 2362func (page TagsListResultPage) Response() TagsListResult { 2363 return page.tlr 2364} 2365 2366// Values returns the slice of values for the current page or nil if there are no values. 2367func (page TagsListResultPage) Values() []TagDetails { 2368 if page.tlr.IsEmpty() { 2369 return nil 2370 } 2371 return *page.tlr.Value 2372} 2373 2374// Creates a new instance of the TagsListResultPage type. 2375func NewTagsListResultPage(cur TagsListResult, getNextPage func(context.Context, TagsListResult) (TagsListResult, error)) TagsListResultPage { 2376 return TagsListResultPage{ 2377 fn: getNextPage, 2378 tlr: cur, 2379 } 2380} 2381 2382// TagValue tag information. 2383type TagValue struct { 2384 autorest.Response `json:"-"` 2385 // ID - READ-ONLY; The tag ID. 2386 ID *string `json:"id,omitempty"` 2387 // TagValue - The tag value. 2388 TagValue *string `json:"tagValue,omitempty"` 2389 // Count - The tag value count. 2390 Count *TagCount `json:"count,omitempty"` 2391} 2392 2393// MarshalJSON is the custom marshaler for TagValue. 2394func (tv TagValue) MarshalJSON() ([]byte, error) { 2395 objectMap := make(map[string]interface{}) 2396 if tv.TagValue != nil { 2397 objectMap["tagValue"] = tv.TagValue 2398 } 2399 if tv.Count != nil { 2400 objectMap["count"] = tv.Count 2401 } 2402 return json.Marshal(objectMap) 2403} 2404 2405// TargetResource target resource. 2406type TargetResource struct { 2407 // ID - The ID of the resource. 2408 ID *string `json:"id,omitempty"` 2409 // ResourceName - The name of the resource. 2410 ResourceName *string `json:"resourceName,omitempty"` 2411 // ResourceType - The type of the resource. 2412 ResourceType *string `json:"resourceType,omitempty"` 2413} 2414 2415// TemplateHashResult result of the request to calculate template hash. It contains a string of minified 2416// template and its hash. 2417type TemplateHashResult struct { 2418 autorest.Response `json:"-"` 2419 // MinifiedTemplate - The minified template string. 2420 MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` 2421 // TemplateHash - The template hash. 2422 TemplateHash *string `json:"templateHash,omitempty"` 2423} 2424 2425// TemplateLink entity representing the reference to the template. 2426type TemplateLink struct { 2427 // URI - The URI of the template to deploy. 2428 URI *string `json:"uri,omitempty"` 2429 // ContentVersion - If included, must match the ContentVersion in the template. 2430 ContentVersion *string `json:"contentVersion,omitempty"` 2431} 2432 2433// UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2434type UpdateByIDFuture struct { 2435 azure.FutureAPI 2436 // Result returns the result of the asynchronous operation. 2437 // If the operation has not completed it will return an error. 2438 Result func(Client) (GenericResource, error) 2439} 2440 2441// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2442func (future *UpdateByIDFuture) UnmarshalJSON(body []byte) error { 2443 var azFuture azure.Future 2444 if err := json.Unmarshal(body, &azFuture); err != nil { 2445 return err 2446 } 2447 future.FutureAPI = &azFuture 2448 future.Result = future.result 2449 return nil 2450} 2451 2452// result is the default implementation for UpdateByIDFuture.Result. 2453func (future *UpdateByIDFuture) result(client Client) (gr GenericResource, err error) { 2454 var done bool 2455 done, err = future.DoneWithContext(context.Background(), client) 2456 if err != nil { 2457 err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Polling failure") 2458 return 2459 } 2460 if !done { 2461 gr.Response.Response = future.Response() 2462 err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") 2463 return 2464 } 2465 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2466 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 2467 gr, err = client.UpdateByIDResponder(gr.Response.Response) 2468 if err != nil { 2469 err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") 2470 } 2471 } 2472 return 2473} 2474 2475// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2476type UpdateFuture struct { 2477 azure.FutureAPI 2478 // Result returns the result of the asynchronous operation. 2479 // If the operation has not completed it will return an error. 2480 Result func(Client) (GenericResource, error) 2481} 2482 2483// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2484func (future *UpdateFuture) UnmarshalJSON(body []byte) error { 2485 var azFuture azure.Future 2486 if err := json.Unmarshal(body, &azFuture); err != nil { 2487 return err 2488 } 2489 future.FutureAPI = &azFuture 2490 future.Result = future.result 2491 return nil 2492} 2493 2494// result is the default implementation for UpdateFuture.Result. 2495func (future *UpdateFuture) result(client Client) (gr GenericResource, err error) { 2496 var done bool 2497 done, err = future.DoneWithContext(context.Background(), client) 2498 if err != nil { 2499 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure") 2500 return 2501 } 2502 if !done { 2503 gr.Response.Response = future.Response() 2504 err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") 2505 return 2506 } 2507 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2508 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 2509 gr, err = client.UpdateResponder(gr.Response.Response) 2510 if err != nil { 2511 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") 2512 } 2513 } 2514 return 2515} 2516 2517// ValidateMoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running 2518// operation. 2519type ValidateMoveResourcesFuture struct { 2520 azure.FutureAPI 2521 // Result returns the result of the asynchronous operation. 2522 // If the operation has not completed it will return an error. 2523 Result func(Client) (autorest.Response, error) 2524} 2525 2526// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2527func (future *ValidateMoveResourcesFuture) UnmarshalJSON(body []byte) error { 2528 var azFuture azure.Future 2529 if err := json.Unmarshal(body, &azFuture); err != nil { 2530 return err 2531 } 2532 future.FutureAPI = &azFuture 2533 future.Result = future.result 2534 return nil 2535} 2536 2537// result is the default implementation for ValidateMoveResourcesFuture.Result. 2538func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { 2539 var done bool 2540 done, err = future.DoneWithContext(context.Background(), client) 2541 if err != nil { 2542 err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Polling failure") 2543 return 2544 } 2545 if !done { 2546 ar.Response = future.Response() 2547 err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") 2548 return 2549 } 2550 ar.Response = future.Response() 2551 return 2552} 2553