createDeployment method

Future<CreateDeploymentResponse> createDeployment({
  1. required String apiId,
  2. String? description,
  3. String? stageName,
})

Creates a Deployment for an API.

May throw NotFoundException. May throw TooManyRequestsException. May throw BadRequestException. May throw ConflictException.

Parameter apiId : The API identifier.

Parameter description : The description for the deployment resource.

Parameter stageName : The name of the Stage resource for the Deployment resource to create.

Implementation

Future<CreateDeploymentResponse> createDeployment({
  required String apiId,
  String? description,
  String? stageName,
}) async {
  ArgumentError.checkNotNull(apiId, 'apiId');
  final $payload = <String, dynamic>{
    if (description != null) 'description': description,
    if (stageName != null) 'stageName': stageName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v2/apis/${Uri.encodeComponent(apiId)}/deployments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDeploymentResponse.fromJson(response);
}