1package apimanagement 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2016-07-07/apimanagement" 22 23// AccessInformationContract tenant access information contract of the API Management service. 24type AccessInformationContract struct { 25 autorest.Response `json:"-"` 26 // ID - Identifier. 27 ID *string `json:"id,omitempty"` 28 // PrimaryKey - Primary access key. 29 PrimaryKey *string `json:"primaryKey,omitempty"` 30 // SecondaryKey - Secondary access key. 31 SecondaryKey *string `json:"secondaryKey,omitempty"` 32 // Enabled - Tenant access information of the API Management service. 33 Enabled *bool `json:"enabled,omitempty"` 34} 35 36// AccessInformationUpdateParameters tenant access information update parameters of the API Management 37// service. 38type AccessInformationUpdateParameters struct { 39 // Enabled - Tenant access information of the API Management service. 40 Enabled *bool `json:"enabled,omitempty"` 41} 42 43// AdditionalRegion description of an additional API Management resource location. 44type AdditionalRegion struct { 45 // Location - The location name of the additional region among Azure Data center regions. 46 Location *string `json:"location,omitempty"` 47 // SkuType - The SKU type in the location. Possible values include: 'Developer', 'Standard', 'Premium' 48 SkuType SkuType `json:"skuType,omitempty"` 49 // SkuUnitCount - The SKU Unit count at the location. The maximum SKU Unit count depends on the SkuType. Maximum allowed for Developer SKU is 1, for Standard SKU is 4, and for Premium SKU is 10, at a location. 50 SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` 51 // StaticIPs - READ-ONLY; Static IP addresses of the location's virtual machines. 52 StaticIPs *[]string `json:"staticIPs,omitempty"` 53 // Vpnconfiguration - Virtual network configuration for the location. 54 Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` 55} 56 57// MarshalJSON is the custom marshaler for AdditionalRegion. 58func (ar AdditionalRegion) MarshalJSON() ([]byte, error) { 59 objectMap := make(map[string]interface{}) 60 if ar.Location != nil { 61 objectMap["location"] = ar.Location 62 } 63 if ar.SkuType != "" { 64 objectMap["skuType"] = ar.SkuType 65 } 66 if ar.SkuUnitCount != nil { 67 objectMap["skuUnitCount"] = ar.SkuUnitCount 68 } 69 if ar.Vpnconfiguration != nil { 70 objectMap["vpnconfiguration"] = ar.Vpnconfiguration 71 } 72 return json.Marshal(objectMap) 73} 74 75// APICollection paged Api list representation. 76type APICollection struct { 77 autorest.Response `json:"-"` 78 // Value - Page values. 79 Value *[]APIContract `json:"value,omitempty"` 80 // Count - Total records count number. 81 Count *int64 `json:"count,omitempty"` 82 // NextLink - Next page link if any. 83 NextLink *string `json:"nextLink,omitempty"` 84} 85 86// APICollectionIterator provides access to a complete listing of APIContract values. 87type APICollectionIterator struct { 88 i int 89 page APICollectionPage 90} 91 92// NextWithContext advances to the next value. If there was an error making 93// the request the iterator does not advance and the error is returned. 94func (iter *APICollectionIterator) NextWithContext(ctx context.Context) (err error) { 95 if tracing.IsEnabled() { 96 ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionIterator.NextWithContext") 97 defer func() { 98 sc := -1 99 if iter.Response().Response.Response != nil { 100 sc = iter.Response().Response.Response.StatusCode 101 } 102 tracing.EndSpan(ctx, sc, err) 103 }() 104 } 105 iter.i++ 106 if iter.i < len(iter.page.Values()) { 107 return nil 108 } 109 err = iter.page.NextWithContext(ctx) 110 if err != nil { 111 iter.i-- 112 return err 113 } 114 iter.i = 0 115 return nil 116} 117 118// Next advances to the next value. If there was an error making 119// the request the iterator does not advance and the error is returned. 120// Deprecated: Use NextWithContext() instead. 121func (iter *APICollectionIterator) Next() error { 122 return iter.NextWithContext(context.Background()) 123} 124 125// NotDone returns true if the enumeration should be started or is not yet complete. 126func (iter APICollectionIterator) NotDone() bool { 127 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 128} 129 130// Response returns the raw server response from the last page request. 131func (iter APICollectionIterator) Response() APICollection { 132 return iter.page.Response() 133} 134 135// Value returns the current value or a zero-initialized value if the 136// iterator has advanced beyond the end of the collection. 137func (iter APICollectionIterator) Value() APIContract { 138 if !iter.page.NotDone() { 139 return APIContract{} 140 } 141 return iter.page.Values()[iter.i] 142} 143 144// Creates a new instance of the APICollectionIterator type. 145func NewAPICollectionIterator(page APICollectionPage) APICollectionIterator { 146 return APICollectionIterator{page: page} 147} 148 149// IsEmpty returns true if the ListResult contains no values. 150func (ac APICollection) IsEmpty() bool { 151 return ac.Value == nil || len(*ac.Value) == 0 152} 153 154// hasNextLink returns true if the NextLink is not empty. 155func (ac APICollection) hasNextLink() bool { 156 return ac.NextLink != nil && len(*ac.NextLink) != 0 157} 158 159// aPICollectionPreparer prepares a request to retrieve the next set of results. 160// It returns nil if no more results exist. 161func (ac APICollection) aPICollectionPreparer(ctx context.Context) (*http.Request, error) { 162 if !ac.hasNextLink() { 163 return nil, nil 164 } 165 return autorest.Prepare((&http.Request{}).WithContext(ctx), 166 autorest.AsJSON(), 167 autorest.AsGet(), 168 autorest.WithBaseURL(to.String(ac.NextLink))) 169} 170 171// APICollectionPage contains a page of APIContract values. 172type APICollectionPage struct { 173 fn func(context.Context, APICollection) (APICollection, error) 174 ac APICollection 175} 176 177// NextWithContext advances to the next page of values. If there was an error making 178// the request the page does not advance and the error is returned. 179func (page *APICollectionPage) NextWithContext(ctx context.Context) (err error) { 180 if tracing.IsEnabled() { 181 ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionPage.NextWithContext") 182 defer func() { 183 sc := -1 184 if page.Response().Response.Response != nil { 185 sc = page.Response().Response.Response.StatusCode 186 } 187 tracing.EndSpan(ctx, sc, err) 188 }() 189 } 190 for { 191 next, err := page.fn(ctx, page.ac) 192 if err != nil { 193 return err 194 } 195 page.ac = next 196 if !next.hasNextLink() || !next.IsEmpty() { 197 break 198 } 199 } 200 return nil 201} 202 203// Next advances to the next page of values. If there was an error making 204// the request the page does not advance and the error is returned. 205// Deprecated: Use NextWithContext() instead. 206func (page *APICollectionPage) Next() error { 207 return page.NextWithContext(context.Background()) 208} 209 210// NotDone returns true if the page enumeration should be started or is not yet complete. 211func (page APICollectionPage) NotDone() bool { 212 return !page.ac.IsEmpty() 213} 214 215// Response returns the raw server response from the last page request. 216func (page APICollectionPage) Response() APICollection { 217 return page.ac 218} 219 220// Values returns the slice of values for the current page or nil if there are no values. 221func (page APICollectionPage) Values() []APIContract { 222 if page.ac.IsEmpty() { 223 return nil 224 } 225 return *page.ac.Value 226} 227 228// Creates a new instance of the APICollectionPage type. 229func NewAPICollectionPage(cur APICollection, getNextPage func(context.Context, APICollection) (APICollection, error)) APICollectionPage { 230 return APICollectionPage{ 231 fn: getNextPage, 232 ac: cur, 233 } 234} 235 236// APIContract API details. 237type APIContract struct { 238 autorest.Response `json:"-"` 239 // ID - READ-ONLY; API identifier path: /apis/{apiId} 240 ID *string `json:"id,omitempty"` 241 // Name - API name. 242 Name *string `json:"name,omitempty"` 243 // Description - Description of the API. May include HTML formatting tags. 244 Description *string `json:"description,omitempty"` 245 // ServiceURL - Absolute URL of the backend service implementing this API. 246 ServiceURL *string `json:"serviceUrl,omitempty"` 247 // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. 248 Path *string `json:"path,omitempty"` 249 // Protocols - Describes on which protocols the operations in this API can be invoked. 250 Protocols *[]APIProtocolContract `json:"protocols,omitempty"` 251 // AuthenticationSettings - Collection of authentication settings included into this API. 252 AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` 253 // SubscriptionKeyParameterNames - Protocols over which API is made available. 254 SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` 255 // Type - Type of API. Possible values include: 'APITypeContractHTTP', 'APITypeContractSoap' 256 Type APITypeContract `json:"type,omitempty"` 257} 258 259// MarshalJSON is the custom marshaler for APIContract. 260func (ac APIContract) MarshalJSON() ([]byte, error) { 261 objectMap := make(map[string]interface{}) 262 if ac.Name != nil { 263 objectMap["name"] = ac.Name 264 } 265 if ac.Description != nil { 266 objectMap["description"] = ac.Description 267 } 268 if ac.ServiceURL != nil { 269 objectMap["serviceUrl"] = ac.ServiceURL 270 } 271 if ac.Path != nil { 272 objectMap["path"] = ac.Path 273 } 274 if ac.Protocols != nil { 275 objectMap["protocols"] = ac.Protocols 276 } 277 if ac.AuthenticationSettings != nil { 278 objectMap["authenticationSettings"] = ac.AuthenticationSettings 279 } 280 if ac.SubscriptionKeyParameterNames != nil { 281 objectMap["subscriptionKeyParameterNames"] = ac.SubscriptionKeyParameterNames 282 } 283 if ac.Type != "" { 284 objectMap["type"] = ac.Type 285 } 286 return json.Marshal(objectMap) 287} 288 289// APIExportResult the response model for the export API output operation. 290type APIExportResult struct { 291 autorest.Response `json:"-"` 292 // Content - Response content bytes. 293 Content *[]byte `json:"content,omitempty"` 294 // StatusCode - Possible values include: 'Continue', 'OK', 'Created', 'Accepted', 'NotFound', 'Conflict' 295 StatusCode HTTPStatusCode `json:"statusCode,omitempty"` 296 RequestID *string `json:"requestId,omitempty"` 297} 298 299// AuthenticationSettingsContract API Authentication Settings. 300type AuthenticationSettingsContract struct { 301 OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` 302} 303 304// AuthorizationServerCollection paged OAuth2 Authorization Servers list representation. 305type AuthorizationServerCollection struct { 306 autorest.Response `json:"-"` 307 // Value - Page values. 308 Value *[]OAuth2AuthorizationServerContract `json:"value,omitempty"` 309 // Count - Total records count number. 310 Count *int64 `json:"count,omitempty"` 311 // NextLink - Next page link if any. 312 NextLink *string `json:"nextLink,omitempty"` 313} 314 315// AuthorizationServerCollectionIterator provides access to a complete listing of 316// OAuth2AuthorizationServerContract values. 317type AuthorizationServerCollectionIterator struct { 318 i int 319 page AuthorizationServerCollectionPage 320} 321 322// NextWithContext advances to the next value. If there was an error making 323// the request the iterator does not advance and the error is returned. 324func (iter *AuthorizationServerCollectionIterator) NextWithContext(ctx context.Context) (err error) { 325 if tracing.IsEnabled() { 326 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionIterator.NextWithContext") 327 defer func() { 328 sc := -1 329 if iter.Response().Response.Response != nil { 330 sc = iter.Response().Response.Response.StatusCode 331 } 332 tracing.EndSpan(ctx, sc, err) 333 }() 334 } 335 iter.i++ 336 if iter.i < len(iter.page.Values()) { 337 return nil 338 } 339 err = iter.page.NextWithContext(ctx) 340 if err != nil { 341 iter.i-- 342 return err 343 } 344 iter.i = 0 345 return nil 346} 347 348// Next advances to the next value. If there was an error making 349// the request the iterator does not advance and the error is returned. 350// Deprecated: Use NextWithContext() instead. 351func (iter *AuthorizationServerCollectionIterator) Next() error { 352 return iter.NextWithContext(context.Background()) 353} 354 355// NotDone returns true if the enumeration should be started or is not yet complete. 356func (iter AuthorizationServerCollectionIterator) NotDone() bool { 357 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 358} 359 360// Response returns the raw server response from the last page request. 361func (iter AuthorizationServerCollectionIterator) Response() AuthorizationServerCollection { 362 return iter.page.Response() 363} 364 365// Value returns the current value or a zero-initialized value if the 366// iterator has advanced beyond the end of the collection. 367func (iter AuthorizationServerCollectionIterator) Value() OAuth2AuthorizationServerContract { 368 if !iter.page.NotDone() { 369 return OAuth2AuthorizationServerContract{} 370 } 371 return iter.page.Values()[iter.i] 372} 373 374// Creates a new instance of the AuthorizationServerCollectionIterator type. 375func NewAuthorizationServerCollectionIterator(page AuthorizationServerCollectionPage) AuthorizationServerCollectionIterator { 376 return AuthorizationServerCollectionIterator{page: page} 377} 378 379// IsEmpty returns true if the ListResult contains no values. 380func (asc AuthorizationServerCollection) IsEmpty() bool { 381 return asc.Value == nil || len(*asc.Value) == 0 382} 383 384// hasNextLink returns true if the NextLink is not empty. 385func (asc AuthorizationServerCollection) hasNextLink() bool { 386 return asc.NextLink != nil && len(*asc.NextLink) != 0 387} 388 389// authorizationServerCollectionPreparer prepares a request to retrieve the next set of results. 390// It returns nil if no more results exist. 391func (asc AuthorizationServerCollection) authorizationServerCollectionPreparer(ctx context.Context) (*http.Request, error) { 392 if !asc.hasNextLink() { 393 return nil, nil 394 } 395 return autorest.Prepare((&http.Request{}).WithContext(ctx), 396 autorest.AsJSON(), 397 autorest.AsGet(), 398 autorest.WithBaseURL(to.String(asc.NextLink))) 399} 400 401// AuthorizationServerCollectionPage contains a page of OAuth2AuthorizationServerContract values. 402type AuthorizationServerCollectionPage struct { 403 fn func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error) 404 asc AuthorizationServerCollection 405} 406 407// NextWithContext advances to the next page of values. If there was an error making 408// the request the page does not advance and the error is returned. 409func (page *AuthorizationServerCollectionPage) NextWithContext(ctx context.Context) (err error) { 410 if tracing.IsEnabled() { 411 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionPage.NextWithContext") 412 defer func() { 413 sc := -1 414 if page.Response().Response.Response != nil { 415 sc = page.Response().Response.Response.StatusCode 416 } 417 tracing.EndSpan(ctx, sc, err) 418 }() 419 } 420 for { 421 next, err := page.fn(ctx, page.asc) 422 if err != nil { 423 return err 424 } 425 page.asc = next 426 if !next.hasNextLink() || !next.IsEmpty() { 427 break 428 } 429 } 430 return nil 431} 432 433// Next advances to the next page of values. If there was an error making 434// the request the page does not advance and the error is returned. 435// Deprecated: Use NextWithContext() instead. 436func (page *AuthorizationServerCollectionPage) Next() error { 437 return page.NextWithContext(context.Background()) 438} 439 440// NotDone returns true if the page enumeration should be started or is not yet complete. 441func (page AuthorizationServerCollectionPage) NotDone() bool { 442 return !page.asc.IsEmpty() 443} 444 445// Response returns the raw server response from the last page request. 446func (page AuthorizationServerCollectionPage) Response() AuthorizationServerCollection { 447 return page.asc 448} 449 450// Values returns the slice of values for the current page or nil if there are no values. 451func (page AuthorizationServerCollectionPage) Values() []OAuth2AuthorizationServerContract { 452 if page.asc.IsEmpty() { 453 return nil 454 } 455 return *page.asc.Value 456} 457 458// Creates a new instance of the AuthorizationServerCollectionPage type. 459func NewAuthorizationServerCollectionPage(cur AuthorizationServerCollection, getNextPage func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error)) AuthorizationServerCollectionPage { 460 return AuthorizationServerCollectionPage{ 461 fn: getNextPage, 462 asc: cur, 463 } 464} 465 466// BackendCollection paged Backend list representation. 467type BackendCollection struct { 468 autorest.Response `json:"-"` 469 // Value - Backend values. 470 Value *[]BackendResponse `json:"value,omitempty"` 471 // Count - Total records count number. 472 Count *int64 `json:"count,omitempty"` 473 // NextLink - Next page link if any. 474 NextLink *string `json:"nextLink,omitempty"` 475} 476 477// BackendCollectionIterator provides access to a complete listing of BackendResponse values. 478type BackendCollectionIterator struct { 479 i int 480 page BackendCollectionPage 481} 482 483// NextWithContext advances to the next value. If there was an error making 484// the request the iterator does not advance and the error is returned. 485func (iter *BackendCollectionIterator) NextWithContext(ctx context.Context) (err error) { 486 if tracing.IsEnabled() { 487 ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionIterator.NextWithContext") 488 defer func() { 489 sc := -1 490 if iter.Response().Response.Response != nil { 491 sc = iter.Response().Response.Response.StatusCode 492 } 493 tracing.EndSpan(ctx, sc, err) 494 }() 495 } 496 iter.i++ 497 if iter.i < len(iter.page.Values()) { 498 return nil 499 } 500 err = iter.page.NextWithContext(ctx) 501 if err != nil { 502 iter.i-- 503 return err 504 } 505 iter.i = 0 506 return nil 507} 508 509// Next advances to the next value. If there was an error making 510// the request the iterator does not advance and the error is returned. 511// Deprecated: Use NextWithContext() instead. 512func (iter *BackendCollectionIterator) Next() error { 513 return iter.NextWithContext(context.Background()) 514} 515 516// NotDone returns true if the enumeration should be started or is not yet complete. 517func (iter BackendCollectionIterator) NotDone() bool { 518 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 519} 520 521// Response returns the raw server response from the last page request. 522func (iter BackendCollectionIterator) Response() BackendCollection { 523 return iter.page.Response() 524} 525 526// Value returns the current value or a zero-initialized value if the 527// iterator has advanced beyond the end of the collection. 528func (iter BackendCollectionIterator) Value() BackendResponse { 529 if !iter.page.NotDone() { 530 return BackendResponse{} 531 } 532 return iter.page.Values()[iter.i] 533} 534 535// Creates a new instance of the BackendCollectionIterator type. 536func NewBackendCollectionIterator(page BackendCollectionPage) BackendCollectionIterator { 537 return BackendCollectionIterator{page: page} 538} 539 540// IsEmpty returns true if the ListResult contains no values. 541func (bc BackendCollection) IsEmpty() bool { 542 return bc.Value == nil || len(*bc.Value) == 0 543} 544 545// hasNextLink returns true if the NextLink is not empty. 546func (bc BackendCollection) hasNextLink() bool { 547 return bc.NextLink != nil && len(*bc.NextLink) != 0 548} 549 550// backendCollectionPreparer prepares a request to retrieve the next set of results. 551// It returns nil if no more results exist. 552func (bc BackendCollection) backendCollectionPreparer(ctx context.Context) (*http.Request, error) { 553 if !bc.hasNextLink() { 554 return nil, nil 555 } 556 return autorest.Prepare((&http.Request{}).WithContext(ctx), 557 autorest.AsJSON(), 558 autorest.AsGet(), 559 autorest.WithBaseURL(to.String(bc.NextLink))) 560} 561 562// BackendCollectionPage contains a page of BackendResponse values. 563type BackendCollectionPage struct { 564 fn func(context.Context, BackendCollection) (BackendCollection, error) 565 bc BackendCollection 566} 567 568// NextWithContext advances to the next page of values. If there was an error making 569// the request the page does not advance and the error is returned. 570func (page *BackendCollectionPage) NextWithContext(ctx context.Context) (err error) { 571 if tracing.IsEnabled() { 572 ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionPage.NextWithContext") 573 defer func() { 574 sc := -1 575 if page.Response().Response.Response != nil { 576 sc = page.Response().Response.Response.StatusCode 577 } 578 tracing.EndSpan(ctx, sc, err) 579 }() 580 } 581 for { 582 next, err := page.fn(ctx, page.bc) 583 if err != nil { 584 return err 585 } 586 page.bc = next 587 if !next.hasNextLink() || !next.IsEmpty() { 588 break 589 } 590 } 591 return nil 592} 593 594// Next advances to the next page of values. If there was an error making 595// the request the page does not advance and the error is returned. 596// Deprecated: Use NextWithContext() instead. 597func (page *BackendCollectionPage) Next() error { 598 return page.NextWithContext(context.Background()) 599} 600 601// NotDone returns true if the page enumeration should be started or is not yet complete. 602func (page BackendCollectionPage) NotDone() bool { 603 return !page.bc.IsEmpty() 604} 605 606// Response returns the raw server response from the last page request. 607func (page BackendCollectionPage) Response() BackendCollection { 608 return page.bc 609} 610 611// Values returns the slice of values for the current page or nil if there are no values. 612func (page BackendCollectionPage) Values() []BackendResponse { 613 if page.bc.IsEmpty() { 614 return nil 615 } 616 return *page.bc.Value 617} 618 619// Creates a new instance of the BackendCollectionPage type. 620func NewBackendCollectionPage(cur BackendCollection, getNextPage func(context.Context, BackendCollection) (BackendCollection, error)) BackendCollectionPage { 621 return BackendCollectionPage{ 622 fn: getNextPage, 623 bc: cur, 624 } 625} 626 627// BackendContract parameters supplied to the Create Backend operation. 628type BackendContract struct { 629 // Host - Host attribute of the backend. Host is a pure hostname without a port or suffix, for example backend.contoso.com. Must not be empty. 630 Host *string `json:"host,omitempty"` 631 // SkipCertificateChainValidation - Flag indicating whether SSL certificate chain validation should be skipped when using self-signed certificates for this backend host. 632 SkipCertificateChainValidation *bool `json:"skipCertificateChainValidation,omitempty"` 633} 634 635// BackendResponse the Backend entity in API Management represents a backend service that is configured to 636// skip certification chain validation when using a self-signed certificate to test mutual certificate 637// authentication. 638type BackendResponse struct { 639 autorest.Response `json:"-"` 640 // ID - READ-ONLY; Uniquely identifies the backend within the current API Management service instance. The value is a valid relative URL in the format of /backends/{backendId} where {backendId} is a backend identifier. 641 ID *string `json:"id,omitempty"` 642 // Host - Host attribute of the backend. Host is a pure hostname without a port or suffix, for example backend.contoso.com. Must not be empty. 643 Host *string `json:"host,omitempty"` 644 // SkipCertificateChainValidation - Flag indicating whether SSL certificate chain validation should be skipped when using self-signed certificates for this backend host. 645 SkipCertificateChainValidation *bool `json:"skipCertificateChainValidation,omitempty"` 646} 647 648// MarshalJSON is the custom marshaler for BackendResponse. 649func (br BackendResponse) MarshalJSON() ([]byte, error) { 650 objectMap := make(map[string]interface{}) 651 if br.Host != nil { 652 objectMap["host"] = br.Host 653 } 654 if br.SkipCertificateChainValidation != nil { 655 objectMap["skipCertificateChainValidation"] = br.SkipCertificateChainValidation 656 } 657 return json.Marshal(objectMap) 658} 659 660// BackendUpdateParameters parameters supplied to the Update Backend operation. 661type BackendUpdateParameters struct { 662 // Host - Host attribute of the backend. Host is a pure hostname without a port or suffix, for example backend.contoso.com. Must not be empty. 663 Host *string `json:"host,omitempty"` 664 // SkipCertificateChainValidation - Flag indicating whether SSL certificate chain validation should be skipped when using self-signed certificates for this backend host. 665 SkipCertificateChainValidation *bool `json:"skipCertificateChainValidation,omitempty"` 666} 667 668// CertificateCollection paged Certificates list representation. 669type CertificateCollection struct { 670 autorest.Response `json:"-"` 671 // Value - Page values. 672 Value *[]CertificateContract `json:"value,omitempty"` 673 // Count - Total records count number. 674 Count *int64 `json:"count,omitempty"` 675 // NextLink - Next page link if any. 676 NextLink *string `json:"nextLink,omitempty"` 677} 678 679// CertificateCollectionIterator provides access to a complete listing of CertificateContract values. 680type CertificateCollectionIterator struct { 681 i int 682 page CertificateCollectionPage 683} 684 685// NextWithContext advances to the next value. If there was an error making 686// the request the iterator does not advance and the error is returned. 687func (iter *CertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { 688 if tracing.IsEnabled() { 689 ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionIterator.NextWithContext") 690 defer func() { 691 sc := -1 692 if iter.Response().Response.Response != nil { 693 sc = iter.Response().Response.Response.StatusCode 694 } 695 tracing.EndSpan(ctx, sc, err) 696 }() 697 } 698 iter.i++ 699 if iter.i < len(iter.page.Values()) { 700 return nil 701 } 702 err = iter.page.NextWithContext(ctx) 703 if err != nil { 704 iter.i-- 705 return err 706 } 707 iter.i = 0 708 return nil 709} 710 711// Next advances to the next value. If there was an error making 712// the request the iterator does not advance and the error is returned. 713// Deprecated: Use NextWithContext() instead. 714func (iter *CertificateCollectionIterator) Next() error { 715 return iter.NextWithContext(context.Background()) 716} 717 718// NotDone returns true if the enumeration should be started or is not yet complete. 719func (iter CertificateCollectionIterator) NotDone() bool { 720 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 721} 722 723// Response returns the raw server response from the last page request. 724func (iter CertificateCollectionIterator) Response() CertificateCollection { 725 return iter.page.Response() 726} 727 728// Value returns the current value or a zero-initialized value if the 729// iterator has advanced beyond the end of the collection. 730func (iter CertificateCollectionIterator) Value() CertificateContract { 731 if !iter.page.NotDone() { 732 return CertificateContract{} 733 } 734 return iter.page.Values()[iter.i] 735} 736 737// Creates a new instance of the CertificateCollectionIterator type. 738func NewCertificateCollectionIterator(page CertificateCollectionPage) CertificateCollectionIterator { 739 return CertificateCollectionIterator{page: page} 740} 741 742// IsEmpty returns true if the ListResult contains no values. 743func (cc CertificateCollection) IsEmpty() bool { 744 return cc.Value == nil || len(*cc.Value) == 0 745} 746 747// hasNextLink returns true if the NextLink is not empty. 748func (cc CertificateCollection) hasNextLink() bool { 749 return cc.NextLink != nil && len(*cc.NextLink) != 0 750} 751 752// certificateCollectionPreparer prepares a request to retrieve the next set of results. 753// It returns nil if no more results exist. 754func (cc CertificateCollection) certificateCollectionPreparer(ctx context.Context) (*http.Request, error) { 755 if !cc.hasNextLink() { 756 return nil, nil 757 } 758 return autorest.Prepare((&http.Request{}).WithContext(ctx), 759 autorest.AsJSON(), 760 autorest.AsGet(), 761 autorest.WithBaseURL(to.String(cc.NextLink))) 762} 763 764// CertificateCollectionPage contains a page of CertificateContract values. 765type CertificateCollectionPage struct { 766 fn func(context.Context, CertificateCollection) (CertificateCollection, error) 767 cc CertificateCollection 768} 769 770// NextWithContext advances to the next page of values. If there was an error making 771// the request the page does not advance and the error is returned. 772func (page *CertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { 773 if tracing.IsEnabled() { 774 ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionPage.NextWithContext") 775 defer func() { 776 sc := -1 777 if page.Response().Response.Response != nil { 778 sc = page.Response().Response.Response.StatusCode 779 } 780 tracing.EndSpan(ctx, sc, err) 781 }() 782 } 783 for { 784 next, err := page.fn(ctx, page.cc) 785 if err != nil { 786 return err 787 } 788 page.cc = next 789 if !next.hasNextLink() || !next.IsEmpty() { 790 break 791 } 792 } 793 return nil 794} 795 796// Next advances to the next page of values. If there was an error making 797// the request the page does not advance and the error is returned. 798// Deprecated: Use NextWithContext() instead. 799func (page *CertificateCollectionPage) Next() error { 800 return page.NextWithContext(context.Background()) 801} 802 803// NotDone returns true if the page enumeration should be started or is not yet complete. 804func (page CertificateCollectionPage) NotDone() bool { 805 return !page.cc.IsEmpty() 806} 807 808// Response returns the raw server response from the last page request. 809func (page CertificateCollectionPage) Response() CertificateCollection { 810 return page.cc 811} 812 813// Values returns the slice of values for the current page or nil if there are no values. 814func (page CertificateCollectionPage) Values() []CertificateContract { 815 if page.cc.IsEmpty() { 816 return nil 817 } 818 return *page.cc.Value 819} 820 821// Creates a new instance of the CertificateCollectionPage type. 822func NewCertificateCollectionPage(cur CertificateCollection, getNextPage func(context.Context, CertificateCollection) (CertificateCollection, error)) CertificateCollectionPage { 823 return CertificateCollectionPage{ 824 fn: getNextPage, 825 cc: cur, 826 } 827} 828 829// CertificateContract certificate details. 830type CertificateContract struct { 831 autorest.Response `json:"-"` 832 // ID - READ-ONLY; Certificate identifier path: /certificates/{certificateId} 833 ID *string `json:"id,omitempty"` 834 // Subject - Subject attribute of the certificate. 835 Subject *string `json:"subject,omitempty"` 836 // Thumbprint - Thumbprint of the certificate. 837 Thumbprint *string `json:"thumbprint,omitempty"` 838 // ExpirationDate - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 839 ExpirationDate *date.Time `json:"expirationDate,omitempty"` 840} 841 842// MarshalJSON is the custom marshaler for CertificateContract. 843func (cc CertificateContract) MarshalJSON() ([]byte, error) { 844 objectMap := make(map[string]interface{}) 845 if cc.Subject != nil { 846 objectMap["subject"] = cc.Subject 847 } 848 if cc.Thumbprint != nil { 849 objectMap["thumbprint"] = cc.Thumbprint 850 } 851 if cc.ExpirationDate != nil { 852 objectMap["expirationDate"] = cc.ExpirationDate 853 } 854 return json.Marshal(objectMap) 855} 856 857// CertificateCreateOrUpdateParameters parameters supplied to the CreateOrUpdate certificate operation. 858type CertificateCreateOrUpdateParameters struct { 859 // Data - Base 64 encoded certificate using the application/x-pkcs12 representation. 860 Data *string `json:"data,omitempty"` 861 // Password - Password for the Certificate 862 Password *string `json:"password,omitempty"` 863} 864 865// CertificateInformation SSL certificate information. 866type CertificateInformation struct { 867 autorest.Response `json:"-"` 868 // Expiry - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 869 Expiry *date.Time `json:"expiry,omitempty"` 870 // Thumbprint - Thumbprint of the certificate. 871 Thumbprint *string `json:"thumbprint,omitempty"` 872 // Subject - Subject of the certificate. 873 Subject *string `json:"subject,omitempty"` 874} 875 876// DeployConfigurationParameters parameters supplied to the Deploy Configuration operation. 877type DeployConfigurationParameters struct { 878 // Branch - The name of the Git branch from which the configuration is to be deployed to the configuration database. 879 Branch *string `json:"branch,omitempty"` 880 // Force - The value enforcing deleting subscriptions to products that are deleted in this update. 881 Force *bool `json:"force,omitempty"` 882} 883 884// ErrorBodyContract error Body contract. 885type ErrorBodyContract struct { 886 autorest.Response `json:"-"` 887 // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. 888 Code *string `json:"code,omitempty"` 889 // Message - Human-readable representation of the error. 890 Message *string `json:"message,omitempty"` 891 // Details - The list of invalid fields send in request, in case of validation error. 892 Details *[]ErrorFieldContract `json:"details,omitempty"` 893} 894 895// ErrorFieldContract error Field contract. 896type ErrorFieldContract struct { 897 // Code - Property level error code. 898 Code *string `json:"code,omitempty"` 899 // Message - Human-readable representation of property-level error. 900 Message *string `json:"message,omitempty"` 901 // Target - Property name. 902 Target *string `json:"target,omitempty"` 903} 904 905// ErrorResponse error Response. 906type ErrorResponse struct { 907 autorest.Response `json:"-"` 908 // Code - Error code. 909 Code *string `json:"code,omitempty"` 910 // Message - Error message indicating why the operation failed. 911 Message *string `json:"message,omitempty"` 912} 913 914// GenerateSsoURLResult generate SSO Url operations response details. 915type GenerateSsoURLResult struct { 916 autorest.Response `json:"-"` 917 // Value - Redirect Url containing the SSO URL value. 918 Value *string `json:"value,omitempty"` 919} 920 921// GroupCollection paged Group list representation. 922type GroupCollection struct { 923 autorest.Response `json:"-"` 924 // Value - Page values. 925 Value *[]GroupContract `json:"value,omitempty"` 926 // Count - Total records count number. 927 Count *int64 `json:"count,omitempty"` 928 // NextLink - Next page link if any. 929 NextLink *string `json:"nextLink,omitempty"` 930} 931 932// GroupCollectionIterator provides access to a complete listing of GroupContract values. 933type GroupCollectionIterator struct { 934 i int 935 page GroupCollectionPage 936} 937 938// NextWithContext advances to the next value. If there was an error making 939// the request the iterator does not advance and the error is returned. 940func (iter *GroupCollectionIterator) NextWithContext(ctx context.Context) (err error) { 941 if tracing.IsEnabled() { 942 ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionIterator.NextWithContext") 943 defer func() { 944 sc := -1 945 if iter.Response().Response.Response != nil { 946 sc = iter.Response().Response.Response.StatusCode 947 } 948 tracing.EndSpan(ctx, sc, err) 949 }() 950 } 951 iter.i++ 952 if iter.i < len(iter.page.Values()) { 953 return nil 954 } 955 err = iter.page.NextWithContext(ctx) 956 if err != nil { 957 iter.i-- 958 return err 959 } 960 iter.i = 0 961 return nil 962} 963 964// Next advances to the next value. If there was an error making 965// the request the iterator does not advance and the error is returned. 966// Deprecated: Use NextWithContext() instead. 967func (iter *GroupCollectionIterator) Next() error { 968 return iter.NextWithContext(context.Background()) 969} 970 971// NotDone returns true if the enumeration should be started or is not yet complete. 972func (iter GroupCollectionIterator) NotDone() bool { 973 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 974} 975 976// Response returns the raw server response from the last page request. 977func (iter GroupCollectionIterator) Response() GroupCollection { 978 return iter.page.Response() 979} 980 981// Value returns the current value or a zero-initialized value if the 982// iterator has advanced beyond the end of the collection. 983func (iter GroupCollectionIterator) Value() GroupContract { 984 if !iter.page.NotDone() { 985 return GroupContract{} 986 } 987 return iter.page.Values()[iter.i] 988} 989 990// Creates a new instance of the GroupCollectionIterator type. 991func NewGroupCollectionIterator(page GroupCollectionPage) GroupCollectionIterator { 992 return GroupCollectionIterator{page: page} 993} 994 995// IsEmpty returns true if the ListResult contains no values. 996func (gc GroupCollection) IsEmpty() bool { 997 return gc.Value == nil || len(*gc.Value) == 0 998} 999 1000// hasNextLink returns true if the NextLink is not empty. 1001func (gc GroupCollection) hasNextLink() bool { 1002 return gc.NextLink != nil && len(*gc.NextLink) != 0 1003} 1004 1005// groupCollectionPreparer prepares a request to retrieve the next set of results. 1006// It returns nil if no more results exist. 1007func (gc GroupCollection) groupCollectionPreparer(ctx context.Context) (*http.Request, error) { 1008 if !gc.hasNextLink() { 1009 return nil, nil 1010 } 1011 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1012 autorest.AsJSON(), 1013 autorest.AsGet(), 1014 autorest.WithBaseURL(to.String(gc.NextLink))) 1015} 1016 1017// GroupCollectionPage contains a page of GroupContract values. 1018type GroupCollectionPage struct { 1019 fn func(context.Context, GroupCollection) (GroupCollection, error) 1020 gc GroupCollection 1021} 1022 1023// NextWithContext advances to the next page of values. If there was an error making 1024// the request the page does not advance and the error is returned. 1025func (page *GroupCollectionPage) NextWithContext(ctx context.Context) (err error) { 1026 if tracing.IsEnabled() { 1027 ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionPage.NextWithContext") 1028 defer func() { 1029 sc := -1 1030 if page.Response().Response.Response != nil { 1031 sc = page.Response().Response.Response.StatusCode 1032 } 1033 tracing.EndSpan(ctx, sc, err) 1034 }() 1035 } 1036 for { 1037 next, err := page.fn(ctx, page.gc) 1038 if err != nil { 1039 return err 1040 } 1041 page.gc = next 1042 if !next.hasNextLink() || !next.IsEmpty() { 1043 break 1044 } 1045 } 1046 return nil 1047} 1048 1049// Next advances to the next page of values. If there was an error making 1050// the request the page does not advance and the error is returned. 1051// Deprecated: Use NextWithContext() instead. 1052func (page *GroupCollectionPage) Next() error { 1053 return page.NextWithContext(context.Background()) 1054} 1055 1056// NotDone returns true if the page enumeration should be started or is not yet complete. 1057func (page GroupCollectionPage) NotDone() bool { 1058 return !page.gc.IsEmpty() 1059} 1060 1061// Response returns the raw server response from the last page request. 1062func (page GroupCollectionPage) Response() GroupCollection { 1063 return page.gc 1064} 1065 1066// Values returns the slice of values for the current page or nil if there are no values. 1067func (page GroupCollectionPage) Values() []GroupContract { 1068 if page.gc.IsEmpty() { 1069 return nil 1070 } 1071 return *page.gc.Value 1072} 1073 1074// Creates a new instance of the GroupCollectionPage type. 1075func NewGroupCollectionPage(cur GroupCollection, getNextPage func(context.Context, GroupCollection) (GroupCollection, error)) GroupCollectionPage { 1076 return GroupCollectionPage{ 1077 fn: getNextPage, 1078 gc: cur, 1079 } 1080} 1081 1082// GroupContract developer group. 1083type GroupContract struct { 1084 autorest.Response `json:"-"` 1085 // ID - READ-ONLY; Uniquely identifies the group within the current API Management service instance. The value is a valid relative URL in the format of /groups/{groupId} where {groupId} is a group identifier. 1086 ID *string `json:"id,omitempty"` 1087 // Name - Group name. 1088 Name *string `json:"name,omitempty"` 1089 // Description - Group description. Can contain HTML formatting tags. 1090 Description *string `json:"description,omitempty"` 1091 // BuiltIn - READ-ONLY; true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. 1092 BuiltIn *bool `json:"builtIn,omitempty"` 1093 // Type - READ-ONLY; Group type. Possible values include: 'Custom', 'System', 'External' 1094 Type GroupTypeContract `json:"type,omitempty"` 1095 // ExternalID - READ-ONLY; For external groups, this property contains the id of the group from the external identity provider, e.g. Azure Active Directory; otherwise the value is null. 1096 ExternalID *string `json:"externalId,omitempty"` 1097} 1098 1099// MarshalJSON is the custom marshaler for GroupContract. 1100func (gc GroupContract) MarshalJSON() ([]byte, error) { 1101 objectMap := make(map[string]interface{}) 1102 if gc.Name != nil { 1103 objectMap["name"] = gc.Name 1104 } 1105 if gc.Description != nil { 1106 objectMap["description"] = gc.Description 1107 } 1108 return json.Marshal(objectMap) 1109} 1110 1111// GroupCreateParameters parameters supplied to the Create Group operation. 1112type GroupCreateParameters struct { 1113 // Name - Group name. 1114 Name *string `json:"name,omitempty"` 1115 // Description - Group description. 1116 Description *string `json:"description,omitempty"` 1117 // Type - Group type. Possible values include: 'Custom', 'System', 'External' 1118 Type GroupTypeContract `json:"type,omitempty"` 1119 // ExternalID - Identifier for an external group. 1120 ExternalID *string `json:"externalId,omitempty"` 1121} 1122 1123// GroupUpdateParameters parameters supplied to the Update Group operation. 1124type GroupUpdateParameters struct { 1125 // Name - Group name. 1126 Name *string `json:"name,omitempty"` 1127 // Description - Group description. 1128 Description *string `json:"description,omitempty"` 1129 // Type - Group type. Possible values include: 'Custom', 'System', 'External' 1130 Type GroupTypeContract `json:"type,omitempty"` 1131 // ExternalID - Identifier for an external group. 1132 ExternalID *string `json:"externalId,omitempty"` 1133} 1134 1135// HostnameConfiguration custom hostname configuration. 1136type HostnameConfiguration struct { 1137 // Type - Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm' 1138 Type HostnameType `json:"type,omitempty"` 1139 // Hostname - Hostname. 1140 Hostname *string `json:"hostname,omitempty"` 1141 // Certificate - Certificate information. 1142 Certificate *CertificateInformation `json:"certificate,omitempty"` 1143} 1144 1145// IdentityProviderContract the external Identity Providers like Facebook, Google, Microsoft, Twitter or 1146// Azure Active Directory which can be used to enable access to the API Management service developer portal 1147// for all users. 1148type IdentityProviderContract struct { 1149 autorest.Response `json:"-"` 1150 // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. 1151 ClientID *string `json:"clientId,omitempty"` 1152 // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. 1153 ClientSecret *string `json:"clientSecret,omitempty"` 1154 // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad' 1155 Type IdentityProviderNameType `json:"type,omitempty"` 1156 // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. 1157 AllowedTenants *[]string `json:"allowedTenants,omitempty"` 1158} 1159 1160// IdentityProviderList list of all the Identity Providers configured on the service instance. 1161type IdentityProviderList struct { 1162 autorest.Response `json:"-"` 1163 // Value - Identity Provider configuration values. 1164 Value *[]IdentityProviderContract `json:"value,omitempty"` 1165} 1166 1167// IdentityProviderUpdateParameters parameters supplied to the Update Identity Provider operation. 1168type IdentityProviderUpdateParameters struct { 1169 // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. 1170 ClientID *string `json:"clientId,omitempty"` 1171 // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. 1172 ClientSecret *string `json:"clientSecret,omitempty"` 1173 // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. 1174 AllowedTenants *[]string `json:"allowedTenants,omitempty"` 1175} 1176 1177// ListPolicySnippetContract ... 1178type ListPolicySnippetContract struct { 1179 autorest.Response `json:"-"` 1180 Value *[]PolicySnippetContract `json:"value,omitempty"` 1181} 1182 1183// ListUserIdentityContract ... 1184type ListUserIdentityContract struct { 1185 autorest.Response `json:"-"` 1186 Value *[]UserIdentityContract `json:"value,omitempty"` 1187} 1188 1189// LoggerCollection paged Logger list representation. 1190type LoggerCollection struct { 1191 autorest.Response `json:"-"` 1192 // Value - Logger values. 1193 Value *[]LoggerResponse `json:"value,omitempty"` 1194 // Count - Total records count number. 1195 Count *int64 `json:"count,omitempty"` 1196 // NextLink - Next page link if any. 1197 NextLink *string `json:"nextLink,omitempty"` 1198} 1199 1200// LoggerCollectionIterator provides access to a complete listing of LoggerResponse values. 1201type LoggerCollectionIterator struct { 1202 i int 1203 page LoggerCollectionPage 1204} 1205 1206// NextWithContext advances to the next value. If there was an error making 1207// the request the iterator does not advance and the error is returned. 1208func (iter *LoggerCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1209 if tracing.IsEnabled() { 1210 ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionIterator.NextWithContext") 1211 defer func() { 1212 sc := -1 1213 if iter.Response().Response.Response != nil { 1214 sc = iter.Response().Response.Response.StatusCode 1215 } 1216 tracing.EndSpan(ctx, sc, err) 1217 }() 1218 } 1219 iter.i++ 1220 if iter.i < len(iter.page.Values()) { 1221 return nil 1222 } 1223 err = iter.page.NextWithContext(ctx) 1224 if err != nil { 1225 iter.i-- 1226 return err 1227 } 1228 iter.i = 0 1229 return nil 1230} 1231 1232// Next advances to the next value. If there was an error making 1233// the request the iterator does not advance and the error is returned. 1234// Deprecated: Use NextWithContext() instead. 1235func (iter *LoggerCollectionIterator) Next() error { 1236 return iter.NextWithContext(context.Background()) 1237} 1238 1239// NotDone returns true if the enumeration should be started or is not yet complete. 1240func (iter LoggerCollectionIterator) NotDone() bool { 1241 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1242} 1243 1244// Response returns the raw server response from the last page request. 1245func (iter LoggerCollectionIterator) Response() LoggerCollection { 1246 return iter.page.Response() 1247} 1248 1249// Value returns the current value or a zero-initialized value if the 1250// iterator has advanced beyond the end of the collection. 1251func (iter LoggerCollectionIterator) Value() LoggerResponse { 1252 if !iter.page.NotDone() { 1253 return LoggerResponse{} 1254 } 1255 return iter.page.Values()[iter.i] 1256} 1257 1258// Creates a new instance of the LoggerCollectionIterator type. 1259func NewLoggerCollectionIterator(page LoggerCollectionPage) LoggerCollectionIterator { 1260 return LoggerCollectionIterator{page: page} 1261} 1262 1263// IsEmpty returns true if the ListResult contains no values. 1264func (lc LoggerCollection) IsEmpty() bool { 1265 return lc.Value == nil || len(*lc.Value) == 0 1266} 1267 1268// hasNextLink returns true if the NextLink is not empty. 1269func (lc LoggerCollection) hasNextLink() bool { 1270 return lc.NextLink != nil && len(*lc.NextLink) != 0 1271} 1272 1273// loggerCollectionPreparer prepares a request to retrieve the next set of results. 1274// It returns nil if no more results exist. 1275func (lc LoggerCollection) loggerCollectionPreparer(ctx context.Context) (*http.Request, error) { 1276 if !lc.hasNextLink() { 1277 return nil, nil 1278 } 1279 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1280 autorest.AsJSON(), 1281 autorest.AsGet(), 1282 autorest.WithBaseURL(to.String(lc.NextLink))) 1283} 1284 1285// LoggerCollectionPage contains a page of LoggerResponse values. 1286type LoggerCollectionPage struct { 1287 fn func(context.Context, LoggerCollection) (LoggerCollection, error) 1288 lc LoggerCollection 1289} 1290 1291// NextWithContext advances to the next page of values. If there was an error making 1292// the request the page does not advance and the error is returned. 1293func (page *LoggerCollectionPage) NextWithContext(ctx context.Context) (err error) { 1294 if tracing.IsEnabled() { 1295 ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionPage.NextWithContext") 1296 defer func() { 1297 sc := -1 1298 if page.Response().Response.Response != nil { 1299 sc = page.Response().Response.Response.StatusCode 1300 } 1301 tracing.EndSpan(ctx, sc, err) 1302 }() 1303 } 1304 for { 1305 next, err := page.fn(ctx, page.lc) 1306 if err != nil { 1307 return err 1308 } 1309 page.lc = next 1310 if !next.hasNextLink() || !next.IsEmpty() { 1311 break 1312 } 1313 } 1314 return nil 1315} 1316 1317// Next advances to the next page of values. If there was an error making 1318// the request the page does not advance and the error is returned. 1319// Deprecated: Use NextWithContext() instead. 1320func (page *LoggerCollectionPage) Next() error { 1321 return page.NextWithContext(context.Background()) 1322} 1323 1324// NotDone returns true if the page enumeration should be started or is not yet complete. 1325func (page LoggerCollectionPage) NotDone() bool { 1326 return !page.lc.IsEmpty() 1327} 1328 1329// Response returns the raw server response from the last page request. 1330func (page LoggerCollectionPage) Response() LoggerCollection { 1331 return page.lc 1332} 1333 1334// Values returns the slice of values for the current page or nil if there are no values. 1335func (page LoggerCollectionPage) Values() []LoggerResponse { 1336 if page.lc.IsEmpty() { 1337 return nil 1338 } 1339 return *page.lc.Value 1340} 1341 1342// Creates a new instance of the LoggerCollectionPage type. 1343func NewLoggerCollectionPage(cur LoggerCollection, getNextPage func(context.Context, LoggerCollection) (LoggerCollection, error)) LoggerCollectionPage { 1344 return LoggerCollectionPage{ 1345 fn: getNextPage, 1346 lc: cur, 1347 } 1348} 1349 1350// LoggerCreateParameters parameters supplied to the Create Logger operation. 1351type LoggerCreateParameters struct { 1352 // Type - Logger type. 1353 Type *string `json:"type,omitempty"` 1354 // Description - Logger description. 1355 Description *string `json:"description,omitempty"` 1356 // Credentials - The name and SendRule connection string of the event hub. 1357 Credentials map[string]*string `json:"credentials"` 1358 // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. 1359 IsBuffered *bool `json:"isBuffered,omitempty"` 1360} 1361 1362// MarshalJSON is the custom marshaler for LoggerCreateParameters. 1363func (lcp LoggerCreateParameters) MarshalJSON() ([]byte, error) { 1364 objectMap := make(map[string]interface{}) 1365 if lcp.Type != nil { 1366 objectMap["type"] = lcp.Type 1367 } 1368 if lcp.Description != nil { 1369 objectMap["description"] = lcp.Description 1370 } 1371 if lcp.Credentials != nil { 1372 objectMap["credentials"] = lcp.Credentials 1373 } 1374 if lcp.IsBuffered != nil { 1375 objectMap["isBuffered"] = lcp.IsBuffered 1376 } 1377 return json.Marshal(objectMap) 1378} 1379 1380// LoggerResponse the Logger entity in API Management represents an event sink that you can use to log API 1381// Management events. Currently the Logger entity supports logging API Management events to Azure Event 1382// Hubs. 1383type LoggerResponse struct { 1384 autorest.Response `json:"-"` 1385 // ID - READ-ONLY; Uniquely identifies the logger within the current API Management service instance. The value is a valid relative URL in the format of /loggers/{loggerId} where {loggerId} is a logger identifier. 1386 ID *string `json:"id,omitempty"` 1387 // Type - Logger type. 1388 Type *string `json:"type,omitempty"` 1389 // Description - Logger description. 1390 Description *string `json:"description,omitempty"` 1391 // Credentials - The name and SendRule connection string of the event hub. 1392 Credentials map[string]*string `json:"credentials"` 1393 // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. 1394 IsBuffered *bool `json:"isBuffered,omitempty"` 1395} 1396 1397// MarshalJSON is the custom marshaler for LoggerResponse. 1398func (lr LoggerResponse) MarshalJSON() ([]byte, error) { 1399 objectMap := make(map[string]interface{}) 1400 if lr.Type != nil { 1401 objectMap["type"] = lr.Type 1402 } 1403 if lr.Description != nil { 1404 objectMap["description"] = lr.Description 1405 } 1406 if lr.Credentials != nil { 1407 objectMap["credentials"] = lr.Credentials 1408 } 1409 if lr.IsBuffered != nil { 1410 objectMap["isBuffered"] = lr.IsBuffered 1411 } 1412 return json.Marshal(objectMap) 1413} 1414 1415// LoggerUpdateParameters parameters supplied to the Update Logger operation. 1416type LoggerUpdateParameters struct { 1417 // Type - Logger type. 1418 Type *string `json:"type,omitempty"` 1419 // Description - Logger description. 1420 Description *string `json:"description,omitempty"` 1421 // Credentials - Logger credentials. 1422 Credentials map[string]*string `json:"credentials"` 1423 // IsBuffered - whether records are buffered in the logger before publishing. Default is assumed to be true. 1424 IsBuffered *bool `json:"isBuffered,omitempty"` 1425} 1426 1427// MarshalJSON is the custom marshaler for LoggerUpdateParameters. 1428func (lup LoggerUpdateParameters) MarshalJSON() ([]byte, error) { 1429 objectMap := make(map[string]interface{}) 1430 if lup.Type != nil { 1431 objectMap["type"] = lup.Type 1432 } 1433 if lup.Description != nil { 1434 objectMap["description"] = lup.Description 1435 } 1436 if lup.Credentials != nil { 1437 objectMap["credentials"] = lup.Credentials 1438 } 1439 if lup.IsBuffered != nil { 1440 objectMap["isBuffered"] = lup.IsBuffered 1441 } 1442 return json.Marshal(objectMap) 1443} 1444 1445// OAuth2AuthenticationSettingsContract API OAuth2 Authentication settings details. 1446type OAuth2AuthenticationSettingsContract struct { 1447 // AuthorizationServerID - OAuth authorization server identifier. 1448 AuthorizationServerID *string `json:"authorizationServerId,omitempty"` 1449 // Scope - operations scope. 1450 Scope *string `json:"scope,omitempty"` 1451} 1452 1453// OAuth2AuthorizationServerContract external OAuth authorization server settings. 1454type OAuth2AuthorizationServerContract struct { 1455 autorest.Response `json:"-"` 1456 // ID - READ-ONLY; Uniquely identifies the authorization server within the current API Management service instance. The value is a valid relative URL in the format of /authorizationServers/{authsid} where {authsid} is an authorization server identifier. 1457 ID *string `json:"id,omitempty"` 1458 // Name - User-friendly authorization server name. 1459 Name *string `json:"name,omitempty"` 1460 // Description - Description of the authorization server. Can contain HTML formatting tags. 1461 Description *string `json:"description,omitempty"` 1462 // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. 1463 ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` 1464 // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. 1465 AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` 1466 // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. 1467 AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` 1468 // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. 1469 ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` 1470 // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. 1471 TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` 1472 // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. 1473 TokenEndpoint *string `json:"tokenEndpoint,omitempty"` 1474 // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. 1475 SupportState *bool `json:"supportState,omitempty"` 1476 // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. 1477 DefaultScope *string `json:"defaultScope,omitempty"` 1478 // GrantTypes - Form of an authorization grant, which the client uses to request the access token. 1479 GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` 1480 // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. 1481 BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` 1482 // ClientID - Client or app id registered with this authorization server. 1483 ClientID *string `json:"clientId,omitempty"` 1484 // ClientSecret - Client or app secret registered with this authorization server. 1485 ClientSecret *string `json:"clientSecret,omitempty"` 1486 // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. 1487 ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` 1488 // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. 1489 ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` 1490} 1491 1492// MarshalJSON is the custom marshaler for OAuth2AuthorizationServerContract. 1493func (oa2asc OAuth2AuthorizationServerContract) MarshalJSON() ([]byte, error) { 1494 objectMap := make(map[string]interface{}) 1495 if oa2asc.Name != nil { 1496 objectMap["name"] = oa2asc.Name 1497 } 1498 if oa2asc.Description != nil { 1499 objectMap["description"] = oa2asc.Description 1500 } 1501 if oa2asc.ClientRegistrationEndpoint != nil { 1502 objectMap["clientRegistrationEndpoint"] = oa2asc.ClientRegistrationEndpoint 1503 } 1504 if oa2asc.AuthorizationEndpoint != nil { 1505 objectMap["authorizationEndpoint"] = oa2asc.AuthorizationEndpoint 1506 } 1507 if oa2asc.AuthorizationMethods != nil { 1508 objectMap["authorizationMethods"] = oa2asc.AuthorizationMethods 1509 } 1510 if oa2asc.ClientAuthenticationMethod != nil { 1511 objectMap["clientAuthenticationMethod"] = oa2asc.ClientAuthenticationMethod 1512 } 1513 if oa2asc.TokenBodyParameters != nil { 1514 objectMap["tokenBodyParameters"] = oa2asc.TokenBodyParameters 1515 } 1516 if oa2asc.TokenEndpoint != nil { 1517 objectMap["tokenEndpoint"] = oa2asc.TokenEndpoint 1518 } 1519 if oa2asc.SupportState != nil { 1520 objectMap["supportState"] = oa2asc.SupportState 1521 } 1522 if oa2asc.DefaultScope != nil { 1523 objectMap["defaultScope"] = oa2asc.DefaultScope 1524 } 1525 if oa2asc.GrantTypes != nil { 1526 objectMap["grantTypes"] = oa2asc.GrantTypes 1527 } 1528 if oa2asc.BearerTokenSendingMethods != nil { 1529 objectMap["bearerTokenSendingMethods"] = oa2asc.BearerTokenSendingMethods 1530 } 1531 if oa2asc.ClientID != nil { 1532 objectMap["clientId"] = oa2asc.ClientID 1533 } 1534 if oa2asc.ClientSecret != nil { 1535 objectMap["clientSecret"] = oa2asc.ClientSecret 1536 } 1537 if oa2asc.ResourceOwnerUsername != nil { 1538 objectMap["resourceOwnerUsername"] = oa2asc.ResourceOwnerUsername 1539 } 1540 if oa2asc.ResourceOwnerPassword != nil { 1541 objectMap["resourceOwnerPassword"] = oa2asc.ResourceOwnerPassword 1542 } 1543 return json.Marshal(objectMap) 1544} 1545 1546// OAuth2AuthorizationServerUpdateContract external OAuth authorization server Update settings contract. 1547type OAuth2AuthorizationServerUpdateContract struct { 1548 // Name - User-friendly authorization server name. 1549 Name *string `json:"name,omitempty"` 1550 // Description - Description of the authorization server. Can contain HTML formatting tags. 1551 Description *string `json:"description,omitempty"` 1552 // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. 1553 ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` 1554 // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. 1555 AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` 1556 // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. 1557 AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` 1558 // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. 1559 ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` 1560 // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. 1561 TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` 1562 // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. 1563 TokenEndpoint *string `json:"tokenEndpoint,omitempty"` 1564 // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. 1565 SupportState *bool `json:"supportState,omitempty"` 1566 // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. 1567 DefaultScope *string `json:"defaultScope,omitempty"` 1568 // GrantTypes - Form of an authorization grant, which the client uses to request the access token. 1569 GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` 1570 // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. 1571 BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` 1572 // ClientID - Client or app id registered with this authorization server. 1573 ClientID *string `json:"clientId,omitempty"` 1574 // ClientSecret - Client or app secret registered with this authorization server. 1575 ClientSecret *string `json:"clientSecret,omitempty"` 1576 // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. 1577 ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` 1578 // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. 1579 ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` 1580} 1581 1582// OpenIDConnectProviderCollection paged OpenIdProviders list representation. 1583type OpenIDConnectProviderCollection struct { 1584 autorest.Response `json:"-"` 1585 // Value - Page values. 1586 Value *[]OpenidConnectProviderContract `json:"value,omitempty"` 1587 // Count - Total records count number. 1588 Count *int64 `json:"count,omitempty"` 1589 // NextLink - Next page link if any. 1590 NextLink *string `json:"nextLink,omitempty"` 1591} 1592 1593// OpenIDConnectProviderCollectionIterator provides access to a complete listing of 1594// OpenidConnectProviderContract values. 1595type OpenIDConnectProviderCollectionIterator struct { 1596 i int 1597 page OpenIDConnectProviderCollectionPage 1598} 1599 1600// NextWithContext advances to the next value. If there was an error making 1601// the request the iterator does not advance and the error is returned. 1602func (iter *OpenIDConnectProviderCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1603 if tracing.IsEnabled() { 1604 ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionIterator.NextWithContext") 1605 defer func() { 1606 sc := -1 1607 if iter.Response().Response.Response != nil { 1608 sc = iter.Response().Response.Response.StatusCode 1609 } 1610 tracing.EndSpan(ctx, sc, err) 1611 }() 1612 } 1613 iter.i++ 1614 if iter.i < len(iter.page.Values()) { 1615 return nil 1616 } 1617 err = iter.page.NextWithContext(ctx) 1618 if err != nil { 1619 iter.i-- 1620 return err 1621 } 1622 iter.i = 0 1623 return nil 1624} 1625 1626// Next advances to the next value. If there was an error making 1627// the request the iterator does not advance and the error is returned. 1628// Deprecated: Use NextWithContext() instead. 1629func (iter *OpenIDConnectProviderCollectionIterator) Next() error { 1630 return iter.NextWithContext(context.Background()) 1631} 1632 1633// NotDone returns true if the enumeration should be started or is not yet complete. 1634func (iter OpenIDConnectProviderCollectionIterator) NotDone() bool { 1635 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1636} 1637 1638// Response returns the raw server response from the last page request. 1639func (iter OpenIDConnectProviderCollectionIterator) Response() OpenIDConnectProviderCollection { 1640 return iter.page.Response() 1641} 1642 1643// Value returns the current value or a zero-initialized value if the 1644// iterator has advanced beyond the end of the collection. 1645func (iter OpenIDConnectProviderCollectionIterator) Value() OpenidConnectProviderContract { 1646 if !iter.page.NotDone() { 1647 return OpenidConnectProviderContract{} 1648 } 1649 return iter.page.Values()[iter.i] 1650} 1651 1652// Creates a new instance of the OpenIDConnectProviderCollectionIterator type. 1653func NewOpenIDConnectProviderCollectionIterator(page OpenIDConnectProviderCollectionPage) OpenIDConnectProviderCollectionIterator { 1654 return OpenIDConnectProviderCollectionIterator{page: page} 1655} 1656 1657// IsEmpty returns true if the ListResult contains no values. 1658func (oicpc OpenIDConnectProviderCollection) IsEmpty() bool { 1659 return oicpc.Value == nil || len(*oicpc.Value) == 0 1660} 1661 1662// hasNextLink returns true if the NextLink is not empty. 1663func (oicpc OpenIDConnectProviderCollection) hasNextLink() bool { 1664 return oicpc.NextLink != nil && len(*oicpc.NextLink) != 0 1665} 1666 1667// openIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. 1668// It returns nil if no more results exist. 1669func (oicpc OpenIDConnectProviderCollection) openIDConnectProviderCollectionPreparer(ctx context.Context) (*http.Request, error) { 1670 if !oicpc.hasNextLink() { 1671 return nil, nil 1672 } 1673 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1674 autorest.AsJSON(), 1675 autorest.AsGet(), 1676 autorest.WithBaseURL(to.String(oicpc.NextLink))) 1677} 1678 1679// OpenIDConnectProviderCollectionPage contains a page of OpenidConnectProviderContract values. 1680type OpenIDConnectProviderCollectionPage struct { 1681 fn func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error) 1682 oicpc OpenIDConnectProviderCollection 1683} 1684 1685// NextWithContext advances to the next page of values. If there was an error making 1686// the request the page does not advance and the error is returned. 1687func (page *OpenIDConnectProviderCollectionPage) NextWithContext(ctx context.Context) (err error) { 1688 if tracing.IsEnabled() { 1689 ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionPage.NextWithContext") 1690 defer func() { 1691 sc := -1 1692 if page.Response().Response.Response != nil { 1693 sc = page.Response().Response.Response.StatusCode 1694 } 1695 tracing.EndSpan(ctx, sc, err) 1696 }() 1697 } 1698 for { 1699 next, err := page.fn(ctx, page.oicpc) 1700 if err != nil { 1701 return err 1702 } 1703 page.oicpc = next 1704 if !next.hasNextLink() || !next.IsEmpty() { 1705 break 1706 } 1707 } 1708 return nil 1709} 1710 1711// Next advances to the next page of values. If there was an error making 1712// the request the page does not advance and the error is returned. 1713// Deprecated: Use NextWithContext() instead. 1714func (page *OpenIDConnectProviderCollectionPage) Next() error { 1715 return page.NextWithContext(context.Background()) 1716} 1717 1718// NotDone returns true if the page enumeration should be started or is not yet complete. 1719func (page OpenIDConnectProviderCollectionPage) NotDone() bool { 1720 return !page.oicpc.IsEmpty() 1721} 1722 1723// Response returns the raw server response from the last page request. 1724func (page OpenIDConnectProviderCollectionPage) Response() OpenIDConnectProviderCollection { 1725 return page.oicpc 1726} 1727 1728// Values returns the slice of values for the current page or nil if there are no values. 1729func (page OpenIDConnectProviderCollectionPage) Values() []OpenidConnectProviderContract { 1730 if page.oicpc.IsEmpty() { 1731 return nil 1732 } 1733 return *page.oicpc.Value 1734} 1735 1736// Creates a new instance of the OpenIDConnectProviderCollectionPage type. 1737func NewOpenIDConnectProviderCollectionPage(cur OpenIDConnectProviderCollection, getNextPage func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error)) OpenIDConnectProviderCollectionPage { 1738 return OpenIDConnectProviderCollectionPage{ 1739 fn: getNextPage, 1740 oicpc: cur, 1741 } 1742} 1743 1744// OpenidConnectProviderContract openID Connect Providers Contract. 1745type OpenidConnectProviderContract struct { 1746 autorest.Response `json:"-"` 1747 // ID - OpenID Connect Provider identifier. 1748 ID *string `json:"id,omitempty"` 1749 // Name - User-friendly OpenID Connect Provider name. 1750 Name *string `json:"name,omitempty"` 1751 // Description - User-friendly description of OpenID Connect Provider. 1752 Description *string `json:"description,omitempty"` 1753 // MetadataEndpoint - Metadata endpoint URI. 1754 MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` 1755 // ClientID - Client ID of developer console which is the client application. 1756 ClientID *string `json:"clientId,omitempty"` 1757 // ClientSecret - Client Secret of developer console which is the client application. 1758 ClientSecret *string `json:"clientSecret,omitempty"` 1759} 1760 1761// OpenidConnectProviderCreateContract parameters supplied to the Create OpenID Connect Provider operation. 1762type OpenidConnectProviderCreateContract struct { 1763 // Name - User-friendly OpenID Connect Provider name. 1764 Name *string `json:"name,omitempty"` 1765 // Description - User-friendly description of OpenID Connect Provider. 1766 Description *string `json:"description,omitempty"` 1767 // MetadataEndpoint - Metadata endpoint URI. 1768 MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` 1769 // ClientID - Client ID of developer console which is the client application. 1770 ClientID *string `json:"clientId,omitempty"` 1771 // ClientSecret - Client Secret of developer console which is the client application. 1772 ClientSecret *string `json:"clientSecret,omitempty"` 1773} 1774 1775// OpenidConnectProviderUpdateContract parameters supplied to the Update OpenID Connect Provider operation. 1776type OpenidConnectProviderUpdateContract struct { 1777 // Name - User-friendly OpenID Connect Provider name. 1778 Name *string `json:"name,omitempty"` 1779 // Description - User-friendly description of OpenID Connect Provider. 1780 Description *string `json:"description,omitempty"` 1781 // MetadataEndpoint - Metadata endpoint URI. 1782 MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` 1783 // ClientID - Client ID of developer console which is the client application. 1784 ClientID *string `json:"clientId,omitempty"` 1785 // ClientSecret - Client Secret of developer console which is the client application. 1786 ClientSecret *string `json:"clientSecret,omitempty"` 1787} 1788 1789// OperationCollection paged Operation list representation. 1790type OperationCollection struct { 1791 autorest.Response `json:"-"` 1792 // Value - Page values. 1793 Value *[]OperationContract `json:"value,omitempty"` 1794 // Count - Total records count number. 1795 Count *int64 `json:"count,omitempty"` 1796 // NextLink - Next page link if any. 1797 NextLink *string `json:"nextLink,omitempty"` 1798} 1799 1800// OperationCollectionIterator provides access to a complete listing of OperationContract values. 1801type OperationCollectionIterator struct { 1802 i int 1803 page OperationCollectionPage 1804} 1805 1806// NextWithContext advances to the next value. If there was an error making 1807// the request the iterator does not advance and the error is returned. 1808func (iter *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1809 if tracing.IsEnabled() { 1810 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.NextWithContext") 1811 defer func() { 1812 sc := -1 1813 if iter.Response().Response.Response != nil { 1814 sc = iter.Response().Response.Response.StatusCode 1815 } 1816 tracing.EndSpan(ctx, sc, err) 1817 }() 1818 } 1819 iter.i++ 1820 if iter.i < len(iter.page.Values()) { 1821 return nil 1822 } 1823 err = iter.page.NextWithContext(ctx) 1824 if err != nil { 1825 iter.i-- 1826 return err 1827 } 1828 iter.i = 0 1829 return nil 1830} 1831 1832// Next advances to the next value. If there was an error making 1833// the request the iterator does not advance and the error is returned. 1834// Deprecated: Use NextWithContext() instead. 1835func (iter *OperationCollectionIterator) Next() error { 1836 return iter.NextWithContext(context.Background()) 1837} 1838 1839// NotDone returns true if the enumeration should be started or is not yet complete. 1840func (iter OperationCollectionIterator) NotDone() bool { 1841 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1842} 1843 1844// Response returns the raw server response from the last page request. 1845func (iter OperationCollectionIterator) Response() OperationCollection { 1846 return iter.page.Response() 1847} 1848 1849// Value returns the current value or a zero-initialized value if the 1850// iterator has advanced beyond the end of the collection. 1851func (iter OperationCollectionIterator) Value() OperationContract { 1852 if !iter.page.NotDone() { 1853 return OperationContract{} 1854 } 1855 return iter.page.Values()[iter.i] 1856} 1857 1858// Creates a new instance of the OperationCollectionIterator type. 1859func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { 1860 return OperationCollectionIterator{page: page} 1861} 1862 1863// IsEmpty returns true if the ListResult contains no values. 1864func (oc OperationCollection) IsEmpty() bool { 1865 return oc.Value == nil || len(*oc.Value) == 0 1866} 1867 1868// hasNextLink returns true if the NextLink is not empty. 1869func (oc OperationCollection) hasNextLink() bool { 1870 return oc.NextLink != nil && len(*oc.NextLink) != 0 1871} 1872 1873// operationCollectionPreparer prepares a request to retrieve the next set of results. 1874// It returns nil if no more results exist. 1875func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { 1876 if !oc.hasNextLink() { 1877 return nil, nil 1878 } 1879 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1880 autorest.AsJSON(), 1881 autorest.AsGet(), 1882 autorest.WithBaseURL(to.String(oc.NextLink))) 1883} 1884 1885// OperationCollectionPage contains a page of OperationContract values. 1886type OperationCollectionPage struct { 1887 fn func(context.Context, OperationCollection) (OperationCollection, error) 1888 oc OperationCollection 1889} 1890 1891// NextWithContext advances to the next page of values. If there was an error making 1892// the request the page does not advance and the error is returned. 1893func (page *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { 1894 if tracing.IsEnabled() { 1895 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.NextWithContext") 1896 defer func() { 1897 sc := -1 1898 if page.Response().Response.Response != nil { 1899 sc = page.Response().Response.Response.StatusCode 1900 } 1901 tracing.EndSpan(ctx, sc, err) 1902 }() 1903 } 1904 for { 1905 next, err := page.fn(ctx, page.oc) 1906 if err != nil { 1907 return err 1908 } 1909 page.oc = next 1910 if !next.hasNextLink() || !next.IsEmpty() { 1911 break 1912 } 1913 } 1914 return nil 1915} 1916 1917// Next advances to the next page of values. If there was an error making 1918// the request the page does not advance and the error is returned. 1919// Deprecated: Use NextWithContext() instead. 1920func (page *OperationCollectionPage) Next() error { 1921 return page.NextWithContext(context.Background()) 1922} 1923 1924// NotDone returns true if the page enumeration should be started or is not yet complete. 1925func (page OperationCollectionPage) NotDone() bool { 1926 return !page.oc.IsEmpty() 1927} 1928 1929// Response returns the raw server response from the last page request. 1930func (page OperationCollectionPage) Response() OperationCollection { 1931 return page.oc 1932} 1933 1934// Values returns the slice of values for the current page or nil if there are no values. 1935func (page OperationCollectionPage) Values() []OperationContract { 1936 if page.oc.IsEmpty() { 1937 return nil 1938 } 1939 return *page.oc.Value 1940} 1941 1942// Creates a new instance of the OperationCollectionPage type. 1943func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { 1944 return OperationCollectionPage{ 1945 fn: getNextPage, 1946 oc: cur, 1947 } 1948} 1949 1950// OperationContract api Operation details. 1951type OperationContract struct { 1952 autorest.Response `json:"-"` 1953 // ID - READ-ONLY; Uniquely identifies the operation within the current API Management service instance. The value is a valid relative URL in the format of /apis/{aid}/operations/{id} where {aid} is an API identifier and {id} is an operation identifier. 1954 ID *string `json:"id,omitempty"` 1955 // Name - Operation Name. 1956 Name *string `json:"name,omitempty"` 1957 // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. 1958 Method *string `json:"method,omitempty"` 1959 // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} 1960 URLTemplate *string `json:"urlTemplate,omitempty"` 1961 // TemplateParameters - Collection of URL template parameters. 1962 TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` 1963 // Description - Description of the operation. May include HTML formatting tags. 1964 Description *string `json:"description,omitempty"` 1965 // Request - An entity containing request details. 1966 Request *RequestContract `json:"request,omitempty"` 1967 // Responses - Array of Operation responses. 1968 Responses *[]ResultContract `json:"responses,omitempty"` 1969} 1970 1971// MarshalJSON is the custom marshaler for OperationContract. 1972func (oc OperationContract) MarshalJSON() ([]byte, error) { 1973 objectMap := make(map[string]interface{}) 1974 if oc.Name != nil { 1975 objectMap["name"] = oc.Name 1976 } 1977 if oc.Method != nil { 1978 objectMap["method"] = oc.Method 1979 } 1980 if oc.URLTemplate != nil { 1981 objectMap["urlTemplate"] = oc.URLTemplate 1982 } 1983 if oc.TemplateParameters != nil { 1984 objectMap["templateParameters"] = oc.TemplateParameters 1985 } 1986 if oc.Description != nil { 1987 objectMap["description"] = oc.Description 1988 } 1989 if oc.Request != nil { 1990 objectMap["request"] = oc.Request 1991 } 1992 if oc.Responses != nil { 1993 objectMap["responses"] = oc.Responses 1994 } 1995 return json.Marshal(objectMap) 1996} 1997 1998// OperationResultContract operation Result. 1999type OperationResultContract struct { 2000 autorest.Response `json:"-"` 2001 // ID - Operation result identifier. 2002 ID *string `json:"id,omitempty"` 2003 // Status - Status of an async operation. Possible values include: 'Started', 'InProgress', 'Succeeded', 'Failed' 2004 Status AsyncOperationState `json:"status,omitempty"` 2005 // Started - Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 2006 Started *date.Time `json:"started,omitempty"` 2007 // Updated - Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 2008 Updated *date.Time `json:"updated,omitempty"` 2009 // ResultInfo - Optional result info. 2010 ResultInfo *string `json:"resultInfo,omitempty"` 2011 Error *ErrorBodyContract `json:"error,omitempty"` 2012} 2013 2014// ParameterContract operation parameters details. 2015type ParameterContract struct { 2016 // Name - Parameter name. 2017 Name *string `json:"name,omitempty"` 2018 // Description - Parameter description. 2019 Description *string `json:"description,omitempty"` 2020 // Type - Parameter type. 2021 Type *string `json:"type,omitempty"` 2022 // DefaultValue - Default parameter value. 2023 DefaultValue *string `json:"defaultValue,omitempty"` 2024 // Required - whether parameter is required or not. 2025 Required *bool `json:"required,omitempty"` 2026 // Values - Parameter values. 2027 Values *[]string `json:"values,omitempty"` 2028} 2029 2030// PatchParameters parameters supplied to the Patch operations. 2031type PatchParameters struct { 2032 // RawJSON - json value. 2033 RawJSON interface{} `json:"RawJson,omitempty"` 2034} 2035 2036// PolicySnippetContract policy snippet. 2037type PolicySnippetContract struct { 2038 // Name - READ-ONLY; Snippet name. 2039 Name *string `json:"name,omitempty"` 2040 // Content - READ-ONLY; Snippet content. 2041 Content *string `json:"content,omitempty"` 2042 // ToolTip - READ-ONLY; Snippet toolTip. 2043 ToolTip *string `json:"toolTip,omitempty"` 2044 // Scope - READ-ONLY; Snippet scope. Possible values include: 'Tenant', 'Product', 'API', 'Operation', 'All' 2045 Scope PolicyScopeContract `json:"scope,omitempty"` 2046} 2047 2048// MarshalJSON is the custom marshaler for PolicySnippetContract. 2049func (psc PolicySnippetContract) MarshalJSON() ([]byte, error) { 2050 objectMap := make(map[string]interface{}) 2051 return json.Marshal(objectMap) 2052} 2053 2054// ProductCollection paged Products list representation. 2055type ProductCollection struct { 2056 autorest.Response `json:"-"` 2057 // Value - Page values. 2058 Value *[]ProductContract `json:"value,omitempty"` 2059 // Count - Total records count number. 2060 Count *int64 `json:"count,omitempty"` 2061 // NextLink - Next page link if any. 2062 NextLink *string `json:"nextLink,omitempty"` 2063} 2064 2065// ProductCollectionIterator provides access to a complete listing of ProductContract values. 2066type ProductCollectionIterator struct { 2067 i int 2068 page ProductCollectionPage 2069} 2070 2071// NextWithContext advances to the next value. If there was an error making 2072// the request the iterator does not advance and the error is returned. 2073func (iter *ProductCollectionIterator) NextWithContext(ctx context.Context) (err error) { 2074 if tracing.IsEnabled() { 2075 ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionIterator.NextWithContext") 2076 defer func() { 2077 sc := -1 2078 if iter.Response().Response.Response != nil { 2079 sc = iter.Response().Response.Response.StatusCode 2080 } 2081 tracing.EndSpan(ctx, sc, err) 2082 }() 2083 } 2084 iter.i++ 2085 if iter.i < len(iter.page.Values()) { 2086 return nil 2087 } 2088 err = iter.page.NextWithContext(ctx) 2089 if err != nil { 2090 iter.i-- 2091 return err 2092 } 2093 iter.i = 0 2094 return nil 2095} 2096 2097// Next advances to the next value. If there was an error making 2098// the request the iterator does not advance and the error is returned. 2099// Deprecated: Use NextWithContext() instead. 2100func (iter *ProductCollectionIterator) Next() error { 2101 return iter.NextWithContext(context.Background()) 2102} 2103 2104// NotDone returns true if the enumeration should be started or is not yet complete. 2105func (iter ProductCollectionIterator) NotDone() bool { 2106 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2107} 2108 2109// Response returns the raw server response from the last page request. 2110func (iter ProductCollectionIterator) Response() ProductCollection { 2111 return iter.page.Response() 2112} 2113 2114// Value returns the current value or a zero-initialized value if the 2115// iterator has advanced beyond the end of the collection. 2116func (iter ProductCollectionIterator) Value() ProductContract { 2117 if !iter.page.NotDone() { 2118 return ProductContract{} 2119 } 2120 return iter.page.Values()[iter.i] 2121} 2122 2123// Creates a new instance of the ProductCollectionIterator type. 2124func NewProductCollectionIterator(page ProductCollectionPage) ProductCollectionIterator { 2125 return ProductCollectionIterator{page: page} 2126} 2127 2128// IsEmpty returns true if the ListResult contains no values. 2129func (pc ProductCollection) IsEmpty() bool { 2130 return pc.Value == nil || len(*pc.Value) == 0 2131} 2132 2133// hasNextLink returns true if the NextLink is not empty. 2134func (pc ProductCollection) hasNextLink() bool { 2135 return pc.NextLink != nil && len(*pc.NextLink) != 0 2136} 2137 2138// productCollectionPreparer prepares a request to retrieve the next set of results. 2139// It returns nil if no more results exist. 2140func (pc ProductCollection) productCollectionPreparer(ctx context.Context) (*http.Request, error) { 2141 if !pc.hasNextLink() { 2142 return nil, nil 2143 } 2144 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2145 autorest.AsJSON(), 2146 autorest.AsGet(), 2147 autorest.WithBaseURL(to.String(pc.NextLink))) 2148} 2149 2150// ProductCollectionPage contains a page of ProductContract values. 2151type ProductCollectionPage struct { 2152 fn func(context.Context, ProductCollection) (ProductCollection, error) 2153 pc ProductCollection 2154} 2155 2156// NextWithContext advances to the next page of values. If there was an error making 2157// the request the page does not advance and the error is returned. 2158func (page *ProductCollectionPage) NextWithContext(ctx context.Context) (err error) { 2159 if tracing.IsEnabled() { 2160 ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionPage.NextWithContext") 2161 defer func() { 2162 sc := -1 2163 if page.Response().Response.Response != nil { 2164 sc = page.Response().Response.Response.StatusCode 2165 } 2166 tracing.EndSpan(ctx, sc, err) 2167 }() 2168 } 2169 for { 2170 next, err := page.fn(ctx, page.pc) 2171 if err != nil { 2172 return err 2173 } 2174 page.pc = next 2175 if !next.hasNextLink() || !next.IsEmpty() { 2176 break 2177 } 2178 } 2179 return nil 2180} 2181 2182// Next advances to the next page of values. If there was an error making 2183// the request the page does not advance and the error is returned. 2184// Deprecated: Use NextWithContext() instead. 2185func (page *ProductCollectionPage) Next() error { 2186 return page.NextWithContext(context.Background()) 2187} 2188 2189// NotDone returns true if the page enumeration should be started or is not yet complete. 2190func (page ProductCollectionPage) NotDone() bool { 2191 return !page.pc.IsEmpty() 2192} 2193 2194// Response returns the raw server response from the last page request. 2195func (page ProductCollectionPage) Response() ProductCollection { 2196 return page.pc 2197} 2198 2199// Values returns the slice of values for the current page or nil if there are no values. 2200func (page ProductCollectionPage) Values() []ProductContract { 2201 if page.pc.IsEmpty() { 2202 return nil 2203 } 2204 return *page.pc.Value 2205} 2206 2207// Creates a new instance of the ProductCollectionPage type. 2208func NewProductCollectionPage(cur ProductCollection, getNextPage func(context.Context, ProductCollection) (ProductCollection, error)) ProductCollectionPage { 2209 return ProductCollectionPage{ 2210 fn: getNextPage, 2211 pc: cur, 2212 } 2213} 2214 2215// ProductContract product profile. 2216type ProductContract struct { 2217 autorest.Response `json:"-"` 2218 // ID - READ-ONLY; Uniquely identifies the product within the current API Management service instance. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier. 2219 ID *string `json:"id,omitempty"` 2220 // Name - Product name. 2221 Name *string `json:"name,omitempty"` 2222 // Description - Product description. May include HTML formatting tags. 2223 Description *string `json:"description,omitempty"` 2224 // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. 2225 Terms *string `json:"terms,omitempty"` 2226 // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. 2227 SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` 2228 // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. 2229 ApprovalRequired *bool `json:"approvalRequired,omitempty"` 2230 // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. 2231 SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` 2232 // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is NotPublished. Possible values include: 'NotPublished', 'Published' 2233 State ProductStateContract `json:"state,omitempty"` 2234} 2235 2236// MarshalJSON is the custom marshaler for ProductContract. 2237func (pc ProductContract) MarshalJSON() ([]byte, error) { 2238 objectMap := make(map[string]interface{}) 2239 if pc.Name != nil { 2240 objectMap["name"] = pc.Name 2241 } 2242 if pc.Description != nil { 2243 objectMap["description"] = pc.Description 2244 } 2245 if pc.Terms != nil { 2246 objectMap["terms"] = pc.Terms 2247 } 2248 if pc.SubscriptionRequired != nil { 2249 objectMap["subscriptionRequired"] = pc.SubscriptionRequired 2250 } 2251 if pc.ApprovalRequired != nil { 2252 objectMap["approvalRequired"] = pc.ApprovalRequired 2253 } 2254 if pc.SubscriptionsLimit != nil { 2255 objectMap["subscriptionsLimit"] = pc.SubscriptionsLimit 2256 } 2257 if pc.State != "" { 2258 objectMap["state"] = pc.State 2259 } 2260 return json.Marshal(objectMap) 2261} 2262 2263// ProductUpdateParameters parameters supplied to the CreateOrUpdate Product operation. 2264type ProductUpdateParameters struct { 2265 // Name - Product name. 2266 Name *string `json:"name,omitempty"` 2267 // Description - Product description. 2268 Description *string `json:"description,omitempty"` 2269 // Terms - Product terms and conditions. Developer will have to accept these terms before he's allowed to call product API. 2270 Terms *string `json:"terms,omitempty"` 2271 // SubscriptionRequired - whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. 2272 SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` 2273 // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. 2274 ApprovalRequired *bool `json:"approvalRequired,omitempty"` 2275 // SubscriptionsLimit - whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. 2276 SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` 2277 // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Possible values include: 'NotPublished', 'Published' 2278 State ProductStateContract `json:"state,omitempty"` 2279} 2280 2281// PropertyCollection paged Property list representation. 2282type PropertyCollection struct { 2283 autorest.Response `json:"-"` 2284 // Value - Page values. 2285 Value *[]PropertyContract `json:"value,omitempty"` 2286 // Count - Total records count number. 2287 Count *int64 `json:"count,omitempty"` 2288 // NextLink - Next page link if any. 2289 NextLink *string `json:"nextLink,omitempty"` 2290} 2291 2292// PropertyCollectionIterator provides access to a complete listing of PropertyContract values. 2293type PropertyCollectionIterator struct { 2294 i int 2295 page PropertyCollectionPage 2296} 2297 2298// NextWithContext advances to the next value. If there was an error making 2299// the request the iterator does not advance and the error is returned. 2300func (iter *PropertyCollectionIterator) NextWithContext(ctx context.Context) (err error) { 2301 if tracing.IsEnabled() { 2302 ctx = tracing.StartSpan(ctx, fqdn+"/PropertyCollectionIterator.NextWithContext") 2303 defer func() { 2304 sc := -1 2305 if iter.Response().Response.Response != nil { 2306 sc = iter.Response().Response.Response.StatusCode 2307 } 2308 tracing.EndSpan(ctx, sc, err) 2309 }() 2310 } 2311 iter.i++ 2312 if iter.i < len(iter.page.Values()) { 2313 return nil 2314 } 2315 err = iter.page.NextWithContext(ctx) 2316 if err != nil { 2317 iter.i-- 2318 return err 2319 } 2320 iter.i = 0 2321 return nil 2322} 2323 2324// Next advances to the next value. If there was an error making 2325// the request the iterator does not advance and the error is returned. 2326// Deprecated: Use NextWithContext() instead. 2327func (iter *PropertyCollectionIterator) Next() error { 2328 return iter.NextWithContext(context.Background()) 2329} 2330 2331// NotDone returns true if the enumeration should be started or is not yet complete. 2332func (iter PropertyCollectionIterator) NotDone() bool { 2333 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2334} 2335 2336// Response returns the raw server response from the last page request. 2337func (iter PropertyCollectionIterator) Response() PropertyCollection { 2338 return iter.page.Response() 2339} 2340 2341// Value returns the current value or a zero-initialized value if the 2342// iterator has advanced beyond the end of the collection. 2343func (iter PropertyCollectionIterator) Value() PropertyContract { 2344 if !iter.page.NotDone() { 2345 return PropertyContract{} 2346 } 2347 return iter.page.Values()[iter.i] 2348} 2349 2350// Creates a new instance of the PropertyCollectionIterator type. 2351func NewPropertyCollectionIterator(page PropertyCollectionPage) PropertyCollectionIterator { 2352 return PropertyCollectionIterator{page: page} 2353} 2354 2355// IsEmpty returns true if the ListResult contains no values. 2356func (pc PropertyCollection) IsEmpty() bool { 2357 return pc.Value == nil || len(*pc.Value) == 0 2358} 2359 2360// hasNextLink returns true if the NextLink is not empty. 2361func (pc PropertyCollection) hasNextLink() bool { 2362 return pc.NextLink != nil && len(*pc.NextLink) != 0 2363} 2364 2365// propertyCollectionPreparer prepares a request to retrieve the next set of results. 2366// It returns nil if no more results exist. 2367func (pc PropertyCollection) propertyCollectionPreparer(ctx context.Context) (*http.Request, error) { 2368 if !pc.hasNextLink() { 2369 return nil, nil 2370 } 2371 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2372 autorest.AsJSON(), 2373 autorest.AsGet(), 2374 autorest.WithBaseURL(to.String(pc.NextLink))) 2375} 2376 2377// PropertyCollectionPage contains a page of PropertyContract values. 2378type PropertyCollectionPage struct { 2379 fn func(context.Context, PropertyCollection) (PropertyCollection, error) 2380 pc PropertyCollection 2381} 2382 2383// NextWithContext advances to the next page of values. If there was an error making 2384// the request the page does not advance and the error is returned. 2385func (page *PropertyCollectionPage) NextWithContext(ctx context.Context) (err error) { 2386 if tracing.IsEnabled() { 2387 ctx = tracing.StartSpan(ctx, fqdn+"/PropertyCollectionPage.NextWithContext") 2388 defer func() { 2389 sc := -1 2390 if page.Response().Response.Response != nil { 2391 sc = page.Response().Response.Response.StatusCode 2392 } 2393 tracing.EndSpan(ctx, sc, err) 2394 }() 2395 } 2396 for { 2397 next, err := page.fn(ctx, page.pc) 2398 if err != nil { 2399 return err 2400 } 2401 page.pc = next 2402 if !next.hasNextLink() || !next.IsEmpty() { 2403 break 2404 } 2405 } 2406 return nil 2407} 2408 2409// Next advances to the next page of values. If there was an error making 2410// the request the page does not advance and the error is returned. 2411// Deprecated: Use NextWithContext() instead. 2412func (page *PropertyCollectionPage) Next() error { 2413 return page.NextWithContext(context.Background()) 2414} 2415 2416// NotDone returns true if the page enumeration should be started or is not yet complete. 2417func (page PropertyCollectionPage) NotDone() bool { 2418 return !page.pc.IsEmpty() 2419} 2420 2421// Response returns the raw server response from the last page request. 2422func (page PropertyCollectionPage) Response() PropertyCollection { 2423 return page.pc 2424} 2425 2426// Values returns the slice of values for the current page or nil if there are no values. 2427func (page PropertyCollectionPage) Values() []PropertyContract { 2428 if page.pc.IsEmpty() { 2429 return nil 2430 } 2431 return *page.pc.Value 2432} 2433 2434// Creates a new instance of the PropertyCollectionPage type. 2435func NewPropertyCollectionPage(cur PropertyCollection, getNextPage func(context.Context, PropertyCollection) (PropertyCollection, error)) PropertyCollectionPage { 2436 return PropertyCollectionPage{ 2437 fn: getNextPage, 2438 pc: cur, 2439 } 2440} 2441 2442// PropertyContract property details. 2443type PropertyContract struct { 2444 autorest.Response `json:"-"` 2445 // ID - READ-ONLY; Uniquely identifies the property within the current API Management service instance. The value is a valid relative URL in the format of /properties/{propId} where {propId} is a property identifier. 2446 ID *string `json:"id,omitempty"` 2447 // Name - Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. 2448 Name *string `json:"name,omitempty"` 2449 // Value - Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. 2450 Value *string `json:"value,omitempty"` 2451 // Tags - Optional tags that when provided can be used to filter the property list. 2452 Tags *[]string `json:"tags,omitempty"` 2453 // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. 2454 Secret *bool `json:"secret,omitempty"` 2455} 2456 2457// MarshalJSON is the custom marshaler for PropertyContract. 2458func (pc PropertyContract) MarshalJSON() ([]byte, error) { 2459 objectMap := make(map[string]interface{}) 2460 if pc.Name != nil { 2461 objectMap["name"] = pc.Name 2462 } 2463 if pc.Value != nil { 2464 objectMap["value"] = pc.Value 2465 } 2466 if pc.Tags != nil { 2467 objectMap["tags"] = pc.Tags 2468 } 2469 if pc.Secret != nil { 2470 objectMap["secret"] = pc.Secret 2471 } 2472 return json.Marshal(objectMap) 2473} 2474 2475// PropertyCreateParameters parameters supplied to the Create Property operation. 2476type PropertyCreateParameters struct { 2477 // Name - Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. 2478 Name *string `json:"name,omitempty"` 2479 // Value - Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. 2480 Value *string `json:"value,omitempty"` 2481 // Tags - Optional tags that when provided can be used to filter the property list. 2482 Tags *[]string `json:"tags,omitempty"` 2483 // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. 2484 Secret *bool `json:"secret,omitempty"` 2485} 2486 2487// PropertyUpdateParameters parameters supplied to the Update Property operation. 2488type PropertyUpdateParameters struct { 2489 // Name - Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. 2490 Name *string `json:"name,omitempty"` 2491 // Value - Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. 2492 Value *string `json:"value,omitempty"` 2493 // Tags - Optional tags that when provided can be used to filter the property list. 2494 Tags *[]string `json:"tags,omitempty"` 2495 // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. 2496 Secret *bool `json:"secret,omitempty"` 2497} 2498 2499// QuotaCounterCollection paged Quota Counter list representation. 2500type QuotaCounterCollection struct { 2501 autorest.Response `json:"-"` 2502 // Value - Quota counter values. 2503 Value *[]QuotaCounterContract `json:"value,omitempty"` 2504 // Count - Total records count number. 2505 Count *int64 `json:"count,omitempty"` 2506 // NextLink - Next page link if any. 2507 NextLink *string `json:"nextLink,omitempty"` 2508} 2509 2510// QuotaCounterContract quota counter details. 2511type QuotaCounterContract struct { 2512 autorest.Response `json:"-"` 2513 // CounterKey - The Key value of the Counter. Must not be empty. 2514 CounterKey *string `json:"counterKey,omitempty"` 2515 // PeriodKey - Identifier of the Period for which the counter was collected. Must not be empty. 2516 PeriodKey *string `json:"periodKey,omitempty"` 2517 // PeriodStartTime - The date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 2518 PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` 2519 // PeriodEndTime - The date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 2520 PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` 2521 // CallsCount - Number of times Counter was called. 2522 CallsCount *int32 `json:"callsCount,omitempty"` 2523 // KbTransferred - Data Transferred in KiloBytes. 2524 KbTransferred *float64 `json:"kbTransferred,omitempty"` 2525} 2526 2527// QuotaCounterValueContract quota counter value details. 2528type QuotaCounterValueContract struct { 2529 // CallsCount - Number of times Counter was called. 2530 CallsCount *int32 `json:"callsCount,omitempty"` 2531 // KbTransferred - Data Transferred in KiloBytes. 2532 KbTransferred *float64 `json:"kbTransferred,omitempty"` 2533} 2534 2535// RegionContract region profile. 2536type RegionContract struct { 2537 // Name - Region name. 2538 Name *string `json:"name,omitempty"` 2539 // IsMasterRegion - whether Region is the master region. 2540 IsMasterRegion *bool `json:"isMasterRegion,omitempty"` 2541} 2542 2543// RegionListResult lists Regions operation response details. 2544type RegionListResult struct { 2545 autorest.Response `json:"-"` 2546 // Value - Lists of Regions. 2547 Value *[]RegionContract `json:"value,omitempty"` 2548} 2549 2550// ReportCollection paged Report records list representation. 2551type ReportCollection struct { 2552 autorest.Response `json:"-"` 2553 // Value - Page values. 2554 Value *[]ReportRecordContract `json:"value,omitempty"` 2555 // Count - Total records count number. 2556 Count *int64 `json:"count,omitempty"` 2557 // NextLink - Next page link if any. 2558 NextLink *string `json:"nextLink,omitempty"` 2559} 2560 2561// ReportCollectionIterator provides access to a complete listing of ReportRecordContract values. 2562type ReportCollectionIterator struct { 2563 i int 2564 page ReportCollectionPage 2565} 2566 2567// NextWithContext advances to the next value. If there was an error making 2568// the request the iterator does not advance and the error is returned. 2569func (iter *ReportCollectionIterator) NextWithContext(ctx context.Context) (err error) { 2570 if tracing.IsEnabled() { 2571 ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionIterator.NextWithContext") 2572 defer func() { 2573 sc := -1 2574 if iter.Response().Response.Response != nil { 2575 sc = iter.Response().Response.Response.StatusCode 2576 } 2577 tracing.EndSpan(ctx, sc, err) 2578 }() 2579 } 2580 iter.i++ 2581 if iter.i < len(iter.page.Values()) { 2582 return nil 2583 } 2584 err = iter.page.NextWithContext(ctx) 2585 if err != nil { 2586 iter.i-- 2587 return err 2588 } 2589 iter.i = 0 2590 return nil 2591} 2592 2593// Next advances to the next value. If there was an error making 2594// the request the iterator does not advance and the error is returned. 2595// Deprecated: Use NextWithContext() instead. 2596func (iter *ReportCollectionIterator) Next() error { 2597 return iter.NextWithContext(context.Background()) 2598} 2599 2600// NotDone returns true if the enumeration should be started or is not yet complete. 2601func (iter ReportCollectionIterator) NotDone() bool { 2602 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2603} 2604 2605// Response returns the raw server response from the last page request. 2606func (iter ReportCollectionIterator) Response() ReportCollection { 2607 return iter.page.Response() 2608} 2609 2610// Value returns the current value or a zero-initialized value if the 2611// iterator has advanced beyond the end of the collection. 2612func (iter ReportCollectionIterator) Value() ReportRecordContract { 2613 if !iter.page.NotDone() { 2614 return ReportRecordContract{} 2615 } 2616 return iter.page.Values()[iter.i] 2617} 2618 2619// Creates a new instance of the ReportCollectionIterator type. 2620func NewReportCollectionIterator(page ReportCollectionPage) ReportCollectionIterator { 2621 return ReportCollectionIterator{page: page} 2622} 2623 2624// IsEmpty returns true if the ListResult contains no values. 2625func (rc ReportCollection) IsEmpty() bool { 2626 return rc.Value == nil || len(*rc.Value) == 0 2627} 2628 2629// hasNextLink returns true if the NextLink is not empty. 2630func (rc ReportCollection) hasNextLink() bool { 2631 return rc.NextLink != nil && len(*rc.NextLink) != 0 2632} 2633 2634// reportCollectionPreparer prepares a request to retrieve the next set of results. 2635// It returns nil if no more results exist. 2636func (rc ReportCollection) reportCollectionPreparer(ctx context.Context) (*http.Request, error) { 2637 if !rc.hasNextLink() { 2638 return nil, nil 2639 } 2640 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2641 autorest.AsJSON(), 2642 autorest.AsGet(), 2643 autorest.WithBaseURL(to.String(rc.NextLink))) 2644} 2645 2646// ReportCollectionPage contains a page of ReportRecordContract values. 2647type ReportCollectionPage struct { 2648 fn func(context.Context, ReportCollection) (ReportCollection, error) 2649 rc ReportCollection 2650} 2651 2652// NextWithContext advances to the next page of values. If there was an error making 2653// the request the page does not advance and the error is returned. 2654func (page *ReportCollectionPage) NextWithContext(ctx context.Context) (err error) { 2655 if tracing.IsEnabled() { 2656 ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionPage.NextWithContext") 2657 defer func() { 2658 sc := -1 2659 if page.Response().Response.Response != nil { 2660 sc = page.Response().Response.Response.StatusCode 2661 } 2662 tracing.EndSpan(ctx, sc, err) 2663 }() 2664 } 2665 for { 2666 next, err := page.fn(ctx, page.rc) 2667 if err != nil { 2668 return err 2669 } 2670 page.rc = next 2671 if !next.hasNextLink() || !next.IsEmpty() { 2672 break 2673 } 2674 } 2675 return nil 2676} 2677 2678// Next advances to the next page of values. If there was an error making 2679// the request the page does not advance and the error is returned. 2680// Deprecated: Use NextWithContext() instead. 2681func (page *ReportCollectionPage) Next() error { 2682 return page.NextWithContext(context.Background()) 2683} 2684 2685// NotDone returns true if the page enumeration should be started or is not yet complete. 2686func (page ReportCollectionPage) NotDone() bool { 2687 return !page.rc.IsEmpty() 2688} 2689 2690// Response returns the raw server response from the last page request. 2691func (page ReportCollectionPage) Response() ReportCollection { 2692 return page.rc 2693} 2694 2695// Values returns the slice of values for the current page or nil if there are no values. 2696func (page ReportCollectionPage) Values() []ReportRecordContract { 2697 if page.rc.IsEmpty() { 2698 return nil 2699 } 2700 return *page.rc.Value 2701} 2702 2703// Creates a new instance of the ReportCollectionPage type. 2704func NewReportCollectionPage(cur ReportCollection, getNextPage func(context.Context, ReportCollection) (ReportCollection, error)) ReportCollectionPage { 2705 return ReportCollectionPage{ 2706 fn: getNextPage, 2707 rc: cur, 2708 } 2709} 2710 2711// ReportRecordContract report data. 2712type ReportRecordContract struct { 2713 // Name - Name depending on report endpoint specifies product, API, operation or developer name. 2714 Name *string `json:"name,omitempty"` 2715 // Timestamp - Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 2716 Timestamp *date.Time `json:"timestamp,omitempty"` 2717 // Interval - Length of aggregation period. 2718 Interval *int64 `json:"interval,omitempty"` 2719 // Country - Country to which this record data is related. 2720 Country *string `json:"country,omitempty"` 2721 // Region - Country region to which this record data is related. 2722 Region *string `json:"region,omitempty"` 2723 // Zip - Zip code to which this record data is related. 2724 Zip *string `json:"zip,omitempty"` 2725 // UserID - READ-ONLY; User identifier path. /users/{userId} 2726 UserID *string `json:"userId,omitempty"` 2727 // ProductID - READ-ONLY; Product identifier path. /products/{productId} 2728 ProductID *string `json:"productId,omitempty"` 2729 // APIID - API identifier path. /apis/{apiId} 2730 APIID *string `json:"apiId,omitempty"` 2731 // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} 2732 OperationID *string `json:"operationId,omitempty"` 2733 // APIRegion - API region identifier. 2734 APIRegion *string `json:"apiRegion,omitempty"` 2735 // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} 2736 SubscriptionID *string `json:"subscriptionId,omitempty"` 2737 // CallCountSuccess - Number of successful calls. 2738 CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` 2739 // CallCountBlocked - Number of calls blocked due to invalid credentials. 2740 CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` 2741 // CallCountFailed - Number of calls failed due to proxy or backend errors. 2742 CallCountFailed *int32 `json:"callCountFailed,omitempty"` 2743 // CallCountOther - Number of other calls. 2744 CallCountOther *int32 `json:"callCountOther,omitempty"` 2745 // CallCountTotal - Total number of calls. 2746 CallCountTotal *int32 `json:"callCountTotal,omitempty"` 2747 // Bandwidth - Bandwidth consumed. 2748 Bandwidth *int64 `json:"bandwidth,omitempty"` 2749 // CacheHitCount - Number of times when content was served from cache policy. 2750 CacheHitCount *int32 `json:"cacheHitCount,omitempty"` 2751 // CacheMissCount - Number of times content was fetched from backend. 2752 CacheMissCount *int32 `json:"cacheMissCount,omitempty"` 2753 // APITimeAvg - Average time it took to process request. 2754 APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` 2755 // APITimeMin - Minimum time it took to process request. 2756 APITimeMin *float64 `json:"apiTimeMin,omitempty"` 2757 // APITimeMax - Maximum time it took to process request. 2758 APITimeMax *float64 `json:"apiTimeMax,omitempty"` 2759 // ServiceTimeAvg - Average time it took to process request on backend. 2760 ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` 2761 // ServiceTimeMin - Minimum time it took to process request on backend. 2762 ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` 2763 // ServiceTimeMax - Maximum time it took to process request on backend. 2764 ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` 2765} 2766 2767// MarshalJSON is the custom marshaler for ReportRecordContract. 2768func (rrc ReportRecordContract) MarshalJSON() ([]byte, error) { 2769 objectMap := make(map[string]interface{}) 2770 if rrc.Name != nil { 2771 objectMap["name"] = rrc.Name 2772 } 2773 if rrc.Timestamp != nil { 2774 objectMap["timestamp"] = rrc.Timestamp 2775 } 2776 if rrc.Interval != nil { 2777 objectMap["interval"] = rrc.Interval 2778 } 2779 if rrc.Country != nil { 2780 objectMap["country"] = rrc.Country 2781 } 2782 if rrc.Region != nil { 2783 objectMap["region"] = rrc.Region 2784 } 2785 if rrc.Zip != nil { 2786 objectMap["zip"] = rrc.Zip 2787 } 2788 if rrc.APIID != nil { 2789 objectMap["apiId"] = rrc.APIID 2790 } 2791 if rrc.OperationID != nil { 2792 objectMap["operationId"] = rrc.OperationID 2793 } 2794 if rrc.APIRegion != nil { 2795 objectMap["apiRegion"] = rrc.APIRegion 2796 } 2797 if rrc.SubscriptionID != nil { 2798 objectMap["subscriptionId"] = rrc.SubscriptionID 2799 } 2800 if rrc.CallCountSuccess != nil { 2801 objectMap["callCountSuccess"] = rrc.CallCountSuccess 2802 } 2803 if rrc.CallCountBlocked != nil { 2804 objectMap["callCountBlocked"] = rrc.CallCountBlocked 2805 } 2806 if rrc.CallCountFailed != nil { 2807 objectMap["callCountFailed"] = rrc.CallCountFailed 2808 } 2809 if rrc.CallCountOther != nil { 2810 objectMap["callCountOther"] = rrc.CallCountOther 2811 } 2812 if rrc.CallCountTotal != nil { 2813 objectMap["callCountTotal"] = rrc.CallCountTotal 2814 } 2815 if rrc.Bandwidth != nil { 2816 objectMap["bandwidth"] = rrc.Bandwidth 2817 } 2818 if rrc.CacheHitCount != nil { 2819 objectMap["cacheHitCount"] = rrc.CacheHitCount 2820 } 2821 if rrc.CacheMissCount != nil { 2822 objectMap["cacheMissCount"] = rrc.CacheMissCount 2823 } 2824 if rrc.APITimeAvg != nil { 2825 objectMap["apiTimeAvg"] = rrc.APITimeAvg 2826 } 2827 if rrc.APITimeMin != nil { 2828 objectMap["apiTimeMin"] = rrc.APITimeMin 2829 } 2830 if rrc.APITimeMax != nil { 2831 objectMap["apiTimeMax"] = rrc.APITimeMax 2832 } 2833 if rrc.ServiceTimeAvg != nil { 2834 objectMap["serviceTimeAvg"] = rrc.ServiceTimeAvg 2835 } 2836 if rrc.ServiceTimeMin != nil { 2837 objectMap["serviceTimeMin"] = rrc.ServiceTimeMin 2838 } 2839 if rrc.ServiceTimeMax != nil { 2840 objectMap["serviceTimeMax"] = rrc.ServiceTimeMax 2841 } 2842 return json.Marshal(objectMap) 2843} 2844 2845// RepresentationContract operation request/response representation details. 2846type RepresentationContract struct { 2847 // ContentType - Specifies a registered or custom content type for this representation, e.g. application/xml. 2848 ContentType *string `json:"contentType,omitempty"` 2849 // Sample - An example of the representation. 2850 Sample *string `json:"sample,omitempty"` 2851} 2852 2853// RequestContract operation request details. 2854type RequestContract struct { 2855 // Description - Operation request description. 2856 Description *string `json:"description,omitempty"` 2857 // QueryParameters - Collection of operation request query parameters. 2858 QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` 2859 // Headers - Collection of operation request headers. 2860 Headers *[]ParameterContract `json:"headers,omitempty"` 2861 // Representations - Collection of operation request representations. 2862 Representations *[]RepresentationContract `json:"representations,omitempty"` 2863} 2864 2865// ResultContract operation response details. 2866type ResultContract struct { 2867 // StatusCode - Operation response HTTP status code. 2868 StatusCode *int32 `json:"statusCode,omitempty"` 2869 // Description - Operation response description. 2870 Description *string `json:"description,omitempty"` 2871 // Representations - Collection of operation response representations. 2872 Representations *[]RepresentationContract `json:"representations,omitempty"` 2873} 2874 2875// SaveConfigurationParameter parameters supplied to the Save Tenant Configuration operation. 2876type SaveConfigurationParameter struct { 2877 // Branch - The name of the Git branch in which to commit the current configuration snapshot. 2878 Branch *string `json:"branch,omitempty"` 2879 // Force - The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. 2880 Force *bool `json:"force,omitempty"` 2881} 2882 2883// ServiceBackupRestoreParameters parameters supplied to the Backup/Restore of an API Management service 2884// operation. 2885type ServiceBackupRestoreParameters struct { 2886 // StorageAccount - Azure Cloud Storage account (used to place/retrieve the backup) name. 2887 StorageAccount *string `json:"storageAccount,omitempty"` 2888 // AccessKey - Azure Cloud Storage account (used to place/retrieve the backup) access key. 2889 AccessKey *string `json:"accessKey,omitempty"` 2890 // ContainerName - Azure Cloud Storage blob container name used to place/retrieve the backup. 2891 ContainerName *string `json:"containerName,omitempty"` 2892 // BackupName - The name of the backup file to create. 2893 BackupName *string `json:"backupName,omitempty"` 2894} 2895 2896// ServiceBaseParameters parameters supplied to the Update API Management service operation. 2897type ServiceBaseParameters struct { 2898 // Tags - API Management service tags. A maximum of 10 tags can be provided for a resource, and each tag must have a key no greater than 128 characters (and a value no greater than 256 characters). 2899 Tags map[string]*string `json:"tags"` 2900 // ServiceProperties - Properties of the API Management service. 2901 *ServiceProperties `json:"properties,omitempty"` 2902 // Sku - SKU properties of the API Management service. 2903 Sku *ServiceSkuProperties `json:"sku,omitempty"` 2904} 2905 2906// MarshalJSON is the custom marshaler for ServiceBaseParameters. 2907func (sbp ServiceBaseParameters) MarshalJSON() ([]byte, error) { 2908 objectMap := make(map[string]interface{}) 2909 if sbp.Tags != nil { 2910 objectMap["tags"] = sbp.Tags 2911 } 2912 if sbp.ServiceProperties != nil { 2913 objectMap["properties"] = sbp.ServiceProperties 2914 } 2915 if sbp.Sku != nil { 2916 objectMap["sku"] = sbp.Sku 2917 } 2918 return json.Marshal(objectMap) 2919} 2920 2921// UnmarshalJSON is the custom unmarshaler for ServiceBaseParameters struct. 2922func (sbp *ServiceBaseParameters) UnmarshalJSON(body []byte) error { 2923 var m map[string]*json.RawMessage 2924 err := json.Unmarshal(body, &m) 2925 if err != nil { 2926 return err 2927 } 2928 for k, v := range m { 2929 switch k { 2930 case "tags": 2931 if v != nil { 2932 var tags map[string]*string 2933 err = json.Unmarshal(*v, &tags) 2934 if err != nil { 2935 return err 2936 } 2937 sbp.Tags = tags 2938 } 2939 case "properties": 2940 if v != nil { 2941 var serviceProperties ServiceProperties 2942 err = json.Unmarshal(*v, &serviceProperties) 2943 if err != nil { 2944 return err 2945 } 2946 sbp.ServiceProperties = &serviceProperties 2947 } 2948 case "sku": 2949 if v != nil { 2950 var sku ServiceSkuProperties 2951 err = json.Unmarshal(*v, &sku) 2952 if err != nil { 2953 return err 2954 } 2955 sbp.Sku = &sku 2956 } 2957 } 2958 } 2959 2960 return nil 2961} 2962 2963// ServiceCheckNameAvailabilityParameters parameters supplied to the CheckNameAvailability operation. 2964type ServiceCheckNameAvailabilityParameters struct { 2965 // Name - The name to check for availability. 2966 Name *string `json:"name,omitempty"` 2967} 2968 2969// ServiceGetSsoTokenResult the response of the GetSsoToken operation. 2970type ServiceGetSsoTokenResult struct { 2971 autorest.Response `json:"-"` 2972 // RedirectURI - Redirect URL containing the SSO token. 2973 RedirectURI *string `json:"redirect_uri,omitempty"` 2974} 2975 2976// ServiceListResult the response of the List API Management services operation. 2977type ServiceListResult struct { 2978 autorest.Response `json:"-"` 2979 // Value - Result of the List API Management services operation. 2980 Value *[]ServiceResource `json:"value,omitempty"` 2981 // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of API Management services. 2982 NextLink *string `json:"nextLink,omitempty"` 2983} 2984 2985// ServiceListResultIterator provides access to a complete listing of ServiceResource values. 2986type ServiceListResultIterator struct { 2987 i int 2988 page ServiceListResultPage 2989} 2990 2991// NextWithContext advances to the next value. If there was an error making 2992// the request the iterator does not advance and the error is returned. 2993func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { 2994 if tracing.IsEnabled() { 2995 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext") 2996 defer func() { 2997 sc := -1 2998 if iter.Response().Response.Response != nil { 2999 sc = iter.Response().Response.Response.StatusCode 3000 } 3001 tracing.EndSpan(ctx, sc, err) 3002 }() 3003 } 3004 iter.i++ 3005 if iter.i < len(iter.page.Values()) { 3006 return nil 3007 } 3008 err = iter.page.NextWithContext(ctx) 3009 if err != nil { 3010 iter.i-- 3011 return err 3012 } 3013 iter.i = 0 3014 return nil 3015} 3016 3017// Next advances to the next value. If there was an error making 3018// the request the iterator does not advance and the error is returned. 3019// Deprecated: Use NextWithContext() instead. 3020func (iter *ServiceListResultIterator) Next() error { 3021 return iter.NextWithContext(context.Background()) 3022} 3023 3024// NotDone returns true if the enumeration should be started or is not yet complete. 3025func (iter ServiceListResultIterator) NotDone() bool { 3026 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3027} 3028 3029// Response returns the raw server response from the last page request. 3030func (iter ServiceListResultIterator) Response() ServiceListResult { 3031 return iter.page.Response() 3032} 3033 3034// Value returns the current value or a zero-initialized value if the 3035// iterator has advanced beyond the end of the collection. 3036func (iter ServiceListResultIterator) Value() ServiceResource { 3037 if !iter.page.NotDone() { 3038 return ServiceResource{} 3039 } 3040 return iter.page.Values()[iter.i] 3041} 3042 3043// Creates a new instance of the ServiceListResultIterator type. 3044func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { 3045 return ServiceListResultIterator{page: page} 3046} 3047 3048// IsEmpty returns true if the ListResult contains no values. 3049func (slr ServiceListResult) IsEmpty() bool { 3050 return slr.Value == nil || len(*slr.Value) == 0 3051} 3052 3053// hasNextLink returns true if the NextLink is not empty. 3054func (slr ServiceListResult) hasNextLink() bool { 3055 return slr.NextLink != nil && len(*slr.NextLink) != 0 3056} 3057 3058// serviceListResultPreparer prepares a request to retrieve the next set of results. 3059// It returns nil if no more results exist. 3060func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) { 3061 if !slr.hasNextLink() { 3062 return nil, nil 3063 } 3064 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3065 autorest.AsJSON(), 3066 autorest.AsGet(), 3067 autorest.WithBaseURL(to.String(slr.NextLink))) 3068} 3069 3070// ServiceListResultPage contains a page of ServiceResource values. 3071type ServiceListResultPage struct { 3072 fn func(context.Context, ServiceListResult) (ServiceListResult, error) 3073 slr ServiceListResult 3074} 3075 3076// NextWithContext advances to the next page of values. If there was an error making 3077// the request the page does not advance and the error is returned. 3078func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { 3079 if tracing.IsEnabled() { 3080 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext") 3081 defer func() { 3082 sc := -1 3083 if page.Response().Response.Response != nil { 3084 sc = page.Response().Response.Response.StatusCode 3085 } 3086 tracing.EndSpan(ctx, sc, err) 3087 }() 3088 } 3089 for { 3090 next, err := page.fn(ctx, page.slr) 3091 if err != nil { 3092 return err 3093 } 3094 page.slr = next 3095 if !next.hasNextLink() || !next.IsEmpty() { 3096 break 3097 } 3098 } 3099 return nil 3100} 3101 3102// Next advances to the next page of values. If there was an error making 3103// the request the page does not advance and the error is returned. 3104// Deprecated: Use NextWithContext() instead. 3105func (page *ServiceListResultPage) Next() error { 3106 return page.NextWithContext(context.Background()) 3107} 3108 3109// NotDone returns true if the page enumeration should be started or is not yet complete. 3110func (page ServiceListResultPage) NotDone() bool { 3111 return !page.slr.IsEmpty() 3112} 3113 3114// Response returns the raw server response from the last page request. 3115func (page ServiceListResultPage) Response() ServiceListResult { 3116 return page.slr 3117} 3118 3119// Values returns the slice of values for the current page or nil if there are no values. 3120func (page ServiceListResultPage) Values() []ServiceResource { 3121 if page.slr.IsEmpty() { 3122 return nil 3123 } 3124 return *page.slr.Value 3125} 3126 3127// Creates a new instance of the ServiceListResultPage type. 3128func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { 3129 return ServiceListResultPage{ 3130 fn: getNextPage, 3131 slr: cur, 3132 } 3133} 3134 3135// ServiceManageDeploymentsParameters parameters supplied to the ManageDeployments operation. 3136type ServiceManageDeploymentsParameters struct { 3137 // Location - Location of the API Management service Azure data center. 3138 Location *string `json:"location,omitempty"` 3139 // SkuType - SKU type of the API Management service. Possible values include: 'Developer', 'Standard', 'Premium' 3140 SkuType SkuType `json:"skuType,omitempty"` 3141 // SkuUnitCount - SKU Unit count of the API Management service. Default value is 1. 3142 SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` 3143 // AdditionalLocations - Additional data center locations for the API Management service. 3144 AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` 3145 // VpnConfiguration - Virtual network configuration. 3146 VpnConfiguration *VirtualNetworkConfiguration `json:"vpnConfiguration,omitempty"` 3147 // VpnType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that the API Management service deployment is set up inside a Virtual Network having an Intranet Facing Endpoint only. When vpnConfiguration is specified, vpnType must be specified. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' 3148 VpnType VirtualNetworkType `json:"vpnType,omitempty"` 3149} 3150 3151// ServiceNameAvailabilityResult response of the CheckNameAvailability operation. 3152type ServiceNameAvailabilityResult struct { 3153 autorest.Response `json:"-"` 3154 // NameAvailable - True if the name is available and can be used to create a new API Management service; otherwise false. 3155 NameAvailable *bool `json:"nameAvailable,omitempty"` 3156 // Message - If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that <resourceName> is already in use, and direct them to select a different name. 3157 Message *string `json:"message,omitempty"` 3158 // Reason - Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Valid', 'Invalid', 'AlreadyExists' 3159 Reason NameAvailabilityReason `json:"reason,omitempty"` 3160} 3161 3162// ServiceProperties properties of an API Management service resource description. 3163type ServiceProperties struct { 3164 // PublisherEmail - Publisher email. 3165 PublisherEmail *string `json:"publisherEmail,omitempty"` 3166 // PublisherName - Publisher name. 3167 PublisherName *string `json:"publisherName,omitempty"` 3168 // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. 3169 ProvisioningState *string `json:"provisioningState,omitempty"` 3170 // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. 3171 TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` 3172 // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3173 CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` 3174 // RuntimeURL - READ-ONLY; Proxy endpoint URL of the API Management service. 3175 RuntimeURL *string `json:"runtimeUrl,omitempty"` 3176 // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. 3177 PortalURL *string `json:"portalUrl,omitempty"` 3178 // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. 3179 ManagementAPIURL *string `json:"managementApiUrl,omitempty"` 3180 // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. 3181 ScmURL *string `json:"scmUrl,omitempty"` 3182 // AddresserEmail - Addresser email. 3183 AddresserEmail *string `json:"addresserEmail,omitempty"` 3184 // HostnameConfigurations - Custom hostname configuration of the API Management service. 3185 HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` 3186 // StaticIPs - READ-ONLY; Static IP addresses of the API Management service virtual machines. Available only for Standard and Premium SKU. 3187 StaticIPs *[]string `json:"staticIPs,omitempty"` 3188 // Vpnconfiguration - Virtual network configuration of the API Management service. 3189 Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` 3190 // AdditionalLocations - Additional datacenter locations of the API Management service. 3191 AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` 3192 // CustomProperties - Custom properties of the API Management service, like disabling TLS 1.0. 3193 CustomProperties map[string]*string `json:"customProperties"` 3194 // VpnType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' 3195 VpnType VirtualNetworkType `json:"vpnType,omitempty"` 3196} 3197 3198// MarshalJSON is the custom marshaler for ServiceProperties. 3199func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 3200 objectMap := make(map[string]interface{}) 3201 if sp.PublisherEmail != nil { 3202 objectMap["publisherEmail"] = sp.PublisherEmail 3203 } 3204 if sp.PublisherName != nil { 3205 objectMap["publisherName"] = sp.PublisherName 3206 } 3207 if sp.AddresserEmail != nil { 3208 objectMap["addresserEmail"] = sp.AddresserEmail 3209 } 3210 if sp.HostnameConfigurations != nil { 3211 objectMap["hostnameConfigurations"] = sp.HostnameConfigurations 3212 } 3213 if sp.Vpnconfiguration != nil { 3214 objectMap["vpnconfiguration"] = sp.Vpnconfiguration 3215 } 3216 if sp.AdditionalLocations != nil { 3217 objectMap["additionalLocations"] = sp.AdditionalLocations 3218 } 3219 if sp.CustomProperties != nil { 3220 objectMap["customProperties"] = sp.CustomProperties 3221 } 3222 if sp.VpnType != "" { 3223 objectMap["vpnType"] = sp.VpnType 3224 } 3225 return json.Marshal(objectMap) 3226} 3227 3228// ServiceResource description of an API Management service resource. 3229type ServiceResource struct { 3230 autorest.Response `json:"-"` 3231 // ID - READ-ONLY; The ID of the created API Management service. 3232 ID *string `json:"id,omitempty"` 3233 // Location - Datacenter location of the API Management service. 3234 Location *string `json:"location,omitempty"` 3235 // Name - READ-ONLY; Name of the API Management service. 3236 Name *string `json:"name,omitempty"` 3237 // Type - READ-ONLY; Resource type of the API Management service. 3238 Type *string `json:"type,omitempty"` 3239 // Etag - ETag of the resource. 3240 Etag *string `json:"etag,omitempty"` 3241 // Tags - API Management service tags. A maximum of 10 tags can be provided for a resource, and each tag must have a key no greater than 128 characters (and a value no greater than 256 characters). 3242 Tags map[string]*string `json:"tags"` 3243 // ServiceProperties - Properties of the API Management service. 3244 *ServiceProperties `json:"properties,omitempty"` 3245 // Sku - SKU properties of the API Management service. 3246 Sku *ServiceSkuProperties `json:"sku,omitempty"` 3247} 3248 3249// MarshalJSON is the custom marshaler for ServiceResource. 3250func (sr ServiceResource) MarshalJSON() ([]byte, error) { 3251 objectMap := make(map[string]interface{}) 3252 if sr.Location != nil { 3253 objectMap["location"] = sr.Location 3254 } 3255 if sr.Etag != nil { 3256 objectMap["etag"] = sr.Etag 3257 } 3258 if sr.Tags != nil { 3259 objectMap["tags"] = sr.Tags 3260 } 3261 if sr.ServiceProperties != nil { 3262 objectMap["properties"] = sr.ServiceProperties 3263 } 3264 if sr.Sku != nil { 3265 objectMap["sku"] = sr.Sku 3266 } 3267 return json.Marshal(objectMap) 3268} 3269 3270// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. 3271func (sr *ServiceResource) UnmarshalJSON(body []byte) error { 3272 var m map[string]*json.RawMessage 3273 err := json.Unmarshal(body, &m) 3274 if err != nil { 3275 return err 3276 } 3277 for k, v := range m { 3278 switch k { 3279 case "id": 3280 if v != nil { 3281 var ID string 3282 err = json.Unmarshal(*v, &ID) 3283 if err != nil { 3284 return err 3285 } 3286 sr.ID = &ID 3287 } 3288 case "location": 3289 if v != nil { 3290 var location string 3291 err = json.Unmarshal(*v, &location) 3292 if err != nil { 3293 return err 3294 } 3295 sr.Location = &location 3296 } 3297 case "name": 3298 if v != nil { 3299 var name string 3300 err = json.Unmarshal(*v, &name) 3301 if err != nil { 3302 return err 3303 } 3304 sr.Name = &name 3305 } 3306 case "type": 3307 if v != nil { 3308 var typeVar string 3309 err = json.Unmarshal(*v, &typeVar) 3310 if err != nil { 3311 return err 3312 } 3313 sr.Type = &typeVar 3314 } 3315 case "etag": 3316 if v != nil { 3317 var etag string 3318 err = json.Unmarshal(*v, &etag) 3319 if err != nil { 3320 return err 3321 } 3322 sr.Etag = &etag 3323 } 3324 case "tags": 3325 if v != nil { 3326 var tags map[string]*string 3327 err = json.Unmarshal(*v, &tags) 3328 if err != nil { 3329 return err 3330 } 3331 sr.Tags = tags 3332 } 3333 case "properties": 3334 if v != nil { 3335 var serviceProperties ServiceProperties 3336 err = json.Unmarshal(*v, &serviceProperties) 3337 if err != nil { 3338 return err 3339 } 3340 sr.ServiceProperties = &serviceProperties 3341 } 3342 case "sku": 3343 if v != nil { 3344 var sku ServiceSkuProperties 3345 err = json.Unmarshal(*v, &sku) 3346 if err != nil { 3347 return err 3348 } 3349 sr.Sku = &sku 3350 } 3351 } 3352 } 3353 3354 return nil 3355} 3356 3357// ServicesBackupFuture an abstraction for monitoring and retrieving the results of a long-running 3358// operation. 3359type ServicesBackupFuture struct { 3360 azure.FutureAPI 3361 // Result returns the result of the asynchronous operation. 3362 // If the operation has not completed it will return an error. 3363 Result func(ServicesClient) (ServiceResource, error) 3364} 3365 3366// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3367func (future *ServicesBackupFuture) UnmarshalJSON(body []byte) error { 3368 var azFuture azure.Future 3369 if err := json.Unmarshal(body, &azFuture); err != nil { 3370 return err 3371 } 3372 future.FutureAPI = &azFuture 3373 future.Result = future.result 3374 return nil 3375} 3376 3377// result is the default implementation for ServicesBackupFuture.Result. 3378func (future *ServicesBackupFuture) result(client ServicesClient) (sr ServiceResource, err error) { 3379 var done bool 3380 done, err = future.DoneWithContext(context.Background(), client) 3381 if err != nil { 3382 err = autorest.NewErrorWithError(err, "apimanagement.ServicesBackupFuture", "Result", future.Response(), "Polling failure") 3383 return 3384 } 3385 if !done { 3386 sr.Response.Response = future.Response() 3387 err = azure.NewAsyncOpIncompleteError("apimanagement.ServicesBackupFuture") 3388 return 3389 } 3390 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3391 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 3392 sr, err = client.BackupResponder(sr.Response.Response) 3393 if err != nil { 3394 err = autorest.NewErrorWithError(err, "apimanagement.ServicesBackupFuture", "Result", sr.Response.Response, "Failure responding to request") 3395 } 3396 } 3397 return 3398} 3399 3400// ServiceSkuProperties API Management service resource SKU properties. 3401type ServiceSkuProperties struct { 3402 // Name - Name of the Sku. Possible values include: 'Developer', 'Standard', 'Premium' 3403 Name SkuType `json:"name,omitempty"` 3404 // Capacity - Capacity of the SKU (number of deployed units of the SKU). The default value is 1. 3405 Capacity *int32 `json:"capacity,omitempty"` 3406} 3407 3408// ServicesManageDeploymentsFuture an abstraction for monitoring and retrieving the results of a 3409// long-running operation. 3410type ServicesManageDeploymentsFuture struct { 3411 azure.FutureAPI 3412 // Result returns the result of the asynchronous operation. 3413 // If the operation has not completed it will return an error. 3414 Result func(ServicesClient) (ServiceResource, error) 3415} 3416 3417// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3418func (future *ServicesManageDeploymentsFuture) UnmarshalJSON(body []byte) error { 3419 var azFuture azure.Future 3420 if err := json.Unmarshal(body, &azFuture); err != nil { 3421 return err 3422 } 3423 future.FutureAPI = &azFuture 3424 future.Result = future.result 3425 return nil 3426} 3427 3428// result is the default implementation for ServicesManageDeploymentsFuture.Result. 3429func (future *ServicesManageDeploymentsFuture) result(client ServicesClient) (sr ServiceResource, err error) { 3430 var done bool 3431 done, err = future.DoneWithContext(context.Background(), client) 3432 if err != nil { 3433 err = autorest.NewErrorWithError(err, "apimanagement.ServicesManageDeploymentsFuture", "Result", future.Response(), "Polling failure") 3434 return 3435 } 3436 if !done { 3437 sr.Response.Response = future.Response() 3438 err = azure.NewAsyncOpIncompleteError("apimanagement.ServicesManageDeploymentsFuture") 3439 return 3440 } 3441 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3442 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 3443 sr, err = client.ManageDeploymentsResponder(sr.Response.Response) 3444 if err != nil { 3445 err = autorest.NewErrorWithError(err, "apimanagement.ServicesManageDeploymentsFuture", "Result", sr.Response.Response, "Failure responding to request") 3446 } 3447 } 3448 return 3449} 3450 3451// ServicesRestoreFuture an abstraction for monitoring and retrieving the results of a long-running 3452// operation. 3453type ServicesRestoreFuture struct { 3454 azure.FutureAPI 3455 // Result returns the result of the asynchronous operation. 3456 // If the operation has not completed it will return an error. 3457 Result func(ServicesClient) (ServiceResource, error) 3458} 3459 3460// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3461func (future *ServicesRestoreFuture) UnmarshalJSON(body []byte) error { 3462 var azFuture azure.Future 3463 if err := json.Unmarshal(body, &azFuture); err != nil { 3464 return err 3465 } 3466 future.FutureAPI = &azFuture 3467 future.Result = future.result 3468 return nil 3469} 3470 3471// result is the default implementation for ServicesRestoreFuture.Result. 3472func (future *ServicesRestoreFuture) result(client ServicesClient) (sr ServiceResource, err error) { 3473 var done bool 3474 done, err = future.DoneWithContext(context.Background(), client) 3475 if err != nil { 3476 err = autorest.NewErrorWithError(err, "apimanagement.ServicesRestoreFuture", "Result", future.Response(), "Polling failure") 3477 return 3478 } 3479 if !done { 3480 sr.Response.Response = future.Response() 3481 err = azure.NewAsyncOpIncompleteError("apimanagement.ServicesRestoreFuture") 3482 return 3483 } 3484 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3485 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 3486 sr, err = client.RestoreResponder(sr.Response.Response) 3487 if err != nil { 3488 err = autorest.NewErrorWithError(err, "apimanagement.ServicesRestoreFuture", "Result", sr.Response.Response, "Failure responding to request") 3489 } 3490 } 3491 return 3492} 3493 3494// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 3495// operation. 3496type ServicesUpdateFuture struct { 3497 azure.FutureAPI 3498 // Result returns the result of the asynchronous operation. 3499 // If the operation has not completed it will return an error. 3500 Result func(ServicesClient) (ServiceResource, error) 3501} 3502 3503// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3504func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { 3505 var azFuture azure.Future 3506 if err := json.Unmarshal(body, &azFuture); err != nil { 3507 return err 3508 } 3509 future.FutureAPI = &azFuture 3510 future.Result = future.result 3511 return nil 3512} 3513 3514// result is the default implementation for ServicesUpdateFuture.Result. 3515func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { 3516 var done bool 3517 done, err = future.DoneWithContext(context.Background(), client) 3518 if err != nil { 3519 err = autorest.NewErrorWithError(err, "apimanagement.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") 3520 return 3521 } 3522 if !done { 3523 sr.Response.Response = future.Response() 3524 err = azure.NewAsyncOpIncompleteError("apimanagement.ServicesUpdateFuture") 3525 return 3526 } 3527 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3528 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 3529 sr, err = client.UpdateResponder(sr.Response.Response) 3530 if err != nil { 3531 err = autorest.NewErrorWithError(err, "apimanagement.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") 3532 } 3533 } 3534 return 3535} 3536 3537// ServicesUpdateHostnameFuture an abstraction for monitoring and retrieving the results of a long-running 3538// operation. 3539type ServicesUpdateHostnameFuture struct { 3540 azure.FutureAPI 3541 // Result returns the result of the asynchronous operation. 3542 // If the operation has not completed it will return an error. 3543 Result func(ServicesClient) (ServiceResource, error) 3544} 3545 3546// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3547func (future *ServicesUpdateHostnameFuture) UnmarshalJSON(body []byte) error { 3548 var azFuture azure.Future 3549 if err := json.Unmarshal(body, &azFuture); err != nil { 3550 return err 3551 } 3552 future.FutureAPI = &azFuture 3553 future.Result = future.result 3554 return nil 3555} 3556 3557// result is the default implementation for ServicesUpdateHostnameFuture.Result. 3558func (future *ServicesUpdateHostnameFuture) result(client ServicesClient) (sr ServiceResource, err error) { 3559 var done bool 3560 done, err = future.DoneWithContext(context.Background(), client) 3561 if err != nil { 3562 err = autorest.NewErrorWithError(err, "apimanagement.ServicesUpdateHostnameFuture", "Result", future.Response(), "Polling failure") 3563 return 3564 } 3565 if !done { 3566 sr.Response.Response = future.Response() 3567 err = azure.NewAsyncOpIncompleteError("apimanagement.ServicesUpdateHostnameFuture") 3568 return 3569 } 3570 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3571 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 3572 sr, err = client.UpdateHostnameResponder(sr.Response.Response) 3573 if err != nil { 3574 err = autorest.NewErrorWithError(err, "apimanagement.ServicesUpdateHostnameFuture", "Result", sr.Response.Response, "Failure responding to request") 3575 } 3576 } 3577 return 3578} 3579 3580// ServiceUpdateHostnameParameters parameters supplied to the UpdateHostname operation. 3581type ServiceUpdateHostnameParameters struct { 3582 // Update - Hostnames to create or update. 3583 Update *[]HostnameConfiguration `json:"update,omitempty"` 3584 // Delete - Hostnames types to delete. 3585 Delete *[]HostnameType `json:"delete,omitempty"` 3586} 3587 3588// ServiceUploadCertificateParameters parameters supplied to the Upload SSL certificate for an API 3589// Management service operation. 3590type ServiceUploadCertificateParameters struct { 3591 // Type - Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm' 3592 Type HostnameType `json:"type,omitempty"` 3593 // Certificate - Base64 Encoded certificate. 3594 Certificate *string `json:"certificate,omitempty"` 3595 // CertificatePassword - Certificate password. 3596 CertificatePassword *string `json:"certificate_password,omitempty"` 3597} 3598 3599// SetObject ... 3600type SetObject struct { 3601 autorest.Response `json:"-"` 3602 Value interface{} `json:"value,omitempty"` 3603} 3604 3605// SubscriptionCollection paged Subscriptions list representation. 3606type SubscriptionCollection struct { 3607 autorest.Response `json:"-"` 3608 // Value - Page values. 3609 Value *[]SubscriptionContract `json:"value,omitempty"` 3610 // Count - Total records count number. 3611 Count *int64 `json:"count,omitempty"` 3612 // NextLink - Next page link if any. 3613 NextLink *string `json:"nextLink,omitempty"` 3614} 3615 3616// SubscriptionCollectionIterator provides access to a complete listing of SubscriptionContract values. 3617type SubscriptionCollectionIterator struct { 3618 i int 3619 page SubscriptionCollectionPage 3620} 3621 3622// NextWithContext advances to the next value. If there was an error making 3623// the request the iterator does not advance and the error is returned. 3624func (iter *SubscriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { 3625 if tracing.IsEnabled() { 3626 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionIterator.NextWithContext") 3627 defer func() { 3628 sc := -1 3629 if iter.Response().Response.Response != nil { 3630 sc = iter.Response().Response.Response.StatusCode 3631 } 3632 tracing.EndSpan(ctx, sc, err) 3633 }() 3634 } 3635 iter.i++ 3636 if iter.i < len(iter.page.Values()) { 3637 return nil 3638 } 3639 err = iter.page.NextWithContext(ctx) 3640 if err != nil { 3641 iter.i-- 3642 return err 3643 } 3644 iter.i = 0 3645 return nil 3646} 3647 3648// Next advances to the next value. If there was an error making 3649// the request the iterator does not advance and the error is returned. 3650// Deprecated: Use NextWithContext() instead. 3651func (iter *SubscriptionCollectionIterator) Next() error { 3652 return iter.NextWithContext(context.Background()) 3653} 3654 3655// NotDone returns true if the enumeration should be started or is not yet complete. 3656func (iter SubscriptionCollectionIterator) NotDone() bool { 3657 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3658} 3659 3660// Response returns the raw server response from the last page request. 3661func (iter SubscriptionCollectionIterator) Response() SubscriptionCollection { 3662 return iter.page.Response() 3663} 3664 3665// Value returns the current value or a zero-initialized value if the 3666// iterator has advanced beyond the end of the collection. 3667func (iter SubscriptionCollectionIterator) Value() SubscriptionContract { 3668 if !iter.page.NotDone() { 3669 return SubscriptionContract{} 3670 } 3671 return iter.page.Values()[iter.i] 3672} 3673 3674// Creates a new instance of the SubscriptionCollectionIterator type. 3675func NewSubscriptionCollectionIterator(page SubscriptionCollectionPage) SubscriptionCollectionIterator { 3676 return SubscriptionCollectionIterator{page: page} 3677} 3678 3679// IsEmpty returns true if the ListResult contains no values. 3680func (sc SubscriptionCollection) IsEmpty() bool { 3681 return sc.Value == nil || len(*sc.Value) == 0 3682} 3683 3684// hasNextLink returns true if the NextLink is not empty. 3685func (sc SubscriptionCollection) hasNextLink() bool { 3686 return sc.NextLink != nil && len(*sc.NextLink) != 0 3687} 3688 3689// subscriptionCollectionPreparer prepares a request to retrieve the next set of results. 3690// It returns nil if no more results exist. 3691func (sc SubscriptionCollection) subscriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { 3692 if !sc.hasNextLink() { 3693 return nil, nil 3694 } 3695 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3696 autorest.AsJSON(), 3697 autorest.AsGet(), 3698 autorest.WithBaseURL(to.String(sc.NextLink))) 3699} 3700 3701// SubscriptionCollectionPage contains a page of SubscriptionContract values. 3702type SubscriptionCollectionPage struct { 3703 fn func(context.Context, SubscriptionCollection) (SubscriptionCollection, error) 3704 sc SubscriptionCollection 3705} 3706 3707// NextWithContext advances to the next page of values. If there was an error making 3708// the request the page does not advance and the error is returned. 3709func (page *SubscriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { 3710 if tracing.IsEnabled() { 3711 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionPage.NextWithContext") 3712 defer func() { 3713 sc := -1 3714 if page.Response().Response.Response != nil { 3715 sc = page.Response().Response.Response.StatusCode 3716 } 3717 tracing.EndSpan(ctx, sc, err) 3718 }() 3719 } 3720 for { 3721 next, err := page.fn(ctx, page.sc) 3722 if err != nil { 3723 return err 3724 } 3725 page.sc = next 3726 if !next.hasNextLink() || !next.IsEmpty() { 3727 break 3728 } 3729 } 3730 return nil 3731} 3732 3733// Next advances to the next page of values. If there was an error making 3734// the request the page does not advance and the error is returned. 3735// Deprecated: Use NextWithContext() instead. 3736func (page *SubscriptionCollectionPage) Next() error { 3737 return page.NextWithContext(context.Background()) 3738} 3739 3740// NotDone returns true if the page enumeration should be started or is not yet complete. 3741func (page SubscriptionCollectionPage) NotDone() bool { 3742 return !page.sc.IsEmpty() 3743} 3744 3745// Response returns the raw server response from the last page request. 3746func (page SubscriptionCollectionPage) Response() SubscriptionCollection { 3747 return page.sc 3748} 3749 3750// Values returns the slice of values for the current page or nil if there are no values. 3751func (page SubscriptionCollectionPage) Values() []SubscriptionContract { 3752 if page.sc.IsEmpty() { 3753 return nil 3754 } 3755 return *page.sc.Value 3756} 3757 3758// Creates a new instance of the SubscriptionCollectionPage type. 3759func NewSubscriptionCollectionPage(cur SubscriptionCollection, getNextPage func(context.Context, SubscriptionCollection) (SubscriptionCollection, error)) SubscriptionCollectionPage { 3760 return SubscriptionCollectionPage{ 3761 fn: getNextPage, 3762 sc: cur, 3763 } 3764} 3765 3766// SubscriptionContract subscription details. 3767type SubscriptionContract struct { 3768 autorest.Response `json:"-"` 3769 // ID - READ-ONLY; Uniquely identifies the subscription within the current API Management service instance. The value is a valid relative URL in the format of /subscriptions/{sid} where {sid} is a subscription identifier. 3770 ID *string `json:"id,omitempty"` 3771 // UserID - The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{uid} where {uid} is a user identifier. 3772 UserID *string `json:"userId,omitempty"` 3773 // ProductID - The product resource identifier of the subscribed product. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier. 3774 ProductID *string `json:"productId,omitempty"` 3775 // Name - The name of the subscription, or null if the subscription has no name. 3776 Name *string `json:"name,omitempty"` 3777 // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' 3778 State SubscriptionStateContract `json:"state,omitempty"` 3779 // CreatedDate - READ-ONLY; Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3780 CreatedDate *date.Time `json:"createdDate,omitempty"` 3781 // StartDate - Subscription activation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3782 StartDate *date.Time `json:"startDate,omitempty"` 3783 // ExpirationDate - Subscription expiration date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3784 ExpirationDate *date.Time `json:"expirationDate,omitempty"` 3785 // EndDate - Date when subscription was cancelled or expired. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3786 EndDate *date.Time `json:"endDate,omitempty"` 3787 // NotificationDate - Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3788 NotificationDate *date.Time `json:"notificationDate,omitempty"` 3789 // PrimaryKey - Subscription primary key. 3790 PrimaryKey *string `json:"primaryKey,omitempty"` 3791 // SecondaryKey - Subscription secondary key. 3792 SecondaryKey *string `json:"secondaryKey,omitempty"` 3793 // StateComment - Optional subscription comment added by an administrator. 3794 StateComment *string `json:"stateComment,omitempty"` 3795} 3796 3797// MarshalJSON is the custom marshaler for SubscriptionContract. 3798func (sc SubscriptionContract) MarshalJSON() ([]byte, error) { 3799 objectMap := make(map[string]interface{}) 3800 if sc.UserID != nil { 3801 objectMap["userId"] = sc.UserID 3802 } 3803 if sc.ProductID != nil { 3804 objectMap["productId"] = sc.ProductID 3805 } 3806 if sc.Name != nil { 3807 objectMap["name"] = sc.Name 3808 } 3809 if sc.State != "" { 3810 objectMap["state"] = sc.State 3811 } 3812 if sc.StartDate != nil { 3813 objectMap["startDate"] = sc.StartDate 3814 } 3815 if sc.ExpirationDate != nil { 3816 objectMap["expirationDate"] = sc.ExpirationDate 3817 } 3818 if sc.EndDate != nil { 3819 objectMap["endDate"] = sc.EndDate 3820 } 3821 if sc.NotificationDate != nil { 3822 objectMap["notificationDate"] = sc.NotificationDate 3823 } 3824 if sc.PrimaryKey != nil { 3825 objectMap["primaryKey"] = sc.PrimaryKey 3826 } 3827 if sc.SecondaryKey != nil { 3828 objectMap["secondaryKey"] = sc.SecondaryKey 3829 } 3830 if sc.StateComment != nil { 3831 objectMap["stateComment"] = sc.StateComment 3832 } 3833 return json.Marshal(objectMap) 3834} 3835 3836// SubscriptionCreateParameters parameters supplied to the Create subscription operation. 3837type SubscriptionCreateParameters struct { 3838 // UserID - User (user id path) for whom subscription is being created in form /users/{uid} 3839 UserID *string `json:"userId,omitempty"` 3840 // ProductID - Product (product id path) for which subscription is being created in form /products/{productId} 3841 ProductID *string `json:"productId,omitempty"` 3842 // Name - Subscription name. 3843 Name *string `json:"name,omitempty"` 3844 // PrimaryKey - Primary subscription key. If not specified during request key will be generated automatically. 3845 PrimaryKey *string `json:"primaryKey,omitempty"` 3846 // SecondaryKey - Secondary subscription key. If not specified during request key will be generated automatically. 3847 SecondaryKey *string `json:"secondaryKey,omitempty"` 3848 // State - Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' 3849 State SubscriptionStateContract `json:"state,omitempty"` 3850} 3851 3852// SubscriptionKeyParameterNamesContract subscription key parameter names details. 3853type SubscriptionKeyParameterNamesContract struct { 3854 // Header - Subscription key header name. 3855 Header *string `json:"header,omitempty"` 3856 // Query - Subscription key query string parameter name. 3857 Query *string `json:"query,omitempty"` 3858} 3859 3860// SubscriptionUpdateParameters parameters supplied to the Update subscription operation. 3861type SubscriptionUpdateParameters struct { 3862 // UserID - User identifier path: /users/{uid} 3863 UserID *string `json:"userId,omitempty"` 3864 // ProductID - Product identifier path: /products/{productId} 3865 ProductID *string `json:"productId,omitempty"` 3866 // ExpirationDate - New subscription expiration date. 3867 ExpirationDate *date.Time `json:"expirationDate,omitempty"` 3868 // Name - Subscription name. 3869 Name *string `json:"name,omitempty"` 3870 // PrimaryKey - Primary subscription key. 3871 PrimaryKey *string `json:"primaryKey,omitempty"` 3872 // SecondaryKey - Secondary subscription key. 3873 SecondaryKey *string `json:"secondaryKey,omitempty"` 3874 // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' 3875 State SubscriptionStateContract `json:"state,omitempty"` 3876 // StateComment - Comments describing subscription state change by the administrator. 3877 StateComment *string `json:"stateComment,omitempty"` 3878} 3879 3880// TenantConfigurationDeployFuture an abstraction for monitoring and retrieving the results of a 3881// long-running operation. 3882type TenantConfigurationDeployFuture struct { 3883 azure.FutureAPI 3884 // Result returns the result of the asynchronous operation. 3885 // If the operation has not completed it will return an error. 3886 Result func(TenantConfigurationClient) (OperationResultContract, error) 3887} 3888 3889// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3890func (future *TenantConfigurationDeployFuture) UnmarshalJSON(body []byte) error { 3891 var azFuture azure.Future 3892 if err := json.Unmarshal(body, &azFuture); err != nil { 3893 return err 3894 } 3895 future.FutureAPI = &azFuture 3896 future.Result = future.result 3897 return nil 3898} 3899 3900// result is the default implementation for TenantConfigurationDeployFuture.Result. 3901func (future *TenantConfigurationDeployFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { 3902 var done bool 3903 done, err = future.DoneWithContext(context.Background(), client) 3904 if err != nil { 3905 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", future.Response(), "Polling failure") 3906 return 3907 } 3908 if !done { 3909 orc.Response.Response = future.Response() 3910 err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationDeployFuture") 3911 return 3912 } 3913 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3914 if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { 3915 orc, err = client.DeployResponder(orc.Response.Response) 3916 if err != nil { 3917 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", orc.Response.Response, "Failure responding to request") 3918 } 3919 } 3920 return 3921} 3922 3923// TenantConfigurationSaveFuture an abstraction for monitoring and retrieving the results of a long-running 3924// operation. 3925type TenantConfigurationSaveFuture struct { 3926 azure.FutureAPI 3927 // Result returns the result of the asynchronous operation. 3928 // If the operation has not completed it will return an error. 3929 Result func(TenantConfigurationClient) (OperationResultContract, error) 3930} 3931 3932// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3933func (future *TenantConfigurationSaveFuture) UnmarshalJSON(body []byte) error { 3934 var azFuture azure.Future 3935 if err := json.Unmarshal(body, &azFuture); err != nil { 3936 return err 3937 } 3938 future.FutureAPI = &azFuture 3939 future.Result = future.result 3940 return nil 3941} 3942 3943// result is the default implementation for TenantConfigurationSaveFuture.Result. 3944func (future *TenantConfigurationSaveFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { 3945 var done bool 3946 done, err = future.DoneWithContext(context.Background(), client) 3947 if err != nil { 3948 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", future.Response(), "Polling failure") 3949 return 3950 } 3951 if !done { 3952 orc.Response.Response = future.Response() 3953 err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationSaveFuture") 3954 return 3955 } 3956 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3957 if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { 3958 orc, err = client.SaveResponder(orc.Response.Response) 3959 if err != nil { 3960 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", orc.Response.Response, "Failure responding to request") 3961 } 3962 } 3963 return 3964} 3965 3966// TenantConfigurationSyncStateContract tenant Configuration Synchronization State. 3967type TenantConfigurationSyncStateContract struct { 3968 autorest.Response `json:"-"` 3969 // Branch - The name of Git branch. 3970 Branch *string `json:"branch,omitempty"` 3971 // CommitID - The latest commit Id. 3972 CommitID *string `json:"commitId,omitempty"` 3973 // IsExport - value indicating if last sync was save (true) or deploy (false) operation. 3974 IsExport *bool `json:"isExport,omitempty"` 3975 // IsSynced - value indicating if last synchronization was later than the configuration change. 3976 IsSynced *bool `json:"isSynced,omitempty"` 3977 // IsGitEnabled - value indicating whether Git configuration access is enabled. 3978 IsGitEnabled *bool `json:"isGitEnabled,omitempty"` 3979 // SyncDate - The date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3980 SyncDate *date.Time `json:"syncDate,omitempty"` 3981 // ConfigurationChangeDate - The date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 3982 ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` 3983} 3984 3985// TenantConfigurationValidateFuture an abstraction for monitoring and retrieving the results of a 3986// long-running operation. 3987type TenantConfigurationValidateFuture struct { 3988 azure.FutureAPI 3989 // Result returns the result of the asynchronous operation. 3990 // If the operation has not completed it will return an error. 3991 Result func(TenantConfigurationClient) (OperationResultContract, error) 3992} 3993 3994// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3995func (future *TenantConfigurationValidateFuture) UnmarshalJSON(body []byte) error { 3996 var azFuture azure.Future 3997 if err := json.Unmarshal(body, &azFuture); err != nil { 3998 return err 3999 } 4000 future.FutureAPI = &azFuture 4001 future.Result = future.result 4002 return nil 4003} 4004 4005// result is the default implementation for TenantConfigurationValidateFuture.Result. 4006func (future *TenantConfigurationValidateFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { 4007 var done bool 4008 done, err = future.DoneWithContext(context.Background(), client) 4009 if err != nil { 4010 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", future.Response(), "Polling failure") 4011 return 4012 } 4013 if !done { 4014 orc.Response.Response = future.Response() 4015 err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationValidateFuture") 4016 return 4017 } 4018 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4019 if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { 4020 orc, err = client.ValidateResponder(orc.Response.Response) 4021 if err != nil { 4022 err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", orc.Response.Response, "Failure responding to request") 4023 } 4024 } 4025 return 4026} 4027 4028// TenantLongRunningOperationResult a standard service response for long running tenant operations. 4029type TenantLongRunningOperationResult struct { 4030 // OperationStatusLink - operation status link. 4031 OperationStatusLink *string `json:"operationStatusLink,omitempty"` 4032 // RetryAfter - The number of minutes to retry the operation after. 4033 RetryAfter *int32 `json:"retryAfter,omitempty"` 4034 // Status - Current status of the operation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed' 4035 Status OperationStatus `json:"status,omitempty"` 4036 // StatusCode - Possible values include: 'Continue', 'OK', 'Created', 'Accepted', 'NotFound', 'Conflict' 4037 StatusCode HTTPStatusCode `json:"statusCode,omitempty"` 4038 RequestID *string `json:"requestId,omitempty"` 4039} 4040 4041// TokenBodyParameterContract oAuth acquire token request body parameter (www-url-form-encoded). 4042type TokenBodyParameterContract struct { 4043 // Name - body parameter name. 4044 Name *string `json:"name,omitempty"` 4045 // Value - body parameter value. 4046 Value *string `json:"value,omitempty"` 4047} 4048 4049// UserCollection paged Users list representation. 4050type UserCollection struct { 4051 autorest.Response `json:"-"` 4052 // Value - Page values. 4053 Value *[]UserContract `json:"value,omitempty"` 4054 // Count - Total records count number. 4055 Count *int64 `json:"count,omitempty"` 4056 // NextLink - Next page link if any. 4057 NextLink *string `json:"nextLink,omitempty"` 4058} 4059 4060// UserCollectionIterator provides access to a complete listing of UserContract values. 4061type UserCollectionIterator struct { 4062 i int 4063 page UserCollectionPage 4064} 4065 4066// NextWithContext advances to the next value. If there was an error making 4067// the request the iterator does not advance and the error is returned. 4068func (iter *UserCollectionIterator) NextWithContext(ctx context.Context) (err error) { 4069 if tracing.IsEnabled() { 4070 ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionIterator.NextWithContext") 4071 defer func() { 4072 sc := -1 4073 if iter.Response().Response.Response != nil { 4074 sc = iter.Response().Response.Response.StatusCode 4075 } 4076 tracing.EndSpan(ctx, sc, err) 4077 }() 4078 } 4079 iter.i++ 4080 if iter.i < len(iter.page.Values()) { 4081 return nil 4082 } 4083 err = iter.page.NextWithContext(ctx) 4084 if err != nil { 4085 iter.i-- 4086 return err 4087 } 4088 iter.i = 0 4089 return nil 4090} 4091 4092// Next advances to the next value. If there was an error making 4093// the request the iterator does not advance and the error is returned. 4094// Deprecated: Use NextWithContext() instead. 4095func (iter *UserCollectionIterator) Next() error { 4096 return iter.NextWithContext(context.Background()) 4097} 4098 4099// NotDone returns true if the enumeration should be started or is not yet complete. 4100func (iter UserCollectionIterator) NotDone() bool { 4101 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4102} 4103 4104// Response returns the raw server response from the last page request. 4105func (iter UserCollectionIterator) Response() UserCollection { 4106 return iter.page.Response() 4107} 4108 4109// Value returns the current value or a zero-initialized value if the 4110// iterator has advanced beyond the end of the collection. 4111func (iter UserCollectionIterator) Value() UserContract { 4112 if !iter.page.NotDone() { 4113 return UserContract{} 4114 } 4115 return iter.page.Values()[iter.i] 4116} 4117 4118// Creates a new instance of the UserCollectionIterator type. 4119func NewUserCollectionIterator(page UserCollectionPage) UserCollectionIterator { 4120 return UserCollectionIterator{page: page} 4121} 4122 4123// IsEmpty returns true if the ListResult contains no values. 4124func (uc UserCollection) IsEmpty() bool { 4125 return uc.Value == nil || len(*uc.Value) == 0 4126} 4127 4128// hasNextLink returns true if the NextLink is not empty. 4129func (uc UserCollection) hasNextLink() bool { 4130 return uc.NextLink != nil && len(*uc.NextLink) != 0 4131} 4132 4133// userCollectionPreparer prepares a request to retrieve the next set of results. 4134// It returns nil if no more results exist. 4135func (uc UserCollection) userCollectionPreparer(ctx context.Context) (*http.Request, error) { 4136 if !uc.hasNextLink() { 4137 return nil, nil 4138 } 4139 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4140 autorest.AsJSON(), 4141 autorest.AsGet(), 4142 autorest.WithBaseURL(to.String(uc.NextLink))) 4143} 4144 4145// UserCollectionPage contains a page of UserContract values. 4146type UserCollectionPage struct { 4147 fn func(context.Context, UserCollection) (UserCollection, error) 4148 uc UserCollection 4149} 4150 4151// NextWithContext advances to the next page of values. If there was an error making 4152// the request the page does not advance and the error is returned. 4153func (page *UserCollectionPage) NextWithContext(ctx context.Context) (err error) { 4154 if tracing.IsEnabled() { 4155 ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionPage.NextWithContext") 4156 defer func() { 4157 sc := -1 4158 if page.Response().Response.Response != nil { 4159 sc = page.Response().Response.Response.StatusCode 4160 } 4161 tracing.EndSpan(ctx, sc, err) 4162 }() 4163 } 4164 for { 4165 next, err := page.fn(ctx, page.uc) 4166 if err != nil { 4167 return err 4168 } 4169 page.uc = next 4170 if !next.hasNextLink() || !next.IsEmpty() { 4171 break 4172 } 4173 } 4174 return nil 4175} 4176 4177// Next advances to the next page of values. If there was an error making 4178// the request the page does not advance and the error is returned. 4179// Deprecated: Use NextWithContext() instead. 4180func (page *UserCollectionPage) Next() error { 4181 return page.NextWithContext(context.Background()) 4182} 4183 4184// NotDone returns true if the page enumeration should be started or is not yet complete. 4185func (page UserCollectionPage) NotDone() bool { 4186 return !page.uc.IsEmpty() 4187} 4188 4189// Response returns the raw server response from the last page request. 4190func (page UserCollectionPage) Response() UserCollection { 4191 return page.uc 4192} 4193 4194// Values returns the slice of values for the current page or nil if there are no values. 4195func (page UserCollectionPage) Values() []UserContract { 4196 if page.uc.IsEmpty() { 4197 return nil 4198 } 4199 return *page.uc.Value 4200} 4201 4202// Creates a new instance of the UserCollectionPage type. 4203func NewUserCollectionPage(cur UserCollection, getNextPage func(context.Context, UserCollection) (UserCollection, error)) UserCollectionPage { 4204 return UserCollectionPage{ 4205 fn: getNextPage, 4206 uc: cur, 4207 } 4208} 4209 4210// UserContract user profile. 4211type UserContract struct { 4212 autorest.Response `json:"-"` 4213 // ID - User identifier path. 4214 ID *string `json:"id,omitempty"` 4215 // FirstName - First name. 4216 FirstName *string `json:"firstName,omitempty"` 4217 // LastName - Last name. 4218 LastName *string `json:"lastName,omitempty"` 4219 // Email - Email address. 4220 Email *string `json:"email,omitempty"` 4221 // State - User state. Possible values include: 'UserStateContractActive', 'UserStateContractBlocked' 4222 State UserStateContract `json:"state,omitempty"` 4223 // RegistrationDate - Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. 4224 RegistrationDate *date.Time `json:"registrationDate,omitempty"` 4225 // Note - Administrator's note about given user. 4226 Note *string `json:"note,omitempty"` 4227 // Identities - READ-ONLY; Collection of user identities. 4228 Identities *[]UserIdentityContract `json:"identities,omitempty"` 4229} 4230 4231// MarshalJSON is the custom marshaler for UserContract. 4232func (uc UserContract) MarshalJSON() ([]byte, error) { 4233 objectMap := make(map[string]interface{}) 4234 if uc.ID != nil { 4235 objectMap["id"] = uc.ID 4236 } 4237 if uc.FirstName != nil { 4238 objectMap["firstName"] = uc.FirstName 4239 } 4240 if uc.LastName != nil { 4241 objectMap["lastName"] = uc.LastName 4242 } 4243 if uc.Email != nil { 4244 objectMap["email"] = uc.Email 4245 } 4246 if uc.State != "" { 4247 objectMap["state"] = uc.State 4248 } 4249 if uc.RegistrationDate != nil { 4250 objectMap["registrationDate"] = uc.RegistrationDate 4251 } 4252 if uc.Note != nil { 4253 objectMap["note"] = uc.Note 4254 } 4255 return json.Marshal(objectMap) 4256} 4257 4258// UserCreateParameters parameters supplied to the Create User operation. 4259type UserCreateParameters struct { 4260 // Email - Email address. Must not be empty and must be unique within the service instance. 4261 Email *string `json:"email,omitempty"` 4262 // Password - User Password. 4263 Password *string `json:"password,omitempty"` 4264 // FirstName - First name. 4265 FirstName *string `json:"firstName,omitempty"` 4266 // LastName - Last name. 4267 LastName *string `json:"lastName,omitempty"` 4268 // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateContractActive', 'UserStateContractBlocked' 4269 State UserStateContract `json:"state,omitempty"` 4270 // Note - Optional note about a user set by the administrator. 4271 Note *string `json:"note,omitempty"` 4272} 4273 4274// UserIdentityContract user identity details. 4275type UserIdentityContract struct { 4276 // Provider - Identity provider name. 4277 Provider *string `json:"provider,omitempty"` 4278 // ID - Identifier value within provider. 4279 ID *string `json:"id,omitempty"` 4280} 4281 4282// UserUpdateParameters parameters supplied to the Update User operation. 4283type UserUpdateParameters struct { 4284 // Email - Email address. 4285 Email *string `json:"email,omitempty"` 4286 // Password - Password. 4287 Password *string `json:"password,omitempty"` 4288 // FirstName - First name. 4289 FirstName *string `json:"firstName,omitempty"` 4290 // LastName - Last name. 4291 LastName *string `json:"lastName,omitempty"` 4292 // State - Account state. Possible values include: 'UserStateContractActive', 'UserStateContractBlocked' 4293 State UserStateContract `json:"state,omitempty"` 4294 // Note - Note about user. 4295 Note *string `json:"note,omitempty"` 4296} 4297 4298// VirtualNetworkConfiguration configuration of a virtual network to which API Management service is 4299// deployed. 4300type VirtualNetworkConfiguration struct { 4301 // Vnetid - READ-ONLY; The virtual network ID. This is typically a GUID. Expect a null GUID by default. 4302 Vnetid *string `json:"vnetid,omitempty"` 4303 // Subnetname - READ-ONLY; The name of the subnet. 4304 Subnetname *string `json:"subnetname,omitempty"` 4305 // SubnetResourceID - The name of the subnet Resource ID. This has format /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/{virtual network name}/subnets/{subnet name}. 4306 SubnetResourceID *string `json:"subnetResourceId,omitempty"` 4307 // Location - The location of the virtual network. 4308 Location *string `json:"location,omitempty"` 4309} 4310 4311// MarshalJSON is the custom marshaler for VirtualNetworkConfiguration. 4312func (vnc VirtualNetworkConfiguration) MarshalJSON() ([]byte, error) { 4313 objectMap := make(map[string]interface{}) 4314 if vnc.SubnetResourceID != nil { 4315 objectMap["subnetResourceId"] = vnc.SubnetResourceID 4316 } 4317 if vnc.Location != nil { 4318 objectMap["location"] = vnc.Location 4319 } 4320 return json.Marshal(objectMap) 4321} 4322