createContainerServiceDeployment method
- required String serviceName,
- Map<
String, Container> ? containers, - EndpointRequest? publicEndpoint,
Creates a deployment for your Amazon Lightsail container service.
A deployment specifies the containers that will be launched on the container service and their settings, such as the ports to open, the environment variables to apply, and the launch command to run. It also specifies the container that will serve as the public endpoint of the deployment and its settings, such as the HTTP or HTTPS port to use, and the health check configuration.
You can deploy containers to your container service using container images from a public registry like Docker Hub, or from your local machine. For more information, see Creating container images for your Amazon Lightsail container services in the Lightsail Dev Guide.
May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw AccessDeniedException. May throw UnauthenticatedException.
Parameter serviceName
:
The name of the container service for which to create the deployment.
Parameter containers
:
An object that describes the settings of the containers that will be
launched on the container service.
Parameter publicEndpoint
:
An object that describes the settings of the public endpoint for the
container service.
Implementation
Future<CreateContainerServiceDeploymentResult>
createContainerServiceDeployment({
required String serviceName,
Map<String, Container>? containers,
EndpointRequest? publicEndpoint,
}) async {
ArgumentError.checkNotNull(serviceName, 'serviceName');
_s.validateStringLength(
'serviceName',
serviceName,
1,
63,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.CreateContainerServiceDeployment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'serviceName': serviceName,
if (containers != null) 'containers': containers,
if (publicEndpoint != null) 'publicEndpoint': publicEndpoint,
},
);
return CreateContainerServiceDeploymentResult.fromJson(jsonResponse.body);
}