{-# 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.DescribeAssociation
(
DescribeAssociation (..),
newDescribeAssociation,
describeAssociation_associationId,
describeAssociation_instanceId,
describeAssociation_name,
describeAssociation_associationVersion,
DescribeAssociationResponse (..),
newDescribeAssociationResponse,
describeAssociationResponse_associationDescription,
describeAssociationResponse_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 DescribeAssociation = DescribeAssociation'
{
DescribeAssociation -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
DescribeAssociation -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
DescribeAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DescribeAssociation -> Maybe Text
associationVersion :: Prelude.Maybe Prelude.Text
}
deriving (DescribeAssociation -> DescribeAssociation -> Bool
(DescribeAssociation -> DescribeAssociation -> Bool)
-> (DescribeAssociation -> DescribeAssociation -> Bool)
-> Eq DescribeAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAssociation -> DescribeAssociation -> Bool
$c/= :: DescribeAssociation -> DescribeAssociation -> Bool
== :: DescribeAssociation -> DescribeAssociation -> Bool
$c== :: DescribeAssociation -> DescribeAssociation -> Bool
Prelude.Eq, ReadPrec [DescribeAssociation]
ReadPrec DescribeAssociation
Int -> ReadS DescribeAssociation
ReadS [DescribeAssociation]
(Int -> ReadS DescribeAssociation)
-> ReadS [DescribeAssociation]
-> ReadPrec DescribeAssociation
-> ReadPrec [DescribeAssociation]
-> Read DescribeAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAssociation]
$creadListPrec :: ReadPrec [DescribeAssociation]
readPrec :: ReadPrec DescribeAssociation
$creadPrec :: ReadPrec DescribeAssociation
readList :: ReadS [DescribeAssociation]
$creadList :: ReadS [DescribeAssociation]
readsPrec :: Int -> ReadS DescribeAssociation
$creadsPrec :: Int -> ReadS DescribeAssociation
Prelude.Read, Int -> DescribeAssociation -> ShowS
[DescribeAssociation] -> ShowS
DescribeAssociation -> String
(Int -> DescribeAssociation -> ShowS)
-> (DescribeAssociation -> String)
-> ([DescribeAssociation] -> ShowS)
-> Show DescribeAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAssociation] -> ShowS
$cshowList :: [DescribeAssociation] -> ShowS
show :: DescribeAssociation -> String
$cshow :: DescribeAssociation -> String
showsPrec :: Int -> DescribeAssociation -> ShowS
$cshowsPrec :: Int -> DescribeAssociation -> ShowS
Prelude.Show, (forall x. DescribeAssociation -> Rep DescribeAssociation x)
-> (forall x. Rep DescribeAssociation x -> DescribeAssociation)
-> Generic DescribeAssociation
forall x. Rep DescribeAssociation x -> DescribeAssociation
forall x. DescribeAssociation -> Rep DescribeAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAssociation x -> DescribeAssociation
$cfrom :: forall x. DescribeAssociation -> Rep DescribeAssociation x
Prelude.Generic)
newDescribeAssociation ::
DescribeAssociation
newDescribeAssociation :: DescribeAssociation
newDescribeAssociation =
DescribeAssociation' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> DescribeAssociation
DescribeAssociation'
{ $sel:associationId:DescribeAssociation' :: Maybe Text
associationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:DescribeAssociation' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DescribeAssociation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:associationVersion:DescribeAssociation' :: Maybe Text
associationVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeAssociation_associationId :: Lens.Lens' DescribeAssociation (Prelude.Maybe Prelude.Text)
describeAssociation_associationId :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociation -> f DescribeAssociation
describeAssociation_associationId = (DescribeAssociation -> Maybe Text)
-> (DescribeAssociation -> Maybe Text -> DescribeAssociation)
-> Lens
DescribeAssociation DescribeAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociation' {Maybe Text
associationId :: Maybe Text
$sel:associationId:DescribeAssociation' :: DescribeAssociation -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: DescribeAssociation
s@DescribeAssociation' {} Maybe Text
a -> DescribeAssociation
s {$sel:associationId:DescribeAssociation' :: Maybe Text
associationId = Maybe Text
a} :: DescribeAssociation)
describeAssociation_instanceId :: Lens.Lens' DescribeAssociation (Prelude.Maybe Prelude.Text)
describeAssociation_instanceId :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociation -> f DescribeAssociation
describeAssociation_instanceId = (DescribeAssociation -> Maybe Text)
-> (DescribeAssociation -> Maybe Text -> DescribeAssociation)
-> Lens
DescribeAssociation DescribeAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociation' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:DescribeAssociation' :: DescribeAssociation -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: DescribeAssociation
s@DescribeAssociation' {} Maybe Text
a -> DescribeAssociation
s {$sel:instanceId:DescribeAssociation' :: Maybe Text
instanceId = Maybe Text
a} :: DescribeAssociation)
describeAssociation_name :: Lens.Lens' DescribeAssociation (Prelude.Maybe Prelude.Text)
describeAssociation_name :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociation -> f DescribeAssociation
describeAssociation_name = (DescribeAssociation -> Maybe Text)
-> (DescribeAssociation -> Maybe Text -> DescribeAssociation)
-> Lens
DescribeAssociation DescribeAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociation' {Maybe Text
name :: Maybe Text
$sel:name:DescribeAssociation' :: DescribeAssociation -> Maybe Text
name} -> Maybe Text
name) (\s :: DescribeAssociation
s@DescribeAssociation' {} Maybe Text
a -> DescribeAssociation
s {$sel:name:DescribeAssociation' :: Maybe Text
name = Maybe Text
a} :: DescribeAssociation)
describeAssociation_associationVersion :: Lens.Lens' DescribeAssociation (Prelude.Maybe Prelude.Text)
describeAssociation_associationVersion :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociation -> f DescribeAssociation
describeAssociation_associationVersion = (DescribeAssociation -> Maybe Text)
-> (DescribeAssociation -> Maybe Text -> DescribeAssociation)
-> Lens
DescribeAssociation DescribeAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociation' {Maybe Text
associationVersion :: Maybe Text
$sel:associationVersion:DescribeAssociation' :: DescribeAssociation -> Maybe Text
associationVersion} -> Maybe Text
associationVersion) (\s :: DescribeAssociation
s@DescribeAssociation' {} Maybe Text
a -> DescribeAssociation
s {$sel:associationVersion:DescribeAssociation' :: Maybe Text
associationVersion = Maybe Text
a} :: DescribeAssociation)
instance Core.AWSRequest DescribeAssociation where
type
AWSResponse DescribeAssociation =
DescribeAssociationResponse
request :: DescribeAssociation -> Request DescribeAssociation
request = Service -> DescribeAssociation -> Request DescribeAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeAssociation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAssociation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeAssociation))
-> Logger
-> Service
-> Proxy DescribeAssociation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAssociation)))
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 AssociationDescription -> Int -> DescribeAssociationResponse
DescribeAssociationResponse'
(Maybe AssociationDescription
-> Int -> DescribeAssociationResponse)
-> Either String (Maybe AssociationDescription)
-> Either String (Int -> DescribeAssociationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AssociationDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AssociationDescription")
Either String (Int -> DescribeAssociationResponse)
-> Either String Int -> Either String DescribeAssociationResponse
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 DescribeAssociation
instance Prelude.NFData DescribeAssociation
instance Core.ToHeaders DescribeAssociation where
toHeaders :: DescribeAssociation -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeAssociation -> 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.DescribeAssociation" ::
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 DescribeAssociation where
toJSON :: DescribeAssociation -> Value
toJSON DescribeAssociation' {Maybe Text
associationVersion :: Maybe Text
name :: Maybe Text
instanceId :: Maybe Text
associationId :: Maybe Text
$sel:associationVersion:DescribeAssociation' :: DescribeAssociation -> Maybe Text
$sel:name:DescribeAssociation' :: DescribeAssociation -> Maybe Text
$sel:instanceId:DescribeAssociation' :: DescribeAssociation -> Maybe Text
$sel:associationId:DescribeAssociation' :: DescribeAssociation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AssociationId" 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
associationId,
(Text
"InstanceId" 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
instanceId,
(Text
"Name" 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
name,
(Text
"AssociationVersion" 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
associationVersion
]
)
instance Core.ToPath DescribeAssociation where
toPath :: DescribeAssociation -> ByteString
toPath = ByteString -> DescribeAssociation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeAssociation where
toQuery :: DescribeAssociation -> QueryString
toQuery = QueryString -> DescribeAssociation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeAssociationResponse = DescribeAssociationResponse'
{
DescribeAssociationResponse -> Maybe AssociationDescription
associationDescription :: Prelude.Maybe AssociationDescription,
DescribeAssociationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeAssociationResponse -> DescribeAssociationResponse -> Bool
(DescribeAssociationResponse
-> DescribeAssociationResponse -> Bool)
-> (DescribeAssociationResponse
-> DescribeAssociationResponse -> Bool)
-> Eq DescribeAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAssociationResponse -> DescribeAssociationResponse -> Bool
$c/= :: DescribeAssociationResponse -> DescribeAssociationResponse -> Bool
== :: DescribeAssociationResponse -> DescribeAssociationResponse -> Bool
$c== :: DescribeAssociationResponse -> DescribeAssociationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAssociationResponse]
ReadPrec DescribeAssociationResponse
Int -> ReadS DescribeAssociationResponse
ReadS [DescribeAssociationResponse]
(Int -> ReadS DescribeAssociationResponse)
-> ReadS [DescribeAssociationResponse]
-> ReadPrec DescribeAssociationResponse
-> ReadPrec [DescribeAssociationResponse]
-> Read DescribeAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAssociationResponse]
$creadListPrec :: ReadPrec [DescribeAssociationResponse]
readPrec :: ReadPrec DescribeAssociationResponse
$creadPrec :: ReadPrec DescribeAssociationResponse
readList :: ReadS [DescribeAssociationResponse]
$creadList :: ReadS [DescribeAssociationResponse]
readsPrec :: Int -> ReadS DescribeAssociationResponse
$creadsPrec :: Int -> ReadS DescribeAssociationResponse
Prelude.Read, Int -> DescribeAssociationResponse -> ShowS
[DescribeAssociationResponse] -> ShowS
DescribeAssociationResponse -> String
(Int -> DescribeAssociationResponse -> ShowS)
-> (DescribeAssociationResponse -> String)
-> ([DescribeAssociationResponse] -> ShowS)
-> Show DescribeAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAssociationResponse] -> ShowS
$cshowList :: [DescribeAssociationResponse] -> ShowS
show :: DescribeAssociationResponse -> String
$cshow :: DescribeAssociationResponse -> String
showsPrec :: Int -> DescribeAssociationResponse -> ShowS
$cshowsPrec :: Int -> DescribeAssociationResponse -> ShowS
Prelude.Show, (forall x.
DescribeAssociationResponse -> Rep DescribeAssociationResponse x)
-> (forall x.
Rep DescribeAssociationResponse x -> DescribeAssociationResponse)
-> Generic DescribeAssociationResponse
forall x.
Rep DescribeAssociationResponse x -> DescribeAssociationResponse
forall x.
DescribeAssociationResponse -> Rep DescribeAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAssociationResponse x -> DescribeAssociationResponse
$cfrom :: forall x.
DescribeAssociationResponse -> Rep DescribeAssociationResponse x
Prelude.Generic)
newDescribeAssociationResponse ::
Prelude.Int ->
DescribeAssociationResponse
newDescribeAssociationResponse :: Int -> DescribeAssociationResponse
newDescribeAssociationResponse Int
pHttpStatus_ =
DescribeAssociationResponse' :: Maybe AssociationDescription -> Int -> DescribeAssociationResponse
DescribeAssociationResponse'
{ $sel:associationDescription:DescribeAssociationResponse' :: Maybe AssociationDescription
associationDescription =
Maybe AssociationDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeAssociationResponse_associationDescription :: Lens.Lens' DescribeAssociationResponse (Prelude.Maybe AssociationDescription)
describeAssociationResponse_associationDescription :: (Maybe AssociationDescription -> f (Maybe AssociationDescription))
-> DescribeAssociationResponse -> f DescribeAssociationResponse
describeAssociationResponse_associationDescription = (DescribeAssociationResponse -> Maybe AssociationDescription)
-> (DescribeAssociationResponse
-> Maybe AssociationDescription -> DescribeAssociationResponse)
-> Lens
DescribeAssociationResponse
DescribeAssociationResponse
(Maybe AssociationDescription)
(Maybe AssociationDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationResponse' {Maybe AssociationDescription
associationDescription :: Maybe AssociationDescription
$sel:associationDescription:DescribeAssociationResponse' :: DescribeAssociationResponse -> Maybe AssociationDescription
associationDescription} -> Maybe AssociationDescription
associationDescription) (\s :: DescribeAssociationResponse
s@DescribeAssociationResponse' {} Maybe AssociationDescription
a -> DescribeAssociationResponse
s {$sel:associationDescription:DescribeAssociationResponse' :: Maybe AssociationDescription
associationDescription = Maybe AssociationDescription
a} :: DescribeAssociationResponse)
describeAssociationResponse_httpStatus :: Lens.Lens' DescribeAssociationResponse Prelude.Int
describeAssociationResponse_httpStatus :: (Int -> f Int)
-> DescribeAssociationResponse -> f DescribeAssociationResponse
describeAssociationResponse_httpStatus = (DescribeAssociationResponse -> Int)
-> (DescribeAssociationResponse
-> Int -> DescribeAssociationResponse)
-> Lens
DescribeAssociationResponse DescribeAssociationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAssociationResponse' :: DescribeAssociationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAssociationResponse
s@DescribeAssociationResponse' {} Int
a -> DescribeAssociationResponse
s {$sel:httpStatus:DescribeAssociationResponse' :: Int
httpStatus = Int
a} :: DescribeAssociationResponse)
instance Prelude.NFData DescribeAssociationResponse