createSubscriptionRequest method

Future<CreateSubscriptionRequestOutput> createSubscriptionRequest({
  1. required String domainIdentifier,
  2. required String requestReason,
  3. required List<SubscribedListingInput> subscribedListings,
  4. required List<SubscribedPrincipalInput> subscribedPrincipals,
  5. List<AssetPermission>? assetPermissions,
  6. List<AcceptedAssetScope>? assetScopes,
  7. String? clientToken,
  8. List<FormInput>? metadataForms,
})

Creates a subscription request in Amazon DataZone.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter domainIdentifier : The ID of the Amazon DataZone domain in which the subscription request is created.

Parameter requestReason : The reason for the subscription request.

Parameter subscribedListings : The published asset for which the subscription grant is to be created.

Parameter subscribedPrincipals : The Amazon DataZone principals for whom the subscription request is created.

Parameter assetPermissions : The asset permissions of the subscription request.

Parameter assetScopes : The asset scopes of the subscription request.

Parameter clientToken : A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Parameter metadataForms : The metadata form included in the subscription request.

Implementation

Future<CreateSubscriptionRequestOutput> createSubscriptionRequest({
  required String domainIdentifier,
  required String requestReason,
  required List<SubscribedListingInput> subscribedListings,
  required List<SubscribedPrincipalInput> subscribedPrincipals,
  List<AssetPermission>? assetPermissions,
  List<AcceptedAssetScope>? assetScopes,
  String? clientToken,
  List<FormInput>? metadataForms,
}) async {
  final $payload = <String, dynamic>{
    'requestReason': requestReason,
    'subscribedListings': subscribedListings,
    'subscribedPrincipals': subscribedPrincipals,
    if (assetPermissions != null) 'assetPermissions': assetPermissions,
    if (assetScopes != null) 'assetScopes': assetScopes,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (metadataForms != null) 'metadataForms': metadataForms,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/subscription-requests',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSubscriptionRequestOutput.fromJson(response);
}