{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.File.Types.Product where
import Network.Google.File.Types.Sum
import Network.Google.Prelude
newtype InstanceLabels = InstanceLabels'
{ _ilAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
instanceLabels
:: HashMap Text Text
-> InstanceLabels
instanceLabels pIlAddtional_ =
InstanceLabels'
{ _ilAddtional = _Coerce # pIlAddtional_
}
ilAddtional :: Lens' InstanceLabels (HashMap Text Text)
ilAddtional
= lens _ilAddtional (\ s a -> s{_ilAddtional = a}) .
_Coerce
instance FromJSON InstanceLabels where
parseJSON
= withObject "InstanceLabels"
(\ o -> InstanceLabels' <$> (parseJSONObject o))
instance ToJSON InstanceLabels where
toJSON = toJSON . _ilAddtional
data Status = Status'
{ _sDetails :: !(Maybe [StatusDetailsItem])
, _sCode :: !(Maybe (Textual Int32))
, _sMessage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
status
:: Status
status =
Status'
{ _sDetails = Nothing
, _sCode = Nothing
, _sMessage = Nothing
}
sDetails :: Lens' Status [StatusDetailsItem]
sDetails
= lens _sDetails (\ s a -> s{_sDetails = a}) .
_Default
. _Coerce
sCode :: Lens' Status (Maybe Int32)
sCode
= lens _sCode (\ s a -> s{_sCode = a}) .
mapping _Coerce
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
instance FromJSON Status where
parseJSON
= withObject "Status"
(\ o ->
Status' <$>
(o .:? "details" .!= mempty) <*> (o .:? "code") <*>
(o .:? "message"))
instance ToJSON Status where
toJSON Status'{..}
= object
(catMaybes
[("details" .=) <$> _sDetails,
("code" .=) <$> _sCode,
("message" .=) <$> _sMessage])
newtype OperationSchema = OperationSchema'
{ _osAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
operationSchema
:: HashMap Text JSONValue
-> OperationSchema
operationSchema pOsAddtional_ =
OperationSchema'
{ _osAddtional = _Coerce # pOsAddtional_
}
osAddtional :: Lens' OperationSchema (HashMap Text JSONValue)
osAddtional
= lens _osAddtional (\ s a -> s{_osAddtional = a}) .
_Coerce
instance FromJSON OperationSchema where
parseJSON
= withObject "OperationSchema"
(\ o -> OperationSchema' <$> (parseJSONObject o))
instance ToJSON OperationSchema where
toJSON = toJSON . _osAddtional
data ListLocationsResponse = ListLocationsResponse'
{ _llrNextPageToken :: !(Maybe Text)
, _llrLocations :: !(Maybe [Location])
} deriving (Eq,Show,Data,Typeable,Generic)
listLocationsResponse
:: ListLocationsResponse
listLocationsResponse =
ListLocationsResponse'
{ _llrNextPageToken = Nothing
, _llrLocations = Nothing
}
llrNextPageToken :: Lens' ListLocationsResponse (Maybe Text)
llrNextPageToken
= lens _llrNextPageToken
(\ s a -> s{_llrNextPageToken = a})
llrLocations :: Lens' ListLocationsResponse [Location]
llrLocations
= lens _llrLocations (\ s a -> s{_llrLocations = a})
. _Default
. _Coerce
instance FromJSON ListLocationsResponse where
parseJSON
= withObject "ListLocationsResponse"
(\ o ->
ListLocationsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "locations" .!= mempty))
instance ToJSON ListLocationsResponse where
toJSON ListLocationsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _llrNextPageToken,
("locations" .=) <$> _llrLocations])
data ListOperationsResponse = ListOperationsResponse'
{ _lorNextPageToken :: !(Maybe Text)
, _lorOperations :: !(Maybe [Operation])
} deriving (Eq,Show,Data,Typeable,Generic)
listOperationsResponse
:: ListOperationsResponse
listOperationsResponse =
ListOperationsResponse'
{ _lorNextPageToken = Nothing
, _lorOperations = Nothing
}
lorNextPageToken :: Lens' ListOperationsResponse (Maybe Text)
lorNextPageToken
= lens _lorNextPageToken
(\ s a -> s{_lorNextPageToken = a})
lorOperations :: Lens' ListOperationsResponse [Operation]
lorOperations
= lens _lorOperations
(\ s a -> s{_lorOperations = a})
. _Default
. _Coerce
instance FromJSON ListOperationsResponse where
parseJSON
= withObject "ListOperationsResponse"
(\ o ->
ListOperationsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "operations" .!= mempty))
instance ToJSON ListOperationsResponse where
toJSON ListOperationsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lorNextPageToken,
("operations" .=) <$> _lorOperations])
data CancelOperationRequest =
CancelOperationRequest'
deriving (Eq,Show,Data,Typeable,Generic)
cancelOperationRequest
:: CancelOperationRequest
cancelOperationRequest = CancelOperationRequest'
instance FromJSON CancelOperationRequest where
parseJSON
= withObject "CancelOperationRequest"
(\ o -> pure CancelOperationRequest')
instance ToJSON CancelOperationRequest where
toJSON = const emptyObject
data Location = Location'
{ _lName :: !(Maybe Text)
, _lMetadata :: !(Maybe LocationMetadata)
, _lDisplayName :: !(Maybe Text)
, _lLabels :: !(Maybe LocationLabels)
, _lLocationId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
location
:: Location
location =
Location'
{ _lName = Nothing
, _lMetadata = Nothing
, _lDisplayName = Nothing
, _lLabels = Nothing
, _lLocationId = Nothing
}
lName :: Lens' Location (Maybe Text)
lName = lens _lName (\ s a -> s{_lName = a})
lMetadata :: Lens' Location (Maybe LocationMetadata)
lMetadata
= lens _lMetadata (\ s a -> s{_lMetadata = a})
lDisplayName :: Lens' Location (Maybe Text)
lDisplayName
= lens _lDisplayName (\ s a -> s{_lDisplayName = a})
lLabels :: Lens' Location (Maybe LocationLabels)
lLabels = lens _lLabels (\ s a -> s{_lLabels = a})
lLocationId :: Lens' Location (Maybe Text)
lLocationId
= lens _lLocationId (\ s a -> s{_lLocationId = a})
instance FromJSON Location where
parseJSON
= withObject "Location"
(\ o ->
Location' <$>
(o .:? "name") <*> (o .:? "metadata") <*>
(o .:? "displayName")
<*> (o .:? "labels")
<*> (o .:? "locationId"))
instance ToJSON Location where
toJSON Location'{..}
= object
(catMaybes
[("name" .=) <$> _lName,
("metadata" .=) <$> _lMetadata,
("displayName" .=) <$> _lDisplayName,
("labels" .=) <$> _lLabels,
("locationId" .=) <$> _lLocationId])
data Operation = Operation'
{ _oDone :: !(Maybe Bool)
, _oError :: !(Maybe Status)
, _oResponse :: !(Maybe OperationResponse)
, _oName :: !(Maybe Text)
, _oMetadata :: !(Maybe OperationSchema)
} deriving (Eq,Show,Data,Typeable,Generic)
operation
:: Operation
operation =
Operation'
{ _oDone = Nothing
, _oError = Nothing
, _oResponse = Nothing
, _oName = Nothing
, _oMetadata = Nothing
}
oDone :: Lens' Operation (Maybe Bool)
oDone = lens _oDone (\ s a -> s{_oDone = a})
oError :: Lens' Operation (Maybe Status)
oError = lens _oError (\ s a -> s{_oError = a})
oResponse :: Lens' Operation (Maybe OperationResponse)
oResponse
= lens _oResponse (\ s a -> s{_oResponse = a})
oName :: Lens' Operation (Maybe Text)
oName = lens _oName (\ s a -> s{_oName = a})
oMetadata :: Lens' Operation (Maybe OperationSchema)
oMetadata
= lens _oMetadata (\ s a -> s{_oMetadata = a})
instance FromJSON Operation where
parseJSON
= withObject "Operation"
(\ o ->
Operation' <$>
(o .:? "done") <*> (o .:? "error") <*>
(o .:? "response")
<*> (o .:? "name")
<*> (o .:? "metadata"))
instance ToJSON Operation where
toJSON Operation'{..}
= object
(catMaybes
[("done" .=) <$> _oDone, ("error" .=) <$> _oError,
("response" .=) <$> _oResponse,
("name" .=) <$> _oName,
("metadata" .=) <$> _oMetadata])
data Empty =
Empty'
deriving (Eq,Show,Data,Typeable,Generic)
empty
:: Empty
empty = Empty'
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty')
instance ToJSON Empty where
toJSON = const emptyObject
newtype StatusDetailsItem = StatusDetailsItem'
{ _sdiAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
statusDetailsItem
:: HashMap Text JSONValue
-> StatusDetailsItem
statusDetailsItem pSdiAddtional_ =
StatusDetailsItem'
{ _sdiAddtional = _Coerce # pSdiAddtional_
}
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
sdiAddtional
= lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
. _Coerce
instance FromJSON StatusDetailsItem where
parseJSON
= withObject "StatusDetailsItem"
(\ o -> StatusDetailsItem' <$> (parseJSONObject o))
instance ToJSON StatusDetailsItem where
toJSON = toJSON . _sdiAddtional
data FileShareConfig = FileShareConfig'
{ _fscName :: !(Maybe Text)
, _fscCapacityGb :: !(Maybe (Textual Int64))
} deriving (Eq,Show,Data,Typeable,Generic)
fileShareConfig
:: FileShareConfig
fileShareConfig =
FileShareConfig'
{ _fscName = Nothing
, _fscCapacityGb = Nothing
}
fscName :: Lens' FileShareConfig (Maybe Text)
fscName = lens _fscName (\ s a -> s{_fscName = a})
fscCapacityGb :: Lens' FileShareConfig (Maybe Int64)
fscCapacityGb
= lens _fscCapacityGb
(\ s a -> s{_fscCapacityGb = a})
. mapping _Coerce
instance FromJSON FileShareConfig where
parseJSON
= withObject "FileShareConfig"
(\ o ->
FileShareConfig' <$>
(o .:? "name") <*> (o .:? "capacityGb"))
instance ToJSON FileShareConfig where
toJSON FileShareConfig'{..}
= object
(catMaybes
[("name" .=) <$> _fscName,
("capacityGb" .=) <$> _fscCapacityGb])
data NetworkConfig = NetworkConfig'
{ _ncModes :: !(Maybe [Text])
, _ncNetwork :: !(Maybe Text)
, _ncReservedIPRange :: !(Maybe Text)
, _ncIPAddresses :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
networkConfig
:: NetworkConfig
networkConfig =
NetworkConfig'
{ _ncModes = Nothing
, _ncNetwork = Nothing
, _ncReservedIPRange = Nothing
, _ncIPAddresses = Nothing
}
ncModes :: Lens' NetworkConfig [Text]
ncModes
= lens _ncModes (\ s a -> s{_ncModes = a}) . _Default
. _Coerce
ncNetwork :: Lens' NetworkConfig (Maybe Text)
ncNetwork
= lens _ncNetwork (\ s a -> s{_ncNetwork = a})
ncReservedIPRange :: Lens' NetworkConfig (Maybe Text)
ncReservedIPRange
= lens _ncReservedIPRange
(\ s a -> s{_ncReservedIPRange = a})
ncIPAddresses :: Lens' NetworkConfig [Text]
ncIPAddresses
= lens _ncIPAddresses
(\ s a -> s{_ncIPAddresses = a})
. _Default
. _Coerce
instance FromJSON NetworkConfig where
parseJSON
= withObject "NetworkConfig"
(\ o ->
NetworkConfig' <$>
(o .:? "modes" .!= mempty) <*> (o .:? "network") <*>
(o .:? "reservedIpRange")
<*> (o .:? "ipAddresses" .!= mempty))
instance ToJSON NetworkConfig where
toJSON NetworkConfig'{..}
= object
(catMaybes
[("modes" .=) <$> _ncModes,
("network" .=) <$> _ncNetwork,
("reservedIpRange" .=) <$> _ncReservedIPRange,
("ipAddresses" .=) <$> _ncIPAddresses])
newtype LocationLabels = LocationLabels'
{ _llAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
locationLabels
:: HashMap Text Text
-> LocationLabels
locationLabels pLlAddtional_ =
LocationLabels'
{ _llAddtional = _Coerce # pLlAddtional_
}
llAddtional :: Lens' LocationLabels (HashMap Text Text)
llAddtional
= lens _llAddtional (\ s a -> s{_llAddtional = a}) .
_Coerce
instance FromJSON LocationLabels where
parseJSON
= withObject "LocationLabels"
(\ o -> LocationLabels' <$> (parseJSONObject o))
instance ToJSON LocationLabels where
toJSON = toJSON . _llAddtional
newtype LocationMetadata = LocationMetadata'
{ _lmAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
locationMetadata
:: HashMap Text JSONValue
-> LocationMetadata
locationMetadata pLmAddtional_ =
LocationMetadata'
{ _lmAddtional = _Coerce # pLmAddtional_
}
lmAddtional :: Lens' LocationMetadata (HashMap Text JSONValue)
lmAddtional
= lens _lmAddtional (\ s a -> s{_lmAddtional = a}) .
_Coerce
instance FromJSON LocationMetadata where
parseJSON
= withObject "LocationMetadata"
(\ o -> LocationMetadata' <$> (parseJSONObject o))
instance ToJSON LocationMetadata where
toJSON = toJSON . _lmAddtional
data OperationMetadata = OperationMetadata'
{ _omAPIVersion :: !(Maybe Text)
, _omEndTime :: !(Maybe DateTime')
, _omStatusDetail :: !(Maybe Text)
, _omVerb :: !(Maybe Text)
, _omCancelRequested :: !(Maybe Bool)
, _omTarget :: !(Maybe Text)
, _omCreateTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
operationMetadata
:: OperationMetadata
operationMetadata =
OperationMetadata'
{ _omAPIVersion = Nothing
, _omEndTime = Nothing
, _omStatusDetail = Nothing
, _omVerb = Nothing
, _omCancelRequested = Nothing
, _omTarget = Nothing
, _omCreateTime = Nothing
}
omAPIVersion :: Lens' OperationMetadata (Maybe Text)
omAPIVersion
= lens _omAPIVersion (\ s a -> s{_omAPIVersion = a})
omEndTime :: Lens' OperationMetadata (Maybe UTCTime)
omEndTime
= lens _omEndTime (\ s a -> s{_omEndTime = a}) .
mapping _DateTime
omStatusDetail :: Lens' OperationMetadata (Maybe Text)
omStatusDetail
= lens _omStatusDetail
(\ s a -> s{_omStatusDetail = a})
omVerb :: Lens' OperationMetadata (Maybe Text)
omVerb = lens _omVerb (\ s a -> s{_omVerb = a})
omCancelRequested :: Lens' OperationMetadata (Maybe Bool)
omCancelRequested
= lens _omCancelRequested
(\ s a -> s{_omCancelRequested = a})
omTarget :: Lens' OperationMetadata (Maybe Text)
omTarget = lens _omTarget (\ s a -> s{_omTarget = a})
omCreateTime :: Lens' OperationMetadata (Maybe UTCTime)
omCreateTime
= lens _omCreateTime (\ s a -> s{_omCreateTime = a})
. mapping _DateTime
instance FromJSON OperationMetadata where
parseJSON
= withObject "OperationMetadata"
(\ o ->
OperationMetadata' <$>
(o .:? "apiVersion") <*> (o .:? "endTime") <*>
(o .:? "statusDetail")
<*> (o .:? "verb")
<*> (o .:? "cancelRequested")
<*> (o .:? "target")
<*> (o .:? "createTime"))
instance ToJSON OperationMetadata where
toJSON OperationMetadata'{..}
= object
(catMaybes
[("apiVersion" .=) <$> _omAPIVersion,
("endTime" .=) <$> _omEndTime,
("statusDetail" .=) <$> _omStatusDetail,
("verb" .=) <$> _omVerb,
("cancelRequested" .=) <$> _omCancelRequested,
("target" .=) <$> _omTarget,
("createTime" .=) <$> _omCreateTime])
data ListInstancesResponse = ListInstancesResponse'
{ _lirNextPageToken :: !(Maybe Text)
, _lirUnreachable :: !(Maybe [Text])
, _lirInstances :: !(Maybe [Instance])
} deriving (Eq,Show,Data,Typeable,Generic)
listInstancesResponse
:: ListInstancesResponse
listInstancesResponse =
ListInstancesResponse'
{ _lirNextPageToken = Nothing
, _lirUnreachable = Nothing
, _lirInstances = Nothing
}
lirNextPageToken :: Lens' ListInstancesResponse (Maybe Text)
lirNextPageToken
= lens _lirNextPageToken
(\ s a -> s{_lirNextPageToken = a})
lirUnreachable :: Lens' ListInstancesResponse [Text]
lirUnreachable
= lens _lirUnreachable
(\ s a -> s{_lirUnreachable = a})
. _Default
. _Coerce
lirInstances :: Lens' ListInstancesResponse [Instance]
lirInstances
= lens _lirInstances (\ s a -> s{_lirInstances = a})
. _Default
. _Coerce
instance FromJSON ListInstancesResponse where
parseJSON
= withObject "ListInstancesResponse"
(\ o ->
ListInstancesResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "unreachable" .!= mempty)
<*> (o .:? "instances" .!= mempty))
instance ToJSON ListInstancesResponse where
toJSON ListInstancesResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lirNextPageToken,
("unreachable" .=) <$> _lirUnreachable,
("instances" .=) <$> _lirInstances])
newtype OperationResponse = OperationResponse'
{ _orAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
operationResponse
:: HashMap Text JSONValue
-> OperationResponse
operationResponse pOrAddtional_ =
OperationResponse'
{ _orAddtional = _Coerce # pOrAddtional_
}
orAddtional :: Lens' OperationResponse (HashMap Text JSONValue)
orAddtional
= lens _orAddtional (\ s a -> s{_orAddtional = a}) .
_Coerce
instance FromJSON OperationResponse where
parseJSON
= withObject "OperationResponse"
(\ o -> OperationResponse' <$> (parseJSONObject o))
instance ToJSON OperationResponse where
toJSON = toJSON . _orAddtional
data Instance = Instance'
{ _iEtag :: !(Maybe Text)
, _iState :: !(Maybe InstanceState)
, _iNetworks :: !(Maybe [NetworkConfig])
, _iFileShares :: !(Maybe [FileShareConfig])
, _iName :: !(Maybe Text)
, _iStatusMessage :: !(Maybe Text)
, _iTier :: !(Maybe InstanceTier)
, _iLabels :: !(Maybe InstanceLabels)
, _iDescription :: !(Maybe Text)
, _iCreateTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
instance'
:: Instance
instance' =
Instance'
{ _iEtag = Nothing
, _iState = Nothing
, _iNetworks = Nothing
, _iFileShares = Nothing
, _iName = Nothing
, _iStatusMessage = Nothing
, _iTier = Nothing
, _iLabels = Nothing
, _iDescription = Nothing
, _iCreateTime = Nothing
}
iEtag :: Lens' Instance (Maybe Text)
iEtag = lens _iEtag (\ s a -> s{_iEtag = a})
iState :: Lens' Instance (Maybe InstanceState)
iState = lens _iState (\ s a -> s{_iState = a})
iNetworks :: Lens' Instance [NetworkConfig]
iNetworks
= lens _iNetworks (\ s a -> s{_iNetworks = a}) .
_Default
. _Coerce
iFileShares :: Lens' Instance [FileShareConfig]
iFileShares
= lens _iFileShares (\ s a -> s{_iFileShares = a}) .
_Default
. _Coerce
iName :: Lens' Instance (Maybe Text)
iName = lens _iName (\ s a -> s{_iName = a})
iStatusMessage :: Lens' Instance (Maybe Text)
iStatusMessage
= lens _iStatusMessage
(\ s a -> s{_iStatusMessage = a})
iTier :: Lens' Instance (Maybe InstanceTier)
iTier = lens _iTier (\ s a -> s{_iTier = a})
iLabels :: Lens' Instance (Maybe InstanceLabels)
iLabels = lens _iLabels (\ s a -> s{_iLabels = a})
iDescription :: Lens' Instance (Maybe Text)
iDescription
= lens _iDescription (\ s a -> s{_iDescription = a})
iCreateTime :: Lens' Instance (Maybe UTCTime)
iCreateTime
= lens _iCreateTime (\ s a -> s{_iCreateTime = a}) .
mapping _DateTime
instance FromJSON Instance where
parseJSON
= withObject "Instance"
(\ o ->
Instance' <$>
(o .:? "etag") <*> (o .:? "state") <*>
(o .:? "networks" .!= mempty)
<*> (o .:? "fileShares" .!= mempty)
<*> (o .:? "name")
<*> (o .:? "statusMessage")
<*> (o .:? "tier")
<*> (o .:? "labels")
<*> (o .:? "description")
<*> (o .:? "createTime"))
instance ToJSON Instance where
toJSON Instance'{..}
= object
(catMaybes
[("etag" .=) <$> _iEtag, ("state" .=) <$> _iState,
("networks" .=) <$> _iNetworks,
("fileShares" .=) <$> _iFileShares,
("name" .=) <$> _iName,
("statusMessage" .=) <$> _iStatusMessage,
("tier" .=) <$> _iTier, ("labels" .=) <$> _iLabels,
("description" .=) <$> _iDescription,
("createTime" .=) <$> _iCreateTime])