createDeployment method
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);
}