createAccessor method

Future<CreateAccessorOutput> createAccessor({
  1. required AccessorType accessorType,
  2. String? clientRequestToken,
  3. AccessorNetworkType? networkType,
  4. Map<String, String>? tags,
})

Creates a new accessor for use with Amazon Managed Blockchain service that supports token based access. The accessor contains information required for token based access.

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

Parameter accessorType : The type of accessor.

Parameter clientRequestToken : This is a unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An idempotent operation completes no more than once. 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 Amazon Web Services CLI.

Parameter networkType : The blockchain network that the Accessor token is created for.

  • Use the actual networkType value for the blockchain network that you are creating the Accessor token for.
  • With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following networkType values are no longer available for selection and use.
    • ETHEREUM_MAINNET_AND_GOERLI
    • ETHEREUM_GOERLI
    • POLYGON_MUMBAI
    However, your existing Accessor tokens with these networkType values will remain unchanged.

Parameter tags : Tags to assign to the Accessor.

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<CreateAccessorOutput> createAccessor({
  required AccessorType accessorType,
  String? clientRequestToken,
  AccessorNetworkType? networkType,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'AccessorType': accessorType.value,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (networkType != null) 'NetworkType': networkType.value,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accessors',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAccessorOutput.fromJson(response);
}