{-# 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.SSM.GetParameters
(
GetParameters (..),
newGetParameters,
getParameters_withDecryption,
getParameters_names,
GetParametersResponse (..),
newGetParametersResponse,
getParametersResponse_parameters,
getParametersResponse_invalidParameters,
getParametersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types
data GetParameters = GetParameters'
{
GetParameters -> Maybe Bool
withDecryption :: Prelude.Maybe Prelude.Bool,
GetParameters -> NonEmpty Text
names :: Prelude.NonEmpty Prelude.Text
}
deriving (GetParameters -> GetParameters -> Bool
(GetParameters -> GetParameters -> Bool)
-> (GetParameters -> GetParameters -> Bool) -> Eq GetParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetParameters -> GetParameters -> Bool
$c/= :: GetParameters -> GetParameters -> Bool
== :: GetParameters -> GetParameters -> Bool
$c== :: GetParameters -> GetParameters -> Bool
Prelude.Eq, ReadPrec [GetParameters]
ReadPrec GetParameters
Int -> ReadS GetParameters
ReadS [GetParameters]
(Int -> ReadS GetParameters)
-> ReadS [GetParameters]
-> ReadPrec GetParameters
-> ReadPrec [GetParameters]
-> Read GetParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetParameters]
$creadListPrec :: ReadPrec [GetParameters]
readPrec :: ReadPrec GetParameters
$creadPrec :: ReadPrec GetParameters
readList :: ReadS [GetParameters]
$creadList :: ReadS [GetParameters]
readsPrec :: Int -> ReadS GetParameters
$creadsPrec :: Int -> ReadS GetParameters
Prelude.Read, Int -> GetParameters -> ShowS
[GetParameters] -> ShowS
GetParameters -> String
(Int -> GetParameters -> ShowS)
-> (GetParameters -> String)
-> ([GetParameters] -> ShowS)
-> Show GetParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetParameters] -> ShowS
$cshowList :: [GetParameters] -> ShowS
show :: GetParameters -> String
$cshow :: GetParameters -> String
showsPrec :: Int -> GetParameters -> ShowS
$cshowsPrec :: Int -> GetParameters -> ShowS
Prelude.Show, (forall x. GetParameters -> Rep GetParameters x)
-> (forall x. Rep GetParameters x -> GetParameters)
-> Generic GetParameters
forall x. Rep GetParameters x -> GetParameters
forall x. GetParameters -> Rep GetParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetParameters x -> GetParameters
$cfrom :: forall x. GetParameters -> Rep GetParameters x
Prelude.Generic)
newGetParameters ::
Prelude.NonEmpty Prelude.Text ->
GetParameters
newGetParameters :: NonEmpty Text -> GetParameters
newGetParameters NonEmpty Text
pNames_ =
GetParameters' :: Maybe Bool -> NonEmpty Text -> GetParameters
GetParameters'
{ $sel:withDecryption:GetParameters' :: Maybe Bool
withDecryption = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:names:GetParameters' :: NonEmpty Text
names = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pNames_
}
getParameters_withDecryption :: Lens.Lens' GetParameters (Prelude.Maybe Prelude.Bool)
getParameters_withDecryption :: (Maybe Bool -> f (Maybe Bool)) -> GetParameters -> f GetParameters
getParameters_withDecryption = (GetParameters -> Maybe Bool)
-> (GetParameters -> Maybe Bool -> GetParameters)
-> Lens GetParameters GetParameters (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetParameters' {Maybe Bool
withDecryption :: Maybe Bool
$sel:withDecryption:GetParameters' :: GetParameters -> Maybe Bool
withDecryption} -> Maybe Bool
withDecryption) (\s :: GetParameters
s@GetParameters' {} Maybe Bool
a -> GetParameters
s {$sel:withDecryption:GetParameters' :: Maybe Bool
withDecryption = Maybe Bool
a} :: GetParameters)
getParameters_names :: Lens.Lens' GetParameters (Prelude.NonEmpty Prelude.Text)
getParameters_names :: (NonEmpty Text -> f (NonEmpty Text))
-> GetParameters -> f GetParameters
getParameters_names = (GetParameters -> NonEmpty Text)
-> (GetParameters -> NonEmpty Text -> GetParameters)
-> Lens GetParameters GetParameters (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetParameters' {NonEmpty Text
names :: NonEmpty Text
$sel:names:GetParameters' :: GetParameters -> NonEmpty Text
names} -> NonEmpty Text
names) (\s :: GetParameters
s@GetParameters' {} NonEmpty Text
a -> GetParameters
s {$sel:names:GetParameters' :: NonEmpty Text
names = NonEmpty Text
a} :: GetParameters) ((NonEmpty Text -> f (NonEmpty Text))
-> GetParameters -> f GetParameters)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> GetParameters
-> f GetParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetParameters where
type
AWSResponse GetParameters =
GetParametersResponse
request :: GetParameters -> Request GetParameters
request = Service -> GetParameters -> Request GetParameters
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetParameters
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetParameters)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetParameters))
-> Logger
-> Service
-> Proxy GetParameters
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetParameters)))
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 [Parameter] -> Maybe [Text] -> Int -> GetParametersResponse
GetParametersResponse'
(Maybe [Parameter] -> Maybe [Text] -> Int -> GetParametersResponse)
-> Either String (Maybe [Parameter])
-> Either String (Maybe [Text] -> Int -> GetParametersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Parameter]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Parameters" Either String (Maybe (Maybe [Parameter]))
-> Maybe [Parameter] -> Either String (Maybe [Parameter])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Parameter]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe [Text] -> Int -> GetParametersResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> GetParametersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InvalidParameters"
Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetParametersResponse)
-> Either String Int -> Either String GetParametersResponse
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 GetParameters
instance Prelude.NFData GetParameters
instance Core.ToHeaders GetParameters where
toHeaders :: GetParameters -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetParameters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AmazonSSM.GetParameters" :: Prelude.ByteString),
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 GetParameters where
toJSON :: GetParameters -> Value
toJSON GetParameters' {Maybe Bool
NonEmpty Text
names :: NonEmpty Text
withDecryption :: Maybe Bool
$sel:names:GetParameters' :: GetParameters -> NonEmpty Text
$sel:withDecryption:GetParameters' :: GetParameters -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"WithDecryption" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
withDecryption,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Names" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
names)
]
)
instance Core.ToPath GetParameters where
toPath :: GetParameters -> ByteString
toPath = ByteString -> GetParameters -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetParameters where
toQuery :: GetParameters -> QueryString
toQuery = QueryString -> GetParameters -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetParametersResponse = GetParametersResponse'
{
GetParametersResponse -> Maybe [Parameter]
parameters :: Prelude.Maybe [Parameter],
GetParametersResponse -> Maybe [Text]
invalidParameters :: Prelude.Maybe [Prelude.Text],
GetParametersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetParametersResponse -> GetParametersResponse -> Bool
(GetParametersResponse -> GetParametersResponse -> Bool)
-> (GetParametersResponse -> GetParametersResponse -> Bool)
-> Eq GetParametersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetParametersResponse -> GetParametersResponse -> Bool
$c/= :: GetParametersResponse -> GetParametersResponse -> Bool
== :: GetParametersResponse -> GetParametersResponse -> Bool
$c== :: GetParametersResponse -> GetParametersResponse -> Bool
Prelude.Eq, Int -> GetParametersResponse -> ShowS
[GetParametersResponse] -> ShowS
GetParametersResponse -> String
(Int -> GetParametersResponse -> ShowS)
-> (GetParametersResponse -> String)
-> ([GetParametersResponse] -> ShowS)
-> Show GetParametersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetParametersResponse] -> ShowS
$cshowList :: [GetParametersResponse] -> ShowS
show :: GetParametersResponse -> String
$cshow :: GetParametersResponse -> String
showsPrec :: Int -> GetParametersResponse -> ShowS
$cshowsPrec :: Int -> GetParametersResponse -> ShowS
Prelude.Show, (forall x. GetParametersResponse -> Rep GetParametersResponse x)
-> (forall x. Rep GetParametersResponse x -> GetParametersResponse)
-> Generic GetParametersResponse
forall x. Rep GetParametersResponse x -> GetParametersResponse
forall x. GetParametersResponse -> Rep GetParametersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetParametersResponse x -> GetParametersResponse
$cfrom :: forall x. GetParametersResponse -> Rep GetParametersResponse x
Prelude.Generic)
newGetParametersResponse ::
Prelude.Int ->
GetParametersResponse
newGetParametersResponse :: Int -> GetParametersResponse
newGetParametersResponse Int
pHttpStatus_ =
GetParametersResponse' :: Maybe [Parameter] -> Maybe [Text] -> Int -> GetParametersResponse
GetParametersResponse'
{ $sel:parameters:GetParametersResponse' :: Maybe [Parameter]
parameters =
Maybe [Parameter]
forall a. Maybe a
Prelude.Nothing,
$sel:invalidParameters:GetParametersResponse' :: Maybe [Text]
invalidParameters = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetParametersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getParametersResponse_parameters :: Lens.Lens' GetParametersResponse (Prelude.Maybe [Parameter])
getParametersResponse_parameters :: (Maybe [Parameter] -> f (Maybe [Parameter]))
-> GetParametersResponse -> f GetParametersResponse
getParametersResponse_parameters = (GetParametersResponse -> Maybe [Parameter])
-> (GetParametersResponse
-> Maybe [Parameter] -> GetParametersResponse)
-> Lens
GetParametersResponse
GetParametersResponse
(Maybe [Parameter])
(Maybe [Parameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetParametersResponse' {Maybe [Parameter]
parameters :: Maybe [Parameter]
$sel:parameters:GetParametersResponse' :: GetParametersResponse -> Maybe [Parameter]
parameters} -> Maybe [Parameter]
parameters) (\s :: GetParametersResponse
s@GetParametersResponse' {} Maybe [Parameter]
a -> GetParametersResponse
s {$sel:parameters:GetParametersResponse' :: Maybe [Parameter]
parameters = Maybe [Parameter]
a} :: GetParametersResponse) ((Maybe [Parameter] -> f (Maybe [Parameter]))
-> GetParametersResponse -> f GetParametersResponse)
-> ((Maybe [Parameter] -> f (Maybe [Parameter]))
-> Maybe [Parameter] -> f (Maybe [Parameter]))
-> (Maybe [Parameter] -> f (Maybe [Parameter]))
-> GetParametersResponse
-> f GetParametersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Parameter] [Parameter] [Parameter] [Parameter]
-> Iso
(Maybe [Parameter])
(Maybe [Parameter])
(Maybe [Parameter])
(Maybe [Parameter])
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 [Parameter] [Parameter] [Parameter] [Parameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getParametersResponse_invalidParameters :: Lens.Lens' GetParametersResponse (Prelude.Maybe [Prelude.Text])
getParametersResponse_invalidParameters :: (Maybe [Text] -> f (Maybe [Text]))
-> GetParametersResponse -> f GetParametersResponse
getParametersResponse_invalidParameters = (GetParametersResponse -> Maybe [Text])
-> (GetParametersResponse -> Maybe [Text] -> GetParametersResponse)
-> Lens
GetParametersResponse
GetParametersResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetParametersResponse' {Maybe [Text]
invalidParameters :: Maybe [Text]
$sel:invalidParameters:GetParametersResponse' :: GetParametersResponse -> Maybe [Text]
invalidParameters} -> Maybe [Text]
invalidParameters) (\s :: GetParametersResponse
s@GetParametersResponse' {} Maybe [Text]
a -> GetParametersResponse
s {$sel:invalidParameters:GetParametersResponse' :: Maybe [Text]
invalidParameters = Maybe [Text]
a} :: GetParametersResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> GetParametersResponse -> f GetParametersResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetParametersResponse
-> f GetParametersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getParametersResponse_httpStatus :: Lens.Lens' GetParametersResponse Prelude.Int
getParametersResponse_httpStatus :: (Int -> f Int) -> GetParametersResponse -> f GetParametersResponse
getParametersResponse_httpStatus = (GetParametersResponse -> Int)
-> (GetParametersResponse -> Int -> GetParametersResponse)
-> Lens GetParametersResponse GetParametersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetParametersResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetParametersResponse' :: GetParametersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetParametersResponse
s@GetParametersResponse' {} Int
a -> GetParametersResponse
s {$sel:httpStatus:GetParametersResponse' :: Int
httpStatus = Int
a} :: GetParametersResponse)
instance Prelude.NFData GetParametersResponse