{-# 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.IoTSiteWise.CreateAccessPolicy
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an access policy that grants the specified identity (Amazon Web
-- Services SSO user, Amazon Web Services SSO group, or IAM user) access to
-- the specified IoT SiteWise Monitor portal or project resource.
module Amazonka.IoTSiteWise.CreateAccessPolicy
  ( -- * Creating a Request
    CreateAccessPolicy (..),
    newCreateAccessPolicy,

    -- * Request Lenses
    createAccessPolicy_clientToken,
    createAccessPolicy_tags,
    createAccessPolicy_accessPolicyIdentity,
    createAccessPolicy_accessPolicyResource,
    createAccessPolicy_accessPolicyPermission,

    -- * Destructuring the Response
    CreateAccessPolicyResponse (..),
    newCreateAccessPolicyResponse,

    -- * Response Lenses
    createAccessPolicyResponse_httpStatus,
    createAccessPolicyResponse_accessPolicyId,
    createAccessPolicyResponse_accessPolicyArn,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateAccessPolicy' smart constructor.
data CreateAccessPolicy = CreateAccessPolicy'
  { -- | A unique case-sensitive identifier that you can provide to ensure the
    -- idempotency of the request. Don\'t reuse this client token if a new
    -- idempotent request is required.
    CreateAccessPolicy -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A list of key-value pairs that contain metadata for the access policy.
    -- For more information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
    -- in the /IoT SiteWise User Guide/.
    CreateAccessPolicy -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The identity for this access policy. Choose an Amazon Web Services SSO
    -- user, an Amazon Web Services SSO group, or an IAM user.
    CreateAccessPolicy -> Identity
accessPolicyIdentity :: Identity,
    -- | The IoT SiteWise Monitor resource for this access policy. Choose either
    -- a portal or a project.
    CreateAccessPolicy -> Resource
accessPolicyResource :: Resource,
    -- | The permission level for this access policy. Note that a project
    -- @ADMINISTRATOR@ is also known as a project owner.
    CreateAccessPolicy -> Permission
accessPolicyPermission :: Permission
  }
  deriving (CreateAccessPolicy -> CreateAccessPolicy -> Bool
(CreateAccessPolicy -> CreateAccessPolicy -> Bool)
-> (CreateAccessPolicy -> CreateAccessPolicy -> Bool)
-> Eq CreateAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessPolicy -> CreateAccessPolicy -> Bool
$c/= :: CreateAccessPolicy -> CreateAccessPolicy -> Bool
== :: CreateAccessPolicy -> CreateAccessPolicy -> Bool
$c== :: CreateAccessPolicy -> CreateAccessPolicy -> Bool
Prelude.Eq, ReadPrec [CreateAccessPolicy]
ReadPrec CreateAccessPolicy
Int -> ReadS CreateAccessPolicy
ReadS [CreateAccessPolicy]
(Int -> ReadS CreateAccessPolicy)
-> ReadS [CreateAccessPolicy]
-> ReadPrec CreateAccessPolicy
-> ReadPrec [CreateAccessPolicy]
-> Read CreateAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessPolicy]
$creadListPrec :: ReadPrec [CreateAccessPolicy]
readPrec :: ReadPrec CreateAccessPolicy
$creadPrec :: ReadPrec CreateAccessPolicy
readList :: ReadS [CreateAccessPolicy]
$creadList :: ReadS [CreateAccessPolicy]
readsPrec :: Int -> ReadS CreateAccessPolicy
$creadsPrec :: Int -> ReadS CreateAccessPolicy
Prelude.Read, Int -> CreateAccessPolicy -> ShowS
[CreateAccessPolicy] -> ShowS
CreateAccessPolicy -> String
(Int -> CreateAccessPolicy -> ShowS)
-> (CreateAccessPolicy -> String)
-> ([CreateAccessPolicy] -> ShowS)
-> Show CreateAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessPolicy] -> ShowS
$cshowList :: [CreateAccessPolicy] -> ShowS
show :: CreateAccessPolicy -> String
$cshow :: CreateAccessPolicy -> String
showsPrec :: Int -> CreateAccessPolicy -> ShowS
$cshowsPrec :: Int -> CreateAccessPolicy -> ShowS
Prelude.Show, (forall x. CreateAccessPolicy -> Rep CreateAccessPolicy x)
-> (forall x. Rep CreateAccessPolicy x -> CreateAccessPolicy)
-> Generic CreateAccessPolicy
forall x. Rep CreateAccessPolicy x -> CreateAccessPolicy
forall x. CreateAccessPolicy -> Rep CreateAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccessPolicy x -> CreateAccessPolicy
$cfrom :: forall x. CreateAccessPolicy -> Rep CreateAccessPolicy x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccessPolicy' 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:
--
-- 'clientToken', 'createAccessPolicy_clientToken' - A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
--
-- 'tags', 'createAccessPolicy_tags' - A list of key-value pairs that contain metadata for the access policy.
-- For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
-- in the /IoT SiteWise User Guide/.
--
-- 'accessPolicyIdentity', 'createAccessPolicy_accessPolicyIdentity' - The identity for this access policy. Choose an Amazon Web Services SSO
-- user, an Amazon Web Services SSO group, or an IAM user.
--
-- 'accessPolicyResource', 'createAccessPolicy_accessPolicyResource' - The IoT SiteWise Monitor resource for this access policy. Choose either
-- a portal or a project.
--
-- 'accessPolicyPermission', 'createAccessPolicy_accessPolicyPermission' - The permission level for this access policy. Note that a project
-- @ADMINISTRATOR@ is also known as a project owner.
newCreateAccessPolicy ::
  -- | 'accessPolicyIdentity'
  Identity ->
  -- | 'accessPolicyResource'
  Resource ->
  -- | 'accessPolicyPermission'
  Permission ->
  CreateAccessPolicy
newCreateAccessPolicy :: Identity -> Resource -> Permission -> CreateAccessPolicy
newCreateAccessPolicy
  Identity
pAccessPolicyIdentity_
  Resource
pAccessPolicyResource_
  Permission
pAccessPolicyPermission_ =
    CreateAccessPolicy' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Identity
-> Resource
-> Permission
-> CreateAccessPolicy
CreateAccessPolicy'
      { $sel:clientToken:CreateAccessPolicy' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateAccessPolicy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:accessPolicyIdentity:CreateAccessPolicy' :: Identity
accessPolicyIdentity = Identity
pAccessPolicyIdentity_,
        $sel:accessPolicyResource:CreateAccessPolicy' :: Resource
accessPolicyResource = Resource
pAccessPolicyResource_,
        $sel:accessPolicyPermission:CreateAccessPolicy' :: Permission
accessPolicyPermission = Permission
pAccessPolicyPermission_
      }

-- | A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
createAccessPolicy_clientToken :: Lens.Lens' CreateAccessPolicy (Prelude.Maybe Prelude.Text)
createAccessPolicy_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateAccessPolicy -> f CreateAccessPolicy
createAccessPolicy_clientToken = (CreateAccessPolicy -> Maybe Text)
-> (CreateAccessPolicy -> Maybe Text -> CreateAccessPolicy)
-> Lens
     CreateAccessPolicy CreateAccessPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicy' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateAccessPolicy' :: CreateAccessPolicy -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateAccessPolicy
s@CreateAccessPolicy' {} Maybe Text
a -> CreateAccessPolicy
s {$sel:clientToken:CreateAccessPolicy' :: Maybe Text
clientToken = Maybe Text
a} :: CreateAccessPolicy)

-- | A list of key-value pairs that contain metadata for the access policy.
-- For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
-- in the /IoT SiteWise User Guide/.
createAccessPolicy_tags :: Lens.Lens' CreateAccessPolicy (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createAccessPolicy_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAccessPolicy -> f CreateAccessPolicy
createAccessPolicy_tags = (CreateAccessPolicy -> Maybe (HashMap Text Text))
-> (CreateAccessPolicy
    -> Maybe (HashMap Text Text) -> CreateAccessPolicy)
-> Lens
     CreateAccessPolicy
     CreateAccessPolicy
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicy' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateAccessPolicy' :: CreateAccessPolicy -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateAccessPolicy
s@CreateAccessPolicy' {} Maybe (HashMap Text Text)
a -> CreateAccessPolicy
s {$sel:tags:CreateAccessPolicy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateAccessPolicy) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateAccessPolicy -> f CreateAccessPolicy)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAccessPolicy
-> f CreateAccessPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identity for this access policy. Choose an Amazon Web Services SSO
-- user, an Amazon Web Services SSO group, or an IAM user.
createAccessPolicy_accessPolicyIdentity :: Lens.Lens' CreateAccessPolicy Identity
createAccessPolicy_accessPolicyIdentity :: (Identity -> f Identity)
-> CreateAccessPolicy -> f CreateAccessPolicy
createAccessPolicy_accessPolicyIdentity = (CreateAccessPolicy -> Identity)
-> (CreateAccessPolicy -> Identity -> CreateAccessPolicy)
-> Lens CreateAccessPolicy CreateAccessPolicy Identity Identity
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicy' {Identity
accessPolicyIdentity :: Identity
$sel:accessPolicyIdentity:CreateAccessPolicy' :: CreateAccessPolicy -> Identity
accessPolicyIdentity} -> Identity
accessPolicyIdentity) (\s :: CreateAccessPolicy
s@CreateAccessPolicy' {} Identity
a -> CreateAccessPolicy
s {$sel:accessPolicyIdentity:CreateAccessPolicy' :: Identity
accessPolicyIdentity = Identity
a} :: CreateAccessPolicy)

-- | The IoT SiteWise Monitor resource for this access policy. Choose either
-- a portal or a project.
createAccessPolicy_accessPolicyResource :: Lens.Lens' CreateAccessPolicy Resource
createAccessPolicy_accessPolicyResource :: (Resource -> f Resource)
-> CreateAccessPolicy -> f CreateAccessPolicy
createAccessPolicy_accessPolicyResource = (CreateAccessPolicy -> Resource)
-> (CreateAccessPolicy -> Resource -> CreateAccessPolicy)
-> Lens CreateAccessPolicy CreateAccessPolicy Resource Resource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicy' {Resource
accessPolicyResource :: Resource
$sel:accessPolicyResource:CreateAccessPolicy' :: CreateAccessPolicy -> Resource
accessPolicyResource} -> Resource
accessPolicyResource) (\s :: CreateAccessPolicy
s@CreateAccessPolicy' {} Resource
a -> CreateAccessPolicy
s {$sel:accessPolicyResource:CreateAccessPolicy' :: Resource
accessPolicyResource = Resource
a} :: CreateAccessPolicy)

-- | The permission level for this access policy. Note that a project
-- @ADMINISTRATOR@ is also known as a project owner.
createAccessPolicy_accessPolicyPermission :: Lens.Lens' CreateAccessPolicy Permission
createAccessPolicy_accessPolicyPermission :: (Permission -> f Permission)
-> CreateAccessPolicy -> f CreateAccessPolicy
createAccessPolicy_accessPolicyPermission = (CreateAccessPolicy -> Permission)
-> (CreateAccessPolicy -> Permission -> CreateAccessPolicy)
-> Lens CreateAccessPolicy CreateAccessPolicy Permission Permission
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicy' {Permission
accessPolicyPermission :: Permission
$sel:accessPolicyPermission:CreateAccessPolicy' :: CreateAccessPolicy -> Permission
accessPolicyPermission} -> Permission
accessPolicyPermission) (\s :: CreateAccessPolicy
s@CreateAccessPolicy' {} Permission
a -> CreateAccessPolicy
s {$sel:accessPolicyPermission:CreateAccessPolicy' :: Permission
accessPolicyPermission = Permission
a} :: CreateAccessPolicy)

instance Core.AWSRequest CreateAccessPolicy where
  type
    AWSResponse CreateAccessPolicy =
      CreateAccessPolicyResponse
  request :: CreateAccessPolicy -> Request CreateAccessPolicy
request = Service -> CreateAccessPolicy -> Request CreateAccessPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateAccessPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAccessPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateAccessPolicy))
-> Logger
-> Service
-> Proxy CreateAccessPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAccessPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> Text -> CreateAccessPolicyResponse
CreateAccessPolicyResponse'
            (Int -> Text -> Text -> CreateAccessPolicyResponse)
-> Either String Int
-> Either String (Text -> Text -> CreateAccessPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Text -> Text -> CreateAccessPolicyResponse)
-> Either String Text
-> Either String (Text -> CreateAccessPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"accessPolicyId")
            Either String (Text -> CreateAccessPolicyResponse)
-> Either String Text -> Either String CreateAccessPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"accessPolicyArn")
      )

instance Prelude.Hashable CreateAccessPolicy

instance Prelude.NFData CreateAccessPolicy

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

instance Core.ToJSON CreateAccessPolicy where
  toJSON :: CreateAccessPolicy -> Value
toJSON CreateAccessPolicy' {Maybe Text
Maybe (HashMap Text Text)
Permission
Resource
Identity
accessPolicyPermission :: Permission
accessPolicyResource :: Resource
accessPolicyIdentity :: Identity
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:accessPolicyPermission:CreateAccessPolicy' :: CreateAccessPolicy -> Permission
$sel:accessPolicyResource:CreateAccessPolicy' :: CreateAccessPolicy -> Resource
$sel:accessPolicyIdentity:CreateAccessPolicy' :: CreateAccessPolicy -> Identity
$sel:tags:CreateAccessPolicy' :: CreateAccessPolicy -> Maybe (HashMap Text Text)
$sel:clientToken:CreateAccessPolicy' :: CreateAccessPolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"accessPolicyIdentity"
                  Text -> Identity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Identity
accessPolicyIdentity
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"accessPolicyResource"
                  Text -> Resource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Resource
accessPolicyResource
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"accessPolicyPermission"
                  Text -> Permission -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Permission
accessPolicyPermission
              )
          ]
      )

instance Core.ToPath CreateAccessPolicy where
  toPath :: CreateAccessPolicy -> ByteString
toPath = ByteString -> CreateAccessPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/access-policies"

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

-- | /See:/ 'newCreateAccessPolicyResponse' smart constructor.
data CreateAccessPolicyResponse = CreateAccessPolicyResponse'
  { -- | The response's http status code.
    CreateAccessPolicyResponse -> Int
httpStatus :: Prelude.Int,
    -- | The ID of the access policy.
    CreateAccessPolicyResponse -> Text
accessPolicyId :: Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the access policy, which has the following format.
    --
    -- @arn:${Partition}:iotsitewise:${Region}:${Account}:access-policy\/${AccessPolicyId}@
    CreateAccessPolicyResponse -> Text
accessPolicyArn :: Prelude.Text
  }
  deriving (CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool
(CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool)
-> (CreateAccessPolicyResponse
    -> CreateAccessPolicyResponse -> Bool)
-> Eq CreateAccessPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool
$c/= :: CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool
== :: CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool
$c== :: CreateAccessPolicyResponse -> CreateAccessPolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateAccessPolicyResponse]
ReadPrec CreateAccessPolicyResponse
Int -> ReadS CreateAccessPolicyResponse
ReadS [CreateAccessPolicyResponse]
(Int -> ReadS CreateAccessPolicyResponse)
-> ReadS [CreateAccessPolicyResponse]
-> ReadPrec CreateAccessPolicyResponse
-> ReadPrec [CreateAccessPolicyResponse]
-> Read CreateAccessPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessPolicyResponse]
$creadListPrec :: ReadPrec [CreateAccessPolicyResponse]
readPrec :: ReadPrec CreateAccessPolicyResponse
$creadPrec :: ReadPrec CreateAccessPolicyResponse
readList :: ReadS [CreateAccessPolicyResponse]
$creadList :: ReadS [CreateAccessPolicyResponse]
readsPrec :: Int -> ReadS CreateAccessPolicyResponse
$creadsPrec :: Int -> ReadS CreateAccessPolicyResponse
Prelude.Read, Int -> CreateAccessPolicyResponse -> ShowS
[CreateAccessPolicyResponse] -> ShowS
CreateAccessPolicyResponse -> String
(Int -> CreateAccessPolicyResponse -> ShowS)
-> (CreateAccessPolicyResponse -> String)
-> ([CreateAccessPolicyResponse] -> ShowS)
-> Show CreateAccessPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessPolicyResponse] -> ShowS
$cshowList :: [CreateAccessPolicyResponse] -> ShowS
show :: CreateAccessPolicyResponse -> String
$cshow :: CreateAccessPolicyResponse -> String
showsPrec :: Int -> CreateAccessPolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateAccessPolicyResponse -> ShowS
Prelude.Show, (forall x.
 CreateAccessPolicyResponse -> Rep CreateAccessPolicyResponse x)
-> (forall x.
    Rep CreateAccessPolicyResponse x -> CreateAccessPolicyResponse)
-> Generic CreateAccessPolicyResponse
forall x.
Rep CreateAccessPolicyResponse x -> CreateAccessPolicyResponse
forall x.
CreateAccessPolicyResponse -> Rep CreateAccessPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAccessPolicyResponse x -> CreateAccessPolicyResponse
$cfrom :: forall x.
CreateAccessPolicyResponse -> Rep CreateAccessPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccessPolicyResponse' 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:
--
-- 'httpStatus', 'createAccessPolicyResponse_httpStatus' - The response's http status code.
--
-- 'accessPolicyId', 'createAccessPolicyResponse_accessPolicyId' - The ID of the access policy.
--
-- 'accessPolicyArn', 'createAccessPolicyResponse_accessPolicyArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the access policy, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:access-policy\/${AccessPolicyId}@
newCreateAccessPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'accessPolicyId'
  Prelude.Text ->
  -- | 'accessPolicyArn'
  Prelude.Text ->
  CreateAccessPolicyResponse
newCreateAccessPolicyResponse :: Int -> Text -> Text -> CreateAccessPolicyResponse
newCreateAccessPolicyResponse
  Int
pHttpStatus_
  Text
pAccessPolicyId_
  Text
pAccessPolicyArn_ =
    CreateAccessPolicyResponse' :: Int -> Text -> Text -> CreateAccessPolicyResponse
CreateAccessPolicyResponse'
      { $sel:httpStatus:CreateAccessPolicyResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:accessPolicyId:CreateAccessPolicyResponse' :: Text
accessPolicyId = Text
pAccessPolicyId_,
        $sel:accessPolicyArn:CreateAccessPolicyResponse' :: Text
accessPolicyArn = Text
pAccessPolicyArn_
      }

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

-- | The ID of the access policy.
createAccessPolicyResponse_accessPolicyId :: Lens.Lens' CreateAccessPolicyResponse Prelude.Text
createAccessPolicyResponse_accessPolicyId :: (Text -> f Text)
-> CreateAccessPolicyResponse -> f CreateAccessPolicyResponse
createAccessPolicyResponse_accessPolicyId = (CreateAccessPolicyResponse -> Text)
-> (CreateAccessPolicyResponse
    -> Text -> CreateAccessPolicyResponse)
-> Lens
     CreateAccessPolicyResponse CreateAccessPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicyResponse' {Text
accessPolicyId :: Text
$sel:accessPolicyId:CreateAccessPolicyResponse' :: CreateAccessPolicyResponse -> Text
accessPolicyId} -> Text
accessPolicyId) (\s :: CreateAccessPolicyResponse
s@CreateAccessPolicyResponse' {} Text
a -> CreateAccessPolicyResponse
s {$sel:accessPolicyId:CreateAccessPolicyResponse' :: Text
accessPolicyId = Text
a} :: CreateAccessPolicyResponse)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the access policy, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:access-policy\/${AccessPolicyId}@
createAccessPolicyResponse_accessPolicyArn :: Lens.Lens' CreateAccessPolicyResponse Prelude.Text
createAccessPolicyResponse_accessPolicyArn :: (Text -> f Text)
-> CreateAccessPolicyResponse -> f CreateAccessPolicyResponse
createAccessPolicyResponse_accessPolicyArn = (CreateAccessPolicyResponse -> Text)
-> (CreateAccessPolicyResponse
    -> Text -> CreateAccessPolicyResponse)
-> Lens
     CreateAccessPolicyResponse CreateAccessPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPolicyResponse' {Text
accessPolicyArn :: Text
$sel:accessPolicyArn:CreateAccessPolicyResponse' :: CreateAccessPolicyResponse -> Text
accessPolicyArn} -> Text
accessPolicyArn) (\s :: CreateAccessPolicyResponse
s@CreateAccessPolicyResponse' {} Text
a -> CreateAccessPolicyResponse
s {$sel:accessPolicyArn:CreateAccessPolicyResponse' :: Text
accessPolicyArn = Text
a} :: CreateAccessPolicyResponse)

instance Prelude.NFData CreateAccessPolicyResponse