createConnection method

Future<CreateConnectionResponse> createConnection({
  1. required String connectionName,
  2. required ProviderType providerType,
  3. List<Tag>? tags,
})

Create an App Runner connection resource. App Runner requires a connection resource when you create App Runner services that access private repositories from certain third-party providers. You can share a connection across multiple services.

A connection resource is needed to access GitHub and Bitbucket repositories. Both require a user interface approval process through the App Runner console before you can use the connection.

May throw InternalServiceErrorException. May throw InvalidRequestException. May throw ServiceQuotaExceededException.

Parameter connectionName : A name for the new connection. It must be unique across all App Runner connections for the Amazon Web Services account in the Amazon Web Services Region.

Parameter providerType : The source repository provider.

Parameter tags : A list of metadata items that you can associate with your connection resource. A tag is a key-value pair.

Implementation

Future<CreateConnectionResponse> createConnection({
  required String connectionName,
  required ProviderType providerType,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AppRunner.CreateConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConnectionName': connectionName,
      'ProviderType': providerType.value,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateConnectionResponse.fromJson(jsonResponse.body);
}