createDeployment method

Future<Deployment> createDeployment({
  1. required String restApiId,
  2. bool? cacheClusterEnabled,
  3. CacheClusterSize? cacheClusterSize,
  4. DeploymentCanarySettings? canarySettings,
  5. String? description,
  6. String? stageDescription,
  7. String? stageName,
  8. bool? tracingEnabled,
  9. Map<String, String>? variables,
})

Creates a Deployment resource, which makes a specified RestApi callable over the internet.

May throw UnauthorizedException. May throw BadRequestException. May throw NotFoundException. May throw ConflictException. May throw LimitExceededException. May throw TooManyRequestsException. May throw ServiceUnavailableException.

Parameter restApiId : Required The string identifier of the associated RestApi.

Parameter cacheClusterEnabled : Enables a cache cluster for the Stage resource specified in the input.

Parameter cacheClusterSize : Specifies the cache cluster size for the Stage resource specified in the input, if a cache cluster is enabled.

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-._~:/?#&amp;=,+.

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 {
  ArgumentError.checkNotNull(restApiId, 'restApiId');
  final $payload = <String, dynamic>{
    if (cacheClusterEnabled != null)
      'cacheClusterEnabled': cacheClusterEnabled,
    if (cacheClusterSize != null)
      'cacheClusterSize': cacheClusterSize.toValue(),
    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);
}