1package blockchain 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/preview/blockchain/mgmt/2018-06-01-preview/blockchain" 22 23// APIKey API key payload which is exposed in the request/response of the resource provider. 24type APIKey struct { 25 // KeyName - Gets or sets the API key name. 26 KeyName *string `json:"keyName,omitempty"` 27 // Value - Gets or sets the API key value. 28 Value *string `json:"value,omitempty"` 29} 30 31// APIKeyCollection collection of the API key payload which is exposed in the response of the resource 32// provider. 33type APIKeyCollection struct { 34 autorest.Response `json:"-"` 35 // Keys - Gets or sets the collection of API key. 36 Keys *[]APIKey `json:"keys,omitempty"` 37} 38 39// Consortium consortium payload 40type Consortium struct { 41 // Name - Gets or sets the blockchain member name. 42 Name *string `json:"name,omitempty"` 43 // Protocol - Gets or sets the protocol for the consortium. Possible values include: 'ProtocolNotSpecified', 'ProtocolParity', 'ProtocolQuorum', 'ProtocolCorda' 44 Protocol Protocol `json:"protocol,omitempty"` 45} 46 47// ConsortiumCollection collection of the consortium payload. 48type ConsortiumCollection struct { 49 autorest.Response `json:"-"` 50 // Value - Gets or sets the collection of consortiums. 51 Value *[]Consortium `json:"value,omitempty"` 52} 53 54// ConsortiumMember consortium approval 55type ConsortiumMember struct { 56 // Name - Gets the consortium member name. 57 Name *string `json:"name,omitempty"` 58 // DisplayName - Gets the consortium member display name. 59 DisplayName *string `json:"displayName,omitempty"` 60 // SubscriptionID - Gets the consortium member subscription id. 61 SubscriptionID *string `json:"subscriptionId,omitempty"` 62 // Role - Gets the consortium member role. 63 Role *string `json:"role,omitempty"` 64 // Status - Gets the consortium member status. 65 Status *string `json:"status,omitempty"` 66 // JoinDate - Gets the consortium member join date. 67 JoinDate *date.Time `json:"joinDate,omitempty"` 68 // DateModified - Gets the consortium member modified date. 69 DateModified *date.Time `json:"dateModified,omitempty"` 70} 71 72// ConsortiumMemberCollection collection of consortium payload. 73type ConsortiumMemberCollection struct { 74 autorest.Response `json:"-"` 75 // Value - Gets or sets the collection of consortiums. 76 Value *[]ConsortiumMember `json:"value,omitempty"` 77 // NextLink - Gets or sets the URL, that the client should use to fetch the next page (per server side paging). 78 // It's null for now, added for future use. 79 NextLink *string `json:"nextLink,omitempty"` 80} 81 82// ConsortiumMemberCollectionIterator provides access to a complete listing of ConsortiumMember values. 83type ConsortiumMemberCollectionIterator struct { 84 i int 85 page ConsortiumMemberCollectionPage 86} 87 88// NextWithContext advances to the next value. If there was an error making 89// the request the iterator does not advance and the error is returned. 90func (iter *ConsortiumMemberCollectionIterator) NextWithContext(ctx context.Context) (err error) { 91 if tracing.IsEnabled() { 92 ctx = tracing.StartSpan(ctx, fqdn+"/ConsortiumMemberCollectionIterator.NextWithContext") 93 defer func() { 94 sc := -1 95 if iter.Response().Response.Response != nil { 96 sc = iter.Response().Response.Response.StatusCode 97 } 98 tracing.EndSpan(ctx, sc, err) 99 }() 100 } 101 iter.i++ 102 if iter.i < len(iter.page.Values()) { 103 return nil 104 } 105 err = iter.page.NextWithContext(ctx) 106 if err != nil { 107 iter.i-- 108 return err 109 } 110 iter.i = 0 111 return nil 112} 113 114// Next advances to the next value. If there was an error making 115// the request the iterator does not advance and the error is returned. 116// Deprecated: Use NextWithContext() instead. 117func (iter *ConsortiumMemberCollectionIterator) Next() error { 118 return iter.NextWithContext(context.Background()) 119} 120 121// NotDone returns true if the enumeration should be started or is not yet complete. 122func (iter ConsortiumMemberCollectionIterator) NotDone() bool { 123 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 124} 125 126// Response returns the raw server response from the last page request. 127func (iter ConsortiumMemberCollectionIterator) Response() ConsortiumMemberCollection { 128 return iter.page.Response() 129} 130 131// Value returns the current value or a zero-initialized value if the 132// iterator has advanced beyond the end of the collection. 133func (iter ConsortiumMemberCollectionIterator) Value() ConsortiumMember { 134 if !iter.page.NotDone() { 135 return ConsortiumMember{} 136 } 137 return iter.page.Values()[iter.i] 138} 139 140// Creates a new instance of the ConsortiumMemberCollectionIterator type. 141func NewConsortiumMemberCollectionIterator(page ConsortiumMemberCollectionPage) ConsortiumMemberCollectionIterator { 142 return ConsortiumMemberCollectionIterator{page: page} 143} 144 145// IsEmpty returns true if the ListResult contains no values. 146func (cmc ConsortiumMemberCollection) IsEmpty() bool { 147 return cmc.Value == nil || len(*cmc.Value) == 0 148} 149 150// hasNextLink returns true if the NextLink is not empty. 151func (cmc ConsortiumMemberCollection) hasNextLink() bool { 152 return cmc.NextLink != nil && len(*cmc.NextLink) != 0 153} 154 155// consortiumMemberCollectionPreparer prepares a request to retrieve the next set of results. 156// It returns nil if no more results exist. 157func (cmc ConsortiumMemberCollection) consortiumMemberCollectionPreparer(ctx context.Context) (*http.Request, error) { 158 if !cmc.hasNextLink() { 159 return nil, nil 160 } 161 return autorest.Prepare((&http.Request{}).WithContext(ctx), 162 autorest.AsJSON(), 163 autorest.AsGet(), 164 autorest.WithBaseURL(to.String(cmc.NextLink))) 165} 166 167// ConsortiumMemberCollectionPage contains a page of ConsortiumMember values. 168type ConsortiumMemberCollectionPage struct { 169 fn func(context.Context, ConsortiumMemberCollection) (ConsortiumMemberCollection, error) 170 cmc ConsortiumMemberCollection 171} 172 173// NextWithContext advances to the next page of values. If there was an error making 174// the request the page does not advance and the error is returned. 175func (page *ConsortiumMemberCollectionPage) NextWithContext(ctx context.Context) (err error) { 176 if tracing.IsEnabled() { 177 ctx = tracing.StartSpan(ctx, fqdn+"/ConsortiumMemberCollectionPage.NextWithContext") 178 defer func() { 179 sc := -1 180 if page.Response().Response.Response != nil { 181 sc = page.Response().Response.Response.StatusCode 182 } 183 tracing.EndSpan(ctx, sc, err) 184 }() 185 } 186 for { 187 next, err := page.fn(ctx, page.cmc) 188 if err != nil { 189 return err 190 } 191 page.cmc = next 192 if !next.hasNextLink() || !next.IsEmpty() { 193 break 194 } 195 } 196 return nil 197} 198 199// Next advances to the next page of values. If there was an error making 200// the request the page does not advance and the error is returned. 201// Deprecated: Use NextWithContext() instead. 202func (page *ConsortiumMemberCollectionPage) Next() error { 203 return page.NextWithContext(context.Background()) 204} 205 206// NotDone returns true if the page enumeration should be started or is not yet complete. 207func (page ConsortiumMemberCollectionPage) NotDone() bool { 208 return !page.cmc.IsEmpty() 209} 210 211// Response returns the raw server response from the last page request. 212func (page ConsortiumMemberCollectionPage) Response() ConsortiumMemberCollection { 213 return page.cmc 214} 215 216// Values returns the slice of values for the current page or nil if there are no values. 217func (page ConsortiumMemberCollectionPage) Values() []ConsortiumMember { 218 if page.cmc.IsEmpty() { 219 return nil 220 } 221 return *page.cmc.Value 222} 223 224// Creates a new instance of the ConsortiumMemberCollectionPage type. 225func NewConsortiumMemberCollectionPage(cur ConsortiumMemberCollection, getNextPage func(context.Context, ConsortiumMemberCollection) (ConsortiumMemberCollection, error)) ConsortiumMemberCollectionPage { 226 return ConsortiumMemberCollectionPage{ 227 fn: getNextPage, 228 cmc: cur, 229 } 230} 231 232// FirewallRule ip range for firewall rules 233type FirewallRule struct { 234 // RuleName - Gets or sets the name of the firewall rules. 235 RuleName *string `json:"ruleName,omitempty"` 236 // StartIPAddress - Gets or sets the start IP address of the firewall rule range. 237 StartIPAddress *string `json:"startIpAddress,omitempty"` 238 // EndIPAddress - Gets or sets the end IP address of the firewall rule range. 239 EndIPAddress *string `json:"endIpAddress,omitempty"` 240} 241 242// Member payload of the blockchain member which is exposed in the request/response of the resource 243// provider. 244type Member struct { 245 autorest.Response `json:"-"` 246 // MemberProperties - Gets or sets the blockchain member properties. 247 *MemberProperties `json:"properties,omitempty"` 248 // Sku - Gets or sets the blockchain member Sku. 249 Sku *Sku `json:"sku,omitempty"` 250 // Location - The GEO location of the blockchain service. 251 Location *string `json:"location,omitempty"` 252 // Tags - Tags of the service which is a list of key value pairs that describes the resource. 253 Tags map[string]*string `json:"tags"` 254 // ID - READ-ONLY; Fully qualified resource Id of the resource. 255 ID *string `json:"id,omitempty"` 256 // Name - READ-ONLY; The name of the resource. 257 Name *string `json:"name,omitempty"` 258 // Type - READ-ONLY; The type of the service - e.g. "Microsoft.Blockchain" 259 Type *string `json:"type,omitempty"` 260} 261 262// MarshalJSON is the custom marshaler for Member. 263func (mVar Member) MarshalJSON() ([]byte, error) { 264 objectMap := make(map[string]interface{}) 265 if mVar.MemberProperties != nil { 266 objectMap["properties"] = mVar.MemberProperties 267 } 268 if mVar.Sku != nil { 269 objectMap["sku"] = mVar.Sku 270 } 271 if mVar.Location != nil { 272 objectMap["location"] = mVar.Location 273 } 274 if mVar.Tags != nil { 275 objectMap["tags"] = mVar.Tags 276 } 277 return json.Marshal(objectMap) 278} 279 280// UnmarshalJSON is the custom unmarshaler for Member struct. 281func (mVar *Member) UnmarshalJSON(body []byte) error { 282 var m map[string]*json.RawMessage 283 err := json.Unmarshal(body, &m) 284 if err != nil { 285 return err 286 } 287 for k, v := range m { 288 switch k { 289 case "properties": 290 if v != nil { 291 var memberProperties MemberProperties 292 err = json.Unmarshal(*v, &memberProperties) 293 if err != nil { 294 return err 295 } 296 mVar.MemberProperties = &memberProperties 297 } 298 case "sku": 299 if v != nil { 300 var sku Sku 301 err = json.Unmarshal(*v, &sku) 302 if err != nil { 303 return err 304 } 305 mVar.Sku = &sku 306 } 307 case "location": 308 if v != nil { 309 var location string 310 err = json.Unmarshal(*v, &location) 311 if err != nil { 312 return err 313 } 314 mVar.Location = &location 315 } 316 case "tags": 317 if v != nil { 318 var tags map[string]*string 319 err = json.Unmarshal(*v, &tags) 320 if err != nil { 321 return err 322 } 323 mVar.Tags = tags 324 } 325 case "id": 326 if v != nil { 327 var ID string 328 err = json.Unmarshal(*v, &ID) 329 if err != nil { 330 return err 331 } 332 mVar.ID = &ID 333 } 334 case "name": 335 if v != nil { 336 var name string 337 err = json.Unmarshal(*v, &name) 338 if err != nil { 339 return err 340 } 341 mVar.Name = &name 342 } 343 case "type": 344 if v != nil { 345 var typeVar string 346 err = json.Unmarshal(*v, &typeVar) 347 if err != nil { 348 return err 349 } 350 mVar.Type = &typeVar 351 } 352 } 353 } 354 355 return nil 356} 357 358// MemberCollection collection of the blockchain member payload which is exposed in the request/response of 359// the resource provider. 360type MemberCollection struct { 361 autorest.Response `json:"-"` 362 // Value - Gets or sets the collection of blockchain members. 363 Value *[]Member `json:"value,omitempty"` 364 // NextLink - Gets or sets the URL, that the client should use to fetch the next page (per server side paging). 365 // It's null for now, added for future use. 366 NextLink *string `json:"nextLink,omitempty"` 367} 368 369// MemberCollectionIterator provides access to a complete listing of Member values. 370type MemberCollectionIterator struct { 371 i int 372 page MemberCollectionPage 373} 374 375// NextWithContext advances to the next value. If there was an error making 376// the request the iterator does not advance and the error is returned. 377func (iter *MemberCollectionIterator) NextWithContext(ctx context.Context) (err error) { 378 if tracing.IsEnabled() { 379 ctx = tracing.StartSpan(ctx, fqdn+"/MemberCollectionIterator.NextWithContext") 380 defer func() { 381 sc := -1 382 if iter.Response().Response.Response != nil { 383 sc = iter.Response().Response.Response.StatusCode 384 } 385 tracing.EndSpan(ctx, sc, err) 386 }() 387 } 388 iter.i++ 389 if iter.i < len(iter.page.Values()) { 390 return nil 391 } 392 err = iter.page.NextWithContext(ctx) 393 if err != nil { 394 iter.i-- 395 return err 396 } 397 iter.i = 0 398 return nil 399} 400 401// Next advances to the next value. If there was an error making 402// the request the iterator does not advance and the error is returned. 403// Deprecated: Use NextWithContext() instead. 404func (iter *MemberCollectionIterator) Next() error { 405 return iter.NextWithContext(context.Background()) 406} 407 408// NotDone returns true if the enumeration should be started or is not yet complete. 409func (iter MemberCollectionIterator) NotDone() bool { 410 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 411} 412 413// Response returns the raw server response from the last page request. 414func (iter MemberCollectionIterator) Response() MemberCollection { 415 return iter.page.Response() 416} 417 418// Value returns the current value or a zero-initialized value if the 419// iterator has advanced beyond the end of the collection. 420func (iter MemberCollectionIterator) Value() Member { 421 if !iter.page.NotDone() { 422 return Member{} 423 } 424 return iter.page.Values()[iter.i] 425} 426 427// Creates a new instance of the MemberCollectionIterator type. 428func NewMemberCollectionIterator(page MemberCollectionPage) MemberCollectionIterator { 429 return MemberCollectionIterator{page: page} 430} 431 432// IsEmpty returns true if the ListResult contains no values. 433func (mc MemberCollection) IsEmpty() bool { 434 return mc.Value == nil || len(*mc.Value) == 0 435} 436 437// hasNextLink returns true if the NextLink is not empty. 438func (mc MemberCollection) hasNextLink() bool { 439 return mc.NextLink != nil && len(*mc.NextLink) != 0 440} 441 442// memberCollectionPreparer prepares a request to retrieve the next set of results. 443// It returns nil if no more results exist. 444func (mc MemberCollection) memberCollectionPreparer(ctx context.Context) (*http.Request, error) { 445 if !mc.hasNextLink() { 446 return nil, nil 447 } 448 return autorest.Prepare((&http.Request{}).WithContext(ctx), 449 autorest.AsJSON(), 450 autorest.AsGet(), 451 autorest.WithBaseURL(to.String(mc.NextLink))) 452} 453 454// MemberCollectionPage contains a page of Member values. 455type MemberCollectionPage struct { 456 fn func(context.Context, MemberCollection) (MemberCollection, error) 457 mc MemberCollection 458} 459 460// NextWithContext advances to the next page of values. If there was an error making 461// the request the page does not advance and the error is returned. 462func (page *MemberCollectionPage) NextWithContext(ctx context.Context) (err error) { 463 if tracing.IsEnabled() { 464 ctx = tracing.StartSpan(ctx, fqdn+"/MemberCollectionPage.NextWithContext") 465 defer func() { 466 sc := -1 467 if page.Response().Response.Response != nil { 468 sc = page.Response().Response.Response.StatusCode 469 } 470 tracing.EndSpan(ctx, sc, err) 471 }() 472 } 473 for { 474 next, err := page.fn(ctx, page.mc) 475 if err != nil { 476 return err 477 } 478 page.mc = next 479 if !next.hasNextLink() || !next.IsEmpty() { 480 break 481 } 482 } 483 return nil 484} 485 486// Next advances to the next page of values. If there was an error making 487// the request the page does not advance and the error is returned. 488// Deprecated: Use NextWithContext() instead. 489func (page *MemberCollectionPage) Next() error { 490 return page.NextWithContext(context.Background()) 491} 492 493// NotDone returns true if the page enumeration should be started or is not yet complete. 494func (page MemberCollectionPage) NotDone() bool { 495 return !page.mc.IsEmpty() 496} 497 498// Response returns the raw server response from the last page request. 499func (page MemberCollectionPage) Response() MemberCollection { 500 return page.mc 501} 502 503// Values returns the slice of values for the current page or nil if there are no values. 504func (page MemberCollectionPage) Values() []Member { 505 if page.mc.IsEmpty() { 506 return nil 507 } 508 return *page.mc.Value 509} 510 511// Creates a new instance of the MemberCollectionPage type. 512func NewMemberCollectionPage(cur MemberCollection, getNextPage func(context.Context, MemberCollection) (MemberCollection, error)) MemberCollectionPage { 513 return MemberCollectionPage{ 514 fn: getNextPage, 515 mc: cur, 516 } 517} 518 519// MemberNodesSku payload of the blockchain member nodes Sku for a blockchain member. 520type MemberNodesSku struct { 521 // Capacity - Gets or sets the nodes capacity. 522 Capacity *int32 `json:"capacity,omitempty"` 523} 524 525// MemberProperties payload of the blockchain member properties for a blockchain member. 526type MemberProperties struct { 527 // Protocol - Gets or sets the blockchain protocol. Possible values include: 'ProtocolNotSpecified', 'ProtocolParity', 'ProtocolQuorum', 'ProtocolCorda' 528 Protocol Protocol `json:"protocol,omitempty"` 529 // ValidatorNodesSku - Gets or sets the blockchain validator nodes Sku. 530 ValidatorNodesSku *MemberNodesSku `json:"validatorNodesSku,omitempty"` 531 // ProvisioningState - READ-ONLY; Gets or sets the blockchain member provision state. Possible values include: 'NotSpecified', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Stale' 532 ProvisioningState MemberProvisioningState `json:"provisioningState,omitempty"` 533 // DNS - READ-ONLY; Gets the dns endpoint of the blockchain member. 534 DNS *string `json:"dns,omitempty"` 535 // UserName - READ-ONLY; Gets the auth user name of the blockchain member. 536 UserName *string `json:"userName,omitempty"` 537 // Password - Sets the basic auth password of the blockchain member. 538 Password *string `json:"password,omitempty"` 539 // Consortium - Gets or sets the consortium for the blockchain member. 540 Consortium *string `json:"consortium,omitempty"` 541 // ConsortiumManagementAccountAddress - READ-ONLY; Gets the managed consortium management account address. 542 ConsortiumManagementAccountAddress *string `json:"consortiumManagementAccountAddress,omitempty"` 543 // ConsortiumManagementAccountPassword - Sets the managed consortium management account password. 544 ConsortiumManagementAccountPassword *string `json:"consortiumManagementAccountPassword,omitempty"` 545 // ConsortiumRole - Gets the role of the member in the consortium. 546 ConsortiumRole *string `json:"consortiumRole,omitempty"` 547 // ConsortiumMemberDisplayName - Gets the display name of the member in the consortium. 548 ConsortiumMemberDisplayName *string `json:"consortiumMemberDisplayName,omitempty"` 549 // RootContractAddress - READ-ONLY; Gets the Ethereum root contract address of the blockchain. 550 RootContractAddress *string `json:"rootContractAddress,omitempty"` 551 // PublicKey - READ-ONLY; Gets the public key of the blockchain member (default transaction node). 552 PublicKey *string `json:"publicKey,omitempty"` 553 // FirewallRules - Gets or sets firewall rules 554 FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` 555} 556 557// MarshalJSON is the custom marshaler for MemberProperties. 558func (mp MemberProperties) MarshalJSON() ([]byte, error) { 559 objectMap := make(map[string]interface{}) 560 if mp.Protocol != "" { 561 objectMap["protocol"] = mp.Protocol 562 } 563 if mp.ValidatorNodesSku != nil { 564 objectMap["validatorNodesSku"] = mp.ValidatorNodesSku 565 } 566 if mp.Password != nil { 567 objectMap["password"] = mp.Password 568 } 569 if mp.Consortium != nil { 570 objectMap["consortium"] = mp.Consortium 571 } 572 if mp.ConsortiumManagementAccountPassword != nil { 573 objectMap["consortiumManagementAccountPassword"] = mp.ConsortiumManagementAccountPassword 574 } 575 if mp.ConsortiumRole != nil { 576 objectMap["consortiumRole"] = mp.ConsortiumRole 577 } 578 if mp.ConsortiumMemberDisplayName != nil { 579 objectMap["consortiumMemberDisplayName"] = mp.ConsortiumMemberDisplayName 580 } 581 if mp.FirewallRules != nil { 582 objectMap["firewallRules"] = mp.FirewallRules 583 } 584 return json.Marshal(objectMap) 585} 586 587// MemberPropertiesUpdate update the payload of the blockchain member properties for a blockchain member. 588type MemberPropertiesUpdate struct { 589 // ConsortiumManagementAccountPassword - Sets the managed consortium management account password. 590 ConsortiumManagementAccountPassword *string `json:"consortiumManagementAccountPassword,omitempty"` 591 // Password - Sets the transaction node dns endpoint basic auth password. 592 Password *string `json:"password,omitempty"` 593 // FirewallRules - Gets or sets the firewall rules. 594 FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` 595} 596 597// MembersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 598// operation. 599type MembersCreateFuture struct { 600 azure.FutureAPI 601 // Result returns the result of the asynchronous operation. 602 // If the operation has not completed it will return an error. 603 Result func(MembersClient) (Member, error) 604} 605 606// UnmarshalJSON is the custom unmarshaller for CreateFuture. 607func (future *MembersCreateFuture) UnmarshalJSON(body []byte) error { 608 var azFuture azure.Future 609 if err := json.Unmarshal(body, &azFuture); err != nil { 610 return err 611 } 612 future.FutureAPI = &azFuture 613 future.Result = future.result 614 return nil 615} 616 617// result is the default implementation for MembersCreateFuture.Result. 618func (future *MembersCreateFuture) result(client MembersClient) (mVar Member, err error) { 619 var done bool 620 done, err = future.DoneWithContext(context.Background(), client) 621 if err != nil { 622 err = autorest.NewErrorWithError(err, "blockchain.MembersCreateFuture", "Result", future.Response(), "Polling failure") 623 return 624 } 625 if !done { 626 mVar.Response.Response = future.Response() 627 err = azure.NewAsyncOpIncompleteError("blockchain.MembersCreateFuture") 628 return 629 } 630 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 631 if mVar.Response.Response, err = future.GetResult(sender); err == nil && mVar.Response.Response.StatusCode != http.StatusNoContent { 632 mVar, err = client.CreateResponder(mVar.Response.Response) 633 if err != nil { 634 err = autorest.NewErrorWithError(err, "blockchain.MembersCreateFuture", "Result", mVar.Response.Response, "Failure responding to request") 635 } 636 } 637 return 638} 639 640// MembersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 641// operation. 642type MembersDeleteFuture struct { 643 azure.FutureAPI 644 // Result returns the result of the asynchronous operation. 645 // If the operation has not completed it will return an error. 646 Result func(MembersClient) (autorest.Response, error) 647} 648 649// UnmarshalJSON is the custom unmarshaller for CreateFuture. 650func (future *MembersDeleteFuture) UnmarshalJSON(body []byte) error { 651 var azFuture azure.Future 652 if err := json.Unmarshal(body, &azFuture); err != nil { 653 return err 654 } 655 future.FutureAPI = &azFuture 656 future.Result = future.result 657 return nil 658} 659 660// result is the default implementation for MembersDeleteFuture.Result. 661func (future *MembersDeleteFuture) result(client MembersClient) (ar autorest.Response, err error) { 662 var done bool 663 done, err = future.DoneWithContext(context.Background(), client) 664 if err != nil { 665 err = autorest.NewErrorWithError(err, "blockchain.MembersDeleteFuture", "Result", future.Response(), "Polling failure") 666 return 667 } 668 if !done { 669 ar.Response = future.Response() 670 err = azure.NewAsyncOpIncompleteError("blockchain.MembersDeleteFuture") 671 return 672 } 673 ar.Response = future.Response() 674 return 675} 676 677// MemberUpdate update the payload of the blockchain member which is exposed in the request/response of the 678// resource provider. 679type MemberUpdate struct { 680 // Tags - Tags of the service which is a list of key value pairs that describes the resource. 681 Tags map[string]*string `json:"tags"` 682 // MemberPropertiesUpdate - Gets or sets the blockchain member update properties. 683 *MemberPropertiesUpdate `json:"properties,omitempty"` 684} 685 686// MarshalJSON is the custom marshaler for MemberUpdate. 687func (mu MemberUpdate) MarshalJSON() ([]byte, error) { 688 objectMap := make(map[string]interface{}) 689 if mu.Tags != nil { 690 objectMap["tags"] = mu.Tags 691 } 692 if mu.MemberPropertiesUpdate != nil { 693 objectMap["properties"] = mu.MemberPropertiesUpdate 694 } 695 return json.Marshal(objectMap) 696} 697 698// UnmarshalJSON is the custom unmarshaler for MemberUpdate struct. 699func (mu *MemberUpdate) UnmarshalJSON(body []byte) error { 700 var m map[string]*json.RawMessage 701 err := json.Unmarshal(body, &m) 702 if err != nil { 703 return err 704 } 705 for k, v := range m { 706 switch k { 707 case "tags": 708 if v != nil { 709 var tags map[string]*string 710 err = json.Unmarshal(*v, &tags) 711 if err != nil { 712 return err 713 } 714 mu.Tags = tags 715 } 716 case "properties": 717 if v != nil { 718 var memberPropertiesUpdate MemberPropertiesUpdate 719 err = json.Unmarshal(*v, &memberPropertiesUpdate) 720 if err != nil { 721 return err 722 } 723 mu.MemberPropertiesUpdate = &memberPropertiesUpdate 724 } 725 } 726 } 727 728 return nil 729} 730 731// NameAvailability name availability payload which is exposed in the response of the resource provider. 732type NameAvailability struct { 733 autorest.Response `json:"-"` 734 // NameAvailable - Gets or sets the value indicating whether the name is available. 735 NameAvailable *bool `json:"nameAvailable,omitempty"` 736 // Message - Gets or sets the message. 737 Message *string `json:"message,omitempty"` 738 // Reason - Gets or sets the name availability reason. Possible values include: 'NameAvailabilityReasonNotSpecified', 'NameAvailabilityReasonAlreadyExists', 'NameAvailabilityReasonInvalid' 739 Reason NameAvailabilityReason `json:"reason,omitempty"` 740} 741 742// NameAvailabilityRequest name availability request payload which is exposed in the request of the 743// resource provider. 744type NameAvailabilityRequest struct { 745 // Name - Gets or sets the name to check. 746 Name *string `json:"name,omitempty"` 747 // Type - Gets or sets the type of the resource to check. 748 Type *string `json:"type,omitempty"` 749} 750 751// OperationResult operation result payload which is exposed in the response of the resource provider. 752type OperationResult struct { 753 autorest.Response `json:"-"` 754 // Name - Gets or sets the operation name. 755 Name *string `json:"name,omitempty"` 756 // StartTime - Gets or sets the operation start time. 757 StartTime *date.Time `json:"startTime,omitempty"` 758 // EndTime - Gets or sets the operation end time. 759 EndTime *date.Time `json:"endTime,omitempty"` 760} 761 762// Resource the core properties of the resources. 763type Resource struct { 764 // ID - READ-ONLY; Fully qualified resource Id of the resource. 765 ID *string `json:"id,omitempty"` 766 // Name - READ-ONLY; The name of the resource. 767 Name *string `json:"name,omitempty"` 768 // Type - READ-ONLY; The type of the service - e.g. "Microsoft.Blockchain" 769 Type *string `json:"type,omitempty"` 770} 771 772// MarshalJSON is the custom marshaler for Resource. 773func (r Resource) MarshalJSON() ([]byte, error) { 774 objectMap := make(map[string]interface{}) 775 return json.Marshal(objectMap) 776} 777 778// ResourceProviderOperation operation payload which is exposed in the response of the resource provider. 779type ResourceProviderOperation struct { 780 // Origin - Gets or sets the origin. 781 Origin *string `json:"origin,omitempty"` 782 // Name - Gets or sets the operation name. 783 Name *string `json:"name,omitempty"` 784 // IsDataAction - Gets or sets a value indicating whether the operation is a data action or not. 785 IsDataAction *bool `json:"isDataAction,omitempty"` 786 // Display - Gets or sets operation display 787 Display *ResourceProviderOperationDisplay `json:"display,omitempty"` 788} 789 790// ResourceProviderOperationCollection collection of operation payload which is exposed in the response of 791// the resource provider. 792type ResourceProviderOperationCollection struct { 793 autorest.Response `json:"-"` 794 // Value - Gets or sets the collection of operations. 795 Value *[]ResourceProviderOperation `json:"value,omitempty"` 796 // NextLink - Gets or sets the URL, that the client should use to fetch the next page (per server side paging). 797 // It's null for now, added for future use. 798 NextLink *string `json:"nextLink,omitempty"` 799} 800 801// ResourceProviderOperationCollectionIterator provides access to a complete listing of 802// ResourceProviderOperation values. 803type ResourceProviderOperationCollectionIterator struct { 804 i int 805 page ResourceProviderOperationCollectionPage 806} 807 808// NextWithContext advances to the next value. If there was an error making 809// the request the iterator does not advance and the error is returned. 810func (iter *ResourceProviderOperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { 811 if tracing.IsEnabled() { 812 ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationCollectionIterator.NextWithContext") 813 defer func() { 814 sc := -1 815 if iter.Response().Response.Response != nil { 816 sc = iter.Response().Response.Response.StatusCode 817 } 818 tracing.EndSpan(ctx, sc, err) 819 }() 820 } 821 iter.i++ 822 if iter.i < len(iter.page.Values()) { 823 return nil 824 } 825 err = iter.page.NextWithContext(ctx) 826 if err != nil { 827 iter.i-- 828 return err 829 } 830 iter.i = 0 831 return nil 832} 833 834// Next advances to the next value. If there was an error making 835// the request the iterator does not advance and the error is returned. 836// Deprecated: Use NextWithContext() instead. 837func (iter *ResourceProviderOperationCollectionIterator) Next() error { 838 return iter.NextWithContext(context.Background()) 839} 840 841// NotDone returns true if the enumeration should be started or is not yet complete. 842func (iter ResourceProviderOperationCollectionIterator) NotDone() bool { 843 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 844} 845 846// Response returns the raw server response from the last page request. 847func (iter ResourceProviderOperationCollectionIterator) Response() ResourceProviderOperationCollection { 848 return iter.page.Response() 849} 850 851// Value returns the current value or a zero-initialized value if the 852// iterator has advanced beyond the end of the collection. 853func (iter ResourceProviderOperationCollectionIterator) Value() ResourceProviderOperation { 854 if !iter.page.NotDone() { 855 return ResourceProviderOperation{} 856 } 857 return iter.page.Values()[iter.i] 858} 859 860// Creates a new instance of the ResourceProviderOperationCollectionIterator type. 861func NewResourceProviderOperationCollectionIterator(page ResourceProviderOperationCollectionPage) ResourceProviderOperationCollectionIterator { 862 return ResourceProviderOperationCollectionIterator{page: page} 863} 864 865// IsEmpty returns true if the ListResult contains no values. 866func (rpoc ResourceProviderOperationCollection) IsEmpty() bool { 867 return rpoc.Value == nil || len(*rpoc.Value) == 0 868} 869 870// hasNextLink returns true if the NextLink is not empty. 871func (rpoc ResourceProviderOperationCollection) hasNextLink() bool { 872 return rpoc.NextLink != nil && len(*rpoc.NextLink) != 0 873} 874 875// resourceProviderOperationCollectionPreparer prepares a request to retrieve the next set of results. 876// It returns nil if no more results exist. 877func (rpoc ResourceProviderOperationCollection) resourceProviderOperationCollectionPreparer(ctx context.Context) (*http.Request, error) { 878 if !rpoc.hasNextLink() { 879 return nil, nil 880 } 881 return autorest.Prepare((&http.Request{}).WithContext(ctx), 882 autorest.AsJSON(), 883 autorest.AsGet(), 884 autorest.WithBaseURL(to.String(rpoc.NextLink))) 885} 886 887// ResourceProviderOperationCollectionPage contains a page of ResourceProviderOperation values. 888type ResourceProviderOperationCollectionPage struct { 889 fn func(context.Context, ResourceProviderOperationCollection) (ResourceProviderOperationCollection, error) 890 rpoc ResourceProviderOperationCollection 891} 892 893// NextWithContext advances to the next page of values. If there was an error making 894// the request the page does not advance and the error is returned. 895func (page *ResourceProviderOperationCollectionPage) NextWithContext(ctx context.Context) (err error) { 896 if tracing.IsEnabled() { 897 ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationCollectionPage.NextWithContext") 898 defer func() { 899 sc := -1 900 if page.Response().Response.Response != nil { 901 sc = page.Response().Response.Response.StatusCode 902 } 903 tracing.EndSpan(ctx, sc, err) 904 }() 905 } 906 for { 907 next, err := page.fn(ctx, page.rpoc) 908 if err != nil { 909 return err 910 } 911 page.rpoc = next 912 if !next.hasNextLink() || !next.IsEmpty() { 913 break 914 } 915 } 916 return nil 917} 918 919// Next advances to the next page of values. If there was an error making 920// the request the page does not advance and the error is returned. 921// Deprecated: Use NextWithContext() instead. 922func (page *ResourceProviderOperationCollectionPage) Next() error { 923 return page.NextWithContext(context.Background()) 924} 925 926// NotDone returns true if the page enumeration should be started or is not yet complete. 927func (page ResourceProviderOperationCollectionPage) NotDone() bool { 928 return !page.rpoc.IsEmpty() 929} 930 931// Response returns the raw server response from the last page request. 932func (page ResourceProviderOperationCollectionPage) Response() ResourceProviderOperationCollection { 933 return page.rpoc 934} 935 936// Values returns the slice of values for the current page or nil if there are no values. 937func (page ResourceProviderOperationCollectionPage) Values() []ResourceProviderOperation { 938 if page.rpoc.IsEmpty() { 939 return nil 940 } 941 return *page.rpoc.Value 942} 943 944// Creates a new instance of the ResourceProviderOperationCollectionPage type. 945func NewResourceProviderOperationCollectionPage(cur ResourceProviderOperationCollection, getNextPage func(context.Context, ResourceProviderOperationCollection) (ResourceProviderOperationCollection, error)) ResourceProviderOperationCollectionPage { 946 return ResourceProviderOperationCollectionPage{ 947 fn: getNextPage, 948 rpoc: cur, 949 } 950} 951 952// ResourceProviderOperationDisplay operation display payload which is exposed in the response of the 953// resource provider. 954type ResourceProviderOperationDisplay struct { 955 // Provider - Gets or sets the name of the provider for display purposes. 956 Provider *string `json:"provider,omitempty"` 957 // Resource - Gets or sets the name of the resource type for display purposes. 958 Resource *string `json:"resource,omitempty"` 959 // Operation - Gets or sets the name of the operation for display purposes. 960 Operation *string `json:"operation,omitempty"` 961 // Description - Gets or sets the description of the provider for display purposes. 962 Description *string `json:"description,omitempty"` 963} 964 965// ResourceTypeSku resource type Sku. 966type ResourceTypeSku struct { 967 // ResourceType - Gets or sets the resource type 968 ResourceType *string `json:"resourceType,omitempty"` 969 // Skus - Gets or sets the Skus 970 Skus *[]SkuSetting `json:"skus,omitempty"` 971} 972 973// ResourceTypeSkuCollection collection of the resource type Sku. 974type ResourceTypeSkuCollection struct { 975 autorest.Response `json:"-"` 976 // Value - Gets or sets the collection of resource type Sku. 977 Value *[]ResourceTypeSku `json:"value,omitempty"` 978} 979 980// Sku blockchain member Sku in payload 981type Sku struct { 982 // Name - Gets or sets Sku name 983 Name *string `json:"name,omitempty"` 984 // Tier - Gets or sets Sku tier 985 Tier *string `json:"tier,omitempty"` 986} 987 988// SkuSetting sku Setting. 989type SkuSetting struct { 990 // Name - Gets or sets the Sku name. 991 Name *string `json:"name,omitempty"` 992 // Tier - Gets or sets the Sku tier. 993 Tier *string `json:"tier,omitempty"` 994 // Locations - Gets or sets the locations. 995 Locations *[]string `json:"locations,omitempty"` 996 // RequiredFeatures - Gets or sets the required features. 997 RequiredFeatures *[]string `json:"requiredFeatures,omitempty"` 998} 999 1000// TrackedResource the resource model definition for a top level resource. 1001type TrackedResource struct { 1002 // Location - The GEO location of the blockchain service. 1003 Location *string `json:"location,omitempty"` 1004 // Tags - Tags of the service which is a list of key value pairs that describes the resource. 1005 Tags map[string]*string `json:"tags"` 1006 // ID - READ-ONLY; Fully qualified resource Id of the resource. 1007 ID *string `json:"id,omitempty"` 1008 // Name - READ-ONLY; The name of the resource. 1009 Name *string `json:"name,omitempty"` 1010 // Type - READ-ONLY; The type of the service - e.g. "Microsoft.Blockchain" 1011 Type *string `json:"type,omitempty"` 1012} 1013 1014// MarshalJSON is the custom marshaler for TrackedResource. 1015func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1016 objectMap := make(map[string]interface{}) 1017 if tr.Location != nil { 1018 objectMap["location"] = tr.Location 1019 } 1020 if tr.Tags != nil { 1021 objectMap["tags"] = tr.Tags 1022 } 1023 return json.Marshal(objectMap) 1024} 1025 1026// TransactionNode payload of the transaction node which is the request/response of the resource provider. 1027type TransactionNode struct { 1028 autorest.Response `json:"-"` 1029 // Location - Gets or sets the transaction node location. 1030 Location *string `json:"location,omitempty"` 1031 // TransactionNodeProperties - Gets or sets the blockchain member properties. 1032 *TransactionNodeProperties `json:"properties,omitempty"` 1033 // ID - READ-ONLY; Fully qualified resource Id of the resource. 1034 ID *string `json:"id,omitempty"` 1035 // Name - READ-ONLY; The name of the resource. 1036 Name *string `json:"name,omitempty"` 1037 // Type - READ-ONLY; The type of the service - e.g. "Microsoft.Blockchain" 1038 Type *string `json:"type,omitempty"` 1039} 1040 1041// MarshalJSON is the custom marshaler for TransactionNode. 1042func (tn TransactionNode) MarshalJSON() ([]byte, error) { 1043 objectMap := make(map[string]interface{}) 1044 if tn.Location != nil { 1045 objectMap["location"] = tn.Location 1046 } 1047 if tn.TransactionNodeProperties != nil { 1048 objectMap["properties"] = tn.TransactionNodeProperties 1049 } 1050 return json.Marshal(objectMap) 1051} 1052 1053// UnmarshalJSON is the custom unmarshaler for TransactionNode struct. 1054func (tn *TransactionNode) UnmarshalJSON(body []byte) error { 1055 var m map[string]*json.RawMessage 1056 err := json.Unmarshal(body, &m) 1057 if err != nil { 1058 return err 1059 } 1060 for k, v := range m { 1061 switch k { 1062 case "location": 1063 if v != nil { 1064 var location string 1065 err = json.Unmarshal(*v, &location) 1066 if err != nil { 1067 return err 1068 } 1069 tn.Location = &location 1070 } 1071 case "properties": 1072 if v != nil { 1073 var transactionNodeProperties TransactionNodeProperties 1074 err = json.Unmarshal(*v, &transactionNodeProperties) 1075 if err != nil { 1076 return err 1077 } 1078 tn.TransactionNodeProperties = &transactionNodeProperties 1079 } 1080 case "id": 1081 if v != nil { 1082 var ID string 1083 err = json.Unmarshal(*v, &ID) 1084 if err != nil { 1085 return err 1086 } 1087 tn.ID = &ID 1088 } 1089 case "name": 1090 if v != nil { 1091 var name string 1092 err = json.Unmarshal(*v, &name) 1093 if err != nil { 1094 return err 1095 } 1096 tn.Name = &name 1097 } 1098 case "type": 1099 if v != nil { 1100 var typeVar string 1101 err = json.Unmarshal(*v, &typeVar) 1102 if err != nil { 1103 return err 1104 } 1105 tn.Type = &typeVar 1106 } 1107 } 1108 } 1109 1110 return nil 1111} 1112 1113// TransactionNodeCollection collection of transaction node payload which is exposed in the 1114// request/response of the resource provider. 1115type TransactionNodeCollection struct { 1116 autorest.Response `json:"-"` 1117 // Value - Gets or sets the collection of transaction nodes. 1118 Value *[]TransactionNode `json:"value,omitempty"` 1119 // NextLink - Gets or sets the URL, that the client should use to fetch the next page (per server side paging). 1120 // It's null for now, added for future use. 1121 NextLink *string `json:"nextLink,omitempty"` 1122} 1123 1124// TransactionNodeCollectionIterator provides access to a complete listing of TransactionNode values. 1125type TransactionNodeCollectionIterator struct { 1126 i int 1127 page TransactionNodeCollectionPage 1128} 1129 1130// NextWithContext advances to the next value. If there was an error making 1131// the request the iterator does not advance and the error is returned. 1132func (iter *TransactionNodeCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1133 if tracing.IsEnabled() { 1134 ctx = tracing.StartSpan(ctx, fqdn+"/TransactionNodeCollectionIterator.NextWithContext") 1135 defer func() { 1136 sc := -1 1137 if iter.Response().Response.Response != nil { 1138 sc = iter.Response().Response.Response.StatusCode 1139 } 1140 tracing.EndSpan(ctx, sc, err) 1141 }() 1142 } 1143 iter.i++ 1144 if iter.i < len(iter.page.Values()) { 1145 return nil 1146 } 1147 err = iter.page.NextWithContext(ctx) 1148 if err != nil { 1149 iter.i-- 1150 return err 1151 } 1152 iter.i = 0 1153 return nil 1154} 1155 1156// Next advances to the next value. If there was an error making 1157// the request the iterator does not advance and the error is returned. 1158// Deprecated: Use NextWithContext() instead. 1159func (iter *TransactionNodeCollectionIterator) Next() error { 1160 return iter.NextWithContext(context.Background()) 1161} 1162 1163// NotDone returns true if the enumeration should be started or is not yet complete. 1164func (iter TransactionNodeCollectionIterator) NotDone() bool { 1165 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1166} 1167 1168// Response returns the raw server response from the last page request. 1169func (iter TransactionNodeCollectionIterator) Response() TransactionNodeCollection { 1170 return iter.page.Response() 1171} 1172 1173// Value returns the current value or a zero-initialized value if the 1174// iterator has advanced beyond the end of the collection. 1175func (iter TransactionNodeCollectionIterator) Value() TransactionNode { 1176 if !iter.page.NotDone() { 1177 return TransactionNode{} 1178 } 1179 return iter.page.Values()[iter.i] 1180} 1181 1182// Creates a new instance of the TransactionNodeCollectionIterator type. 1183func NewTransactionNodeCollectionIterator(page TransactionNodeCollectionPage) TransactionNodeCollectionIterator { 1184 return TransactionNodeCollectionIterator{page: page} 1185} 1186 1187// IsEmpty returns true if the ListResult contains no values. 1188func (tnc TransactionNodeCollection) IsEmpty() bool { 1189 return tnc.Value == nil || len(*tnc.Value) == 0 1190} 1191 1192// hasNextLink returns true if the NextLink is not empty. 1193func (tnc TransactionNodeCollection) hasNextLink() bool { 1194 return tnc.NextLink != nil && len(*tnc.NextLink) != 0 1195} 1196 1197// transactionNodeCollectionPreparer prepares a request to retrieve the next set of results. 1198// It returns nil if no more results exist. 1199func (tnc TransactionNodeCollection) transactionNodeCollectionPreparer(ctx context.Context) (*http.Request, error) { 1200 if !tnc.hasNextLink() { 1201 return nil, nil 1202 } 1203 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1204 autorest.AsJSON(), 1205 autorest.AsGet(), 1206 autorest.WithBaseURL(to.String(tnc.NextLink))) 1207} 1208 1209// TransactionNodeCollectionPage contains a page of TransactionNode values. 1210type TransactionNodeCollectionPage struct { 1211 fn func(context.Context, TransactionNodeCollection) (TransactionNodeCollection, error) 1212 tnc TransactionNodeCollection 1213} 1214 1215// NextWithContext advances to the next page of values. If there was an error making 1216// the request the page does not advance and the error is returned. 1217func (page *TransactionNodeCollectionPage) NextWithContext(ctx context.Context) (err error) { 1218 if tracing.IsEnabled() { 1219 ctx = tracing.StartSpan(ctx, fqdn+"/TransactionNodeCollectionPage.NextWithContext") 1220 defer func() { 1221 sc := -1 1222 if page.Response().Response.Response != nil { 1223 sc = page.Response().Response.Response.StatusCode 1224 } 1225 tracing.EndSpan(ctx, sc, err) 1226 }() 1227 } 1228 for { 1229 next, err := page.fn(ctx, page.tnc) 1230 if err != nil { 1231 return err 1232 } 1233 page.tnc = next 1234 if !next.hasNextLink() || !next.IsEmpty() { 1235 break 1236 } 1237 } 1238 return nil 1239} 1240 1241// Next advances to the next page of values. If there was an error making 1242// the request the page does not advance and the error is returned. 1243// Deprecated: Use NextWithContext() instead. 1244func (page *TransactionNodeCollectionPage) Next() error { 1245 return page.NextWithContext(context.Background()) 1246} 1247 1248// NotDone returns true if the page enumeration should be started or is not yet complete. 1249func (page TransactionNodeCollectionPage) NotDone() bool { 1250 return !page.tnc.IsEmpty() 1251} 1252 1253// Response returns the raw server response from the last page request. 1254func (page TransactionNodeCollectionPage) Response() TransactionNodeCollection { 1255 return page.tnc 1256} 1257 1258// Values returns the slice of values for the current page or nil if there are no values. 1259func (page TransactionNodeCollectionPage) Values() []TransactionNode { 1260 if page.tnc.IsEmpty() { 1261 return nil 1262 } 1263 return *page.tnc.Value 1264} 1265 1266// Creates a new instance of the TransactionNodeCollectionPage type. 1267func NewTransactionNodeCollectionPage(cur TransactionNodeCollection, getNextPage func(context.Context, TransactionNodeCollection) (TransactionNodeCollection, error)) TransactionNodeCollectionPage { 1268 return TransactionNodeCollectionPage{ 1269 fn: getNextPage, 1270 tnc: cur, 1271 } 1272} 1273 1274// TransactionNodeProperties payload of transaction node properties payload in the transaction node 1275// payload. 1276type TransactionNodeProperties struct { 1277 // ProvisioningState - READ-ONLY; Gets or sets the blockchain member provision state. Possible values include: 'NodeProvisioningStateNotSpecified', 'NodeProvisioningStateUpdating', 'NodeProvisioningStateDeleting', 'NodeProvisioningStateSucceeded', 'NodeProvisioningStateFailed' 1278 ProvisioningState NodeProvisioningState `json:"provisioningState,omitempty"` 1279 // DNS - READ-ONLY; Gets or sets the transaction node dns endpoint. 1280 DNS *string `json:"dns,omitempty"` 1281 // PublicKey - READ-ONLY; Gets or sets the transaction node public key. 1282 PublicKey *string `json:"publicKey,omitempty"` 1283 // UserName - READ-ONLY; Gets or sets the transaction node dns endpoint basic auth user name. 1284 UserName *string `json:"userName,omitempty"` 1285 // Password - Sets the transaction node dns endpoint basic auth password. 1286 Password *string `json:"password,omitempty"` 1287 // FirewallRules - Gets or sets the firewall rules. 1288 FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` 1289} 1290 1291// MarshalJSON is the custom marshaler for TransactionNodeProperties. 1292func (tnp TransactionNodeProperties) MarshalJSON() ([]byte, error) { 1293 objectMap := make(map[string]interface{}) 1294 if tnp.Password != nil { 1295 objectMap["password"] = tnp.Password 1296 } 1297 if tnp.FirewallRules != nil { 1298 objectMap["firewallRules"] = tnp.FirewallRules 1299 } 1300 return json.Marshal(objectMap) 1301} 1302 1303// TransactionNodePropertiesUpdate update the payload of the transaction node properties in the transaction 1304// node payload. 1305type TransactionNodePropertiesUpdate struct { 1306 // Password - Sets the transaction node dns endpoint basic auth password. 1307 Password *string `json:"password,omitempty"` 1308 // FirewallRules - Gets or sets the firewall rules. 1309 FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` 1310} 1311 1312// TransactionNodesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 1313// operation. 1314type TransactionNodesCreateFuture struct { 1315 azure.FutureAPI 1316 // Result returns the result of the asynchronous operation. 1317 // If the operation has not completed it will return an error. 1318 Result func(TransactionNodesClient) (TransactionNode, error) 1319} 1320 1321// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1322func (future *TransactionNodesCreateFuture) UnmarshalJSON(body []byte) error { 1323 var azFuture azure.Future 1324 if err := json.Unmarshal(body, &azFuture); err != nil { 1325 return err 1326 } 1327 future.FutureAPI = &azFuture 1328 future.Result = future.result 1329 return nil 1330} 1331 1332// result is the default implementation for TransactionNodesCreateFuture.Result. 1333func (future *TransactionNodesCreateFuture) result(client TransactionNodesClient) (tn TransactionNode, err error) { 1334 var done bool 1335 done, err = future.DoneWithContext(context.Background(), client) 1336 if err != nil { 1337 err = autorest.NewErrorWithError(err, "blockchain.TransactionNodesCreateFuture", "Result", future.Response(), "Polling failure") 1338 return 1339 } 1340 if !done { 1341 tn.Response.Response = future.Response() 1342 err = azure.NewAsyncOpIncompleteError("blockchain.TransactionNodesCreateFuture") 1343 return 1344 } 1345 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1346 if tn.Response.Response, err = future.GetResult(sender); err == nil && tn.Response.Response.StatusCode != http.StatusNoContent { 1347 tn, err = client.CreateResponder(tn.Response.Response) 1348 if err != nil { 1349 err = autorest.NewErrorWithError(err, "blockchain.TransactionNodesCreateFuture", "Result", tn.Response.Response, "Failure responding to request") 1350 } 1351 } 1352 return 1353} 1354 1355// TransactionNodesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1356// operation. 1357type TransactionNodesDeleteFuture struct { 1358 azure.FutureAPI 1359 // Result returns the result of the asynchronous operation. 1360 // If the operation has not completed it will return an error. 1361 Result func(TransactionNodesClient) (autorest.Response, error) 1362} 1363 1364// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1365func (future *TransactionNodesDeleteFuture) UnmarshalJSON(body []byte) error { 1366 var azFuture azure.Future 1367 if err := json.Unmarshal(body, &azFuture); err != nil { 1368 return err 1369 } 1370 future.FutureAPI = &azFuture 1371 future.Result = future.result 1372 return nil 1373} 1374 1375// result is the default implementation for TransactionNodesDeleteFuture.Result. 1376func (future *TransactionNodesDeleteFuture) result(client TransactionNodesClient) (ar autorest.Response, err error) { 1377 var done bool 1378 done, err = future.DoneWithContext(context.Background(), client) 1379 if err != nil { 1380 err = autorest.NewErrorWithError(err, "blockchain.TransactionNodesDeleteFuture", "Result", future.Response(), "Polling failure") 1381 return 1382 } 1383 if !done { 1384 ar.Response = future.Response() 1385 err = azure.NewAsyncOpIncompleteError("blockchain.TransactionNodesDeleteFuture") 1386 return 1387 } 1388 ar.Response = future.Response() 1389 return 1390} 1391 1392// TransactionNodeUpdate update the transaction node payload which is exposed in the request/response of 1393// the resource provider. 1394type TransactionNodeUpdate struct { 1395 // TransactionNodePropertiesUpdate - Gets or sets the transaction node update properties. 1396 *TransactionNodePropertiesUpdate `json:"properties,omitempty"` 1397} 1398 1399// MarshalJSON is the custom marshaler for TransactionNodeUpdate. 1400func (tnu TransactionNodeUpdate) MarshalJSON() ([]byte, error) { 1401 objectMap := make(map[string]interface{}) 1402 if tnu.TransactionNodePropertiesUpdate != nil { 1403 objectMap["properties"] = tnu.TransactionNodePropertiesUpdate 1404 } 1405 return json.Marshal(objectMap) 1406} 1407 1408// UnmarshalJSON is the custom unmarshaler for TransactionNodeUpdate struct. 1409func (tnu *TransactionNodeUpdate) UnmarshalJSON(body []byte) error { 1410 var m map[string]*json.RawMessage 1411 err := json.Unmarshal(body, &m) 1412 if err != nil { 1413 return err 1414 } 1415 for k, v := range m { 1416 switch k { 1417 case "properties": 1418 if v != nil { 1419 var transactionNodePropertiesUpdate TransactionNodePropertiesUpdate 1420 err = json.Unmarshal(*v, &transactionNodePropertiesUpdate) 1421 if err != nil { 1422 return err 1423 } 1424 tnu.TransactionNodePropertiesUpdate = &transactionNodePropertiesUpdate 1425 } 1426 } 1427 } 1428 1429 return nil 1430} 1431