1package resources 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-07-01/resources" 33 34// DeploymentMode enumerates the values for deployment mode. 35type DeploymentMode string 36 37const ( 38 // Complete ... 39 Complete DeploymentMode = "Complete" 40 // Incremental ... 41 Incremental DeploymentMode = "Incremental" 42) 43 44// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type. 45func PossibleDeploymentModeValues() []DeploymentMode { 46 return []DeploymentMode{Complete, Incremental} 47} 48 49// ResourceIdentityType enumerates the values for resource identity type. 50type ResourceIdentityType string 51 52const ( 53 // SystemAssigned ... 54 SystemAssigned ResourceIdentityType = "SystemAssigned" 55) 56 57// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. 58func PossibleResourceIdentityTypeValues() []ResourceIdentityType { 59 return []ResourceIdentityType{SystemAssigned} 60} 61 62// AliasPathType the type of the paths for alias. 63type AliasPathType struct { 64 // Path - The path of an alias. 65 Path *string `json:"path,omitempty"` 66 // APIVersions - The api versions. 67 APIVersions *[]string `json:"apiVersions,omitempty"` 68} 69 70// AliasType the alias type. 71type AliasType struct { 72 // Name - The alias name. 73 Name *string `json:"name,omitempty"` 74 // Paths - The paths for an alias. 75 Paths *[]AliasPathType `json:"paths,omitempty"` 76} 77 78// BasicDependency deployment dependency information. 79type BasicDependency struct { 80 // ID - The ID of the dependency. 81 ID *string `json:"id,omitempty"` 82 // ResourceType - The dependency resource type. 83 ResourceType *string `json:"resourceType,omitempty"` 84 // ResourceName - The dependency resource name. 85 ResourceName *string `json:"resourceName,omitempty"` 86} 87 88// CloudError an error response for a resource management request. 89type CloudError struct { 90 Error *ErrorResponse `json:"error,omitempty"` 91} 92 93// DebugSetting ... 94type DebugSetting struct { 95 // DetailLevel - The debug detail level. 96 DetailLevel *string `json:"detailLevel,omitempty"` 97} 98 99// Dependency deployment dependency information. 100type Dependency struct { 101 // DependsOn - The list of dependencies. 102 DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` 103 // ID - The ID of the dependency. 104 ID *string `json:"id,omitempty"` 105 // ResourceType - The dependency resource type. 106 ResourceType *string `json:"resourceType,omitempty"` 107 // ResourceName - The dependency resource name. 108 ResourceName *string `json:"resourceName,omitempty"` 109} 110 111// Deployment deployment operation parameters. 112type Deployment struct { 113 // Properties - The deployment properties. 114 Properties *DeploymentProperties `json:"properties,omitempty"` 115} 116 117// DeploymentExportResult the deployment export result. 118type DeploymentExportResult struct { 119 autorest.Response `json:"-"` 120 // Template - The template content. 121 Template interface{} `json:"template,omitempty"` 122} 123 124// DeploymentExtended deployment information. 125type DeploymentExtended struct { 126 autorest.Response `json:"-"` 127 // ID - READ-ONLY; The ID of the deployment. 128 ID *string `json:"id,omitempty"` 129 // Name - The name of the deployment. 130 Name *string `json:"name,omitempty"` 131 // Properties - Deployment properties. 132 Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` 133} 134 135// DeploymentExtendedFilter deployment filter. 136type DeploymentExtendedFilter struct { 137 // ProvisioningState - The provisioning state. 138 ProvisioningState *string `json:"provisioningState,omitempty"` 139} 140 141// DeploymentListResult list of deployments. 142type DeploymentListResult struct { 143 autorest.Response `json:"-"` 144 // Value - The list of deployments. 145 Value *[]DeploymentExtended `json:"value,omitempty"` 146 // NextLink - The URL to get the next set of results. 147 NextLink *string `json:"nextLink,omitempty"` 148} 149 150// DeploymentListResultIterator provides access to a complete listing of DeploymentExtended values. 151type DeploymentListResultIterator struct { 152 i int 153 page DeploymentListResultPage 154} 155 156// NextWithContext advances to the next value. If there was an error making 157// the request the iterator does not advance and the error is returned. 158func (iter *DeploymentListResultIterator) NextWithContext(ctx context.Context) (err error) { 159 if tracing.IsEnabled() { 160 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultIterator.NextWithContext") 161 defer func() { 162 sc := -1 163 if iter.Response().Response.Response != nil { 164 sc = iter.Response().Response.Response.StatusCode 165 } 166 tracing.EndSpan(ctx, sc, err) 167 }() 168 } 169 iter.i++ 170 if iter.i < len(iter.page.Values()) { 171 return nil 172 } 173 err = iter.page.NextWithContext(ctx) 174 if err != nil { 175 iter.i-- 176 return err 177 } 178 iter.i = 0 179 return nil 180} 181 182// Next advances to the next value. If there was an error making 183// the request the iterator does not advance and the error is returned. 184// Deprecated: Use NextWithContext() instead. 185func (iter *DeploymentListResultIterator) Next() error { 186 return iter.NextWithContext(context.Background()) 187} 188 189// NotDone returns true if the enumeration should be started or is not yet complete. 190func (iter DeploymentListResultIterator) NotDone() bool { 191 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 192} 193 194// Response returns the raw server response from the last page request. 195func (iter DeploymentListResultIterator) Response() DeploymentListResult { 196 return iter.page.Response() 197} 198 199// Value returns the current value or a zero-initialized value if the 200// iterator has advanced beyond the end of the collection. 201func (iter DeploymentListResultIterator) Value() DeploymentExtended { 202 if !iter.page.NotDone() { 203 return DeploymentExtended{} 204 } 205 return iter.page.Values()[iter.i] 206} 207 208// Creates a new instance of the DeploymentListResultIterator type. 209func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { 210 return DeploymentListResultIterator{page: page} 211} 212 213// IsEmpty returns true if the ListResult contains no values. 214func (dlr DeploymentListResult) IsEmpty() bool { 215 return dlr.Value == nil || len(*dlr.Value) == 0 216} 217 218// deploymentListResultPreparer prepares a request to retrieve the next set of results. 219// It returns nil if no more results exist. 220func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) { 221 if dlr.NextLink == nil || len(to.String(dlr.NextLink)) < 1 { 222 return nil, nil 223 } 224 return autorest.Prepare((&http.Request{}).WithContext(ctx), 225 autorest.AsJSON(), 226 autorest.AsGet(), 227 autorest.WithBaseURL(to.String(dlr.NextLink))) 228} 229 230// DeploymentListResultPage contains a page of DeploymentExtended values. 231type DeploymentListResultPage struct { 232 fn func(context.Context, DeploymentListResult) (DeploymentListResult, error) 233 dlr DeploymentListResult 234} 235 236// NextWithContext advances to the next page of values. If there was an error making 237// the request the page does not advance and the error is returned. 238func (page *DeploymentListResultPage) NextWithContext(ctx context.Context) (err error) { 239 if tracing.IsEnabled() { 240 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultPage.NextWithContext") 241 defer func() { 242 sc := -1 243 if page.Response().Response.Response != nil { 244 sc = page.Response().Response.Response.StatusCode 245 } 246 tracing.EndSpan(ctx, sc, err) 247 }() 248 } 249 next, err := page.fn(ctx, page.dlr) 250 if err != nil { 251 return err 252 } 253 page.dlr = next 254 return nil 255} 256 257// Next advances to the next page of values. If there was an error making 258// the request the page does not advance and the error is returned. 259// Deprecated: Use NextWithContext() instead. 260func (page *DeploymentListResultPage) Next() error { 261 return page.NextWithContext(context.Background()) 262} 263 264// NotDone returns true if the page enumeration should be started or is not yet complete. 265func (page DeploymentListResultPage) NotDone() bool { 266 return !page.dlr.IsEmpty() 267} 268 269// Response returns the raw server response from the last page request. 270func (page DeploymentListResultPage) Response() DeploymentListResult { 271 return page.dlr 272} 273 274// Values returns the slice of values for the current page or nil if there are no values. 275func (page DeploymentListResultPage) Values() []DeploymentExtended { 276 if page.dlr.IsEmpty() { 277 return nil 278 } 279 return *page.dlr.Value 280} 281 282// Creates a new instance of the DeploymentListResultPage type. 283func NewDeploymentListResultPage(getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { 284 return DeploymentListResultPage{fn: getNextPage} 285} 286 287// DeploymentOperation deployment operation information. 288type DeploymentOperation struct { 289 autorest.Response `json:"-"` 290 // ID - Full deployment operation id. 291 ID *string `json:"id,omitempty"` 292 // OperationID - Deployment operation id. 293 OperationID *string `json:"operationId,omitempty"` 294 // Properties - Deployment properties. 295 Properties *DeploymentOperationProperties `json:"properties,omitempty"` 296} 297 298// DeploymentOperationProperties deployment operation properties. 299type DeploymentOperationProperties struct { 300 // ProvisioningState - The state of the provisioning. 301 ProvisioningState *string `json:"provisioningState,omitempty"` 302 // Timestamp - The date and time of the operation. 303 Timestamp *date.Time `json:"timestamp,omitempty"` 304 // ServiceRequestID - Deployment operation service request id. 305 ServiceRequestID *string `json:"serviceRequestId,omitempty"` 306 // StatusCode - Operation status code. 307 StatusCode *string `json:"statusCode,omitempty"` 308 // StatusMessage - Operation status message. 309 StatusMessage interface{} `json:"statusMessage,omitempty"` 310 // TargetResource - The target resource. 311 TargetResource *TargetResource `json:"targetResource,omitempty"` 312 // Request - The HTTP request message. 313 Request *HTTPMessage `json:"request,omitempty"` 314 // Response - The HTTP response message. 315 Response *HTTPMessage `json:"response,omitempty"` 316} 317 318// DeploymentOperationsListResult list of deployment operations. 319type DeploymentOperationsListResult struct { 320 autorest.Response `json:"-"` 321 // Value - The list of deployments. 322 Value *[]DeploymentOperation `json:"value,omitempty"` 323 // NextLink - The URL to get the next set of results. 324 NextLink *string `json:"nextLink,omitempty"` 325} 326 327// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation 328// values. 329type DeploymentOperationsListResultIterator struct { 330 i int 331 page DeploymentOperationsListResultPage 332} 333 334// NextWithContext advances to the next value. If there was an error making 335// the request the iterator does not advance and the error is returned. 336func (iter *DeploymentOperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { 337 if tracing.IsEnabled() { 338 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultIterator.NextWithContext") 339 defer func() { 340 sc := -1 341 if iter.Response().Response.Response != nil { 342 sc = iter.Response().Response.Response.StatusCode 343 } 344 tracing.EndSpan(ctx, sc, err) 345 }() 346 } 347 iter.i++ 348 if iter.i < len(iter.page.Values()) { 349 return nil 350 } 351 err = iter.page.NextWithContext(ctx) 352 if err != nil { 353 iter.i-- 354 return err 355 } 356 iter.i = 0 357 return nil 358} 359 360// Next advances to the next value. If there was an error making 361// the request the iterator does not advance and the error is returned. 362// Deprecated: Use NextWithContext() instead. 363func (iter *DeploymentOperationsListResultIterator) Next() error { 364 return iter.NextWithContext(context.Background()) 365} 366 367// NotDone returns true if the enumeration should be started or is not yet complete. 368func (iter DeploymentOperationsListResultIterator) NotDone() bool { 369 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 370} 371 372// Response returns the raw server response from the last page request. 373func (iter DeploymentOperationsListResultIterator) Response() DeploymentOperationsListResult { 374 return iter.page.Response() 375} 376 377// Value returns the current value or a zero-initialized value if the 378// iterator has advanced beyond the end of the collection. 379func (iter DeploymentOperationsListResultIterator) Value() DeploymentOperation { 380 if !iter.page.NotDone() { 381 return DeploymentOperation{} 382 } 383 return iter.page.Values()[iter.i] 384} 385 386// Creates a new instance of the DeploymentOperationsListResultIterator type. 387func NewDeploymentOperationsListResultIterator(page DeploymentOperationsListResultPage) DeploymentOperationsListResultIterator { 388 return DeploymentOperationsListResultIterator{page: page} 389} 390 391// IsEmpty returns true if the ListResult contains no values. 392func (dolr DeploymentOperationsListResult) IsEmpty() bool { 393 return dolr.Value == nil || len(*dolr.Value) == 0 394} 395 396// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. 397// It returns nil if no more results exist. 398func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer(ctx context.Context) (*http.Request, error) { 399 if dolr.NextLink == nil || len(to.String(dolr.NextLink)) < 1 { 400 return nil, nil 401 } 402 return autorest.Prepare((&http.Request{}).WithContext(ctx), 403 autorest.AsJSON(), 404 autorest.AsGet(), 405 autorest.WithBaseURL(to.String(dolr.NextLink))) 406} 407 408// DeploymentOperationsListResultPage contains a page of DeploymentOperation values. 409type DeploymentOperationsListResultPage struct { 410 fn func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error) 411 dolr DeploymentOperationsListResult 412} 413 414// NextWithContext advances to the next page of values. If there was an error making 415// the request the page does not advance and the error is returned. 416func (page *DeploymentOperationsListResultPage) NextWithContext(ctx context.Context) (err error) { 417 if tracing.IsEnabled() { 418 ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultPage.NextWithContext") 419 defer func() { 420 sc := -1 421 if page.Response().Response.Response != nil { 422 sc = page.Response().Response.Response.StatusCode 423 } 424 tracing.EndSpan(ctx, sc, err) 425 }() 426 } 427 next, err := page.fn(ctx, page.dolr) 428 if err != nil { 429 return err 430 } 431 page.dolr = next 432 return nil 433} 434 435// Next advances to the next page of values. If there was an error making 436// the request the page does not advance and the error is returned. 437// Deprecated: Use NextWithContext() instead. 438func (page *DeploymentOperationsListResultPage) Next() error { 439 return page.NextWithContext(context.Background()) 440} 441 442// NotDone returns true if the page enumeration should be started or is not yet complete. 443func (page DeploymentOperationsListResultPage) NotDone() bool { 444 return !page.dolr.IsEmpty() 445} 446 447// Response returns the raw server response from the last page request. 448func (page DeploymentOperationsListResultPage) Response() DeploymentOperationsListResult { 449 return page.dolr 450} 451 452// Values returns the slice of values for the current page or nil if there are no values. 453func (page DeploymentOperationsListResultPage) Values() []DeploymentOperation { 454 if page.dolr.IsEmpty() { 455 return nil 456 } 457 return *page.dolr.Value 458} 459 460// Creates a new instance of the DeploymentOperationsListResultPage type. 461func NewDeploymentOperationsListResultPage(getNextPage func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error)) DeploymentOperationsListResultPage { 462 return DeploymentOperationsListResultPage{fn: getNextPage} 463} 464 465// DeploymentProperties deployment properties. 466type DeploymentProperties struct { 467 // Template - The template content. It can be a JObject or a well formed JSON string. Use only one of Template or TemplateLink. 468 Template interface{} `json:"template,omitempty"` 469 // TemplateLink - The template URI. Use only one of Template or TemplateLink. 470 TemplateLink *TemplateLink `json:"templateLink,omitempty"` 471 // Parameters - Deployment parameters. It can be a JObject or a well formed JSON string. Use only one of Parameters or ParametersLink. 472 Parameters interface{} `json:"parameters,omitempty"` 473 // ParametersLink - The parameters URI. Use only one of Parameters or ParametersLink. 474 ParametersLink *ParametersLink `json:"parametersLink,omitempty"` 475 // Mode - The deployment mode. Possible values include: 'Incremental', 'Complete' 476 Mode DeploymentMode `json:"mode,omitempty"` 477 // DebugSetting - The debug setting of the deployment. 478 DebugSetting *DebugSetting `json:"debugSetting,omitempty"` 479} 480 481// DeploymentPropertiesExtended deployment properties with additional details. 482type DeploymentPropertiesExtended struct { 483 // ProvisioningState - The state of the provisioning. 484 ProvisioningState *string `json:"provisioningState,omitempty"` 485 // CorrelationID - The correlation ID of the deployment. 486 CorrelationID *string `json:"correlationId,omitempty"` 487 // Timestamp - The timestamp of the template deployment. 488 Timestamp *date.Time `json:"timestamp,omitempty"` 489 // Outputs - Key/value pairs that represent deployment output. 490 Outputs interface{} `json:"outputs,omitempty"` 491 // Providers - The list of resource providers needed for the deployment. 492 Providers *[]Provider `json:"providers,omitempty"` 493 // Dependencies - The list of deployment dependencies. 494 Dependencies *[]Dependency `json:"dependencies,omitempty"` 495 // Template - The template content. Use only one of Template or TemplateLink. 496 Template interface{} `json:"template,omitempty"` 497 // TemplateLink - The URI referencing the template. Use only one of Template or TemplateLink. 498 TemplateLink *TemplateLink `json:"templateLink,omitempty"` 499 // Parameters - Deployment parameters. Use only one of Parameters or ParametersLink. 500 Parameters interface{} `json:"parameters,omitempty"` 501 // ParametersLink - The URI referencing the parameters. Use only one of Parameters or ParametersLink. 502 ParametersLink *ParametersLink `json:"parametersLink,omitempty"` 503 // Mode - The deployment mode. Possible values include: 'Incremental', 'Complete' 504 Mode DeploymentMode `json:"mode,omitempty"` 505 // DebugSetting - The debug setting of the deployment. 506 DebugSetting *DebugSetting `json:"debugSetting,omitempty"` 507} 508 509// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 510// long-running operation. 511type DeploymentsCreateOrUpdateFuture struct { 512 azure.Future 513} 514 515// Result returns the result of the asynchronous operation. 516// If the operation has not completed it will return an error. 517func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) { 518 var done bool 519 done, err = future.DoneWithContext(context.Background(), client) 520 if err != nil { 521 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 522 return 523 } 524 if !done { 525 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") 526 return 527 } 528 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 529 if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { 530 de, err = client.CreateOrUpdateResponder(de.Response.Response) 531 if err != nil { 532 err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") 533 } 534 } 535 return 536} 537 538// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 539// operation. 540type DeploymentsDeleteFuture struct { 541 azure.Future 542} 543 544// Result returns the result of the asynchronous operation. 545// If the operation has not completed it will return an error. 546func (future *DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { 547 var done bool 548 done, err = future.DoneWithContext(context.Background(), client) 549 if err != nil { 550 err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") 551 return 552 } 553 if !done { 554 err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") 555 return 556 } 557 ar.Response = future.Response() 558 return 559} 560 561// DeploymentValidateResult information from validate template deployment response. 562type DeploymentValidateResult struct { 563 autorest.Response `json:"-"` 564 // Error - Validation error. 565 Error *ManagementErrorWithDetails `json:"error,omitempty"` 566 // Properties - The template deployment properties. 567 Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` 568} 569 570// ErrorAdditionalInfo the resource management error additional info. 571type ErrorAdditionalInfo struct { 572 // Type - READ-ONLY; The additional info type. 573 Type *string `json:"type,omitempty"` 574 // Info - READ-ONLY; The additional info. 575 Info interface{} `json:"info,omitempty"` 576} 577 578// ErrorResponse the resource management error response. 579type ErrorResponse struct { 580 // Code - READ-ONLY; The error code. 581 Code *string `json:"code,omitempty"` 582 // Message - READ-ONLY; The error message. 583 Message *string `json:"message,omitempty"` 584 // Target - READ-ONLY; The error target. 585 Target *string `json:"target,omitempty"` 586 // Details - READ-ONLY; The error details. 587 Details *[]ErrorResponse `json:"details,omitempty"` 588 // AdditionalInfo - READ-ONLY; The error additional info. 589 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 590} 591 592// ExportTemplateRequest export resource group template request parameters. 593type ExportTemplateRequest struct { 594 // ResourcesProperty - The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. 595 ResourcesProperty *[]string `json:"resources,omitempty"` 596 // Options - The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization' 597 Options *string `json:"options,omitempty"` 598} 599 600// GenericResource resource information. 601type GenericResource struct { 602 autorest.Response `json:"-"` 603 // Plan - The plan of the resource. 604 Plan *Plan `json:"plan,omitempty"` 605 // Properties - The resource properties. 606 Properties interface{} `json:"properties,omitempty"` 607 // Kind - The kind of the resource. 608 Kind *string `json:"kind,omitempty"` 609 // ManagedBy - Id of the resource that manages this resource. 610 ManagedBy *string `json:"managedBy,omitempty"` 611 // Sku - The sku of the resource. 612 Sku *Sku `json:"sku,omitempty"` 613 // Identity - The identity of the resource. 614 Identity *Identity `json:"identity,omitempty"` 615 // ID - READ-ONLY; Resource Id 616 ID *string `json:"id,omitempty"` 617 // Name - READ-ONLY; Resource name 618 Name *string `json:"name,omitempty"` 619 // Type - READ-ONLY; Resource type 620 Type *string `json:"type,omitempty"` 621 // Location - Resource location 622 Location *string `json:"location,omitempty"` 623 // Tags - Resource tags 624 Tags map[string]*string `json:"tags"` 625} 626 627// MarshalJSON is the custom marshaler for GenericResource. 628func (gr GenericResource) MarshalJSON() ([]byte, error) { 629 objectMap := make(map[string]interface{}) 630 if gr.Plan != nil { 631 objectMap["plan"] = gr.Plan 632 } 633 if gr.Properties != nil { 634 objectMap["properties"] = gr.Properties 635 } 636 if gr.Kind != nil { 637 objectMap["kind"] = gr.Kind 638 } 639 if gr.ManagedBy != nil { 640 objectMap["managedBy"] = gr.ManagedBy 641 } 642 if gr.Sku != nil { 643 objectMap["sku"] = gr.Sku 644 } 645 if gr.Identity != nil { 646 objectMap["identity"] = gr.Identity 647 } 648 if gr.Location != nil { 649 objectMap["location"] = gr.Location 650 } 651 if gr.Tags != nil { 652 objectMap["tags"] = gr.Tags 653 } 654 return json.Marshal(objectMap) 655} 656 657// GenericResourceExpanded resource information. 658type GenericResourceExpanded struct { 659 // CreatedTime - READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. 660 CreatedTime *date.Time `json:"createdTime,omitempty"` 661 // ChangedTime - READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. 662 ChangedTime *date.Time `json:"changedTime,omitempty"` 663 // ProvisioningState - READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. 664 ProvisioningState *string `json:"provisioningState,omitempty"` 665 // Plan - The plan of the resource. 666 Plan *Plan `json:"plan,omitempty"` 667 // Properties - The resource properties. 668 Properties interface{} `json:"properties,omitempty"` 669 // Kind - The kind of the resource. 670 Kind *string `json:"kind,omitempty"` 671 // ManagedBy - Id of the resource that manages this resource. 672 ManagedBy *string `json:"managedBy,omitempty"` 673 // Sku - The sku of the resource. 674 Sku *Sku `json:"sku,omitempty"` 675 // Identity - The identity of the resource. 676 Identity *Identity `json:"identity,omitempty"` 677 // ID - READ-ONLY; Resource Id 678 ID *string `json:"id,omitempty"` 679 // Name - READ-ONLY; Resource name 680 Name *string `json:"name,omitempty"` 681 // Type - READ-ONLY; Resource type 682 Type *string `json:"type,omitempty"` 683 // Location - Resource location 684 Location *string `json:"location,omitempty"` 685 // Tags - Resource tags 686 Tags map[string]*string `json:"tags"` 687} 688 689// MarshalJSON is the custom marshaler for GenericResourceExpanded. 690func (gre GenericResourceExpanded) MarshalJSON() ([]byte, error) { 691 objectMap := make(map[string]interface{}) 692 if gre.Plan != nil { 693 objectMap["plan"] = gre.Plan 694 } 695 if gre.Properties != nil { 696 objectMap["properties"] = gre.Properties 697 } 698 if gre.Kind != nil { 699 objectMap["kind"] = gre.Kind 700 } 701 if gre.ManagedBy != nil { 702 objectMap["managedBy"] = gre.ManagedBy 703 } 704 if gre.Sku != nil { 705 objectMap["sku"] = gre.Sku 706 } 707 if gre.Identity != nil { 708 objectMap["identity"] = gre.Identity 709 } 710 if gre.Location != nil { 711 objectMap["location"] = gre.Location 712 } 713 if gre.Tags != nil { 714 objectMap["tags"] = gre.Tags 715 } 716 return json.Marshal(objectMap) 717} 718 719// GenericResourceFilter resource filter. 720type GenericResourceFilter struct { 721 // ResourceType - The resource type. 722 ResourceType *string `json:"resourceType,omitempty"` 723 // Tagname - The tag name. 724 Tagname *string `json:"tagname,omitempty"` 725 // Tagvalue - The tag value. 726 Tagvalue *string `json:"tagvalue,omitempty"` 727} 728 729// Group resource group information. 730type Group struct { 731 autorest.Response `json:"-"` 732 // ID - READ-ONLY; The ID of the resource group. 733 ID *string `json:"id,omitempty"` 734 // Name - The Name of the resource group. 735 Name *string `json:"name,omitempty"` 736 Properties *GroupProperties `json:"properties,omitempty"` 737 // Location - The location of the resource group. It cannot be changed after the resource group has been created. Has to be one of the supported Azure Locations, such as West US, East US, West Europe, East Asia, etc. 738 Location *string `json:"location,omitempty"` 739 // Tags - The tags attached to the resource group. 740 Tags map[string]*string `json:"tags"` 741} 742 743// MarshalJSON is the custom marshaler for Group. 744func (g Group) MarshalJSON() ([]byte, error) { 745 objectMap := make(map[string]interface{}) 746 if g.Name != nil { 747 objectMap["name"] = g.Name 748 } 749 if g.Properties != nil { 750 objectMap["properties"] = g.Properties 751 } 752 if g.Location != nil { 753 objectMap["location"] = g.Location 754 } 755 if g.Tags != nil { 756 objectMap["tags"] = g.Tags 757 } 758 return json.Marshal(objectMap) 759} 760 761// GroupExportResult ... 762type GroupExportResult struct { 763 autorest.Response `json:"-"` 764 // Template - The template content. 765 Template interface{} `json:"template,omitempty"` 766 // Error - The error. 767 Error *ManagementErrorWithDetails `json:"error,omitempty"` 768} 769 770// GroupFilter resource group filter. 771type GroupFilter struct { 772 // TagName - The tag name. 773 TagName *string `json:"tagName,omitempty"` 774 // TagValue - The tag value. 775 TagValue *string `json:"tagValue,omitempty"` 776} 777 778// GroupListResult list of resource groups. 779type GroupListResult struct { 780 autorest.Response `json:"-"` 781 // Value - The list of resource groups. 782 Value *[]Group `json:"value,omitempty"` 783 // NextLink - The URL to get the next set of results. 784 NextLink *string `json:"nextLink,omitempty"` 785} 786 787// GroupListResultIterator provides access to a complete listing of Group values. 788type GroupListResultIterator struct { 789 i int 790 page GroupListResultPage 791} 792 793// NextWithContext advances to the next value. If there was an error making 794// the request the iterator does not advance and the error is returned. 795func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 796 if tracing.IsEnabled() { 797 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") 798 defer func() { 799 sc := -1 800 if iter.Response().Response.Response != nil { 801 sc = iter.Response().Response.Response.StatusCode 802 } 803 tracing.EndSpan(ctx, sc, err) 804 }() 805 } 806 iter.i++ 807 if iter.i < len(iter.page.Values()) { 808 return nil 809 } 810 err = iter.page.NextWithContext(ctx) 811 if err != nil { 812 iter.i-- 813 return err 814 } 815 iter.i = 0 816 return nil 817} 818 819// Next advances to the next value. If there was an error making 820// the request the iterator does not advance and the error is returned. 821// Deprecated: Use NextWithContext() instead. 822func (iter *GroupListResultIterator) Next() error { 823 return iter.NextWithContext(context.Background()) 824} 825 826// NotDone returns true if the enumeration should be started or is not yet complete. 827func (iter GroupListResultIterator) NotDone() bool { 828 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 829} 830 831// Response returns the raw server response from the last page request. 832func (iter GroupListResultIterator) Response() GroupListResult { 833 return iter.page.Response() 834} 835 836// Value returns the current value or a zero-initialized value if the 837// iterator has advanced beyond the end of the collection. 838func (iter GroupListResultIterator) Value() Group { 839 if !iter.page.NotDone() { 840 return Group{} 841 } 842 return iter.page.Values()[iter.i] 843} 844 845// Creates a new instance of the GroupListResultIterator type. 846func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { 847 return GroupListResultIterator{page: page} 848} 849 850// IsEmpty returns true if the ListResult contains no values. 851func (glr GroupListResult) IsEmpty() bool { 852 return glr.Value == nil || len(*glr.Value) == 0 853} 854 855// groupListResultPreparer prepares a request to retrieve the next set of results. 856// It returns nil if no more results exist. 857func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { 858 if glr.NextLink == nil || len(to.String(glr.NextLink)) < 1 { 859 return nil, nil 860 } 861 return autorest.Prepare((&http.Request{}).WithContext(ctx), 862 autorest.AsJSON(), 863 autorest.AsGet(), 864 autorest.WithBaseURL(to.String(glr.NextLink))) 865} 866 867// GroupListResultPage contains a page of Group values. 868type GroupListResultPage struct { 869 fn func(context.Context, GroupListResult) (GroupListResult, error) 870 glr GroupListResult 871} 872 873// NextWithContext advances to the next page of values. If there was an error making 874// the request the page does not advance and the error is returned. 875func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { 876 if tracing.IsEnabled() { 877 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") 878 defer func() { 879 sc := -1 880 if page.Response().Response.Response != nil { 881 sc = page.Response().Response.Response.StatusCode 882 } 883 tracing.EndSpan(ctx, sc, err) 884 }() 885 } 886 next, err := page.fn(ctx, page.glr) 887 if err != nil { 888 return err 889 } 890 page.glr = next 891 return nil 892} 893 894// Next advances to the next page of values. If there was an error making 895// the request the page does not advance and the error is returned. 896// Deprecated: Use NextWithContext() instead. 897func (page *GroupListResultPage) Next() error { 898 return page.NextWithContext(context.Background()) 899} 900 901// NotDone returns true if the page enumeration should be started or is not yet complete. 902func (page GroupListResultPage) NotDone() bool { 903 return !page.glr.IsEmpty() 904} 905 906// Response returns the raw server response from the last page request. 907func (page GroupListResultPage) Response() GroupListResult { 908 return page.glr 909} 910 911// Values returns the slice of values for the current page or nil if there are no values. 912func (page GroupListResultPage) Values() []Group { 913 if page.glr.IsEmpty() { 914 return nil 915 } 916 return *page.glr.Value 917} 918 919// Creates a new instance of the GroupListResultPage type. 920func NewGroupListResultPage(getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { 921 return GroupListResultPage{fn: getNextPage} 922} 923 924// GroupProperties the resource group properties. 925type GroupProperties struct { 926 // ProvisioningState - READ-ONLY; The provisioning state. 927 ProvisioningState *string `json:"provisioningState,omitempty"` 928} 929 930// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 931type GroupsDeleteFuture struct { 932 azure.Future 933} 934 935// Result returns the result of the asynchronous operation. 936// If the operation has not completed it will return an error. 937func (future *GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) { 938 var done bool 939 done, err = future.DoneWithContext(context.Background(), client) 940 if err != nil { 941 err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") 942 return 943 } 944 if !done { 945 err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") 946 return 947 } 948 ar.Response = future.Response() 949 return 950} 951 952// HTTPMessage ... 953type HTTPMessage struct { 954 // Content - HTTP message content. 955 Content interface{} `json:"content,omitempty"` 956} 957 958// Identity identity for the resource. 959type Identity struct { 960 // PrincipalID - READ-ONLY; The principal id of resource identity. 961 PrincipalID *string `json:"principalId,omitempty"` 962 // TenantID - READ-ONLY; The tenant id of resource. 963 TenantID *string `json:"tenantId,omitempty"` 964 // Type - The identity type. Possible values include: 'SystemAssigned' 965 Type ResourceIdentityType `json:"type,omitempty"` 966} 967 968// ListResult list of resource groups. 969type ListResult struct { 970 autorest.Response `json:"-"` 971 // Value - The list of resources. 972 Value *[]GenericResourceExpanded `json:"value,omitempty"` 973 // NextLink - The URL to get the next set of results. 974 NextLink *string `json:"nextLink,omitempty"` 975} 976 977// ListResultIterator provides access to a complete listing of GenericResourceExpanded values. 978type ListResultIterator struct { 979 i int 980 page ListResultPage 981} 982 983// NextWithContext advances to the next value. If there was an error making 984// the request the iterator does not advance and the error is returned. 985func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 986 if tracing.IsEnabled() { 987 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 988 defer func() { 989 sc := -1 990 if iter.Response().Response.Response != nil { 991 sc = iter.Response().Response.Response.StatusCode 992 } 993 tracing.EndSpan(ctx, sc, err) 994 }() 995 } 996 iter.i++ 997 if iter.i < len(iter.page.Values()) { 998 return nil 999 } 1000 err = iter.page.NextWithContext(ctx) 1001 if err != nil { 1002 iter.i-- 1003 return err 1004 } 1005 iter.i = 0 1006 return nil 1007} 1008 1009// Next advances to the next value. If there was an error making 1010// the request the iterator does not advance and the error is returned. 1011// Deprecated: Use NextWithContext() instead. 1012func (iter *ListResultIterator) Next() error { 1013 return iter.NextWithContext(context.Background()) 1014} 1015 1016// NotDone returns true if the enumeration should be started or is not yet complete. 1017func (iter ListResultIterator) NotDone() bool { 1018 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1019} 1020 1021// Response returns the raw server response from the last page request. 1022func (iter ListResultIterator) Response() ListResult { 1023 return iter.page.Response() 1024} 1025 1026// Value returns the current value or a zero-initialized value if the 1027// iterator has advanced beyond the end of the collection. 1028func (iter ListResultIterator) Value() GenericResourceExpanded { 1029 if !iter.page.NotDone() { 1030 return GenericResourceExpanded{} 1031 } 1032 return iter.page.Values()[iter.i] 1033} 1034 1035// Creates a new instance of the ListResultIterator type. 1036func NewListResultIterator(page ListResultPage) ListResultIterator { 1037 return ListResultIterator{page: page} 1038} 1039 1040// IsEmpty returns true if the ListResult contains no values. 1041func (lr ListResult) IsEmpty() bool { 1042 return lr.Value == nil || len(*lr.Value) == 0 1043} 1044 1045// listResultPreparer prepares a request to retrieve the next set of results. 1046// It returns nil if no more results exist. 1047func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 1048 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 1049 return nil, nil 1050 } 1051 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1052 autorest.AsJSON(), 1053 autorest.AsGet(), 1054 autorest.WithBaseURL(to.String(lr.NextLink))) 1055} 1056 1057// ListResultPage contains a page of GenericResourceExpanded values. 1058type ListResultPage struct { 1059 fn func(context.Context, ListResult) (ListResult, error) 1060 lr ListResult 1061} 1062 1063// NextWithContext advances to the next page of values. If there was an error making 1064// the request the page does not advance and the error is returned. 1065func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 1066 if tracing.IsEnabled() { 1067 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 1068 defer func() { 1069 sc := -1 1070 if page.Response().Response.Response != nil { 1071 sc = page.Response().Response.Response.StatusCode 1072 } 1073 tracing.EndSpan(ctx, sc, err) 1074 }() 1075 } 1076 next, err := page.fn(ctx, page.lr) 1077 if err != nil { 1078 return err 1079 } 1080 page.lr = next 1081 return nil 1082} 1083 1084// Next advances to the next page of values. If there was an error making 1085// the request the page does not advance and the error is returned. 1086// Deprecated: Use NextWithContext() instead. 1087func (page *ListResultPage) Next() error { 1088 return page.NextWithContext(context.Background()) 1089} 1090 1091// NotDone returns true if the page enumeration should be started or is not yet complete. 1092func (page ListResultPage) NotDone() bool { 1093 return !page.lr.IsEmpty() 1094} 1095 1096// Response returns the raw server response from the last page request. 1097func (page ListResultPage) Response() ListResult { 1098 return page.lr 1099} 1100 1101// Values returns the slice of values for the current page or nil if there are no values. 1102func (page ListResultPage) Values() []GenericResourceExpanded { 1103 if page.lr.IsEmpty() { 1104 return nil 1105 } 1106 return *page.lr.Value 1107} 1108 1109// Creates a new instance of the ListResultPage type. 1110func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 1111 return ListResultPage{fn: getNextPage} 1112} 1113 1114// ManagementErrorWithDetails ... 1115type ManagementErrorWithDetails struct { 1116 // Code - The error code returned from the server. 1117 Code *string `json:"code,omitempty"` 1118 // Message - The error message returned from the server. 1119 Message *string `json:"message,omitempty"` 1120 // Target - The target of the error. 1121 Target *string `json:"target,omitempty"` 1122 // Details - Validation error. 1123 Details *[]ManagementErrorWithDetails `json:"details,omitempty"` 1124} 1125 1126// MoveInfo parameters of move resources. 1127type MoveInfo struct { 1128 // ResourcesProperty - The ids of the resources. 1129 ResourcesProperty *[]string `json:"resources,omitempty"` 1130 // TargetResourceGroup - The target resource group. 1131 TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` 1132} 1133 1134// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running 1135// operation. 1136type MoveResourcesFuture struct { 1137 azure.Future 1138} 1139 1140// Result returns the result of the asynchronous operation. 1141// If the operation has not completed it will return an error. 1142func (future *MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { 1143 var done bool 1144 done, err = future.DoneWithContext(context.Background(), client) 1145 if err != nil { 1146 err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Polling failure") 1147 return 1148 } 1149 if !done { 1150 err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") 1151 return 1152 } 1153 ar.Response = future.Response() 1154 return 1155} 1156 1157// ParametersLink entity representing the reference to the deployment parameters. 1158type ParametersLink struct { 1159 // URI - URI referencing the template. 1160 URI *string `json:"uri,omitempty"` 1161 // ContentVersion - If included it must match the ContentVersion in the template. 1162 ContentVersion *string `json:"contentVersion,omitempty"` 1163} 1164 1165// Plan plan for the resource. 1166type Plan struct { 1167 // Name - The plan ID. 1168 Name *string `json:"name,omitempty"` 1169 // Publisher - The publisher ID. 1170 Publisher *string `json:"publisher,omitempty"` 1171 // Product - The offer ID. 1172 Product *string `json:"product,omitempty"` 1173 // PromotionCode - The promotion code. 1174 PromotionCode *string `json:"promotionCode,omitempty"` 1175} 1176 1177// Provider resource provider information. 1178type Provider struct { 1179 autorest.Response `json:"-"` 1180 // ID - The provider id. 1181 ID *string `json:"id,omitempty"` 1182 // Namespace - The namespace of the provider. 1183 Namespace *string `json:"namespace,omitempty"` 1184 // RegistrationState - The registration state of the provider. 1185 RegistrationState *string `json:"registrationState,omitempty"` 1186 // ResourceTypes - The collection of provider resource types. 1187 ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` 1188} 1189 1190// ProviderListResult list of resource providers. 1191type ProviderListResult struct { 1192 autorest.Response `json:"-"` 1193 // Value - The list of resource providers. 1194 Value *[]Provider `json:"value,omitempty"` 1195 // NextLink - The URL to get the next set of results. 1196 NextLink *string `json:"nextLink,omitempty"` 1197} 1198 1199// ProviderListResultIterator provides access to a complete listing of Provider values. 1200type ProviderListResultIterator struct { 1201 i int 1202 page ProviderListResultPage 1203} 1204 1205// NextWithContext advances to the next value. If there was an error making 1206// the request the iterator does not advance and the error is returned. 1207func (iter *ProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 1208 if tracing.IsEnabled() { 1209 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultIterator.NextWithContext") 1210 defer func() { 1211 sc := -1 1212 if iter.Response().Response.Response != nil { 1213 sc = iter.Response().Response.Response.StatusCode 1214 } 1215 tracing.EndSpan(ctx, sc, err) 1216 }() 1217 } 1218 iter.i++ 1219 if iter.i < len(iter.page.Values()) { 1220 return nil 1221 } 1222 err = iter.page.NextWithContext(ctx) 1223 if err != nil { 1224 iter.i-- 1225 return err 1226 } 1227 iter.i = 0 1228 return nil 1229} 1230 1231// Next advances to the next value. If there was an error making 1232// the request the iterator does not advance and the error is returned. 1233// Deprecated: Use NextWithContext() instead. 1234func (iter *ProviderListResultIterator) Next() error { 1235 return iter.NextWithContext(context.Background()) 1236} 1237 1238// NotDone returns true if the enumeration should be started or is not yet complete. 1239func (iter ProviderListResultIterator) NotDone() bool { 1240 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1241} 1242 1243// Response returns the raw server response from the last page request. 1244func (iter ProviderListResultIterator) Response() ProviderListResult { 1245 return iter.page.Response() 1246} 1247 1248// Value returns the current value or a zero-initialized value if the 1249// iterator has advanced beyond the end of the collection. 1250func (iter ProviderListResultIterator) Value() Provider { 1251 if !iter.page.NotDone() { 1252 return Provider{} 1253 } 1254 return iter.page.Values()[iter.i] 1255} 1256 1257// Creates a new instance of the ProviderListResultIterator type. 1258func NewProviderListResultIterator(page ProviderListResultPage) ProviderListResultIterator { 1259 return ProviderListResultIterator{page: page} 1260} 1261 1262// IsEmpty returns true if the ListResult contains no values. 1263func (plr ProviderListResult) IsEmpty() bool { 1264 return plr.Value == nil || len(*plr.Value) == 0 1265} 1266 1267// providerListResultPreparer prepares a request to retrieve the next set of results. 1268// It returns nil if no more results exist. 1269func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) { 1270 if plr.NextLink == nil || len(to.String(plr.NextLink)) < 1 { 1271 return nil, nil 1272 } 1273 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1274 autorest.AsJSON(), 1275 autorest.AsGet(), 1276 autorest.WithBaseURL(to.String(plr.NextLink))) 1277} 1278 1279// ProviderListResultPage contains a page of Provider values. 1280type ProviderListResultPage struct { 1281 fn func(context.Context, ProviderListResult) (ProviderListResult, error) 1282 plr ProviderListResult 1283} 1284 1285// NextWithContext advances to the next page of values. If there was an error making 1286// the request the page does not advance and the error is returned. 1287func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 1288 if tracing.IsEnabled() { 1289 ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultPage.NextWithContext") 1290 defer func() { 1291 sc := -1 1292 if page.Response().Response.Response != nil { 1293 sc = page.Response().Response.Response.StatusCode 1294 } 1295 tracing.EndSpan(ctx, sc, err) 1296 }() 1297 } 1298 next, err := page.fn(ctx, page.plr) 1299 if err != nil { 1300 return err 1301 } 1302 page.plr = next 1303 return nil 1304} 1305 1306// Next advances to the next page of values. If there was an error making 1307// the request the page does not advance and the error is returned. 1308// Deprecated: Use NextWithContext() instead. 1309func (page *ProviderListResultPage) Next() error { 1310 return page.NextWithContext(context.Background()) 1311} 1312 1313// NotDone returns true if the page enumeration should be started or is not yet complete. 1314func (page ProviderListResultPage) NotDone() bool { 1315 return !page.plr.IsEmpty() 1316} 1317 1318// Response returns the raw server response from the last page request. 1319func (page ProviderListResultPage) Response() ProviderListResult { 1320 return page.plr 1321} 1322 1323// Values returns the slice of values for the current page or nil if there are no values. 1324func (page ProviderListResultPage) Values() []Provider { 1325 if page.plr.IsEmpty() { 1326 return nil 1327 } 1328 return *page.plr.Value 1329} 1330 1331// Creates a new instance of the ProviderListResultPage type. 1332func NewProviderListResultPage(getNextPage func(context.Context, ProviderListResult) (ProviderListResult, error)) ProviderListResultPage { 1333 return ProviderListResultPage{fn: getNextPage} 1334} 1335 1336// ProviderOperationDisplayProperties resource provider operation's display properties. 1337type ProviderOperationDisplayProperties struct { 1338 // Publisher - Operation description. 1339 Publisher *string `json:"publisher,omitempty"` 1340 // Provider - Operation provider. 1341 Provider *string `json:"provider,omitempty"` 1342 // Resource - Operation resource. 1343 Resource *string `json:"resource,omitempty"` 1344 // Operation - Operation. 1345 Operation *string `json:"operation,omitempty"` 1346 // Description - Operation description. 1347 Description *string `json:"description,omitempty"` 1348} 1349 1350// ProviderResourceType resource type managed by the resource provider. 1351type ProviderResourceType struct { 1352 // ResourceType - The resource type. 1353 ResourceType *string `json:"resourceType,omitempty"` 1354 // Locations - The collection of locations where this resource type can be created in. 1355 Locations *[]string `json:"locations,omitempty"` 1356 // Aliases - The aliases that are supported by this resource type. 1357 Aliases *[]AliasType `json:"aliases,omitempty"` 1358 // APIVersions - The api version. 1359 APIVersions *[]string `json:"apiVersions,omitempty"` 1360 // Properties - The properties. 1361 Properties map[string]*string `json:"properties"` 1362} 1363 1364// MarshalJSON is the custom marshaler for ProviderResourceType. 1365func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { 1366 objectMap := make(map[string]interface{}) 1367 if prt.ResourceType != nil { 1368 objectMap["resourceType"] = prt.ResourceType 1369 } 1370 if prt.Locations != nil { 1371 objectMap["locations"] = prt.Locations 1372 } 1373 if prt.Aliases != nil { 1374 objectMap["aliases"] = prt.Aliases 1375 } 1376 if prt.APIVersions != nil { 1377 objectMap["apiVersions"] = prt.APIVersions 1378 } 1379 if prt.Properties != nil { 1380 objectMap["properties"] = prt.Properties 1381 } 1382 return json.Marshal(objectMap) 1383} 1384 1385// Resource ... 1386type Resource struct { 1387 // ID - READ-ONLY; Resource Id 1388 ID *string `json:"id,omitempty"` 1389 // Name - READ-ONLY; Resource name 1390 Name *string `json:"name,omitempty"` 1391 // Type - READ-ONLY; Resource type 1392 Type *string `json:"type,omitempty"` 1393 // Location - Resource location 1394 Location *string `json:"location,omitempty"` 1395 // Tags - Resource tags 1396 Tags map[string]*string `json:"tags"` 1397} 1398 1399// MarshalJSON is the custom marshaler for Resource. 1400func (r Resource) MarshalJSON() ([]byte, error) { 1401 objectMap := make(map[string]interface{}) 1402 if r.Location != nil { 1403 objectMap["location"] = r.Location 1404 } 1405 if r.Tags != nil { 1406 objectMap["tags"] = r.Tags 1407 } 1408 return json.Marshal(objectMap) 1409} 1410 1411// Sku sku for the resource. 1412type Sku struct { 1413 // Name - The sku name. 1414 Name *string `json:"name,omitempty"` 1415 // Tier - The sku tier. 1416 Tier *string `json:"tier,omitempty"` 1417 // Size - The sku size. 1418 Size *string `json:"size,omitempty"` 1419 // Family - The sku family. 1420 Family *string `json:"family,omitempty"` 1421 // Model - The sku model. 1422 Model *string `json:"model,omitempty"` 1423 // Capacity - The sku capacity. 1424 Capacity *int32 `json:"capacity,omitempty"` 1425} 1426 1427// SubResource ... 1428type SubResource struct { 1429 // ID - Resource Id 1430 ID *string `json:"id,omitempty"` 1431} 1432 1433// TagCount tag count. 1434type TagCount struct { 1435 // Type - Type of count. 1436 Type *string `json:"type,omitempty"` 1437 // Value - Value of count. 1438 Value *string `json:"value,omitempty"` 1439} 1440 1441// TagDetails tag details. 1442type TagDetails struct { 1443 autorest.Response `json:"-"` 1444 // ID - READ-ONLY; The tag ID. 1445 ID *string `json:"id,omitempty"` 1446 // TagName - The tag name. 1447 TagName *string `json:"tagName,omitempty"` 1448 // Count - The tag count. 1449 Count *TagCount `json:"count,omitempty"` 1450 // Values - The list of tag values. 1451 Values *[]TagValue `json:"values,omitempty"` 1452} 1453 1454// TagsListResult list of subscription tags. 1455type TagsListResult struct { 1456 autorest.Response `json:"-"` 1457 // Value - The list of tags. 1458 Value *[]TagDetails `json:"value,omitempty"` 1459 // NextLink - The URL to get the next set of results. 1460 NextLink *string `json:"nextLink,omitempty"` 1461} 1462 1463// TagsListResultIterator provides access to a complete listing of TagDetails values. 1464type TagsListResultIterator struct { 1465 i int 1466 page TagsListResultPage 1467} 1468 1469// NextWithContext advances to the next value. If there was an error making 1470// the request the iterator does not advance and the error is returned. 1471func (iter *TagsListResultIterator) NextWithContext(ctx context.Context) (err error) { 1472 if tracing.IsEnabled() { 1473 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultIterator.NextWithContext") 1474 defer func() { 1475 sc := -1 1476 if iter.Response().Response.Response != nil { 1477 sc = iter.Response().Response.Response.StatusCode 1478 } 1479 tracing.EndSpan(ctx, sc, err) 1480 }() 1481 } 1482 iter.i++ 1483 if iter.i < len(iter.page.Values()) { 1484 return nil 1485 } 1486 err = iter.page.NextWithContext(ctx) 1487 if err != nil { 1488 iter.i-- 1489 return err 1490 } 1491 iter.i = 0 1492 return nil 1493} 1494 1495// Next advances to the next value. If there was an error making 1496// the request the iterator does not advance and the error is returned. 1497// Deprecated: Use NextWithContext() instead. 1498func (iter *TagsListResultIterator) Next() error { 1499 return iter.NextWithContext(context.Background()) 1500} 1501 1502// NotDone returns true if the enumeration should be started or is not yet complete. 1503func (iter TagsListResultIterator) NotDone() bool { 1504 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1505} 1506 1507// Response returns the raw server response from the last page request. 1508func (iter TagsListResultIterator) Response() TagsListResult { 1509 return iter.page.Response() 1510} 1511 1512// Value returns the current value or a zero-initialized value if the 1513// iterator has advanced beyond the end of the collection. 1514func (iter TagsListResultIterator) Value() TagDetails { 1515 if !iter.page.NotDone() { 1516 return TagDetails{} 1517 } 1518 return iter.page.Values()[iter.i] 1519} 1520 1521// Creates a new instance of the TagsListResultIterator type. 1522func NewTagsListResultIterator(page TagsListResultPage) TagsListResultIterator { 1523 return TagsListResultIterator{page: page} 1524} 1525 1526// IsEmpty returns true if the ListResult contains no values. 1527func (tlr TagsListResult) IsEmpty() bool { 1528 return tlr.Value == nil || len(*tlr.Value) == 0 1529} 1530 1531// tagsListResultPreparer prepares a request to retrieve the next set of results. 1532// It returns nil if no more results exist. 1533func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) { 1534 if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { 1535 return nil, nil 1536 } 1537 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1538 autorest.AsJSON(), 1539 autorest.AsGet(), 1540 autorest.WithBaseURL(to.String(tlr.NextLink))) 1541} 1542 1543// TagsListResultPage contains a page of TagDetails values. 1544type TagsListResultPage struct { 1545 fn func(context.Context, TagsListResult) (TagsListResult, error) 1546 tlr TagsListResult 1547} 1548 1549// NextWithContext advances to the next page of values. If there was an error making 1550// the request the page does not advance and the error is returned. 1551func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error) { 1552 if tracing.IsEnabled() { 1553 ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultPage.NextWithContext") 1554 defer func() { 1555 sc := -1 1556 if page.Response().Response.Response != nil { 1557 sc = page.Response().Response.Response.StatusCode 1558 } 1559 tracing.EndSpan(ctx, sc, err) 1560 }() 1561 } 1562 next, err := page.fn(ctx, page.tlr) 1563 if err != nil { 1564 return err 1565 } 1566 page.tlr = next 1567 return nil 1568} 1569 1570// Next advances to the next page of values. If there was an error making 1571// the request the page does not advance and the error is returned. 1572// Deprecated: Use NextWithContext() instead. 1573func (page *TagsListResultPage) Next() error { 1574 return page.NextWithContext(context.Background()) 1575} 1576 1577// NotDone returns true if the page enumeration should be started or is not yet complete. 1578func (page TagsListResultPage) NotDone() bool { 1579 return !page.tlr.IsEmpty() 1580} 1581 1582// Response returns the raw server response from the last page request. 1583func (page TagsListResultPage) Response() TagsListResult { 1584 return page.tlr 1585} 1586 1587// Values returns the slice of values for the current page or nil if there are no values. 1588func (page TagsListResultPage) Values() []TagDetails { 1589 if page.tlr.IsEmpty() { 1590 return nil 1591 } 1592 return *page.tlr.Value 1593} 1594 1595// Creates a new instance of the TagsListResultPage type. 1596func NewTagsListResultPage(getNextPage func(context.Context, TagsListResult) (TagsListResult, error)) TagsListResultPage { 1597 return TagsListResultPage{fn: getNextPage} 1598} 1599 1600// TagValue tag information. 1601type TagValue struct { 1602 autorest.Response `json:"-"` 1603 // ID - READ-ONLY; The tag ID. 1604 ID *string `json:"id,omitempty"` 1605 // TagValue - The tag value. 1606 TagValue *string `json:"tagValue,omitempty"` 1607 // Count - The tag value count. 1608 Count *TagCount `json:"count,omitempty"` 1609} 1610 1611// TargetResource target resource. 1612type TargetResource struct { 1613 // ID - The ID of the resource. 1614 ID *string `json:"id,omitempty"` 1615 // ResourceName - The name of the resource. 1616 ResourceName *string `json:"resourceName,omitempty"` 1617 // ResourceType - The type of the resource. 1618 ResourceType *string `json:"resourceType,omitempty"` 1619} 1620 1621// TemplateHashResult result of the request to calculate template hash. It contains a string of minified 1622// template and its hash. 1623type TemplateHashResult struct { 1624 autorest.Response `json:"-"` 1625 // MinifiedTemplate - The minified template string. 1626 MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` 1627 // TemplateHash - The template hash. 1628 TemplateHash *string `json:"templateHash,omitempty"` 1629} 1630 1631// TemplateLink entity representing the reference to the template. 1632type TemplateLink struct { 1633 // URI - URI referencing the template. 1634 URI *string `json:"uri,omitempty"` 1635 // ContentVersion - If included it must match the ContentVersion in the template. 1636 ContentVersion *string `json:"contentVersion,omitempty"` 1637} 1638 1639// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1640type UpdateFuture struct { 1641 azure.Future 1642} 1643 1644// Result returns the result of the asynchronous operation. 1645// If the operation has not completed it will return an error. 1646func (future *UpdateFuture) Result(client Client) (gr GenericResource, err error) { 1647 var done bool 1648 done, err = future.DoneWithContext(context.Background(), client) 1649 if err != nil { 1650 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure") 1651 return 1652 } 1653 if !done { 1654 err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") 1655 return 1656 } 1657 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1658 if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { 1659 gr, err = client.UpdateResponder(gr.Response.Response) 1660 if err != nil { 1661 err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") 1662 } 1663 } 1664 return 1665} 1666