createDeployment method
Creates a Deployment resource, which makes a specified RestApi callable over the internet.
May throw BadRequestException.
May throw ConflictException.
May throw LimitExceededException.
May throw NotFoundException.
May throw ServiceUnavailableException.
May throw TooManyRequestsException.
May throw UnauthorizedException.
Parameter restApiId :
The string identifier of the associated RestApi.
Parameter cacheClusterEnabled :
Enables a cache cluster for the Stage resource specified in the input.
Parameter cacheClusterSize :
The stage's cache capacity in GB. For more information about choosing a
cache size, see Enabling
API caching to enhance responsiveness.
Parameter canarySettings :
The input configuration for the canary deployment when the deployment is a
canary release deployment.
Parameter description :
The description for the Deployment resource to create.
Parameter stageDescription :
The description of the Stage resource for the Deployment resource to
create.
Parameter stageName :
The name of the Stage resource for the Deployment resource to create.
Parameter tracingEnabled :
Specifies whether active tracing with X-ray is enabled for the Stage.
Parameter variables :
A map that defines the stage variables for the Stage resource that is
associated with the new deployment. Variable names can have alphanumeric
and underscore characters, and the values must match
[A-Za-z0-9-._~:/?#&=,]+.
Implementation
Future<Deployment> createDeployment({
required String restApiId,
bool? cacheClusterEnabled,
CacheClusterSize? cacheClusterSize,
DeploymentCanarySettings? canarySettings,
String? description,
String? stageDescription,
String? stageName,
bool? tracingEnabled,
Map<String, String>? variables,
}) async {
final $payload = <String, dynamic>{
if (cacheClusterEnabled != null)
'cacheClusterEnabled': cacheClusterEnabled,
if (cacheClusterSize != null) 'cacheClusterSize': cacheClusterSize.value,
if (canarySettings != null) 'canarySettings': canarySettings,
if (description != null) 'description': description,
if (stageDescription != null) 'stageDescription': stageDescription,
if (stageName != null) 'stageName': stageName,
if (tracingEnabled != null) 'tracingEnabled': tracingEnabled,
if (variables != null) 'variables': variables,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/restapis/${Uri.encodeComponent(restApiId)}/deployments',
exceptionFnMap: _exceptionFns,
);
return Deployment.fromJson(response);
}