createHost method

Future<CreateHostOutput> createHost({
  1. required String name,
  2. required String providerEndpoint,
  3. required ProviderType providerType,
  4. VpcConfiguration? vpcConfiguration,
})

Creates a resource that represents the infrastructure where a third-party provider is installed. The host is used when you create connections to an installed third-party provider type, such as GitHub Enterprise Server. You create one host for all connections to that provider.

May throw LimitExceededException.

Parameter name : The name of the host to be created. The name must be unique in the calling AWS account.

Parameter providerEndpoint : The endpoint of the infrastructure to be represented by the host after it is created.

Parameter providerType : The name of the installed provider to be associated with your connection. The host resource represents the infrastructure where your provider type is installed. The valid provider type is GitHub Enterprise Server.

Parameter vpcConfiguration : The VPC configuration to be provisioned for the host. A VPC must be configured and the infrastructure to be represented by the host must already be connected to the VPC.

Implementation

Future<CreateHostOutput> createHost({
  required String name,
  required String providerEndpoint,
  required ProviderType providerType,
  VpcConfiguration? vpcConfiguration,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(providerEndpoint, 'providerEndpoint');
  _s.validateStringLength(
    'providerEndpoint',
    providerEndpoint,
    1,
    512,
    isRequired: true,
  );
  ArgumentError.checkNotNull(providerType, 'providerType');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'com.amazonaws.codestar.connections.CodeStar_connections_20191201.CreateHost'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'ProviderEndpoint': providerEndpoint,
      'ProviderType': providerType.toValue(),
      if (vpcConfiguration != null) 'VpcConfiguration': vpcConfiguration,
    },
  );

  return CreateHostOutput.fromJson(jsonResponse.body);
}