{-# 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 #-}
module Amazonka.EKS.AssociateEncryptionConfig
(
AssociateEncryptionConfig (..),
newAssociateEncryptionConfig,
associateEncryptionConfig_clientRequestToken,
associateEncryptionConfig_clusterName,
associateEncryptionConfig_encryptionConfig,
AssociateEncryptionConfigResponse (..),
newAssociateEncryptionConfigResponse,
associateEncryptionConfigResponse_update,
associateEncryptionConfigResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EKS.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
data AssociateEncryptionConfig = AssociateEncryptionConfig'
{
AssociateEncryptionConfig -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
AssociateEncryptionConfig -> Text
clusterName :: Prelude.Text,
AssociateEncryptionConfig -> [EncryptionConfig]
encryptionConfig :: [EncryptionConfig]
}
deriving (AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool
(AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool)
-> (AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool)
-> Eq AssociateEncryptionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool
$c/= :: AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool
== :: AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool
$c== :: AssociateEncryptionConfig -> AssociateEncryptionConfig -> Bool
Prelude.Eq, ReadPrec [AssociateEncryptionConfig]
ReadPrec AssociateEncryptionConfig
Int -> ReadS AssociateEncryptionConfig
ReadS [AssociateEncryptionConfig]
(Int -> ReadS AssociateEncryptionConfig)
-> ReadS [AssociateEncryptionConfig]
-> ReadPrec AssociateEncryptionConfig
-> ReadPrec [AssociateEncryptionConfig]
-> Read AssociateEncryptionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateEncryptionConfig]
$creadListPrec :: ReadPrec [AssociateEncryptionConfig]
readPrec :: ReadPrec AssociateEncryptionConfig
$creadPrec :: ReadPrec AssociateEncryptionConfig
readList :: ReadS [AssociateEncryptionConfig]
$creadList :: ReadS [AssociateEncryptionConfig]
readsPrec :: Int -> ReadS AssociateEncryptionConfig
$creadsPrec :: Int -> ReadS AssociateEncryptionConfig
Prelude.Read, Int -> AssociateEncryptionConfig -> ShowS
[AssociateEncryptionConfig] -> ShowS
AssociateEncryptionConfig -> String
(Int -> AssociateEncryptionConfig -> ShowS)
-> (AssociateEncryptionConfig -> String)
-> ([AssociateEncryptionConfig] -> ShowS)
-> Show AssociateEncryptionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateEncryptionConfig] -> ShowS
$cshowList :: [AssociateEncryptionConfig] -> ShowS
show :: AssociateEncryptionConfig -> String
$cshow :: AssociateEncryptionConfig -> String
showsPrec :: Int -> AssociateEncryptionConfig -> ShowS
$cshowsPrec :: Int -> AssociateEncryptionConfig -> ShowS
Prelude.Show, (forall x.
AssociateEncryptionConfig -> Rep AssociateEncryptionConfig x)
-> (forall x.
Rep AssociateEncryptionConfig x -> AssociateEncryptionConfig)
-> Generic AssociateEncryptionConfig
forall x.
Rep AssociateEncryptionConfig x -> AssociateEncryptionConfig
forall x.
AssociateEncryptionConfig -> Rep AssociateEncryptionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateEncryptionConfig x -> AssociateEncryptionConfig
$cfrom :: forall x.
AssociateEncryptionConfig -> Rep AssociateEncryptionConfig x
Prelude.Generic)
newAssociateEncryptionConfig ::
Prelude.Text ->
AssociateEncryptionConfig
newAssociateEncryptionConfig :: Text -> AssociateEncryptionConfig
newAssociateEncryptionConfig Text
pClusterName_ =
AssociateEncryptionConfig' :: Maybe Text
-> Text -> [EncryptionConfig] -> AssociateEncryptionConfig
AssociateEncryptionConfig'
{ $sel:clientRequestToken:AssociateEncryptionConfig' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterName:AssociateEncryptionConfig' :: Text
clusterName = Text
pClusterName_,
$sel:encryptionConfig:AssociateEncryptionConfig' :: [EncryptionConfig]
encryptionConfig = [EncryptionConfig]
forall a. Monoid a => a
Prelude.mempty
}
associateEncryptionConfig_clientRequestToken :: Lens.Lens' AssociateEncryptionConfig (Prelude.Maybe Prelude.Text)
associateEncryptionConfig_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> AssociateEncryptionConfig -> f AssociateEncryptionConfig
associateEncryptionConfig_clientRequestToken = (AssociateEncryptionConfig -> Maybe Text)
-> (AssociateEncryptionConfig
-> Maybe Text -> AssociateEncryptionConfig)
-> Lens
AssociateEncryptionConfig
AssociateEncryptionConfig
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateEncryptionConfig' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: AssociateEncryptionConfig
s@AssociateEncryptionConfig' {} Maybe Text
a -> AssociateEncryptionConfig
s {$sel:clientRequestToken:AssociateEncryptionConfig' :: Maybe Text
clientRequestToken = Maybe Text
a} :: AssociateEncryptionConfig)
associateEncryptionConfig_clusterName :: Lens.Lens' AssociateEncryptionConfig Prelude.Text
associateEncryptionConfig_clusterName :: (Text -> f Text)
-> AssociateEncryptionConfig -> f AssociateEncryptionConfig
associateEncryptionConfig_clusterName = (AssociateEncryptionConfig -> Text)
-> (AssociateEncryptionConfig -> Text -> AssociateEncryptionConfig)
-> Lens
AssociateEncryptionConfig AssociateEncryptionConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateEncryptionConfig' {Text
clusterName :: Text
$sel:clusterName:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Text
clusterName} -> Text
clusterName) (\s :: AssociateEncryptionConfig
s@AssociateEncryptionConfig' {} Text
a -> AssociateEncryptionConfig
s {$sel:clusterName:AssociateEncryptionConfig' :: Text
clusterName = Text
a} :: AssociateEncryptionConfig)
associateEncryptionConfig_encryptionConfig :: Lens.Lens' AssociateEncryptionConfig [EncryptionConfig]
associateEncryptionConfig_encryptionConfig :: ([EncryptionConfig] -> f [EncryptionConfig])
-> AssociateEncryptionConfig -> f AssociateEncryptionConfig
associateEncryptionConfig_encryptionConfig = (AssociateEncryptionConfig -> [EncryptionConfig])
-> (AssociateEncryptionConfig
-> [EncryptionConfig] -> AssociateEncryptionConfig)
-> Lens
AssociateEncryptionConfig
AssociateEncryptionConfig
[EncryptionConfig]
[EncryptionConfig]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateEncryptionConfig' {[EncryptionConfig]
encryptionConfig :: [EncryptionConfig]
$sel:encryptionConfig:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> [EncryptionConfig]
encryptionConfig} -> [EncryptionConfig]
encryptionConfig) (\s :: AssociateEncryptionConfig
s@AssociateEncryptionConfig' {} [EncryptionConfig]
a -> AssociateEncryptionConfig
s {$sel:encryptionConfig:AssociateEncryptionConfig' :: [EncryptionConfig]
encryptionConfig = [EncryptionConfig]
a} :: AssociateEncryptionConfig) (([EncryptionConfig] -> f [EncryptionConfig])
-> AssociateEncryptionConfig -> f AssociateEncryptionConfig)
-> (([EncryptionConfig] -> f [EncryptionConfig])
-> [EncryptionConfig] -> f [EncryptionConfig])
-> ([EncryptionConfig] -> f [EncryptionConfig])
-> AssociateEncryptionConfig
-> f AssociateEncryptionConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EncryptionConfig] -> f [EncryptionConfig])
-> [EncryptionConfig] -> f [EncryptionConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AssociateEncryptionConfig where
type
AWSResponse AssociateEncryptionConfig =
AssociateEncryptionConfigResponse
request :: AssociateEncryptionConfig -> Request AssociateEncryptionConfig
request = Service
-> AssociateEncryptionConfig -> Request AssociateEncryptionConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateEncryptionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateEncryptionConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateEncryptionConfig))
-> Logger
-> Service
-> Proxy AssociateEncryptionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateEncryptionConfig)))
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 ->
Maybe Update -> Int -> AssociateEncryptionConfigResponse
AssociateEncryptionConfigResponse'
(Maybe Update -> Int -> AssociateEncryptionConfigResponse)
-> Either String (Maybe Update)
-> Either String (Int -> AssociateEncryptionConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Update)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"update")
Either String (Int -> AssociateEncryptionConfigResponse)
-> Either String Int
-> Either String AssociateEncryptionConfigResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable AssociateEncryptionConfig
instance Prelude.NFData AssociateEncryptionConfig
instance Core.ToHeaders AssociateEncryptionConfig where
toHeaders :: AssociateEncryptionConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateEncryptionConfig -> 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 AssociateEncryptionConfig where
toJSON :: AssociateEncryptionConfig -> Value
toJSON AssociateEncryptionConfig' {[EncryptionConfig]
Maybe Text
Text
encryptionConfig :: [EncryptionConfig]
clusterName :: Text
clientRequestToken :: Maybe Text
$sel:encryptionConfig:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> [EncryptionConfig]
$sel:clusterName:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Text
$sel:clientRequestToken:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientRequestToken" 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
clientRequestToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"encryptionConfig" Text -> [EncryptionConfig] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [EncryptionConfig]
encryptionConfig)
]
)
instance Core.ToPath AssociateEncryptionConfig where
toPath :: AssociateEncryptionConfig -> ByteString
toPath AssociateEncryptionConfig' {[EncryptionConfig]
Maybe Text
Text
encryptionConfig :: [EncryptionConfig]
clusterName :: Text
clientRequestToken :: Maybe Text
$sel:encryptionConfig:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> [EncryptionConfig]
$sel:clusterName:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Text
$sel:clientRequestToken:AssociateEncryptionConfig' :: AssociateEncryptionConfig -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/clusters/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clusterName,
ByteString
"/encryption-config/associate"
]
instance Core.ToQuery AssociateEncryptionConfig where
toQuery :: AssociateEncryptionConfig -> QueryString
toQuery = QueryString -> AssociateEncryptionConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateEncryptionConfigResponse = AssociateEncryptionConfigResponse'
{ AssociateEncryptionConfigResponse -> Maybe Update
update :: Prelude.Maybe Update,
AssociateEncryptionConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool
(AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool)
-> (AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool)
-> Eq AssociateEncryptionConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool
$c/= :: AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool
== :: AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool
$c== :: AssociateEncryptionConfigResponse
-> AssociateEncryptionConfigResponse -> Bool
Prelude.Eq, ReadPrec [AssociateEncryptionConfigResponse]
ReadPrec AssociateEncryptionConfigResponse
Int -> ReadS AssociateEncryptionConfigResponse
ReadS [AssociateEncryptionConfigResponse]
(Int -> ReadS AssociateEncryptionConfigResponse)
-> ReadS [AssociateEncryptionConfigResponse]
-> ReadPrec AssociateEncryptionConfigResponse
-> ReadPrec [AssociateEncryptionConfigResponse]
-> Read AssociateEncryptionConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateEncryptionConfigResponse]
$creadListPrec :: ReadPrec [AssociateEncryptionConfigResponse]
readPrec :: ReadPrec AssociateEncryptionConfigResponse
$creadPrec :: ReadPrec AssociateEncryptionConfigResponse
readList :: ReadS [AssociateEncryptionConfigResponse]
$creadList :: ReadS [AssociateEncryptionConfigResponse]
readsPrec :: Int -> ReadS AssociateEncryptionConfigResponse
$creadsPrec :: Int -> ReadS AssociateEncryptionConfigResponse
Prelude.Read, Int -> AssociateEncryptionConfigResponse -> ShowS
[AssociateEncryptionConfigResponse] -> ShowS
AssociateEncryptionConfigResponse -> String
(Int -> AssociateEncryptionConfigResponse -> ShowS)
-> (AssociateEncryptionConfigResponse -> String)
-> ([AssociateEncryptionConfigResponse] -> ShowS)
-> Show AssociateEncryptionConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateEncryptionConfigResponse] -> ShowS
$cshowList :: [AssociateEncryptionConfigResponse] -> ShowS
show :: AssociateEncryptionConfigResponse -> String
$cshow :: AssociateEncryptionConfigResponse -> String
showsPrec :: Int -> AssociateEncryptionConfigResponse -> ShowS
$cshowsPrec :: Int -> AssociateEncryptionConfigResponse -> ShowS
Prelude.Show, (forall x.
AssociateEncryptionConfigResponse
-> Rep AssociateEncryptionConfigResponse x)
-> (forall x.
Rep AssociateEncryptionConfigResponse x
-> AssociateEncryptionConfigResponse)
-> Generic AssociateEncryptionConfigResponse
forall x.
Rep AssociateEncryptionConfigResponse x
-> AssociateEncryptionConfigResponse
forall x.
AssociateEncryptionConfigResponse
-> Rep AssociateEncryptionConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateEncryptionConfigResponse x
-> AssociateEncryptionConfigResponse
$cfrom :: forall x.
AssociateEncryptionConfigResponse
-> Rep AssociateEncryptionConfigResponse x
Prelude.Generic)
newAssociateEncryptionConfigResponse ::
Prelude.Int ->
AssociateEncryptionConfigResponse
newAssociateEncryptionConfigResponse :: Int -> AssociateEncryptionConfigResponse
newAssociateEncryptionConfigResponse Int
pHttpStatus_ =
AssociateEncryptionConfigResponse' :: Maybe Update -> Int -> AssociateEncryptionConfigResponse
AssociateEncryptionConfigResponse'
{ $sel:update:AssociateEncryptionConfigResponse' :: Maybe Update
update =
Maybe Update
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateEncryptionConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateEncryptionConfigResponse_update :: Lens.Lens' AssociateEncryptionConfigResponse (Prelude.Maybe Update)
associateEncryptionConfigResponse_update :: (Maybe Update -> f (Maybe Update))
-> AssociateEncryptionConfigResponse
-> f AssociateEncryptionConfigResponse
associateEncryptionConfigResponse_update = (AssociateEncryptionConfigResponse -> Maybe Update)
-> (AssociateEncryptionConfigResponse
-> Maybe Update -> AssociateEncryptionConfigResponse)
-> Lens
AssociateEncryptionConfigResponse
AssociateEncryptionConfigResponse
(Maybe Update)
(Maybe Update)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateEncryptionConfigResponse' {Maybe Update
update :: Maybe Update
$sel:update:AssociateEncryptionConfigResponse' :: AssociateEncryptionConfigResponse -> Maybe Update
update} -> Maybe Update
update) (\s :: AssociateEncryptionConfigResponse
s@AssociateEncryptionConfigResponse' {} Maybe Update
a -> AssociateEncryptionConfigResponse
s {$sel:update:AssociateEncryptionConfigResponse' :: Maybe Update
update = Maybe Update
a} :: AssociateEncryptionConfigResponse)
associateEncryptionConfigResponse_httpStatus :: Lens.Lens' AssociateEncryptionConfigResponse Prelude.Int
associateEncryptionConfigResponse_httpStatus :: (Int -> f Int)
-> AssociateEncryptionConfigResponse
-> f AssociateEncryptionConfigResponse
associateEncryptionConfigResponse_httpStatus = (AssociateEncryptionConfigResponse -> Int)
-> (AssociateEncryptionConfigResponse
-> Int -> AssociateEncryptionConfigResponse)
-> Lens
AssociateEncryptionConfigResponse
AssociateEncryptionConfigResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateEncryptionConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateEncryptionConfigResponse' :: AssociateEncryptionConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateEncryptionConfigResponse
s@AssociateEncryptionConfigResponse' {} Int
a -> AssociateEncryptionConfigResponse
s {$sel:httpStatus:AssociateEncryptionConfigResponse' :: Int
httpStatus = Int
a} :: AssociateEncryptionConfigResponse)
instance
Prelude.NFData
AssociateEncryptionConfigResponse