createGatewayTarget method

Future<CreateGatewayTargetResponse> createGatewayTarget({
  1. required String gatewayIdentifier,
  2. required String name,
  3. required TargetConfiguration targetConfiguration,
  4. String? clientToken,
  5. List<CredentialProviderConfiguration>? credentialProviderConfigurations,
  6. String? description,
  7. MetadataConfiguration? metadataConfiguration,
  8. PrivateEndpoint? privateEndpoint,
})

Creates a target for a gateway. A target defines an endpoint that the gateway can connect to.

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

Parameter gatewayIdentifier : The identifier of the gateway to create a target for.

Parameter name : The name of the gateway target. The name must be unique within the gateway.

Parameter targetConfiguration : The configuration settings for the target, including endpoint information and schema definitions.

Parameter clientToken : A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see Ensuring idempotency.

Parameter credentialProviderConfigurations : The credential provider configurations for the target. These configurations specify how the gateway authenticates with the target endpoint.

Parameter description : The description of the gateway target.

Parameter metadataConfiguration : Optional configuration for HTTP header and query parameter propagation to and from the gateway target.

Parameter privateEndpoint : The private endpoint configuration for the gateway target. Use this to connect the gateway to private resources in your VPC.

Implementation

Future<CreateGatewayTargetResponse> createGatewayTarget({
  required String gatewayIdentifier,
  required String name,
  required TargetConfiguration targetConfiguration,
  String? clientToken,
  List<CredentialProviderConfiguration>? credentialProviderConfigurations,
  String? description,
  MetadataConfiguration? metadataConfiguration,
  PrivateEndpoint? privateEndpoint,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'targetConfiguration': targetConfiguration,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (credentialProviderConfigurations != null)
      'credentialProviderConfigurations': credentialProviderConfigurations,
    if (description != null) 'description': description,
    if (metadataConfiguration != null)
      'metadataConfiguration': metadataConfiguration,
    if (privateEndpoint != null) 'privateEndpoint': privateEndpoint,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/gateways/${Uri.encodeComponent(gatewayIdentifier)}/targets/',
    exceptionFnMap: _exceptionFns,
  );
  return CreateGatewayTargetResponse.fromJson(response);
}