createDomain method

Future<CreateDomainResponse> createDomain({
  1. required String domainName,
  2. AIMLOptionsInput? aIMLOptions,
  3. String? accessPolicies,
  4. Map<String, String>? advancedOptions,
  5. AdvancedSecurityOptionsInput? advancedSecurityOptions,
  6. AutoTuneOptionsInput? autoTuneOptions,
  7. AutomatedSnapshotPauseRequestOptions? automatedSnapshotPauseOptions,
  8. ClusterConfig? clusterConfig,
  9. CognitoOptions? cognitoOptions,
  10. DeploymentStrategyOptions? deploymentStrategyOptions,
  11. DomainEndpointOptions? domainEndpointOptions,
  12. EBSOptions? eBSOptions,
  13. EncryptionAtRestOptions? encryptionAtRestOptions,
  14. String? engineVersion,
  15. IPAddressType? iPAddressType,
  16. IdentityCenterOptionsInput? identityCenterOptions,
  17. Map<LogType, LogPublishingOption>? logPublishingOptions,
  18. NodeToNodeEncryptionOptions? nodeToNodeEncryptionOptions,
  19. OffPeakWindowOptions? offPeakWindowOptions,
  20. SnapshotOptions? snapshotOptions,
  21. SoftwareUpdateOptions? softwareUpdateOptions,
  22. List<Tag>? tagList,
  23. VPCOptions? vPCOptions,
})

Creates an Amazon OpenSearch Service domain. For more information, see Creating and managing Amazon OpenSearch Service domains.

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

Parameter domainName : Name of the OpenSearch Service domain to create. Domain names are unique across the domains owned by an account within an Amazon Web Services Region.

Parameter aIMLOptions : Options for all machine learning features for the specified domain.

Parameter accessPolicies : Identity and Access Management (IAM) policy document specifying the access policies for the new domain.

Parameter advancedOptions : Key-value pairs to specify advanced configuration options. The following key-value pairs are supported:

  • "rest.action.multi.allow_explicit_index": "true" | "false" - Note the use of a string rather than a boolean. Specifies whether explicit references to indexes are allowed inside the body of HTTP requests. If you want to configure access policies for domain sub-resources, such as specific indexes and domain APIs, you must disable this property. Default is true.
  • "indices.fielddata.cache.size": "80" - Note the use of a string rather than a boolean. Specifies the percentage of heap space allocated to field data. Default is unbounded.
  • "indices.query.bool.max_clause_count": "1024" - Note the use of a string rather than a boolean. Specifies the maximum number of clauses allowed in a Lucene boolean query. Default is 1,024. Queries with more than the permitted number of clauses result in a TooManyClauses error.
  • "override_main_response_version": "true" | "false" - Note the use of a string rather than a boolean. Specifies whether the domain reports its version as 7.10 to allow Elasticsearch OSS clients and plugins to continue working with it. Default is false when creating a domain and true when upgrading a domain.
For more information, see Advanced cluster parameters.

Parameter advancedSecurityOptions : Options for fine-grained access control.

Parameter autoTuneOptions : Options for Auto-Tune.

Parameter automatedSnapshotPauseOptions : Specifies the automated snapshot pause options for the domain. Maximum suspension duration: 3 days.

Parameter clusterConfig : Container for the cluster configuration of a domain.

Parameter cognitoOptions : Key-value pairs to configure Amazon Cognito authentication. For more information, see Configuring Amazon Cognito authentication for OpenSearch Dashboards.

Parameter deploymentStrategyOptions : Specifies the deployment strategy options for the domain.

Parameter domainEndpointOptions : Additional options for the domain endpoint, such as whether to require HTTPS for all traffic.

Parameter eBSOptions : Container for the parameters required to enable EBS-based storage for an OpenSearch Service domain.

Parameter encryptionAtRestOptions : Key-value pairs to enable encryption at rest.

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

Parameter iPAddressType : Specify either dual stack or IPv4 as your IP address type. Dual stack allows you to share domain resources across IPv4 and IPv6 address types, and is the recommended option. If you set your IP address type to dual stack, you can't change your address type later.

Parameter identityCenterOptions : Configuration options for enabling and managing IAM Identity Center integration within a domain.

Parameter logPublishingOptions : Key-value pairs to configure log publishing.

Parameter nodeToNodeEncryptionOptions : Enables node-to-node encryption.

Parameter offPeakWindowOptions : Specifies a daily 10-hour time block during which OpenSearch Service can perform configuration changes on the domain, including service software updates and Auto-Tune enhancements that require a blue/green deployment. If no options are specified, the default start time of 10:00 P.M. local time (for the Region that the domain is created in) is used.

Parameter snapshotOptions : DEPRECATED. Container for the parameters required to configure automated snapshots of domain indexes.

Parameter softwareUpdateOptions : Software update options for the domain.

Parameter tagList : List of tags to add to the domain upon creation.

Parameter vPCOptions : Container for the values required to configure VPC access domains. If you don't specify these values, OpenSearch Service creates the domain with a public endpoint. For more information, see Launching your Amazon OpenSearch Service domains using a VPC.

Implementation

Future<CreateDomainResponse> createDomain({
  required String domainName,
  AIMLOptionsInput? aIMLOptions,
  String? accessPolicies,
  Map<String, String>? advancedOptions,
  AdvancedSecurityOptionsInput? advancedSecurityOptions,
  AutoTuneOptionsInput? autoTuneOptions,
  AutomatedSnapshotPauseRequestOptions? automatedSnapshotPauseOptions,
  ClusterConfig? clusterConfig,
  CognitoOptions? cognitoOptions,
  DeploymentStrategyOptions? deploymentStrategyOptions,
  DomainEndpointOptions? domainEndpointOptions,
  EBSOptions? eBSOptions,
  EncryptionAtRestOptions? encryptionAtRestOptions,
  String? engineVersion,
  IPAddressType? iPAddressType,
  IdentityCenterOptionsInput? identityCenterOptions,
  Map<LogType, LogPublishingOption>? logPublishingOptions,
  NodeToNodeEncryptionOptions? nodeToNodeEncryptionOptions,
  OffPeakWindowOptions? offPeakWindowOptions,
  SnapshotOptions? snapshotOptions,
  SoftwareUpdateOptions? softwareUpdateOptions,
  List<Tag>? tagList,
  VPCOptions? vPCOptions,
}) async {
  final $payload = <String, dynamic>{
    'DomainName': domainName,
    if (aIMLOptions != null) 'AIMLOptions': aIMLOptions,
    if (accessPolicies != null) 'AccessPolicies': accessPolicies,
    if (advancedOptions != null) 'AdvancedOptions': advancedOptions,
    if (advancedSecurityOptions != null)
      'AdvancedSecurityOptions': advancedSecurityOptions,
    if (autoTuneOptions != null) 'AutoTuneOptions': autoTuneOptions,
    if (automatedSnapshotPauseOptions != null)
      'AutomatedSnapshotPauseOptions': automatedSnapshotPauseOptions,
    if (clusterConfig != null) 'ClusterConfig': clusterConfig,
    if (cognitoOptions != null) 'CognitoOptions': cognitoOptions,
    if (deploymentStrategyOptions != null)
      'DeploymentStrategyOptions': deploymentStrategyOptions,
    if (domainEndpointOptions != null)
      'DomainEndpointOptions': domainEndpointOptions,
    if (eBSOptions != null) 'EBSOptions': eBSOptions,
    if (encryptionAtRestOptions != null)
      'EncryptionAtRestOptions': encryptionAtRestOptions,
    if (engineVersion != null) 'EngineVersion': engineVersion,
    if (iPAddressType != null) 'IPAddressType': iPAddressType.value,
    if (identityCenterOptions != null)
      'IdentityCenterOptions': identityCenterOptions,
    if (logPublishingOptions != null)
      'LogPublishingOptions':
          logPublishingOptions.map((k, e) => MapEntry(k.value, e)),
    if (nodeToNodeEncryptionOptions != null)
      'NodeToNodeEncryptionOptions': nodeToNodeEncryptionOptions,
    if (offPeakWindowOptions != null)
      'OffPeakWindowOptions': offPeakWindowOptions,
    if (snapshotOptions != null) 'SnapshotOptions': snapshotOptions,
    if (softwareUpdateOptions != null)
      'SoftwareUpdateOptions': softwareUpdateOptions,
    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);
}