{-# 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.Connect.CreateSecurityProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Creates a security profile.
module Amazonka.Connect.CreateSecurityProfile
  ( -- * Creating a Request
    CreateSecurityProfile (..),
    newCreateSecurityProfile,

    -- * Request Lenses
    createSecurityProfile_allowedAccessControlTags,
    createSecurityProfile_description,
    createSecurityProfile_permissions,
    createSecurityProfile_tagRestrictedResources,
    createSecurityProfile_tags,
    createSecurityProfile_securityProfileName,
    createSecurityProfile_instanceId,

    -- * Destructuring the Response
    CreateSecurityProfileResponse (..),
    newCreateSecurityProfileResponse,

    -- * Response Lenses
    createSecurityProfileResponse_securityProfileArn,
    createSecurityProfileResponse_securityProfileId,
    createSecurityProfileResponse_httpStatus,
  )
where

import Amazonka.Connect.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:/ 'newCreateSecurityProfile' smart constructor.
data CreateSecurityProfile = CreateSecurityProfile'
  { -- | The list of tags that a security profile uses to restrict access to
    -- resources in Amazon Connect.
    CreateSecurityProfile -> Maybe (HashMap Text Text)
allowedAccessControlTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The description of the security profile.
    CreateSecurityProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Permissions assigned to the security profile. For a list of valid
    -- permissions, see
    -- <https://docs.aws.amazon.com/connect/latest/adminguide/security-profile-list.html List of security profile permissions>.
    CreateSecurityProfile -> Maybe [Text]
permissions :: Prelude.Maybe [Prelude.Text],
    -- | The list of resources that a security profile applies tag restrictions
    -- to in Amazon Connect. Following are acceptable ResourceNames: @User@ |
    -- @SecurityProfile@ | @Queue@ | @RoutingProfile@
    CreateSecurityProfile -> Maybe [Text]
tagRestrictedResources :: Prelude.Maybe [Prelude.Text],
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    CreateSecurityProfile -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the security profile.
    CreateSecurityProfile -> Text
securityProfileName :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    CreateSecurityProfile -> Text
instanceId :: Prelude.Text
  }
  deriving (CreateSecurityProfile -> CreateSecurityProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecurityProfile -> CreateSecurityProfile -> Bool
$c/= :: CreateSecurityProfile -> CreateSecurityProfile -> Bool
== :: CreateSecurityProfile -> CreateSecurityProfile -> Bool
$c== :: CreateSecurityProfile -> CreateSecurityProfile -> Bool
Prelude.Eq, ReadPrec [CreateSecurityProfile]
ReadPrec CreateSecurityProfile
Int -> ReadS CreateSecurityProfile
ReadS [CreateSecurityProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSecurityProfile]
$creadListPrec :: ReadPrec [CreateSecurityProfile]
readPrec :: ReadPrec CreateSecurityProfile
$creadPrec :: ReadPrec CreateSecurityProfile
readList :: ReadS [CreateSecurityProfile]
$creadList :: ReadS [CreateSecurityProfile]
readsPrec :: Int -> ReadS CreateSecurityProfile
$creadsPrec :: Int -> ReadS CreateSecurityProfile
Prelude.Read, Int -> CreateSecurityProfile -> ShowS
[CreateSecurityProfile] -> ShowS
CreateSecurityProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecurityProfile] -> ShowS
$cshowList :: [CreateSecurityProfile] -> ShowS
show :: CreateSecurityProfile -> String
$cshow :: CreateSecurityProfile -> String
showsPrec :: Int -> CreateSecurityProfile -> ShowS
$cshowsPrec :: Int -> CreateSecurityProfile -> ShowS
Prelude.Show, forall x. Rep CreateSecurityProfile x -> CreateSecurityProfile
forall x. CreateSecurityProfile -> Rep CreateSecurityProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSecurityProfile x -> CreateSecurityProfile
$cfrom :: forall x. CreateSecurityProfile -> Rep CreateSecurityProfile x
Prelude.Generic)

-- |
-- Create a value of 'CreateSecurityProfile' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'allowedAccessControlTags', 'createSecurityProfile_allowedAccessControlTags' - The list of tags that a security profile uses to restrict access to
-- resources in Amazon Connect.
--
-- 'description', 'createSecurityProfile_description' - The description of the security profile.
--
-- 'permissions', 'createSecurityProfile_permissions' - Permissions assigned to the security profile. For a list of valid
-- permissions, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/security-profile-list.html List of security profile permissions>.
--
-- 'tagRestrictedResources', 'createSecurityProfile_tagRestrictedResources' - The list of resources that a security profile applies tag restrictions
-- to in Amazon Connect. Following are acceptable ResourceNames: @User@ |
-- @SecurityProfile@ | @Queue@ | @RoutingProfile@
--
-- 'tags', 'createSecurityProfile_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
--
-- 'securityProfileName', 'createSecurityProfile_securityProfileName' - The name of the security profile.
--
-- 'instanceId', 'createSecurityProfile_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newCreateSecurityProfile ::
  -- | 'securityProfileName'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  CreateSecurityProfile
newCreateSecurityProfile :: Text -> Text -> CreateSecurityProfile
newCreateSecurityProfile
  Text
pSecurityProfileName_
  Text
pInstanceId_ =
    CreateSecurityProfile'
      { $sel:allowedAccessControlTags:CreateSecurityProfile' :: Maybe (HashMap Text Text)
allowedAccessControlTags =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateSecurityProfile' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:permissions:CreateSecurityProfile' :: Maybe [Text]
permissions = forall a. Maybe a
Prelude.Nothing,
        $sel:tagRestrictedResources:CreateSecurityProfile' :: Maybe [Text]
tagRestrictedResources = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateSecurityProfile' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:securityProfileName:CreateSecurityProfile' :: Text
securityProfileName = Text
pSecurityProfileName_,
        $sel:instanceId:CreateSecurityProfile' :: Text
instanceId = Text
pInstanceId_
      }

-- | The list of tags that a security profile uses to restrict access to
-- resources in Amazon Connect.
createSecurityProfile_allowedAccessControlTags :: Lens.Lens' CreateSecurityProfile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSecurityProfile_allowedAccessControlTags :: Lens' CreateSecurityProfile (Maybe (HashMap Text Text))
createSecurityProfile_allowedAccessControlTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Maybe (HashMap Text Text)
allowedAccessControlTags :: Maybe (HashMap Text Text)
$sel:allowedAccessControlTags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
allowedAccessControlTags} -> Maybe (HashMap Text Text)
allowedAccessControlTags) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Maybe (HashMap Text Text)
a -> CreateSecurityProfile
s {$sel:allowedAccessControlTags:CreateSecurityProfile' :: Maybe (HashMap Text Text)
allowedAccessControlTags = Maybe (HashMap Text Text)
a} :: CreateSecurityProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The description of the security profile.
createSecurityProfile_description :: Lens.Lens' CreateSecurityProfile (Prelude.Maybe Prelude.Text)
createSecurityProfile_description :: Lens' CreateSecurityProfile (Maybe Text)
createSecurityProfile_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Maybe Text
description :: Maybe Text
$sel:description:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Maybe Text
a -> CreateSecurityProfile
s {$sel:description:CreateSecurityProfile' :: Maybe Text
description = Maybe Text
a} :: CreateSecurityProfile)

-- | Permissions assigned to the security profile. For a list of valid
-- permissions, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/security-profile-list.html List of security profile permissions>.
createSecurityProfile_permissions :: Lens.Lens' CreateSecurityProfile (Prelude.Maybe [Prelude.Text])
createSecurityProfile_permissions :: Lens' CreateSecurityProfile (Maybe [Text])
createSecurityProfile_permissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Maybe [Text]
permissions :: Maybe [Text]
$sel:permissions:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
permissions} -> Maybe [Text]
permissions) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Maybe [Text]
a -> CreateSecurityProfile
s {$sel:permissions:CreateSecurityProfile' :: Maybe [Text]
permissions = Maybe [Text]
a} :: CreateSecurityProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of resources that a security profile applies tag restrictions
-- to in Amazon Connect. Following are acceptable ResourceNames: @User@ |
-- @SecurityProfile@ | @Queue@ | @RoutingProfile@
createSecurityProfile_tagRestrictedResources :: Lens.Lens' CreateSecurityProfile (Prelude.Maybe [Prelude.Text])
createSecurityProfile_tagRestrictedResources :: Lens' CreateSecurityProfile (Maybe [Text])
createSecurityProfile_tagRestrictedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Maybe [Text]
tagRestrictedResources :: Maybe [Text]
$sel:tagRestrictedResources:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
tagRestrictedResources} -> Maybe [Text]
tagRestrictedResources) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Maybe [Text]
a -> CreateSecurityProfile
s {$sel:tagRestrictedResources:CreateSecurityProfile' :: Maybe [Text]
tagRestrictedResources = Maybe [Text]
a} :: CreateSecurityProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
createSecurityProfile_tags :: Lens.Lens' CreateSecurityProfile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSecurityProfile_tags :: Lens' CreateSecurityProfile (Maybe (HashMap Text Text))
createSecurityProfile_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Maybe (HashMap Text Text)
a -> CreateSecurityProfile
s {$sel:tags:CreateSecurityProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSecurityProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the security profile.
createSecurityProfile_securityProfileName :: Lens.Lens' CreateSecurityProfile Prelude.Text
createSecurityProfile_securityProfileName :: Lens' CreateSecurityProfile Text
createSecurityProfile_securityProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Text
securityProfileName :: Text
$sel:securityProfileName:CreateSecurityProfile' :: CreateSecurityProfile -> Text
securityProfileName} -> Text
securityProfileName) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Text
a -> CreateSecurityProfile
s {$sel:securityProfileName:CreateSecurityProfile' :: Text
securityProfileName = Text
a} :: CreateSecurityProfile)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
createSecurityProfile_instanceId :: Lens.Lens' CreateSecurityProfile Prelude.Text
createSecurityProfile_instanceId :: Lens' CreateSecurityProfile Text
createSecurityProfile_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfile' {Text
instanceId :: Text
$sel:instanceId:CreateSecurityProfile' :: CreateSecurityProfile -> Text
instanceId} -> Text
instanceId) (\s :: CreateSecurityProfile
s@CreateSecurityProfile' {} Text
a -> CreateSecurityProfile
s {$sel:instanceId:CreateSecurityProfile' :: Text
instanceId = Text
a} :: CreateSecurityProfile)

instance Core.AWSRequest CreateSecurityProfile where
  type
    AWSResponse CreateSecurityProfile =
      CreateSecurityProfileResponse
  request :: (Service -> Service)
-> CreateSecurityProfile -> Request CreateSecurityProfile
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSecurityProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSecurityProfile)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> CreateSecurityProfileResponse
CreateSecurityProfileResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SecurityProfileArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SecurityProfileId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateSecurityProfile where
  hashWithSalt :: Int -> CreateSecurityProfile -> Int
hashWithSalt Int
_salt CreateSecurityProfile' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
instanceId :: Text
securityProfileName :: Text
tags :: Maybe (HashMap Text Text)
tagRestrictedResources :: Maybe [Text]
permissions :: Maybe [Text]
description :: Maybe Text
allowedAccessControlTags :: Maybe (HashMap Text Text)
$sel:instanceId:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:securityProfileName:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:tags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
$sel:tagRestrictedResources:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:permissions:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:description:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe Text
$sel:allowedAccessControlTags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
allowedAccessControlTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
permissions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tagRestrictedResources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
securityProfileName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData CreateSecurityProfile where
  rnf :: CreateSecurityProfile -> ()
rnf CreateSecurityProfile' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
instanceId :: Text
securityProfileName :: Text
tags :: Maybe (HashMap Text Text)
tagRestrictedResources :: Maybe [Text]
permissions :: Maybe [Text]
description :: Maybe Text
allowedAccessControlTags :: Maybe (HashMap Text Text)
$sel:instanceId:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:securityProfileName:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:tags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
$sel:tagRestrictedResources:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:permissions:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:description:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe Text
$sel:allowedAccessControlTags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
allowedAccessControlTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
permissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tagRestrictedResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
securityProfileName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

instance Data.ToHeaders CreateSecurityProfile where
  toHeaders :: CreateSecurityProfile -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateSecurityProfile where
  toJSON :: CreateSecurityProfile -> Value
toJSON CreateSecurityProfile' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
instanceId :: Text
securityProfileName :: Text
tags :: Maybe (HashMap Text Text)
tagRestrictedResources :: Maybe [Text]
permissions :: Maybe [Text]
description :: Maybe Text
allowedAccessControlTags :: Maybe (HashMap Text Text)
$sel:instanceId:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:securityProfileName:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:tags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
$sel:tagRestrictedResources:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:permissions:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:description:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe Text
$sel:allowedAccessControlTags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AllowedAccessControlTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
allowedAccessControlTags,
            (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"Permissions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
permissions,
            (Key
"TagRestrictedResources" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagRestrictedResources,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"SecurityProfileName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
securityProfileName)
          ]
      )

instance Data.ToPath CreateSecurityProfile where
  toPath :: CreateSecurityProfile -> ByteString
toPath CreateSecurityProfile' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
instanceId :: Text
securityProfileName :: Text
tags :: Maybe (HashMap Text Text)
tagRestrictedResources :: Maybe [Text]
permissions :: Maybe [Text]
description :: Maybe Text
allowedAccessControlTags :: Maybe (HashMap Text Text)
$sel:instanceId:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:securityProfileName:CreateSecurityProfile' :: CreateSecurityProfile -> Text
$sel:tags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
$sel:tagRestrictedResources:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:permissions:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe [Text]
$sel:description:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe Text
$sel:allowedAccessControlTags:CreateSecurityProfile' :: CreateSecurityProfile -> Maybe (HashMap Text Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/security-profiles/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId]

instance Data.ToQuery CreateSecurityProfile where
  toQuery :: CreateSecurityProfile -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateSecurityProfileResponse' smart constructor.
data CreateSecurityProfileResponse = CreateSecurityProfileResponse'
  { -- | The Amazon Resource Name (ARN) for the security profile.
    CreateSecurityProfileResponse -> Maybe Text
securityProfileArn :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the security profle.
    CreateSecurityProfileResponse -> Maybe Text
securityProfileId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateSecurityProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSecurityProfileResponse
-> CreateSecurityProfileResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecurityProfileResponse
-> CreateSecurityProfileResponse -> Bool
$c/= :: CreateSecurityProfileResponse
-> CreateSecurityProfileResponse -> Bool
== :: CreateSecurityProfileResponse
-> CreateSecurityProfileResponse -> Bool
$c== :: CreateSecurityProfileResponse
-> CreateSecurityProfileResponse -> Bool
Prelude.Eq, ReadPrec [CreateSecurityProfileResponse]
ReadPrec CreateSecurityProfileResponse
Int -> ReadS CreateSecurityProfileResponse
ReadS [CreateSecurityProfileResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSecurityProfileResponse]
$creadListPrec :: ReadPrec [CreateSecurityProfileResponse]
readPrec :: ReadPrec CreateSecurityProfileResponse
$creadPrec :: ReadPrec CreateSecurityProfileResponse
readList :: ReadS [CreateSecurityProfileResponse]
$creadList :: ReadS [CreateSecurityProfileResponse]
readsPrec :: Int -> ReadS CreateSecurityProfileResponse
$creadsPrec :: Int -> ReadS CreateSecurityProfileResponse
Prelude.Read, Int -> CreateSecurityProfileResponse -> ShowS
[CreateSecurityProfileResponse] -> ShowS
CreateSecurityProfileResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecurityProfileResponse] -> ShowS
$cshowList :: [CreateSecurityProfileResponse] -> ShowS
show :: CreateSecurityProfileResponse -> String
$cshow :: CreateSecurityProfileResponse -> String
showsPrec :: Int -> CreateSecurityProfileResponse -> ShowS
$cshowsPrec :: Int -> CreateSecurityProfileResponse -> ShowS
Prelude.Show, forall x.
Rep CreateSecurityProfileResponse x
-> CreateSecurityProfileResponse
forall x.
CreateSecurityProfileResponse
-> Rep CreateSecurityProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSecurityProfileResponse x
-> CreateSecurityProfileResponse
$cfrom :: forall x.
CreateSecurityProfileResponse
-> Rep CreateSecurityProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSecurityProfileResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'securityProfileArn', 'createSecurityProfileResponse_securityProfileArn' - The Amazon Resource Name (ARN) for the security profile.
--
-- 'securityProfileId', 'createSecurityProfileResponse_securityProfileId' - The identifier for the security profle.
--
-- 'httpStatus', 'createSecurityProfileResponse_httpStatus' - The response's http status code.
newCreateSecurityProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSecurityProfileResponse
newCreateSecurityProfileResponse :: Int -> CreateSecurityProfileResponse
newCreateSecurityProfileResponse Int
pHttpStatus_ =
  CreateSecurityProfileResponse'
    { $sel:securityProfileArn:CreateSecurityProfileResponse' :: Maybe Text
securityProfileArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityProfileId:CreateSecurityProfileResponse' :: Maybe Text
securityProfileId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSecurityProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) for the security profile.
createSecurityProfileResponse_securityProfileArn :: Lens.Lens' CreateSecurityProfileResponse (Prelude.Maybe Prelude.Text)
createSecurityProfileResponse_securityProfileArn :: Lens' CreateSecurityProfileResponse (Maybe Text)
createSecurityProfileResponse_securityProfileArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfileResponse' {Maybe Text
securityProfileArn :: Maybe Text
$sel:securityProfileArn:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Maybe Text
securityProfileArn} -> Maybe Text
securityProfileArn) (\s :: CreateSecurityProfileResponse
s@CreateSecurityProfileResponse' {} Maybe Text
a -> CreateSecurityProfileResponse
s {$sel:securityProfileArn:CreateSecurityProfileResponse' :: Maybe Text
securityProfileArn = Maybe Text
a} :: CreateSecurityProfileResponse)

-- | The identifier for the security profle.
createSecurityProfileResponse_securityProfileId :: Lens.Lens' CreateSecurityProfileResponse (Prelude.Maybe Prelude.Text)
createSecurityProfileResponse_securityProfileId :: Lens' CreateSecurityProfileResponse (Maybe Text)
createSecurityProfileResponse_securityProfileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfileResponse' {Maybe Text
securityProfileId :: Maybe Text
$sel:securityProfileId:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Maybe Text
securityProfileId} -> Maybe Text
securityProfileId) (\s :: CreateSecurityProfileResponse
s@CreateSecurityProfileResponse' {} Maybe Text
a -> CreateSecurityProfileResponse
s {$sel:securityProfileId:CreateSecurityProfileResponse' :: Maybe Text
securityProfileId = Maybe Text
a} :: CreateSecurityProfileResponse)

-- | The response's http status code.
createSecurityProfileResponse_httpStatus :: Lens.Lens' CreateSecurityProfileResponse Prelude.Int
createSecurityProfileResponse_httpStatus :: Lens' CreateSecurityProfileResponse Int
createSecurityProfileResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSecurityProfileResponse
s@CreateSecurityProfileResponse' {} Int
a -> CreateSecurityProfileResponse
s {$sel:httpStatus:CreateSecurityProfileResponse' :: Int
httpStatus = Int
a} :: CreateSecurityProfileResponse)

instance Prelude.NFData CreateSecurityProfileResponse where
  rnf :: CreateSecurityProfileResponse -> ()
rnf CreateSecurityProfileResponse' {Int
Maybe Text
httpStatus :: Int
securityProfileId :: Maybe Text
securityProfileArn :: Maybe Text
$sel:httpStatus:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Int
$sel:securityProfileId:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Maybe Text
$sel:securityProfileArn:CreateSecurityProfileResponse' :: CreateSecurityProfileResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
securityProfileArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
securityProfileId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus