{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.CloudDirectory.CreateSchema -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a new schema in a development state. A schema can exist in three -- phases: -- -- - /Development:/ This is a mutable phase of the schema. All new -- schemas are in the development phase. Once the schema is finalized, -- it can be published. -- -- - /Published:/ Published schemas are immutable and have a version -- associated with them. -- -- - /Applied:/ Applied schemas are mutable in a way that allows you to -- add new schema facets. You can also add new, nonrequired attributes -- to existing schema facets. You can apply only published schemas to -- directories. module Amazonka.CloudDirectory.CreateSchema ( -- * Creating a Request CreateSchema (..), newCreateSchema, -- * Request Lenses createSchema_name, -- * Destructuring the Response CreateSchemaResponse (..), newCreateSchemaResponse, -- * Response Lenses createSchemaResponse_schemaArn, createSchemaResponse_httpStatus, ) where import Amazonka.CloudDirectory.Types import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newCreateSchema' smart constructor. data CreateSchema = CreateSchema' { -- | The name that is associated with the schema. This is unique to each -- account and in each region. name :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateSchema' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'name', 'createSchema_name' - The name that is associated with the schema. This is unique to each -- account and in each region. newCreateSchema :: -- | 'name' Prelude.Text -> CreateSchema newCreateSchema pName_ = CreateSchema' {name = pName_} -- | The name that is associated with the schema. This is unique to each -- account and in each region. createSchema_name :: Lens.Lens' CreateSchema Prelude.Text createSchema_name = Lens.lens (\CreateSchema' {name} -> name) (\s@CreateSchema' {} a -> s {name = a} :: CreateSchema) instance Core.AWSRequest CreateSchema where type AWSResponse CreateSchema = CreateSchemaResponse request overrides = Request.putJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> CreateSchemaResponse' Prelude.<$> (x Data..?> "SchemaArn") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateSchema where hashWithSalt _salt CreateSchema' {..} = _salt `Prelude.hashWithSalt` name instance Prelude.NFData CreateSchema where rnf CreateSchema' {..} = Prelude.rnf name instance Data.ToHeaders CreateSchema where toHeaders = Prelude.const Prelude.mempty instance Data.ToJSON CreateSchema where toJSON CreateSchema' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("Name" Data..= name)] ) instance Data.ToPath CreateSchema where toPath = Prelude.const "/amazonclouddirectory/2017-01-11/schema/create" instance Data.ToQuery CreateSchema where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreateSchemaResponse' smart constructor. data CreateSchemaResponse = CreateSchemaResponse' { -- | The Amazon Resource Name (ARN) that is associated with the schema. For -- more information, see arns. schemaArn :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateSchemaResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'schemaArn', 'createSchemaResponse_schemaArn' - The Amazon Resource Name (ARN) that is associated with the schema. For -- more information, see arns. -- -- 'httpStatus', 'createSchemaResponse_httpStatus' - The response's http status code. newCreateSchemaResponse :: -- | 'httpStatus' Prelude.Int -> CreateSchemaResponse newCreateSchemaResponse pHttpStatus_ = CreateSchemaResponse' { schemaArn = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The Amazon Resource Name (ARN) that is associated with the schema. For -- more information, see arns. createSchemaResponse_schemaArn :: Lens.Lens' CreateSchemaResponse (Prelude.Maybe Prelude.Text) createSchemaResponse_schemaArn = Lens.lens (\CreateSchemaResponse' {schemaArn} -> schemaArn) (\s@CreateSchemaResponse' {} a -> s {schemaArn = a} :: CreateSchemaResponse) -- | The response's http status code. createSchemaResponse_httpStatus :: Lens.Lens' CreateSchemaResponse Prelude.Int createSchemaResponse_httpStatus = Lens.lens (\CreateSchemaResponse' {httpStatus} -> httpStatus) (\s@CreateSchemaResponse' {} a -> s {httpStatus = a} :: CreateSchemaResponse) instance Prelude.NFData CreateSchemaResponse where rnf CreateSchemaResponse' {..} = Prelude.rnf schemaArn `Prelude.seq` Prelude.rnf httpStatus