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