Skip to content

Commit db0e989

Browse files
author
awstools
committed
feat(client-managedblockchain): Adding new Accessor APIs for Amazon Managed Blockchain
1 parent 4ceb486 commit db0e989

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3628
-611
lines changed

clients/client-managedblockchain/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AWS SDK for JavaScript ManagedBlockchain Client for Node.js, Browser and React N
1111

1212
<p></p>
1313
<p>Amazon Managed Blockchain is a fully managed service for creating and managing blockchain networks using open-source frameworks. Blockchain allows you to build applications where multiple parties can securely and transparently run transactions and share data without the need for a trusted, central authority.</p>
14-
<p>Managed Blockchain supports the Hyperledger Fabric and Ethereum open-source frameworks. Because of fundamental differences between the frameworks, some API actions or data types may only apply in the context of one framework and not the other. For example, actions related to Hyperledger Fabric network members such as <code>CreateMember</code> and <code>DeleteMember</code> do not apply to Ethereum.</p>
14+
<p>Managed Blockchain supports the Hyperledger Fabric and Ethereum open-source frameworks. Because of fundamental differences between the frameworks, some API actions or data types may only apply in the context of one framework and not the other. For example, actions related to Hyperledger Fabric network members such as <code>CreateMember</code> and <code>DeleteMember</code> don't apply to Ethereum.</p>
1515
<p>The description for each action indicates the framework or frameworks to which it applies. Data types and properties that apply only in the context of a particular framework are similarly indicated.</p>
1616

1717
## Installing
@@ -29,16 +29,16 @@ using your favorite package manager:
2929

3030
The AWS SDK is modulized by clients and commands.
3131
To send a request, you only need to import the `ManagedBlockchainClient` and
32-
the commands you need, for example `CreateMemberCommand`:
32+
the commands you need, for example `CreateAccessorCommand`:
3333

3434
```js
3535
// ES5 example
36-
const { ManagedBlockchainClient, CreateMemberCommand } = require("@aws-sdk/client-managedblockchain");
36+
const { ManagedBlockchainClient, CreateAccessorCommand } = require("@aws-sdk/client-managedblockchain");
3737
```
3838

3939
```ts
4040
// ES6+ example
41-
import { ManagedBlockchainClient, CreateMemberCommand } from "@aws-sdk/client-managedblockchain";
41+
import { ManagedBlockchainClient, CreateAccessorCommand } from "@aws-sdk/client-managedblockchain";
4242
```
4343

4444
### Usage
@@ -57,7 +57,7 @@ const client = new ManagedBlockchainClient({ region: "REGION" });
5757
const params = {
5858
/** input parameters */
5959
};
60-
const command = new CreateMemberCommand(params);
60+
const command = new CreateAccessorCommand(params);
6161
```
6262

6363
#### Async/await
@@ -136,15 +136,15 @@ const client = new AWS.ManagedBlockchain({ region: "REGION" });
136136

137137
// async/await.
138138
try {
139-
const data = await client.createMember(params);
139+
const data = await client.createAccessor(params);
140140
// process data.
141141
} catch (error) {
142142
// error handling.
143143
}
144144

145145
// Promises.
146146
client
147-
.createMember(params)
147+
.createAccessor(params)
148148
.then((data) => {
149149
// process data.
150150
})
@@ -153,7 +153,7 @@ client
153153
});
154154

155155
// callbacks.
156-
client.createMember(params, (err, data) => {
156+
client.createAccessor(params, (err, data) => {
157157
// process err and data.
158158
});
159159
```

clients/client-managedblockchain/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@aws-sdk/hash-node": "*",
2727
"@aws-sdk/invalid-dependency": "*",
2828
"@aws-sdk/middleware-content-length": "*",
29+
"@aws-sdk/middleware-endpoint": "*",
2930
"@aws-sdk/middleware-host-header": "*",
3031
"@aws-sdk/middleware-logger": "*",
3132
"@aws-sdk/middleware-recursion-detection": "*",

clients/client-managedblockchain/src/ManagedBlockchain.ts

Lines changed: 174 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// smithy-typescript generated code
22
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
33

4+
import {
5+
CreateAccessorCommand,
6+
CreateAccessorCommandInput,
7+
CreateAccessorCommandOutput,
8+
} from "./commands/CreateAccessorCommand";
49
import {
510
CreateMemberCommand,
611
CreateMemberCommandInput,
@@ -17,16 +22,27 @@ import {
1722
CreateProposalCommandInput,
1823
CreateProposalCommandOutput,
1924
} from "./commands/CreateProposalCommand";
25+
import {
26+
DeleteAccessorCommand,
27+
DeleteAccessorCommandInput,
28+
DeleteAccessorCommandOutput,
29+
} from "./commands/DeleteAccessorCommand";
2030
import {
2131
DeleteMemberCommand,
2232
DeleteMemberCommandInput,
2333
DeleteMemberCommandOutput,
2434
} from "./commands/DeleteMemberCommand";
2535
import { DeleteNodeCommand, DeleteNodeCommandInput, DeleteNodeCommandOutput } from "./commands/DeleteNodeCommand";
36+
import { GetAccessorCommand, GetAccessorCommandInput, GetAccessorCommandOutput } from "./commands/GetAccessorCommand";
2637
import { GetMemberCommand, GetMemberCommandInput, GetMemberCommandOutput } from "./commands/GetMemberCommand";
2738
import { GetNetworkCommand, GetNetworkCommandInput, GetNetworkCommandOutput } from "./commands/GetNetworkCommand";
2839
import { GetNodeCommand, GetNodeCommandInput, GetNodeCommandOutput } from "./commands/GetNodeCommand";
2940
import { GetProposalCommand, GetProposalCommandInput, GetProposalCommandOutput } from "./commands/GetProposalCommand";
41+
import {
42+
ListAccessorsCommand,
43+
ListAccessorsCommandInput,
44+
ListAccessorsCommandOutput,
45+
} from "./commands/ListAccessorsCommand";
3046
import {
3147
ListInvitationsCommand,
3248
ListInvitationsCommandInput,
@@ -81,10 +97,48 @@ import { ManagedBlockchainClient } from "./ManagedBlockchainClient";
8197
/**
8298
* <p></p>
8399
* <p>Amazon Managed Blockchain is a fully managed service for creating and managing blockchain networks using open-source frameworks. Blockchain allows you to build applications where multiple parties can securely and transparently run transactions and share data without the need for a trusted, central authority.</p>
84-
* <p>Managed Blockchain supports the Hyperledger Fabric and Ethereum open-source frameworks. Because of fundamental differences between the frameworks, some API actions or data types may only apply in the context of one framework and not the other. For example, actions related to Hyperledger Fabric network members such as <code>CreateMember</code> and <code>DeleteMember</code> do not apply to Ethereum.</p>
100+
* <p>Managed Blockchain supports the Hyperledger Fabric and Ethereum open-source frameworks. Because of fundamental differences between the frameworks, some API actions or data types may only apply in the context of one framework and not the other. For example, actions related to Hyperledger Fabric network members such as <code>CreateMember</code> and <code>DeleteMember</code> don't apply to Ethereum.</p>
85101
* <p>The description for each action indicates the framework or frameworks to which it applies. Data types and properties that apply only in the context of a particular framework are similarly indicated.</p>
86102
*/
87103
export class ManagedBlockchain extends ManagedBlockchainClient {
104+
/**
105+
* <important>
106+
* <p>The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is
107+
* subject to change. We recommend that you use this feature only with
108+
* test scenarios, and not in production environments.</p>
109+
* </important>
110+
* <p>Creates a new accessor for use with Managed Blockchain Ethereum nodes. An accessor object is a container that has the information
111+
* required for token based access to your Ethereum nodes.</p>
112+
*/
113+
public createAccessor(
114+
args: CreateAccessorCommandInput,
115+
options?: __HttpHandlerOptions
116+
): Promise<CreateAccessorCommandOutput>;
117+
public createAccessor(
118+
args: CreateAccessorCommandInput,
119+
cb: (err: any, data?: CreateAccessorCommandOutput) => void
120+
): void;
121+
public createAccessor(
122+
args: CreateAccessorCommandInput,
123+
options: __HttpHandlerOptions,
124+
cb: (err: any, data?: CreateAccessorCommandOutput) => void
125+
): void;
126+
public createAccessor(
127+
args: CreateAccessorCommandInput,
128+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CreateAccessorCommandOutput) => void),
129+
cb?: (err: any, data?: CreateAccessorCommandOutput) => void
130+
): Promise<CreateAccessorCommandOutput> | void {
131+
const command = new CreateAccessorCommand(args);
132+
if (typeof optionsOrCb === "function") {
133+
this.send(command, optionsOrCb);
134+
} else if (typeof cb === "function") {
135+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
136+
this.send(command, optionsOrCb || {}, cb);
137+
} else {
138+
return this.send(command, optionsOrCb);
139+
}
140+
}
141+
88142
/**
89143
* <p>Creates a member within a Managed Blockchain network.</p>
90144
* <p>Applies only to Hyperledger Fabric.</p>
@@ -209,7 +263,50 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
209263
}
210264

211265
/**
212-
* <p>Deletes a member. Deleting a member removes the member and all associated resources from the network. <code>DeleteMember</code> can only be called for a specified <code>MemberId</code> if the principal performing the action is associated with the AWS account that owns the member. In all other cases, the <code>DeleteMember</code> action is carried out as the result of an approved proposal to remove a member. If <code>MemberId</code> is the last member in a network specified by the last AWS account, the network is deleted also.</p>
266+
* <important>
267+
* <p>The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is
268+
* subject to change. We recommend that you use this feature only with
269+
* test scenarios, and not in production environments.</p>
270+
* </important>
271+
* <p>Deletes an accessor that your Amazon Web Services account owns. An accessor object is a container that has the
272+
* information required for token based access to your Ethereum nodes including, the
273+
* <code>BILLING_TOKEN</code>. After an accessor is deleted, the status of the accessor changes
274+
* from <code>AVAILABLE</code> to <code>PENDING_DELETION</code>. An accessor in the
275+
* <code>PENDING_DELETION</code> state can’t be used for new WebSocket requests or
276+
* HTTP requests. However, WebSocket connections that are initiated while the accessor was in the
277+
* <code>AVAILABLE</code> state remain open until they expire (up to 2 hours).</p>
278+
*/
279+
public deleteAccessor(
280+
args: DeleteAccessorCommandInput,
281+
options?: __HttpHandlerOptions
282+
): Promise<DeleteAccessorCommandOutput>;
283+
public deleteAccessor(
284+
args: DeleteAccessorCommandInput,
285+
cb: (err: any, data?: DeleteAccessorCommandOutput) => void
286+
): void;
287+
public deleteAccessor(
288+
args: DeleteAccessorCommandInput,
289+
options: __HttpHandlerOptions,
290+
cb: (err: any, data?: DeleteAccessorCommandOutput) => void
291+
): void;
292+
public deleteAccessor(
293+
args: DeleteAccessorCommandInput,
294+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DeleteAccessorCommandOutput) => void),
295+
cb?: (err: any, data?: DeleteAccessorCommandOutput) => void
296+
): Promise<DeleteAccessorCommandOutput> | void {
297+
const command = new DeleteAccessorCommand(args);
298+
if (typeof optionsOrCb === "function") {
299+
this.send(command, optionsOrCb);
300+
} else if (typeof cb === "function") {
301+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
302+
this.send(command, optionsOrCb || {}, cb);
303+
} else {
304+
return this.send(command, optionsOrCb);
305+
}
306+
}
307+
308+
/**
309+
* <p>Deletes a member. Deleting a member removes the member and all associated resources from the network. <code>DeleteMember</code> can only be called for a specified <code>MemberId</code> if the principal performing the action is associated with the Amazon Web Services account that owns the member. In all other cases, the <code>DeleteMember</code> action is carried out as the result of an approved proposal to remove a member. If <code>MemberId</code> is the last member in a network specified by the last Amazon Web Services account, the network is deleted also.</p>
213310
* <p>Applies only to Hyperledger Fabric.</p>
214311
*/
215312
public deleteMember(
@@ -239,7 +336,7 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
239336
}
240337

241338
/**
242-
* <p>Deletes a node that your AWS account owns. All data on the node is lost and cannot be recovered.</p>
339+
* <p>Deletes a node that your Amazon Web Services account owns. All data on the node is lost and cannot be recovered.</p>
243340
* <p>Applies to Hyperledger Fabric and Ethereum.</p>
244341
*/
245342
public deleteNode(args: DeleteNodeCommandInput, options?: __HttpHandlerOptions): Promise<DeleteNodeCommandOutput>;
@@ -265,6 +362,38 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
265362
}
266363
}
267364

365+
/**
366+
* <important>
367+
* <p>The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is
368+
* subject to change. We recommend that you use this feature only with
369+
* test scenarios, and not in production environments.</p>
370+
* </important>
371+
* <p>Returns detailed information about an accessor. An accessor object is a container that has the
372+
* information required for token based access to your Ethereum nodes.</p>
373+
*/
374+
public getAccessor(args: GetAccessorCommandInput, options?: __HttpHandlerOptions): Promise<GetAccessorCommandOutput>;
375+
public getAccessor(args: GetAccessorCommandInput, cb: (err: any, data?: GetAccessorCommandOutput) => void): void;
376+
public getAccessor(
377+
args: GetAccessorCommandInput,
378+
options: __HttpHandlerOptions,
379+
cb: (err: any, data?: GetAccessorCommandOutput) => void
380+
): void;
381+
public getAccessor(
382+
args: GetAccessorCommandInput,
383+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetAccessorCommandOutput) => void),
384+
cb?: (err: any, data?: GetAccessorCommandOutput) => void
385+
): Promise<GetAccessorCommandOutput> | void {
386+
const command = new GetAccessorCommand(args);
387+
if (typeof optionsOrCb === "function") {
388+
this.send(command, optionsOrCb);
389+
} else if (typeof cb === "function") {
390+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
391+
this.send(command, optionsOrCb || {}, cb);
392+
} else {
393+
return this.send(command, optionsOrCb);
394+
}
395+
}
396+
268397
/**
269398
* <p>Returns detailed information about a member.</p>
270399
* <p>Applies only to Hyperledger Fabric.</p>
@@ -374,7 +503,45 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
374503
}
375504

376505
/**
377-
* <p>Returns a list of all invitations for the current AWS account.</p>
506+
* <important>
507+
* <p>The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is
508+
* subject to change. We recommend that you use this feature only with
509+
* test scenarios, and not in production environments.</p>
510+
* </important>
511+
* <p>Returns a list of the accessors and their properties. Accessor objects are containers that have the
512+
* information required for token based access to your Ethereum nodes.</p>
513+
*/
514+
public listAccessors(
515+
args: ListAccessorsCommandInput,
516+
options?: __HttpHandlerOptions
517+
): Promise<ListAccessorsCommandOutput>;
518+
public listAccessors(
519+
args: ListAccessorsCommandInput,
520+
cb: (err: any, data?: ListAccessorsCommandOutput) => void
521+
): void;
522+
public listAccessors(
523+
args: ListAccessorsCommandInput,
524+
options: __HttpHandlerOptions,
525+
cb: (err: any, data?: ListAccessorsCommandOutput) => void
526+
): void;
527+
public listAccessors(
528+
args: ListAccessorsCommandInput,
529+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListAccessorsCommandOutput) => void),
530+
cb?: (err: any, data?: ListAccessorsCommandOutput) => void
531+
): Promise<ListAccessorsCommandOutput> | void {
532+
const command = new ListAccessorsCommand(args);
533+
if (typeof optionsOrCb === "function") {
534+
this.send(command, optionsOrCb);
535+
} else if (typeof cb === "function") {
536+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
537+
this.send(command, optionsOrCb || {}, cb);
538+
} else {
539+
return this.send(command, optionsOrCb);
540+
}
541+
}
542+
543+
/**
544+
* <p>Returns a list of all invitations for the current Amazon Web Services account.</p>
378545
* <p>Applies only to Hyperledger Fabric.</p>
379546
*/
380547
public listInvitations(
@@ -434,7 +601,7 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
434601
}
435602

436603
/**
437-
* <p>Returns information about the networks in which the current AWS account participates.</p>
604+
* <p>Returns information about the networks in which the current Amazon Web Services account participates.</p>
438605
* <p>Applies to Hyperledger Fabric and Ethereum.</p>
439606
*/
440607
public listNetworks(
@@ -590,7 +757,7 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
590757
}
591758

592759
/**
593-
* <p>Rejects an invitation to join a network. This action can be called by a principal in an AWS account that has received an invitation to create a member and join a network.</p>
760+
* <p>Rejects an invitation to join a network. This action can be called by a principal in an Amazon Web Services account that has received an invitation to create a member and join a network.</p>
594761
* <p>Applies only to Hyperledger Fabric.</p>
595762
*/
596763
public rejectInvitation(
@@ -742,7 +909,7 @@ export class ManagedBlockchain extends ManagedBlockchainClient {
742909
}
743910

744911
/**
745-
* <p>Casts a vote for a specified <code>ProposalId</code> on behalf of a member. The member to vote as, specified by <code>VoterMemberId</code>, must be in the same AWS account as the principal that calls the action.</p>
912+
* <p>Casts a vote for a specified <code>ProposalId</code> on behalf of a member. The member to vote as, specified by <code>VoterMemberId</code>, must be in the same Amazon Web Services account as the principal that calls the action.</p>
746913
* <p>Applies only to Hyperledger Fabric.</p>
747914
*/
748915
public voteOnProposal(

0 commit comments

Comments
 (0)