createNetwork method

Future<CreateNetworkOutput> createNetwork({
  1. required Framework framework,
  2. required String frameworkVersion,
  3. required MemberConfiguration memberConfiguration,
  4. required String name,
  5. required VotingPolicy votingPolicy,
  6. String? clientRequestToken,
  7. String? description,
  8. NetworkFrameworkConfiguration? frameworkConfiguration,
})

Creates a new blockchain network using Amazon Managed Blockchain.

Applies only to Hyperledger Fabric.

May throw InvalidRequestException. May throw AccessDeniedException. May throw ResourceAlreadyExistsException. May throw ThrottlingException. May throw ResourceLimitExceededException. May throw InternalServiceErrorException.

Parameter framework : The blockchain framework that the network uses.

Parameter frameworkVersion : The version of the blockchain framework that the network uses.

Parameter memberConfiguration : Configuration properties for the first member within the network.

Parameter name : The name of the network.

Parameter votingPolicy : The voting rules used by the network to determine if a proposal is approved.

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 AWS SDK or the AWS CLI.

Parameter description : An optional description for the network.

Parameter frameworkConfiguration : Configuration properties of the blockchain framework relevant to the network configuration.

Implementation

Future<CreateNetworkOutput> createNetwork({
  required Framework framework,
  required String frameworkVersion,
  required MemberConfiguration memberConfiguration,
  required String name,
  required VotingPolicy votingPolicy,
  String? clientRequestToken,
  String? description,
  NetworkFrameworkConfiguration? frameworkConfiguration,
}) async {
  ArgumentError.checkNotNull(framework, 'framework');
  ArgumentError.checkNotNull(frameworkVersion, 'frameworkVersion');
  _s.validateStringLength(
    'frameworkVersion',
    frameworkVersion,
    1,
    8,
    isRequired: true,
  );
  ArgumentError.checkNotNull(memberConfiguration, 'memberConfiguration');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(votingPolicy, 'votingPolicy');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    128,
  );
  final $payload = <String, dynamic>{
    'Framework': framework.toValue(),
    'FrameworkVersion': frameworkVersion,
    'MemberConfiguration': memberConfiguration,
    'Name': name,
    'VotingPolicy': votingPolicy,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (frameworkConfiguration != null)
      'FrameworkConfiguration': frameworkConfiguration,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks',
    exceptionFnMap: _exceptionFns,
  );
  return CreateNetworkOutput.fromJson(response);
}