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/2019-03-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 resource provider. 1899 RegistrationState *string `json:"registrationState,omitempty"` 1900 // RegistrationPolicy - READ-ONLY; The registration policy of the resource provider. 1901 RegistrationPolicy *string `json:"registrationPolicy,omitempty"` 1902 // ResourceTypes - READ-ONLY; The collection of provider resource types. 1903 ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` 1904} 1905 1906// MarshalJSON is the custom marshaler for Provider. 1907func (p Provider) MarshalJSON() ([]byte, error) { 1908 objectMap := make(map[string]interface{}) 1909 if p.Namespace != nil { 1910 objectMap["namespace"] = p.Namespace 1911 } 1912 return json.Marshal(objectMap) 1913} 1914 1915// ProviderListResult list of resource providers. 1916type ProviderListResult struct { 1917 autorest.Response `json:"-"` 1918 // Value - An array of resource providers. 1919 Value *[]Provider `json:"value,omitempty"` 1920 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1921 NextLink *string `json:"nextLink,omitempty"` 1922} 1923 1924// MarshalJSON is the custom marshaler for ProviderListResult. 1925func (plr ProviderListResult) MarshalJSON() ([]byte, error) { 1926 objectMap := make(map[string]interface{}) 1927 if plr.Value != nil { 1928 objectMap["value"] = plr.Value 1929 } 1930 return json.Marshal(objectMap) 1931} 1932 1933// ProviderListResultIterator provides access to a complete listing of Provider values. 1934type ProviderListResultIterator struct { 1935 i int 1936 page ProviderListResultPage 1937} 1938 1939// NextWithContext advances to the next value. If there was an error making 1940// the request the iterator does not advance and the error is returned. 1941func (iter *ProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 1942 if tracing.IsEnabled() { 1943 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultIterator.NextWithContext") 1944 defer func() { 1945 sc := -1 1946 if iter.Response().Response.Response != nil { 1947 sc = iter.Response().Response.Response.StatusCode 1948 } 1949 tracing.EndSpan(ctx, sc, err) 1950 }() 1951 } 1952 iter.i++ 1953 if iter.i < len(iter.page.Values()) { 1954 return nil 1955 } 1956 err = iter.page.NextWithContext(ctx) 1957 if err != nil { 1958 iter.i-- 1959 return err 1960 } 1961 iter.i = 0 1962 return nil 1963} 1964 1965// Next advances to the next value. If there was an error making 1966// the request the iterator does not advance and the error is returned. 1967// Deprecated: Use NextWithContext() instead. 1968func (iter *ProviderListResultIterator) Next() error { 1969 return iter.NextWithContext(context.Background()) 1970} 1971 1972// NotDone returns true if the enumeration should be started or is not yet complete. 1973func (iter ProviderListResultIterator) NotDone() bool { 1974 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1975} 1976 1977// Response returns the raw server response from the last page request. 1978func (iter ProviderListResultIterator) Response() ProviderListResult { 1979 return iter.page.Response() 1980} 1981 1982// Value returns the current value or a zero-initialized value if the 1983// iterator has advanced beyond the end of the collection. 1984func (iter ProviderListResultIterator) Value() Provider { 1985 if !iter.page.NotDone() { 1986 return Provider{} 1987 } 1988 return iter.page.Values()[iter.i] 1989} 1990 1991// Creates a new instance of the ProviderListResultIterator type. 1992func NewProviderListResultIterator(page ProviderListResultPage) ProviderListResultIterator { 1993 return ProviderListResultIterator{page: page} 1994} 1995 1996// IsEmpty returns true if the ListResult contains no values. 1997func (plr ProviderListResult) IsEmpty() bool { 1998 return plr.Value == nil || len(*plr.Value) == 0 1999} 2000 2001// hasNextLink returns true if the NextLink is not empty. 2002func (plr ProviderListResult) hasNextLink() bool { 2003 return plr.NextLink != nil && len(*plr.NextLink) != 0 2004} 2005 2006// providerListResultPreparer prepares a request to retrieve the next set of results. 2007// It returns nil if no more results exist. 2008func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) { 2009 if !plr.hasNextLink() { 2010 return nil, nil 2011 } 2012 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2013 autorest.AsJSON(), 2014 autorest.AsGet(), 2015 autorest.WithBaseURL(to.String(plr.NextLink))) 2016} 2017 2018// ProviderListResultPage contains a page of Provider values. 2019type ProviderListResultPage struct { 2020 fn func(context.Context, ProviderListResult) (ProviderListResult, error) 2021 plr ProviderListResult 2022} 2023 2024// NextWithContext advances to the next page of values. If there was an error making 2025// the request the page does not advance and the error is returned. 2026func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 2027 if tracing.IsEnabled() { 2028 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultPage.NextWithContext") 2029 defer func() { 2030 sc := -1 2031 if page.Response().Response.Response != nil { 2032 sc = page.Response().Response.Response.StatusCode 2033 } 2034 tracing.EndSpan(ctx, sc, err) 2035 }() 2036 } 2037 for { 2038 next, err := page.fn(ctx, page.plr) 2039 if err != nil { 2040 return err 2041 } 2042 page.plr = next 2043 if !next.hasNextLink() || !next.IsEmpty() { 2044 break 2045 } 2046 } 2047 return nil 2048} 2049 2050// Next advances to the next page of values. If there was an error making 2051// the request the page does not advance and the error is returned. 2052// Deprecated: Use NextWithContext() instead. 2053func (page *ProviderListResultPage) Next() error { 2054 return page.NextWithContext(context.Background()) 2055} 2056 2057// NotDone returns true if the page enumeration should be started or is not yet complete. 2058func (page ProviderListResultPage) NotDone() bool { 2059 return !page.plr.IsEmpty() 2060} 2061 2062// Response returns the raw server response from the last page request. 2063func (page ProviderListResultPage) Response() ProviderListResult { 2064 return page.plr 2065} 2066 2067// Values returns the slice of values for the current page or nil if there are no values. 2068func (page ProviderListResultPage) Values() []Provider { 2069 if page.plr.IsEmpty() { 2070 return nil 2071 } 2072 return *page.plr.Value 2073} 2074 2075// Creates a new instance of the ProviderListResultPage type. 2076func NewProviderListResultPage(cur ProviderListResult, getNextPage func(context.Context, ProviderListResult) (ProviderListResult, error)) ProviderListResultPage { 2077 return ProviderListResultPage{ 2078 fn: getNextPage, 2079 plr: cur, 2080 } 2081} 2082 2083// ProviderOperationDisplayProperties resource provider operation's display properties. 2084type ProviderOperationDisplayProperties struct { 2085 // Publisher - Operation description. 2086 Publisher *string `json:"publisher,omitempty"` 2087 // Provider - Operation provider. 2088 Provider *string `json:"provider,omitempty"` 2089 // Resource - Operation resource. 2090 Resource *string `json:"resource,omitempty"` 2091 // Operation - Resource provider operation. 2092 Operation *string `json:"operation,omitempty"` 2093 // Description - Operation description. 2094 Description *string `json:"description,omitempty"` 2095} 2096 2097// ProviderResourceType resource type managed by the resource provider. 2098type ProviderResourceType struct { 2099 // ResourceType - The resource type. 2100 ResourceType *string `json:"resourceType,omitempty"` 2101 // Locations - The collection of locations where this resource type can be created. 2102 Locations *[]string `json:"locations,omitempty"` 2103 // Aliases - The aliases that are supported by this resource type. 2104 Aliases *[]AliasType `json:"aliases,omitempty"` 2105 // APIVersions - The API version. 2106 APIVersions *[]string `json:"apiVersions,omitempty"` 2107 // Capabilities - The additional capabilities offered by this resource type. 2108 Capabilities *string `json:"capabilities,omitempty"` 2109 // Properties - The properties. 2110 Properties map[string]*string `json:"properties"` 2111} 2112 2113// MarshalJSON is the custom marshaler for ProviderResourceType. 2114func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { 2115 objectMap := make(map[string]interface{}) 2116 if prt.ResourceType != nil { 2117 objectMap["resourceType"] = prt.ResourceType 2118 } 2119 if prt.Locations != nil { 2120 objectMap["locations"] = prt.Locations 2121 } 2122 if prt.Aliases != nil { 2123 objectMap["aliases"] = prt.Aliases 2124 } 2125 if prt.APIVersions != nil { 2126 objectMap["apiVersions"] = prt.APIVersions 2127 } 2128 if prt.Capabilities != nil { 2129 objectMap["capabilities"] = prt.Capabilities 2130 } 2131 if prt.Properties != nil { 2132 objectMap["properties"] = prt.Properties 2133 } 2134 return json.Marshal(objectMap) 2135} 2136 2137// Resource specified resource. 2138type Resource struct { 2139 // ID - READ-ONLY; Resource ID 2140 ID *string `json:"id,omitempty"` 2141 // Name - READ-ONLY; Resource name 2142 Name *string `json:"name,omitempty"` 2143 // Type - READ-ONLY; Resource type 2144 Type *string `json:"type,omitempty"` 2145 // Location - Resource location 2146 Location *string `json:"location,omitempty"` 2147 // Tags - Resource tags 2148 Tags map[string]*string `json:"tags"` 2149} 2150 2151// MarshalJSON is the custom marshaler for Resource. 2152func (r Resource) MarshalJSON() ([]byte, error) { 2153 objectMap := make(map[string]interface{}) 2154 if r.Location != nil { 2155 objectMap["location"] = r.Location 2156 } 2157 if r.Tags != nil { 2158 objectMap["tags"] = r.Tags 2159 } 2160 return json.Marshal(objectMap) 2161} 2162 2163// Sku SKU for the resource. 2164type Sku struct { 2165 // Name - The SKU name. 2166 Name *string `json:"name,omitempty"` 2167 // Tier - The SKU tier. 2168 Tier *string `json:"tier,omitempty"` 2169 // Size - The SKU size. 2170 Size *string `json:"size,omitempty"` 2171 // Family - The SKU family. 2172 Family *string `json:"family,omitempty"` 2173 // Model - The SKU model. 2174 Model *string `json:"model,omitempty"` 2175 // Capacity - The SKU capacity. 2176 Capacity *int32 `json:"capacity,omitempty"` 2177} 2178 2179// SubResource sub-resource. 2180type SubResource struct { 2181 // ID - Resource ID 2182 ID *string `json:"id,omitempty"` 2183} 2184 2185// TagCount tag count. 2186type TagCount struct { 2187 // Type - Type of count. 2188 Type *string `json:"type,omitempty"` 2189 // Value - Value of count. 2190 Value *int32 `json:"value,omitempty"` 2191} 2192 2193// TagDetails tag details. 2194type TagDetails struct { 2195 autorest.Response `json:"-"` 2196 // ID - READ-ONLY; The tag ID. 2197 ID *string `json:"id,omitempty"` 2198 // TagName - The tag name. 2199 TagName *string `json:"tagName,omitempty"` 2200 // 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. 2201 Count *TagCount `json:"count,omitempty"` 2202 // Values - The list of tag values. 2203 Values *[]TagValue `json:"values,omitempty"` 2204} 2205 2206// MarshalJSON is the custom marshaler for TagDetails. 2207func (td TagDetails) MarshalJSON() ([]byte, error) { 2208 objectMap := make(map[string]interface{}) 2209 if td.TagName != nil { 2210 objectMap["tagName"] = td.TagName 2211 } 2212 if td.Count != nil { 2213 objectMap["count"] = td.Count 2214 } 2215 if td.Values != nil { 2216 objectMap["values"] = td.Values 2217 } 2218 return json.Marshal(objectMap) 2219} 2220 2221// TagsListResult list of subscription tags. 2222type TagsListResult struct { 2223 autorest.Response `json:"-"` 2224 // Value - An array of tags. 2225 Value *[]TagDetails `json:"value,omitempty"` 2226 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 2227 NextLink *string `json:"nextLink,omitempty"` 2228} 2229 2230// MarshalJSON is the custom marshaler for TagsListResult. 2231func (tlr TagsListResult) MarshalJSON() ([]byte, error) { 2232 objectMap := make(map[string]interface{}) 2233 if tlr.Value != nil { 2234 objectMap["value"] = tlr.Value 2235 } 2236 return json.Marshal(objectMap) 2237} 2238 2239// TagsListResultIterator provides access to a complete listing of TagDetails values. 2240type TagsListResultIterator struct { 2241 i int 2242 page TagsListResultPage 2243} 2244 2245// NextWithContext advances to the next value. If there was an error making 2246// the request the iterator does not advance and the error is returned. 2247func (iter *TagsListResultIterator) NextWithContext(ctx context.Context) (err error) { 2248 if tracing.IsEnabled() { 2249 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultIterator.NextWithContext") 2250 defer func() { 2251 sc := -1 2252 if iter.Response().Response.Response != nil { 2253 sc = iter.Response().Response.Response.StatusCode 2254 } 2255 tracing.EndSpan(ctx, sc, err) 2256 }() 2257 } 2258 iter.i++ 2259 if iter.i < len(iter.page.Values()) { 2260 return nil 2261 } 2262 err = iter.page.NextWithContext(ctx) 2263 if err != nil { 2264 iter.i-- 2265 return err 2266 } 2267 iter.i = 0 2268 return nil 2269} 2270 2271// Next advances to the next value. If there was an error making 2272// the request the iterator does not advance and the error is returned. 2273// Deprecated: Use NextWithContext() instead. 2274func (iter *TagsListResultIterator) Next() error { 2275 return iter.NextWithContext(context.Background()) 2276} 2277 2278// NotDone returns true if the enumeration should be started or is not yet complete. 2279func (iter TagsListResultIterator) NotDone() bool { 2280 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2281} 2282 2283// Response returns the raw server response from the last page request. 2284func (iter TagsListResultIterator) Response() TagsListResult { 2285 return iter.page.Response() 2286} 2287 2288// Value returns the current value or a zero-initialized value if the 2289// iterator has advanced beyond the end of the collection. 2290func (iter TagsListResultIterator) Value() TagDetails { 2291 if !iter.page.NotDone() { 2292 return TagDetails{} 2293 } 2294 return iter.page.Values()[iter.i] 2295} 2296 2297// Creates a new instance of the TagsListResultIterator type. 2298func NewTagsListResultIterator(page TagsListResultPage) TagsListResultIterator { 2299 return TagsListResultIterator{page: page} 2300} 2301 2302// IsEmpty returns true if the ListResult contains no values. 2303func (tlr TagsListResult) IsEmpty() bool { 2304 return tlr.Value == nil || len(*tlr.Value) == 0 2305} 2306 2307// hasNextLink returns true if the NextLink is not empty. 2308func (tlr TagsListResult) hasNextLink() bool { 2309 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 2310} 2311 2312// tagsListResultPreparer prepares a request to retrieve the next set of results. 2313// It returns nil if no more results exist. 2314func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) { 2315 if !tlr.hasNextLink() { 2316 return nil, nil 2317 } 2318 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2319 autorest.AsJSON(), 2320 autorest.AsGet(), 2321 autorest.WithBaseURL(to.String(tlr.NextLink))) 2322} 2323 2324// TagsListResultPage contains a page of TagDetails values. 2325type TagsListResultPage struct { 2326 fn func(context.Context, TagsListResult) (TagsListResult, error) 2327 tlr TagsListResult 2328} 2329 2330// NextWithContext advances to the next page of values. If there was an error making 2331// the request the page does not advance and the error is returned. 2332func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error) { 2333 if tracing.IsEnabled() { 2334 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultPage.NextWithContext") 2335 defer func() { 2336 sc := -1 2337 if page.Response().Response.Response != nil { 2338 sc = page.Response().Response.Response.StatusCode 2339 } 2340 tracing.EndSpan(ctx, sc, err) 2341 }() 2342 } 2343 for { 2344 next, err := page.fn(ctx, page.tlr) 2345 if err != nil { 2346 return err 2347 } 2348 page.tlr = next 2349 if !next.hasNextLink() || !next.IsEmpty() { 2350 break 2351 } 2352 } 2353 return nil 2354} 2355 2356// Next advances to the next page of values. If there was an error making 2357// the request the page does not advance and the error is returned. 2358// Deprecated: Use NextWithContext() instead. 2359func (page *TagsListResultPage) Next() error { 2360 return page.NextWithContext(context.Background()) 2361} 2362 2363// NotDone returns true if the page enumeration should be started or is not yet complete. 2364func (page TagsListResultPage) NotDone() bool { 2365 return !page.tlr.IsEmpty() 2366} 2367 2368// Response returns the raw server response from the last page request. 2369func (page TagsListResultPage) Response() TagsListResult { 2370 return page.tlr 2371} 2372 2373// Values returns the slice of values for the current page or nil if there are no values. 2374func (page TagsListResultPage) Values() []TagDetails { 2375 if page.tlr.IsEmpty() { 2376 return nil 2377 } 2378 return *page.tlr.Value 2379} 2380 2381// Creates a new instance of the TagsListResultPage type. 2382func NewTagsListResultPage(cur TagsListResult, getNextPage func(context.Context, TagsListResult) (TagsListResult, error)) TagsListResultPage { 2383 return TagsListResultPage{ 2384 fn: getNextPage, 2385 tlr: cur, 2386 } 2387} 2388 2389// TagValue tag information. 2390type TagValue struct { 2391 autorest.Response `json:"-"` 2392 // ID - READ-ONLY; The tag ID. 2393 ID *string `json:"id,omitempty"` 2394 // TagValue - The tag value. 2395 TagValue *string `json:"tagValue,omitempty"` 2396 // Count - The tag value count. 2397 Count *TagCount `json:"count,omitempty"` 2398} 2399 2400// MarshalJSON is the custom marshaler for TagValue. 2401func (tv TagValue) MarshalJSON() ([]byte, error) { 2402 objectMap := make(map[string]interface{}) 2403 if tv.TagValue != nil { 2404 objectMap["tagValue"] = tv.TagValue 2405 } 2406 if tv.Count != nil { 2407 objectMap["count"] = tv.Count 2408 } 2409 return json.Marshal(objectMap) 2410} 2411 2412// TargetResource target resource. 2413type TargetResource struct { 2414 // ID - The ID of the resource. 2415 ID *string `json:"id,omitempty"` 2416 // ResourceName - The name of the resource. 2417 ResourceName *string `json:"resourceName,omitempty"` 2418 // ResourceType - The type of the resource. 2419 ResourceType *string `json:"resourceType,omitempty"` 2420} 2421 2422// TemplateHashResult result of the request to calculate template hash. It contains a string of minified 2423// template and its hash. 2424type TemplateHashResult struct { 2425 autorest.Response `json:"-"` 2426 // MinifiedTemplate - The minified template string. 2427 MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` 2428 // TemplateHash - The template hash. 2429 TemplateHash *string `json:"templateHash,omitempty"` 2430} 2431 2432// TemplateLink entity representing the reference to the template. 2433type TemplateLink struct { 2434 // URI - The URI of the template to deploy. 2435 URI *string `json:"uri,omitempty"` 2436 // ContentVersion - If included, must match the ContentVersion in the template. 2437 ContentVersion *string `json:"contentVersion,omitempty"` 2438} 2439 2440// UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2441type UpdateByIDFuture struct { 2442 azure.FutureAPI 2443 // Result returns the result of the asynchronous operation. 2444 // If the operation has not completed it will return an error. 2445 Result func(Client) (GenericResource, error) 2446} 2447 2448// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2449func (future *UpdateByIDFuture) UnmarshalJSON(body []byte) error { 2450 var azFuture azure.Future 2451 if err := json.Unmarshal(body, &azFuture); err != nil { 2452 return err 2453 } 2454 future.FutureAPI = &azFuture 2455 future.Result = future.result 2456 return nil 2457} 2458 2459// result is the default implementation for UpdateByIDFuture.Result. 2460func (future *UpdateByIDFuture) result(client Client) (gr GenericResource, err error) { 2461 var done bool 2462 done, err = future.DoneWithContext(context.Background(), client) 2463 if err != nil { 2464 err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Polling failure") 2465 return 2466 } 2467 if !done { 2468 gr.Response.Response = future.Response() 2469 err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") 2470 return 2471 } 2472 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2473 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 2474 gr, err = client.UpdateByIDResponder(gr.Response.Response) 2475 if err != nil { 2476 err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") 2477 } 2478 } 2479 return 2480} 2481 2482// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2483type UpdateFuture struct { 2484 azure.FutureAPI 2485 // Result returns the result of the asynchronous operation. 2486 // If the operation has not completed it will return an error. 2487 Result func(Client) (GenericResource, error) 2488} 2489 2490// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2491func (future *UpdateFuture) UnmarshalJSON(body []byte) error { 2492 var azFuture azure.Future 2493 if err := json.Unmarshal(body, &azFuture); err != nil { 2494 return err 2495 } 2496 future.FutureAPI = &azFuture 2497 future.Result = future.result 2498 return nil 2499} 2500 2501// result is the default implementation for UpdateFuture.Result. 2502func (future *UpdateFuture) result(client Client) (gr GenericResource, err error) { 2503 var done bool 2504 done, err = future.DoneWithContext(context.Background(), client) 2505 if err != nil { 2506 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure") 2507 return 2508 } 2509 if !done { 2510 gr.Response.Response = future.Response() 2511 err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") 2512 return 2513 } 2514 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2515 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 2516 gr, err = client.UpdateResponder(gr.Response.Response) 2517 if err != nil { 2518 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") 2519 } 2520 } 2521 return 2522} 2523 2524// ValidateMoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running 2525// operation. 2526type ValidateMoveResourcesFuture struct { 2527 azure.FutureAPI 2528 // Result returns the result of the asynchronous operation. 2529 // If the operation has not completed it will return an error. 2530 Result func(Client) (autorest.Response, error) 2531} 2532 2533// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2534func (future *ValidateMoveResourcesFuture) UnmarshalJSON(body []byte) error { 2535 var azFuture azure.Future 2536 if err := json.Unmarshal(body, &azFuture); err != nil { 2537 return err 2538 } 2539 future.FutureAPI = &azFuture 2540 future.Result = future.result 2541 return nil 2542} 2543 2544// result is the default implementation for ValidateMoveResourcesFuture.Result. 2545func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { 2546 var done bool 2547 done, err = future.DoneWithContext(context.Background(), client) 2548 if err != nil { 2549 err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Polling failure") 2550 return 2551 } 2552 if !done { 2553 ar.Response = future.Response() 2554 err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") 2555 return 2556 } 2557 ar.Response = future.Response() 2558 return 2559} 2560