createDomain method

Future<CreateDomainResponse> createDomain({
  1. required String domainName,
  2. String? accessPolicies,
  3. Map<String, String>? advancedOptions,
  4. AdvancedSecurityOptionsInput? advancedSecurityOptions,
  5. AutoTuneOptionsInput? autoTuneOptions,
  6. ClusterConfig? clusterConfig,
  7. CognitoOptions? cognitoOptions,
  8. DomainEndpointOptions? domainEndpointOptions,
  9. EBSOptions? eBSOptions,
  10. EncryptionAtRestOptions? encryptionAtRestOptions,
  11. String? engineVersion,
  12. Map<LogType, LogPublishingOption>? logPublishingOptions,
  13. NodeToNodeEncryptionOptions? nodeToNodeEncryptionOptions,
  14. SnapshotOptions? snapshotOptions,
  15. List<Tag>? tagList,
  16. VPCOptions? vPCOptions,
})

Creates a new Amazon OpenSearch Service domain. For more information, see Creating and managing Amazon OpenSearch Service domains in the Amazon OpenSearch Service Developer Guide.

May throw BaseException. May throw DisabledOperationException. May throw InternalException. May throw InvalidTypeException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ValidationException.

Parameter domainName : The name of the Amazon OpenSearch Service domain you're creating. Domain names are unique across the domains owned by an account within an AWS region. Domain names must start with a lowercase letter and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).

Parameter accessPolicies : IAM access policy as a JSON-formatted string.

Parameter advancedOptions : Option to allow references to indices in an HTTP request body. Must be false when configuring access to individual sub-resources. By default, the value is true. See Advanced cluster parameters for more information.

Parameter advancedSecurityOptions : Specifies advanced security options.

Parameter autoTuneOptions : Specifies Auto-Tune options.

Parameter clusterConfig : Configuration options for a domain. Specifies the instance type and number of instances in the domain.

Parameter cognitoOptions : Options to specify the Cognito user and identity pools for OpenSearch Dashboards authentication. For more information, see Configuring Amazon Cognito authentication for OpenSearch Dashboards.

Parameter domainEndpointOptions : Options to specify configurations that will be applied to the domain endpoint.

Parameter eBSOptions : Options to enable, disable, and specify the type and size of EBS storage volumes.

Parameter encryptionAtRestOptions : Options for encryption of data at rest.

Parameter engineVersion : String of format Elasticsearch_X.Y or OpenSearch_X.Y to specify the engine version for the Amazon OpenSearch Service domain. For example, "OpenSearch_1.0" or "Elasticsearch_7.9". For more information, see Creating and managing Amazon OpenSearch Service domains .

Parameter logPublishingOptions : Map of LogType and LogPublishingOption, each containing options to publish a given type of OpenSearch log.

Parameter nodeToNodeEncryptionOptions : Node-to-node encryption options.

Parameter snapshotOptions : Option to set time, in UTC format, of the daily automated snapshot. Default value is 0 hours.

Parameter tagList : A list of Tag added during domain creation.

Parameter vPCOptions : Options to specify the subnets and security groups for a VPC endpoint. For more information, see Launching your Amazon OpenSearch Service domains using a VPC .

Implementation

Future<CreateDomainResponse> createDomain({
  required String domainName,
  String? accessPolicies,
  Map<String, String>? advancedOptions,
  AdvancedSecurityOptionsInput? advancedSecurityOptions,
  AutoTuneOptionsInput? autoTuneOptions,
  ClusterConfig? clusterConfig,
  CognitoOptions? cognitoOptions,
  DomainEndpointOptions? domainEndpointOptions,
  EBSOptions? eBSOptions,
  EncryptionAtRestOptions? encryptionAtRestOptions,
  String? engineVersion,
  Map<LogType, LogPublishingOption>? logPublishingOptions,
  NodeToNodeEncryptionOptions? nodeToNodeEncryptionOptions,
  SnapshotOptions? snapshotOptions,
  List<Tag>? tagList,
  VPCOptions? vPCOptions,
}) async {
  ArgumentError.checkNotNull(domainName, 'domainName');
  _s.validateStringLength(
    'domainName',
    domainName,
    3,
    28,
    isRequired: true,
  );
  _s.validateStringLength(
    'accessPolicies',
    accessPolicies,
    0,
    102400,
  );
  _s.validateStringLength(
    'engineVersion',
    engineVersion,
    14,
    18,
  );
  final $payload = <String, dynamic>{
    'DomainName': domainName,
    if (accessPolicies != null) 'AccessPolicies': accessPolicies,
    if (advancedOptions != null) 'AdvancedOptions': advancedOptions,
    if (advancedSecurityOptions != null)
      'AdvancedSecurityOptions': advancedSecurityOptions,
    if (autoTuneOptions != null) 'AutoTuneOptions': autoTuneOptions,
    if (clusterConfig != null) 'ClusterConfig': clusterConfig,
    if (cognitoOptions != null) 'CognitoOptions': cognitoOptions,
    if (domainEndpointOptions != null)
      'DomainEndpointOptions': domainEndpointOptions,
    if (eBSOptions != null) 'EBSOptions': eBSOptions,
    if (encryptionAtRestOptions != null)
      'EncryptionAtRestOptions': encryptionAtRestOptions,
    if (engineVersion != null) 'EngineVersion': engineVersion,
    if (logPublishingOptions != null)
      'LogPublishingOptions':
          logPublishingOptions.map((k, e) => MapEntry(k.toValue(), e)),
    if (nodeToNodeEncryptionOptions != null)
      'NodeToNodeEncryptionOptions': nodeToNodeEncryptionOptions,
    if (snapshotOptions != null) 'SnapshotOptions': snapshotOptions,
    if (tagList != null) 'TagList': tagList,
    if (vPCOptions != null) 'VPCOptions': vPCOptions,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2021-01-01/opensearch/domain',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDomainResponse.fromJson(response);
}