createPackage method
Future<CreatePackageResponse>
createPackage({
- required String packageName,
- required PackageSource packageSource,
- required PackageType packageType,
- String? packageDescription,
Create a package for use with Amazon ES domains.
May throw BaseException. May throw InternalException. May throw LimitExceededException. May throw InvalidTypeException. May throw ResourceAlreadyExistsException. May throw AccessDeniedException. May throw ValidationException.
Parameter packageName
:
Unique identifier for the package.
Parameter packageSource
:
The customer S3 location PackageSource
for importing the
package.
Parameter packageType
:
Type of package. Currently supports only TXT-DICTIONARY.
Parameter packageDescription
:
Description of the package.
Implementation
Future<CreatePackageResponse> createPackage({
required String packageName,
required PackageSource packageSource,
required PackageType packageType,
String? packageDescription,
}) async {
ArgumentError.checkNotNull(packageName, 'packageName');
_s.validateStringLength(
'packageName',
packageName,
3,
28,
isRequired: true,
);
ArgumentError.checkNotNull(packageSource, 'packageSource');
ArgumentError.checkNotNull(packageType, 'packageType');
_s.validateStringLength(
'packageDescription',
packageDescription,
0,
1024,
);
final $payload = <String, dynamic>{
'PackageName': packageName,
'PackageSource': packageSource,
'PackageType': packageType.toValue(),
if (packageDescription != null) 'PackageDescription': packageDescription,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2015-01-01/packages',
exceptionFnMap: _exceptionFns,
);
return CreatePackageResponse.fromJson(response);
}