createPackage method
Creates a package for use with Amazon OpenSearch Service domains. For more information, see Custom packages for Amazon OpenSearch Service.
May throw AccessDeniedException.
May throw BaseException.
May throw InternalException.
May throw InvalidTypeException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ValidationException.
Parameter packageName :
Unique name for the package.
Parameter packageSource :
The Amazon S3 location from which to import the package.
Parameter packageType :
The type of package.
Parameter engineVersion :
The version of the Amazon OpenSearch Service engine for which is
compatible with the package. This can only be specified for package type
ZIP-PLUGIN
Parameter packageConfiguration :
The configuration parameters for the package being created.
Parameter packageDescription :
Description of the package.
Parameter packageEncryptionOptions :
The encryption parameters for the package being created.
Parameter packageVendingOptions :
The vending options for the package being created. They determine if the
package can be vended to other users.
Implementation
Future<CreatePackageResponse> createPackage({
required String packageName,
required PackageSource packageSource,
required PackageType packageType,
String? engineVersion,
PackageConfiguration? packageConfiguration,
String? packageDescription,
PackageEncryptionOptions? packageEncryptionOptions,
PackageVendingOptions? packageVendingOptions,
}) async {
final $payload = <String, dynamic>{
'PackageName': packageName,
'PackageSource': packageSource,
'PackageType': packageType.value,
if (engineVersion != null) 'EngineVersion': engineVersion,
if (packageConfiguration != null)
'PackageConfiguration': packageConfiguration,
if (packageDescription != null) 'PackageDescription': packageDescription,
if (packageEncryptionOptions != null)
'PackageEncryptionOptions': packageEncryptionOptions,
if (packageVendingOptions != null)
'PackageVendingOptions': packageVendingOptions,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2021-01-01/packages',
exceptionFnMap: _exceptionFns,
);
return CreatePackageResponse.fromJson(response);
}