createDeployment method
Future<CreateDeploymentResponse>
createDeployment({
- required DeploymentType deploymentType,
- required String groupId,
- String? amznClientToken,
- String? deploymentId,
- String? groupVersionId,
Creates a deployment. ''CreateDeployment'' requests are idempotent with respect to the ''X-Amzn-Client-Token'' token and the request parameters.
May throw BadRequestException.
Parameter deploymentType
:
The type of deployment. When used for ''CreateDeployment'', only
''NewDeployment'' and ''Redeployment'' are valid.
Parameter groupId
:
The ID of the Greengrass group.
Parameter amznClientToken
:
A client token used to correlate requests and responses.
Parameter deploymentId
:
The ID of the deployment if you wish to redeploy a previous deployment.
Parameter groupVersionId
:
The ID of the group version to be deployed.
Implementation
Future<CreateDeploymentResponse> createDeployment({
required DeploymentType deploymentType,
required String groupId,
String? amznClientToken,
String? deploymentId,
String? groupVersionId,
}) async {
ArgumentError.checkNotNull(deploymentType, 'deploymentType');
ArgumentError.checkNotNull(groupId, 'groupId');
final headers = <String, String>{
if (amznClientToken != null)
'X-Amzn-Client-Token': amznClientToken.toString(),
};
final $payload = <String, dynamic>{
'DeploymentType': deploymentType.toValue(),
if (deploymentId != null) 'DeploymentId': deploymentId,
if (groupVersionId != null) 'GroupVersionId': groupVersionId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/greengrass/groups/${Uri.encodeComponent(groupId)}/deployments',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateDeploymentResponse.fromJson(response);
}