{-# 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.ListAssociations
(
ListAssociations (..),
newListAssociations,
listAssociations_associationFilterList,
listAssociations_maxResults,
listAssociations_nextToken,
ListAssociationsResponse (..),
newListAssociationsResponse,
listAssociationsResponse_associations,
listAssociationsResponse_nextToken,
listAssociationsResponse_httpStatus,
)
where
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
import Amazonka.SSM.Types
data ListAssociations = ListAssociations'
{
ListAssociations -> Maybe (NonEmpty AssociationFilter)
associationFilterList :: Prelude.Maybe (Prelude.NonEmpty AssociationFilter),
ListAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListAssociations -> ListAssociations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociations -> ListAssociations -> Bool
$c/= :: ListAssociations -> ListAssociations -> Bool
== :: ListAssociations -> ListAssociations -> Bool
$c== :: ListAssociations -> ListAssociations -> Bool
Prelude.Eq, ReadPrec [ListAssociations]
ReadPrec ListAssociations
Int -> ReadS ListAssociations
ReadS [ListAssociations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociations]
$creadListPrec :: ReadPrec [ListAssociations]
readPrec :: ReadPrec ListAssociations
$creadPrec :: ReadPrec ListAssociations
readList :: ReadS [ListAssociations]
$creadList :: ReadS [ListAssociations]
readsPrec :: Int -> ReadS ListAssociations
$creadsPrec :: Int -> ReadS ListAssociations
Prelude.Read, Int -> ListAssociations -> ShowS
[ListAssociations] -> ShowS
ListAssociations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociations] -> ShowS
$cshowList :: [ListAssociations] -> ShowS
show :: ListAssociations -> String
$cshow :: ListAssociations -> String
showsPrec :: Int -> ListAssociations -> ShowS
$cshowsPrec :: Int -> ListAssociations -> ShowS
Prelude.Show, forall x. Rep ListAssociations x -> ListAssociations
forall x. ListAssociations -> Rep ListAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssociations x -> ListAssociations
$cfrom :: forall x. ListAssociations -> Rep ListAssociations x
Prelude.Generic)
newListAssociations ::
ListAssociations
newListAssociations :: ListAssociations
newListAssociations =
ListAssociations'
{ $sel:associationFilterList:ListAssociations' :: Maybe (NonEmpty AssociationFilter)
associationFilterList =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAssociations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listAssociations_associationFilterList :: Lens.Lens' ListAssociations (Prelude.Maybe (Prelude.NonEmpty AssociationFilter))
listAssociations_associationFilterList :: Lens' ListAssociations (Maybe (NonEmpty AssociationFilter))
listAssociations_associationFilterList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe (NonEmpty AssociationFilter)
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
associationFilterList} -> Maybe (NonEmpty AssociationFilter)
associationFilterList) (\s :: ListAssociations
s@ListAssociations' {} Maybe (NonEmpty AssociationFilter)
a -> ListAssociations
s {$sel:associationFilterList:ListAssociations' :: Maybe (NonEmpty AssociationFilter)
associationFilterList = Maybe (NonEmpty AssociationFilter)
a} :: ListAssociations) 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
listAssociations_maxResults :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Natural)
listAssociations_maxResults :: Lens' ListAssociations (Maybe Natural)
listAssociations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAssociations
s@ListAssociations' {} Maybe Natural
a -> ListAssociations
s {$sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAssociations)
listAssociations_nextToken :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_nextToken :: Lens' ListAssociations (Maybe Text)
listAssociations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:nextToken:ListAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociations)
instance Core.AWSPager ListAssociations where
page :: ListAssociations
-> AWSResponse ListAssociations -> Maybe ListAssociations
page ListAssociations
rq AWSResponse ListAssociations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe [Association])
listAssociationsResponse_associations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListAssociations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAssociations (Maybe Text)
listAssociations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListAssociations where
type
AWSResponse ListAssociations =
ListAssociationsResponse
request :: (Service -> Service)
-> ListAssociations -> Request ListAssociations
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAssociations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssociations)))
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 [Association]
-> Maybe Text -> Int -> ListAssociationsResponse
ListAssociationsResponse'
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
"Associations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"NextToken")
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 ListAssociations where
hashWithSalt :: Int -> ListAssociations -> Int
hashWithSalt Int
_salt ListAssociations' {Maybe Natural
Maybe (NonEmpty AssociationFilter)
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty AssociationFilter)
associationFilterList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListAssociations where
rnf :: ListAssociations -> ()
rnf ListAssociations' {Maybe Natural
Maybe (NonEmpty AssociationFilter)
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty AssociationFilter)
associationFilterList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListAssociations where
toHeaders :: ListAssociations -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AmazonSSM.ListAssociations" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListAssociations where
toJSON :: ListAssociations -> Value
toJSON ListAssociations' {Maybe Natural
Maybe (NonEmpty AssociationFilter)
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AssociationFilterList" 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 (NonEmpty AssociationFilter)
associationFilterList,
(Key
"MaxResults" 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 Natural
maxResults,
(Key
"NextToken" 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
nextToken
]
)
instance Data.ToPath ListAssociations where
toPath :: ListAssociations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListAssociations where
toQuery :: ListAssociations -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListAssociationsResponse = ListAssociationsResponse'
{
ListAssociationsResponse -> Maybe [Association]
associations :: Prelude.Maybe [Association],
ListAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAssociationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAssociationsResponse -> ListAssociationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssociationsResponse]
ReadPrec ListAssociationsResponse
Int -> ReadS ListAssociationsResponse
ReadS [ListAssociationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociationsResponse]
$creadListPrec :: ReadPrec [ListAssociationsResponse]
readPrec :: ReadPrec ListAssociationsResponse
$creadPrec :: ReadPrec ListAssociationsResponse
readList :: ReadS [ListAssociationsResponse]
$creadList :: ReadS [ListAssociationsResponse]
readsPrec :: Int -> ReadS ListAssociationsResponse
$creadsPrec :: Int -> ReadS ListAssociationsResponse
Prelude.Read, Int -> ListAssociationsResponse -> ShowS
[ListAssociationsResponse] -> ShowS
ListAssociationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociationsResponse] -> ShowS
$cshowList :: [ListAssociationsResponse] -> ShowS
show :: ListAssociationsResponse -> String
$cshow :: ListAssociationsResponse -> String
showsPrec :: Int -> ListAssociationsResponse -> ShowS
$cshowsPrec :: Int -> ListAssociationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
$cfrom :: forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
Prelude.Generic)
newListAssociationsResponse ::
Prelude.Int ->
ListAssociationsResponse
newListAssociationsResponse :: Int -> ListAssociationsResponse
newListAssociationsResponse Int
pHttpStatus_ =
ListAssociationsResponse'
{ $sel:associations:ListAssociationsResponse' :: Maybe [Association]
associations =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAssociationsResponse_associations :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe [Association])
listAssociationsResponse_associations :: Lens' ListAssociationsResponse (Maybe [Association])
listAssociationsResponse_associations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe [Association]
associations :: Maybe [Association]
$sel:associations:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe [Association]
associations} -> Maybe [Association]
associations) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe [Association]
a -> ListAssociationsResponse
s {$sel:associations:ListAssociationsResponse' :: Maybe [Association]
associations = Maybe [Association]
a} :: ListAssociationsResponse) 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
listAssociationsResponse_nextToken :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe Prelude.Text)
listAssociationsResponse_nextToken :: Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe Text
a -> ListAssociationsResponse
s {$sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociationsResponse)
listAssociationsResponse_httpStatus :: Lens.Lens' ListAssociationsResponse Prelude.Int
listAssociationsResponse_httpStatus :: Lens' ListAssociationsResponse Int
listAssociationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAssociationsResponse' :: ListAssociationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Int
a -> ListAssociationsResponse
s {$sel:httpStatus:ListAssociationsResponse' :: Int
httpStatus = Int
a} :: ListAssociationsResponse)
instance Prelude.NFData ListAssociationsResponse where
rnf :: ListAssociationsResponse -> ()
rnf ListAssociationsResponse' {Int
Maybe [Association]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
associations :: Maybe [Association]
$sel:httpStatus:ListAssociationsResponse' :: ListAssociationsResponse -> Int
$sel:nextToken:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe Text
$sel:associations:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe [Association]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Association]
associations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus