createNode method

Future<CreateNodeOutput> createNode({
  1. required String networkId,
  2. required NodeConfiguration nodeConfiguration,
  3. String? clientRequestToken,
  4. String? memberId,
  5. Map<String, String>? tags,
})

Creates a node on the specified blockchain network.

Applies to Hyperledger Fabric and Ethereum.

May throw AccessDeniedException. May throw InternalServiceErrorException. May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ResourceLimitExceededException. May throw ResourceNotFoundException. May throw ResourceNotReadyException. May throw ThrottlingException. May throw TooManyTagsException.

Parameter networkId : The unique identifier of the network for the node.

Ethereum public networks have the following NetworkIds:

  • n-ethereum-mainnet

Parameter nodeConfiguration : The properties of a node configuration.

Parameter clientRequestToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An idempotent operation completes no more than one time. This identifier is required only if you make a service request directly using an HTTP client. It is generated automatically if you use an Amazon Web Services SDK or the CLI.

Parameter memberId : The unique identifier of the member that owns this node.

Applies only to Hyperledger Fabric.

Parameter tags : Tags to assign to the node.

Each tag consists of a key and an optional value. You can specify multiple key-value pairs in a single request with an overall maximum of 50 tags allowed per resource.

For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.

Implementation

Future<CreateNodeOutput> createNode({
  required String networkId,
  required NodeConfiguration nodeConfiguration,
  String? clientRequestToken,
  String? memberId,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'NodeConfiguration': nodeConfiguration,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (memberId != null) 'MemberId': memberId,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/nodes',
    exceptionFnMap: _exceptionFns,
  );
  return CreateNodeOutput.fromJson(response);
}