createSecurityConfig method

Future<CreateSecurityConfigResponse> createSecurityConfig({
  1. required String name,
  2. required SecurityConfigType type,
  3. String? clientToken,
  4. String? description,
  5. IamFederationConfigOptions? iamFederationOptions,
  6. CreateIamIdentityCenterConfigOptions? iamIdentityCenterOptions,
  7. SamlConfigOptions? samlOptions,
})

Specifies a security configuration for OpenSearch Serverless. For more information, see SAML authentication for Amazon OpenSearch Serverless.

May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter name : The name of the security configuration.

Parameter type : The type of security configuration.

Parameter clientToken : Unique, case-sensitive identifier to ensure idempotency of the request.

Parameter description : A description of the security configuration.

Parameter iamFederationOptions : Describes IAM federation options in the form of a key-value map. This field is required if you specify iamFederation for the type parameter.

Parameter iamIdentityCenterOptions : Describes IAM Identity Center options in the form of a key-value map. This field is required if you specify iamidentitycenter for the type parameter.

Parameter samlOptions : Describes SAML options in the form of a key-value map. This field is required if you specify SAML for the type parameter.

Implementation

Future<CreateSecurityConfigResponse> createSecurityConfig({
  required String name,
  required SecurityConfigType type,
  String? clientToken,
  String? description,
  IamFederationConfigOptions? iamFederationOptions,
  CreateIamIdentityCenterConfigOptions? iamIdentityCenterOptions,
  SamlConfigOptions? samlOptions,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.CreateSecurityConfig'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'type': type.value,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'description': description,
      if (iamFederationOptions != null)
        'iamFederationOptions': iamFederationOptions,
      if (iamIdentityCenterOptions != null)
        'iamIdentityCenterOptions': iamIdentityCenterOptions,
      if (samlOptions != null) 'samlOptions': samlOptions,
    },
  );

  return CreateSecurityConfigResponse.fromJson(jsonResponse.body);
}