Skip to content

create_security_config

create_security_config(
    type: SecurityConfigType,
    name: ConfigName,
    *,
    config_overrides: Optional[OpenSearchServerlessClientConfig] = None,
    description: Optional[ConfigDescription] = None,
    saml_options: Optional[SamlConfigOptions] = None,
    iam_identity_center_options: Optional[CreateIamIdentityCenterConfigOptions] = None,
    iam_federation_options: Optional[IamFederationConfigOptions] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateSecurityConfigResponse

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

Parameters:

  • type (SecurityConfigType) –

    The type of security configuration.

  • name (ConfigName) –

    The name of the security configuration.

  • description (Optional[ConfigDescription], default: None ) –

    A description of the security configuration.

  • saml_options (Optional[SamlConfigOptions], default: None ) –

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

  • iam_identity_center_options (Optional[CreateIamIdentityCenterConfigOptions], default: None ) –

    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.

  • iam_federation_options (Optional[IamFederationConfigOptions], default: None ) –

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

  • client_token (Optional[ClientToken], default: None ) –

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

Raises:

  • ConflictException –

    When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.

  • InternalServerException –

    Thrown when an error internal to the service occurs while processing a request.

  • ServiceQuotaExceededException –

    Thrown when you attempt to create more resources than the service allows based on service quotas.

  • ValidationException –

    Thrown when the HTTP request contains invalid input or is missing required input.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearchserverless/_services/open_search_serverless.py
def create_security_config(
    self,
    type: "capo_opensearchserverless.types.security_config_type.SecurityConfigType",
    name: "capo_opensearchserverless.types.config_name.ConfigName",
    *,
    config_overrides: Optional[OpenSearchServerlessClientConfig] = None,
    description: Optional[
        "capo_opensearchserverless.types.config_description.ConfigDescription"
    ] = None,
    saml_options: Optional[
        "capo_opensearchserverless.types.saml_config_options.SamlConfigOptions"
    ] = None,
    iam_identity_center_options: Optional[
        "capo_opensearchserverless.types.create_iam_identity_center_config_options.CreateIamIdentityCenterConfigOptions"
    ] = None,
    iam_federation_options: Optional[
        "capo_opensearchserverless.types.iam_federation_config_options.IamFederationConfigOptions"
    ] = None,
    client_token: Optional[
        "capo_opensearchserverless.types.client_token.ClientToken"
    ] = None,
) -> "capo_opensearchserverless.types.create_security_config_response.CreateSecurityConfigResponse":
    """<p>Specifies a security configuration for OpenSearch Serverless. For more information, see <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-saml.html">SAML authentication for Amazon OpenSearch Serverless</a>.</p>

    Args:
        type: <p>The type of security configuration.</p>
        name: <p>The name of the security configuration.</p>
        description: <p>A description of the security configuration.</p>
        saml_options: <p>Describes SAML options in the form of a key-value map. This field is required if you specify <code>SAML</code> for the <code>type</code> parameter.</p>
        iam_identity_center_options: <p>Describes IAM Identity Center options in the form of a key-value map. This field is required if you specify <code>iamidentitycenter</code> for the <code>type</code> parameter.</p>
        iam_federation_options: <p>Describes IAM federation options in the form of a key-value map. This field is required if you specify <code>iamFederation</code> for the <code>type</code> parameter.</p>
        client_token: <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>

    Raises:
        capo_opensearchserverless.errors.conflict_exception.ConflictException: <p>When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.</p>
        capo_opensearchserverless.errors.internal_server_exception.InternalServerException: <p>Thrown when an error internal to the service occurs while processing a request.</p>
        capo_opensearchserverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Thrown when you attempt to create more resources than the service allows based on service quotas.</p>
        capo_opensearchserverless.errors.validation_exception.ValidationException: <p>Thrown when the HTTP request contains invalid input or is missing required input.</p>
        capo_opensearchserverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_opensearchserverless.types.create_security_config_request.CreateSecurityConfigRequest]",
    ) -> OperationResponse[
        "capo_opensearchserverless.types.create_security_config_response.CreateSecurityConfigResponse"
    ]:
        import capo_opensearchserverless._operations.open_search_serverless.create_security_config

        output, http_response = (
            capo_opensearchserverless._operations.open_search_serverless.create_security_config.create_security_config(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSecurityConfig")
    )
    input_: capo_opensearchserverless.types.create_security_config_request.CreateSecurityConfigRequest = {
        "type": type,
        "name": name,
    }
    if description is not None:
        input_["description"] = description
    if saml_options is not None:
        input_["saml_options"] = saml_options
    if iam_identity_center_options is not None:
        input_["iam_identity_center_options"] = iam_identity_center_options
    if iam_federation_options is not None:
        input_["iam_federation_options"] = iam_federation_options
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output