module Network.AWS.SSM.Types
(
SSM
, JSONError
, CreateAssociationBatchRequestEntry
, createAssociationBatchRequestEntry
, cabreInstanceId
, cabreName
, DocumentFilter
, documentFilter
, dfKey
, dfValue
, AssociationDescription
, associationDescription
, adDate
, adInstanceId
, adName
, adStatus
, AssociationStatusName (..)
, DocumentFilterKey (..)
, DocumentDescription
, documentDescription
, dd1CreatedDate
, dd1Name
, dd1Sha1
, dd1Status
, AssociationFilter
, associationFilter
, afKey
, afValue
, DocumentIdentifier
, documentIdentifier
, diName
, Fault (..)
, AssociationStatus
, associationStatus
, asAdditionalInfo
, asDate
, asMessage
, asName
, DocumentStatus (..)
, AssociationFilterKey (..)
, FailedCreateAssociation
, failedCreateAssociation
, fcaEntry
, fcaFault
, fcaMessage
, Association
, association
, aInstanceId
, aName
) where
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data SSM
instance AWSService SSM where
type Sg SSM = V4
type Er SSM = JSONError
service = service'
where
service' :: Service SSM
service' = Service
{ _svcAbbrev = "SSM"
, _svcPrefix = "ssm"
, _svcVersion = "2014-11-06"
, _svcTargetPrefix = Just "AmazonSSM"
, _svcJSONVersion = Just "1.1"
, _svcHandle = handle
, _svcRetry = retry
}
handle :: Status
-> Maybe (LazyByteString -> ServiceError JSONError)
handle = jsonError statusSuccess service'
retry :: Retry SSM
retry = Exponential
{ _retryBase = 0.05
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check :: Status
-> JSONError
-> Bool
check (statusCode -> s) (awsErrorCode -> e)
| s == 500 = True
| s == 509 = True
| s == 503 = True
| otherwise = False
data CreateAssociationBatchRequestEntry = CreateAssociationBatchRequestEntry
{ _cabreInstanceId :: Maybe Text
, _cabreName :: Maybe Text
} deriving (Eq, Ord, Read, Show)
createAssociationBatchRequestEntry :: CreateAssociationBatchRequestEntry
createAssociationBatchRequestEntry = CreateAssociationBatchRequestEntry
{ _cabreName = Nothing
, _cabreInstanceId = Nothing
}
cabreInstanceId :: Lens' CreateAssociationBatchRequestEntry (Maybe Text)
cabreInstanceId = lens _cabreInstanceId (\s a -> s { _cabreInstanceId = a })
cabreName :: Lens' CreateAssociationBatchRequestEntry (Maybe Text)
cabreName = lens _cabreName (\s a -> s { _cabreName = a })
instance FromJSON CreateAssociationBatchRequestEntry where
parseJSON = withObject "CreateAssociationBatchRequestEntry" $ \o -> CreateAssociationBatchRequestEntry
<$> o .:? "InstanceId"
<*> o .:? "Name"
instance ToJSON CreateAssociationBatchRequestEntry where
toJSON CreateAssociationBatchRequestEntry{..} = object
[ "Name" .= _cabreName
, "InstanceId" .= _cabreInstanceId
]
data DocumentFilter = DocumentFilter
{ _dfKey :: DocumentFilterKey
, _dfValue :: Text
} deriving (Eq, Read, Show)
documentFilter :: DocumentFilterKey
-> Text
-> DocumentFilter
documentFilter p1 p2 = DocumentFilter
{ _dfKey = p1
, _dfValue = p2
}
dfKey :: Lens' DocumentFilter DocumentFilterKey
dfKey = lens _dfKey (\s a -> s { _dfKey = a })
dfValue :: Lens' DocumentFilter Text
dfValue = lens _dfValue (\s a -> s { _dfValue = a })
instance FromJSON DocumentFilter where
parseJSON = withObject "DocumentFilter" $ \o -> DocumentFilter
<$> o .: "key"
<*> o .: "value"
instance ToJSON DocumentFilter where
toJSON DocumentFilter{..} = object
[ "key" .= _dfKey
, "value" .= _dfValue
]
data AssociationDescription = AssociationDescription
{ _adDate :: Maybe POSIX
, _adInstanceId :: Maybe Text
, _adName :: Maybe Text
, _adStatus :: Maybe AssociationStatus
} deriving (Eq, Read, Show)
associationDescription :: AssociationDescription
associationDescription = AssociationDescription
{ _adName = Nothing
, _adInstanceId = Nothing
, _adDate = Nothing
, _adStatus = Nothing
}
adDate :: Lens' AssociationDescription (Maybe UTCTime)
adDate = lens _adDate (\s a -> s { _adDate = a }) . mapping _Time
adInstanceId :: Lens' AssociationDescription (Maybe Text)
adInstanceId = lens _adInstanceId (\s a -> s { _adInstanceId = a })
adName :: Lens' AssociationDescription (Maybe Text)
adName = lens _adName (\s a -> s { _adName = a })
adStatus :: Lens' AssociationDescription (Maybe AssociationStatus)
adStatus = lens _adStatus (\s a -> s { _adStatus = a })
instance FromJSON AssociationDescription where
parseJSON = withObject "AssociationDescription" $ \o -> AssociationDescription
<$> o .:? "Date"
<*> o .:? "InstanceId"
<*> o .:? "Name"
<*> o .:? "Status"
instance ToJSON AssociationDescription where
toJSON AssociationDescription{..} = object
[ "Name" .= _adName
, "InstanceId" .= _adInstanceId
, "Date" .= _adDate
, "Status" .= _adStatus
]
data AssociationStatusName
= Failed
| Pending
| Success
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable AssociationStatusName
instance FromText AssociationStatusName where
parser = takeLowerText >>= \case
"failed" -> pure Failed
"pending" -> pure Pending
"success" -> pure Success
e -> fail $
"Failure parsing AssociationStatusName from " ++ show e
instance ToText AssociationStatusName where
toText = \case
Failed -> "Failed"
Pending -> "Pending"
Success -> "Success"
instance ToByteString AssociationStatusName
instance ToHeader AssociationStatusName
instance ToQuery AssociationStatusName
instance FromJSON AssociationStatusName where
parseJSON = parseJSONText "AssociationStatusName"
instance ToJSON AssociationStatusName where
toJSON = toJSONText
data DocumentFilterKey
= Name
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable DocumentFilterKey
instance FromText DocumentFilterKey where
parser = takeLowerText >>= \case
"name" -> pure Name
e -> fail $
"Failure parsing DocumentFilterKey from " ++ show e
instance ToText DocumentFilterKey where
toText Name = "Name"
instance ToByteString DocumentFilterKey
instance ToHeader DocumentFilterKey
instance ToQuery DocumentFilterKey
instance FromJSON DocumentFilterKey where
parseJSON = parseJSONText "DocumentFilterKey"
instance ToJSON DocumentFilterKey where
toJSON = toJSONText
data DocumentDescription = DocumentDescription
{ _dd1CreatedDate :: Maybe POSIX
, _dd1Name :: Maybe Text
, _dd1Sha1 :: Maybe Text
, _dd1Status :: Maybe DocumentStatus
} deriving (Eq, Read, Show)
documentDescription :: DocumentDescription
documentDescription = DocumentDescription
{ _dd1Sha1 = Nothing
, _dd1Name = Nothing
, _dd1CreatedDate = Nothing
, _dd1Status = Nothing
}
dd1CreatedDate :: Lens' DocumentDescription (Maybe UTCTime)
dd1CreatedDate = lens _dd1CreatedDate (\s a -> s { _dd1CreatedDate = a }) . mapping _Time
dd1Name :: Lens' DocumentDescription (Maybe Text)
dd1Name = lens _dd1Name (\s a -> s { _dd1Name = a })
dd1Sha1 :: Lens' DocumentDescription (Maybe Text)
dd1Sha1 = lens _dd1Sha1 (\s a -> s { _dd1Sha1 = a })
dd1Status :: Lens' DocumentDescription (Maybe DocumentStatus)
dd1Status = lens _dd1Status (\s a -> s { _dd1Status = a })
instance FromJSON DocumentDescription where
parseJSON = withObject "DocumentDescription" $ \o -> DocumentDescription
<$> o .:? "CreatedDate"
<*> o .:? "Name"
<*> o .:? "Sha1"
<*> o .:? "Status"
instance ToJSON DocumentDescription where
toJSON DocumentDescription{..} = object
[ "Sha1" .= _dd1Sha1
, "Name" .= _dd1Name
, "CreatedDate" .= _dd1CreatedDate
, "Status" .= _dd1Status
]
data AssociationFilter = AssociationFilter
{ _afKey :: AssociationFilterKey
, _afValue :: Text
} deriving (Eq, Read, Show)
associationFilter :: AssociationFilterKey
-> Text
-> AssociationFilter
associationFilter p1 p2 = AssociationFilter
{ _afKey = p1
, _afValue = p2
}
afKey :: Lens' AssociationFilter AssociationFilterKey
afKey = lens _afKey (\s a -> s { _afKey = a })
afValue :: Lens' AssociationFilter Text
afValue = lens _afValue (\s a -> s { _afValue = a })
instance FromJSON AssociationFilter where
parseJSON = withObject "AssociationFilter" $ \o -> AssociationFilter
<$> o .: "key"
<*> o .: "value"
instance ToJSON AssociationFilter where
toJSON AssociationFilter{..} = object
[ "key" .= _afKey
, "value" .= _afValue
]
newtype DocumentIdentifier = DocumentIdentifier
{ _diName :: Maybe Text
} deriving (Eq, Ord, Read, Show, Monoid)
documentIdentifier :: DocumentIdentifier
documentIdentifier = DocumentIdentifier
{ _diName = Nothing
}
diName :: Lens' DocumentIdentifier (Maybe Text)
diName = lens _diName (\s a -> s { _diName = a })
instance FromJSON DocumentIdentifier where
parseJSON = withObject "DocumentIdentifier" $ \o -> DocumentIdentifier
<$> o .:? "Name"
instance ToJSON DocumentIdentifier where
toJSON DocumentIdentifier{..} = object
[ "Name" .= _diName
]
data Fault
= Client
| Server
| Unknown
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable Fault
instance FromText Fault where
parser = takeLowerText >>= \case
"client" -> pure Client
"server" -> pure Server
"unknown" -> pure Unknown
e -> fail $
"Failure parsing Fault from " ++ show e
instance ToText Fault where
toText = \case
Client -> "Client"
Server -> "Server"
Unknown -> "Unknown"
instance ToByteString Fault
instance ToHeader Fault
instance ToQuery Fault
instance FromJSON Fault where
parseJSON = parseJSONText "Fault"
instance ToJSON Fault where
toJSON = toJSONText
data AssociationStatus = AssociationStatus
{ _asAdditionalInfo :: Maybe Text
, _asDate :: POSIX
, _asMessage :: Text
, _asName :: AssociationStatusName
} deriving (Eq, Read, Show)
associationStatus :: UTCTime
-> AssociationStatusName
-> Text
-> AssociationStatus
associationStatus p1 p2 p3 = AssociationStatus
{ _asDate = withIso _Time (const id) p1
, _asName = p2
, _asMessage = p3
, _asAdditionalInfo = Nothing
}
asAdditionalInfo :: Lens' AssociationStatus (Maybe Text)
asAdditionalInfo = lens _asAdditionalInfo (\s a -> s { _asAdditionalInfo = a })
asDate :: Lens' AssociationStatus UTCTime
asDate = lens _asDate (\s a -> s { _asDate = a }) . _Time
asMessage :: Lens' AssociationStatus Text
asMessage = lens _asMessage (\s a -> s { _asMessage = a })
asName :: Lens' AssociationStatus AssociationStatusName
asName = lens _asName (\s a -> s { _asName = a })
instance FromJSON AssociationStatus where
parseJSON = withObject "AssociationStatus" $ \o -> AssociationStatus
<$> o .:? "AdditionalInfo"
<*> o .: "Date"
<*> o .: "Message"
<*> o .: "Name"
instance ToJSON AssociationStatus where
toJSON AssociationStatus{..} = object
[ "Date" .= _asDate
, "Name" .= _asName
, "Message" .= _asMessage
, "AdditionalInfo" .= _asAdditionalInfo
]
data DocumentStatus
= Active
| Creating
| Deleting
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable DocumentStatus
instance FromText DocumentStatus where
parser = takeLowerText >>= \case
"active" -> pure Active
"creating" -> pure Creating
"deleting" -> pure Deleting
e -> fail $
"Failure parsing DocumentStatus from " ++ show e
instance ToText DocumentStatus where
toText = \case
Active -> "Active"
Creating -> "Creating"
Deleting -> "Deleting"
instance ToByteString DocumentStatus
instance ToHeader DocumentStatus
instance ToQuery DocumentStatus
instance FromJSON DocumentStatus where
parseJSON = parseJSONText "DocumentStatus"
instance ToJSON DocumentStatus where
toJSON = toJSONText
data AssociationFilterKey
= AFKInstanceId
| AFKName
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable AssociationFilterKey
instance FromText AssociationFilterKey where
parser = takeLowerText >>= \case
"instanceid" -> pure AFKInstanceId
"name" -> pure AFKName
e -> fail $
"Failure parsing AssociationFilterKey from " ++ show e
instance ToText AssociationFilterKey where
toText = \case
AFKInstanceId -> "InstanceId"
AFKName -> "Name"
instance ToByteString AssociationFilterKey
instance ToHeader AssociationFilterKey
instance ToQuery AssociationFilterKey
instance FromJSON AssociationFilterKey where
parseJSON = parseJSONText "AssociationFilterKey"
instance ToJSON AssociationFilterKey where
toJSON = toJSONText
data FailedCreateAssociation = FailedCreateAssociation
{ _fcaEntry :: Maybe CreateAssociationBatchRequestEntry
, _fcaFault :: Maybe Fault
, _fcaMessage :: Maybe Text
} deriving (Eq, Read, Show)
failedCreateAssociation :: FailedCreateAssociation
failedCreateAssociation = FailedCreateAssociation
{ _fcaEntry = Nothing
, _fcaMessage = Nothing
, _fcaFault = Nothing
}
fcaEntry :: Lens' FailedCreateAssociation (Maybe CreateAssociationBatchRequestEntry)
fcaEntry = lens _fcaEntry (\s a -> s { _fcaEntry = a })
fcaFault :: Lens' FailedCreateAssociation (Maybe Fault)
fcaFault = lens _fcaFault (\s a -> s { _fcaFault = a })
fcaMessage :: Lens' FailedCreateAssociation (Maybe Text)
fcaMessage = lens _fcaMessage (\s a -> s { _fcaMessage = a })
instance FromJSON FailedCreateAssociation where
parseJSON = withObject "FailedCreateAssociation" $ \o -> FailedCreateAssociation
<$> o .:? "Entry"
<*> o .:? "Fault"
<*> o .:? "Message"
instance ToJSON FailedCreateAssociation where
toJSON FailedCreateAssociation{..} = object
[ "Entry" .= _fcaEntry
, "Message" .= _fcaMessage
, "Fault" .= _fcaFault
]
data Association = Association
{ _aInstanceId :: Maybe Text
, _aName :: Maybe Text
} deriving (Eq, Ord, Read, Show)
association :: Association
association = Association
{ _aName = Nothing
, _aInstanceId = Nothing
}
aInstanceId :: Lens' Association (Maybe Text)
aInstanceId = lens _aInstanceId (\s a -> s { _aInstanceId = a })
aName :: Lens' Association (Maybe Text)
aName = lens _aName (\s a -> s { _aName = a })
instance FromJSON Association where
parseJSON = withObject "Association" $ \o -> Association
<$> o .:? "InstanceId"
<*> o .:? "Name"
instance ToJSON Association where
toJSON Association{..} = object
[ "Name" .= _aName
, "InstanceId" .= _aInstanceId
]