createServiceNetworkServiceAssociation method

Future<CreateServiceNetworkServiceAssociationResponse> createServiceNetworkServiceAssociation({
  1. required String serviceIdentifier,
  2. required String serviceNetworkIdentifier,
  3. String? clientToken,
  4. Map<String, String>? tags,
})

Associates the specified service with the specified service network. For more information, see Manage service associations in the Amazon VPC Lattice User Guide.

You can't use this operation if the service and service network are already associated or if there is a disassociation or deletion in progress. If the association fails, you can retry the operation by deleting the association and recreating it.

You cannot associate a service and service network that are shared with a caller. The caller must own either the service or the service network.

As a result of this operation, the association is created in the service network account and the association owner account.

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

Parameter serviceIdentifier : The ID or ARN of the service.

Parameter serviceNetworkIdentifier : The ID or ARN of the service network. You must use an ARN if the resources are in different accounts.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.

Parameter tags : The tags for the association.

Implementation

Future<CreateServiceNetworkServiceAssociationResponse>
    createServiceNetworkServiceAssociation({
  required String serviceIdentifier,
  required String serviceNetworkIdentifier,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'serviceIdentifier': serviceIdentifier,
    'serviceNetworkIdentifier': serviceNetworkIdentifier,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/servicenetworkserviceassociations',
    exceptionFnMap: _exceptionFns,
  );
  return CreateServiceNetworkServiceAssociationResponse.fromJson(response);
}