createEndpointAccess method

Future<CreateEndpointAccessResponse> createEndpointAccess({
  1. required String endpointName,
  2. required List<String> subnetIds,
  3. required String workgroupName,
  4. String? ownerAccount,
  5. List<String>? vpcSecurityGroupIds,
})

Creates an Amazon Redshift Serverless managed VPC endpoint.

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

Parameter endpointName : The name of the VPC endpoint. An endpoint name must contain 1-30 characters. Valid characters are A-Z, a-z, 0-9, and hyphen(-). The first character must be a letter. The name can't contain two consecutive hyphens or end with a hyphen.

Parameter subnetIds : The unique identifers of subnets from which Amazon Redshift Serverless chooses one to deploy a VPC endpoint.

Parameter workgroupName : The name of the workgroup to associate with the VPC endpoint.

Parameter ownerAccount : The owner Amazon Web Services account for the Amazon Redshift Serverless workgroup.

Parameter vpcSecurityGroupIds : The unique identifiers of the security group that defines the ports, protocols, and sources for inbound traffic that you are authorizing into your endpoint.

Implementation

Future<CreateEndpointAccessResponse> createEndpointAccess({
  required String endpointName,
  required List<String> subnetIds,
  required String workgroupName,
  String? ownerAccount,
  List<String>? vpcSecurityGroupIds,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.CreateEndpointAccess'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'endpointName': endpointName,
      'subnetIds': subnetIds,
      'workgroupName': workgroupName,
      if (ownerAccount != null) 'ownerAccount': ownerAccount,
      if (vpcSecurityGroupIds != null)
        'vpcSecurityGroupIds': vpcSecurityGroupIds,
    },
  );

  return CreateEndpointAccessResponse.fromJson(jsonResponse.body);
}