createProposal method

Future<CreateProposalOutput> createProposal({
  1. required ProposalActions actions,
  2. required String memberId,
  3. required String networkId,
  4. String? clientRequestToken,
  5. String? description,
})

Creates a proposal for a change to the network that other members of the network can vote on, for example, a proposal to add a new member to the network. Any member can create a proposal.

Applies only to Hyperledger Fabric.

May throw InvalidRequestException. May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ResourceNotReadyException. May throw ThrottlingException. May throw InternalServiceErrorException.

Parameter actions : The type of actions proposed, such as inviting a member or removing a member. The types of Actions in a proposal are mutually exclusive. For example, a proposal with Invitations actions cannot also contain Removals actions.

Parameter memberId : The unique identifier of the member that is creating the proposal. This identifier is especially useful for identifying the member making the proposal when multiple members exist in a single AWS account.

Parameter networkId : The unique identifier of the network for which the proposal is made.

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 : A description for the proposal that is visible to voting members, for example, "Proposal to add Example Corp. as member."

Implementation

Future<CreateProposalOutput> createProposal({
  required ProposalActions actions,
  required String memberId,
  required String networkId,
  String? clientRequestToken,
  String? description,
}) async {
  ArgumentError.checkNotNull(actions, 'actions');
  ArgumentError.checkNotNull(memberId, 'memberId');
  _s.validateStringLength(
    'memberId',
    memberId,
    1,
    32,
    isRequired: true,
  );
  ArgumentError.checkNotNull(networkId, 'networkId');
  _s.validateStringLength(
    'networkId',
    networkId,
    1,
    32,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    128,
  );
  final $payload = <String, dynamic>{
    'Actions': actions,
    'MemberId': memberId,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/proposals',
    exceptionFnMap: _exceptionFns,
  );
  return CreateProposalOutput.fromJson(response);
}