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