{-# 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.Storage.Types.Product
-- Copyright   : (c) 2015-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.Google.Storage.Types.Product where

import           Network.Google.Prelude
import           Network.Google.Storage.Types.Sum

-- | The owner of the object. This will always be the uploader of the object.
--
-- /See:/ 'objectOwner' smart constructor.
data ObjectOwner = ObjectOwner'
    { _ooEntity   :: !(Maybe Text)
    , _ooEntityId :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectOwner' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ooEntity'
--
-- * 'ooEntityId'
objectOwner
    :: ObjectOwner
objectOwner =
    ObjectOwner'
    { _ooEntity = Nothing
    , _ooEntityId = Nothing
    }

-- | The entity, in the form user-userId.
ooEntity :: Lens' ObjectOwner (Maybe Text)
ooEntity = lens _ooEntity (\ s a -> s{_ooEntity = a})

-- | The ID for the entity.
ooEntityId :: Lens' ObjectOwner (Maybe Text)
ooEntityId
  = lens _ooEntityId (\ s a -> s{_ooEntityId = a})

instance FromJSON ObjectOwner where
        parseJSON
          = withObject "ObjectOwner"
              (\ o ->
                 ObjectOwner' <$>
                   (o .:? "entity") <*> (o .:? "entityId"))

instance ToJSON ObjectOwner where
        toJSON ObjectOwner'{..}
          = object
              (catMaybes
                 [("entity" .=) <$> _ooEntity,
                  ("entityId" .=) <$> _ooEntityId])

-- | The bucket\'s versioning configuration.
--
-- /See:/ 'bucketVersioning' smart constructor.
newtype BucketVersioning = BucketVersioning'
    { _bvEnabled :: Maybe Bool
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketVersioning' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bvEnabled'
bucketVersioning
    :: BucketVersioning
bucketVersioning =
    BucketVersioning'
    { _bvEnabled = Nothing
    }

-- | While set to true, versioning is fully enabled for this bucket.
bvEnabled :: Lens' BucketVersioning (Maybe Bool)
bvEnabled
  = lens _bvEnabled (\ s a -> s{_bvEnabled = a})

instance FromJSON BucketVersioning where
        parseJSON
          = withObject "BucketVersioning"
              (\ o -> BucketVersioning' <$> (o .:? "enabled"))

instance ToJSON BucketVersioning where
        toJSON BucketVersioning'{..}
          = object (catMaybes [("enabled" .=) <$> _bvEnabled])

-- | A list of buckets.
--
-- /See:/ 'buckets' smart constructor.
data Buckets = Buckets'
    { _bNextPageToken :: !(Maybe Text)
    , _bKind          :: !Text
    , _bItems         :: !(Maybe [Bucket])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Buckets' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bNextPageToken'
--
-- * 'bKind'
--
-- * 'bItems'
buckets
    :: Buckets
buckets =
    Buckets'
    { _bNextPageToken = Nothing
    , _bKind = "storage#buckets"
    , _bItems = Nothing
    }

-- | The continuation token, used to page through large result sets. Provide
-- this value in a subsequent request to return the next page of results.
bNextPageToken :: Lens' Buckets (Maybe Text)
bNextPageToken
  = lens _bNextPageToken
      (\ s a -> s{_bNextPageToken = a})

-- | The kind of item this is. For lists of buckets, this is always
-- storage#buckets.
bKind :: Lens' Buckets Text
bKind = lens _bKind (\ s a -> s{_bKind = a})

-- | The list of items.
bItems :: Lens' Buckets [Bucket]
bItems
  = lens _bItems (\ s a -> s{_bItems = a}) . _Default .
      _Coerce

instance FromJSON Buckets where
        parseJSON
          = withObject "Buckets"
              (\ o ->
                 Buckets' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "storage#buckets")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON Buckets where
        toJSON Buckets'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _bNextPageToken,
                  Just ("kind" .= _bKind), ("items" .=) <$> _bItems])

-- | The bucket\'s logging configuration, which defines the destination
-- bucket and optional name prefix for the current bucket\'s logs.
--
-- /See:/ 'bucketLogging' smart constructor.
data BucketLogging = BucketLogging'
    { _blLogBucket       :: !(Maybe Text)
    , _blLogObjectPrefix :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketLogging' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blLogBucket'
--
-- * 'blLogObjectPrefix'
bucketLogging
    :: BucketLogging
bucketLogging =
    BucketLogging'
    { _blLogBucket = Nothing
    , _blLogObjectPrefix = Nothing
    }

-- | The destination bucket where the current bucket\'s logs should be
-- placed.
blLogBucket :: Lens' BucketLogging (Maybe Text)
blLogBucket
  = lens _blLogBucket (\ s a -> s{_blLogBucket = a})

-- | A prefix for log object names.
blLogObjectPrefix :: Lens' BucketLogging (Maybe Text)
blLogObjectPrefix
  = lens _blLogObjectPrefix
      (\ s a -> s{_blLogObjectPrefix = a})

instance FromJSON BucketLogging where
        parseJSON
          = withObject "BucketLogging"
              (\ o ->
                 BucketLogging' <$>
                   (o .:? "logBucket") <*> (o .:? "logObjectPrefix"))

instance ToJSON BucketLogging where
        toJSON BucketLogging'{..}
          = object
              (catMaybes
                 [("logBucket" .=) <$> _blLogBucket,
                  ("logObjectPrefix" .=) <$> _blLogObjectPrefix])

-- | User-provided metadata, in key\/value pairs.
--
-- /See:/ 'objectMetadata' smart constructor.
newtype ObjectMetadata = ObjectMetadata'
    { _omAddtional :: HashMap Text Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'omAddtional'
objectMetadata
    :: HashMap Text Text -- ^ 'omAddtional'
    -> ObjectMetadata
objectMetadata pOmAddtional_ =
    ObjectMetadata'
    { _omAddtional = _Coerce # pOmAddtional_
    }

-- | An individual metadata entry.
omAddtional :: Lens' ObjectMetadata (HashMap Text Text)
omAddtional
  = lens _omAddtional (\ s a -> s{_omAddtional = a}) .
      _Coerce

instance FromJSON ObjectMetadata where
        parseJSON
          = withObject "ObjectMetadata"
              (\ o -> ObjectMetadata' <$> (parseJSONObject o))

instance ToJSON ObjectMetadata where
        toJSON = toJSON . _omAddtional

-- | The condition(s) under which the action will be taken.
--
-- /See:/ 'bucketLifecycleRuleItemCondition' smart constructor.
data BucketLifecycleRuleItemCondition = BucketLifecycleRuleItemCondition'
    { _blricAge                 :: !(Maybe (Textual Int32))
    , _blricIsLive              :: !(Maybe Bool)
    , _blricNumNewerVersions    :: !(Maybe (Textual Int32))
    , _blricMatchesStorageClass :: !(Maybe [Text])
    , _blricCreatedBefore       :: !(Maybe Date')
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketLifecycleRuleItemCondition' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blricAge'
--
-- * 'blricIsLive'
--
-- * 'blricNumNewerVersions'
--
-- * 'blricMatchesStorageClass'
--
-- * 'blricCreatedBefore'
bucketLifecycleRuleItemCondition
    :: BucketLifecycleRuleItemCondition
bucketLifecycleRuleItemCondition =
    BucketLifecycleRuleItemCondition'
    { _blricAge = Nothing
    , _blricIsLive = Nothing
    , _blricNumNewerVersions = Nothing
    , _blricMatchesStorageClass = Nothing
    , _blricCreatedBefore = Nothing
    }

-- | Age of an object (in days). This condition is satisfied when an object
-- reaches the specified age.
blricAge :: Lens' BucketLifecycleRuleItemCondition (Maybe Int32)
blricAge
  = lens _blricAge (\ s a -> s{_blricAge = a}) .
      mapping _Coerce

-- | Relevant only for versioned objects. If the value is true, this
-- condition matches live objects; if the value is false, it matches
-- archived objects.
blricIsLive :: Lens' BucketLifecycleRuleItemCondition (Maybe Bool)
blricIsLive
  = lens _blricIsLive (\ s a -> s{_blricIsLive = a})

-- | Relevant only for versioned objects. If the value is N, this condition
-- is satisfied when there are at least N versions (including the live
-- version) newer than this version of the object.
blricNumNewerVersions :: Lens' BucketLifecycleRuleItemCondition (Maybe Int32)
blricNumNewerVersions
  = lens _blricNumNewerVersions
      (\ s a -> s{_blricNumNewerVersions = a})
      . mapping _Coerce

-- | Objects having any of the storage classes specified by this condition
-- will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE,
-- COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.
blricMatchesStorageClass :: Lens' BucketLifecycleRuleItemCondition [Text]
blricMatchesStorageClass
  = lens _blricMatchesStorageClass
      (\ s a -> s{_blricMatchesStorageClass = a})
      . _Default
      . _Coerce

-- | A date in RFC 3339 format with only the date part (for instance,
-- \"2013-01-15\"). This condition is satisfied when an object is created
-- before midnight of the specified date in UTC.
blricCreatedBefore :: Lens' BucketLifecycleRuleItemCondition (Maybe Day)
blricCreatedBefore
  = lens _blricCreatedBefore
      (\ s a -> s{_blricCreatedBefore = a})
      . mapping _Date

instance FromJSON BucketLifecycleRuleItemCondition
         where
        parseJSON
          = withObject "BucketLifecycleRuleItemCondition"
              (\ o ->
                 BucketLifecycleRuleItemCondition' <$>
                   (o .:? "age") <*> (o .:? "isLive") <*>
                     (o .:? "numNewerVersions")
                     <*> (o .:? "matchesStorageClass" .!= mempty)
                     <*> (o .:? "createdBefore"))

instance ToJSON BucketLifecycleRuleItemCondition
         where
        toJSON BucketLifecycleRuleItemCondition'{..}
          = object
              (catMaybes
                 [("age" .=) <$> _blricAge,
                  ("isLive" .=) <$> _blricIsLive,
                  ("numNewerVersions" .=) <$> _blricNumNewerVersions,
                  ("matchesStorageClass" .=) <$>
                    _blricMatchesStorageClass,
                  ("createdBefore" .=) <$> _blricCreatedBefore])

-- | The bucket\'s lifecycle configuration. See lifecycle management for more
-- information.
--
-- /See:/ 'bucketLifecycle' smart constructor.
newtype BucketLifecycle = BucketLifecycle'
    { _blRule :: Maybe [BucketLifecycleRuleItem]
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketLifecycle' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blRule'
bucketLifecycle
    :: BucketLifecycle
bucketLifecycle =
    BucketLifecycle'
    { _blRule = Nothing
    }

-- | A lifecycle management rule, which is made of an action to take and the
-- condition(s) under which the action will be taken.
blRule :: Lens' BucketLifecycle [BucketLifecycleRuleItem]
blRule
  = lens _blRule (\ s a -> s{_blRule = a}) . _Default .
      _Coerce

instance FromJSON BucketLifecycle where
        parseJSON
          = withObject "BucketLifecycle"
              (\ o ->
                 BucketLifecycle' <$> (o .:? "rule" .!= mempty))

instance ToJSON BucketLifecycle where
        toJSON BucketLifecycle'{..}
          = object (catMaybes [("rule" .=) <$> _blRule])

-- | An notification channel used to watch for resource changes.
--
-- /See:/ 'channel' smart constructor.
data Channel = Channel'
    { _cResourceURI :: !(Maybe Text)
    , _cResourceId  :: !(Maybe Text)
    , _cKind        :: !Text
    , _cExpiration  :: !(Maybe (Textual Int64))
    , _cToken       :: !(Maybe Text)
    , _cAddress     :: !(Maybe Text)
    , _cPayload     :: !(Maybe Bool)
    , _cParams      :: !(Maybe ChannelParams)
    , _cId          :: !(Maybe Text)
    , _cType        :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Channel' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cResourceURI'
--
-- * 'cResourceId'
--
-- * 'cKind'
--
-- * 'cExpiration'
--
-- * 'cToken'
--
-- * 'cAddress'
--
-- * 'cPayload'
--
-- * 'cParams'
--
-- * 'cId'
--
-- * 'cType'
channel
    :: Channel
channel =
    Channel'
    { _cResourceURI = Nothing
    , _cResourceId = Nothing
    , _cKind = "api#channel"
    , _cExpiration = Nothing
    , _cToken = Nothing
    , _cAddress = Nothing
    , _cPayload = Nothing
    , _cParams = Nothing
    , _cId = Nothing
    , _cType = Nothing
    }

-- | A version-specific identifier for the watched resource.
cResourceURI :: Lens' Channel (Maybe Text)
cResourceURI
  = lens _cResourceURI (\ s a -> s{_cResourceURI = a})

-- | An opaque ID that identifies the resource being watched on this channel.
-- Stable across different API versions.
cResourceId :: Lens' Channel (Maybe Text)
cResourceId
  = lens _cResourceId (\ s a -> s{_cResourceId = a})

-- | Identifies this as a notification channel used to watch for changes to a
-- resource. Value: the fixed string \"api#channel\".
cKind :: Lens' Channel Text
cKind = lens _cKind (\ s a -> s{_cKind = a})

-- | Date and time of notification channel expiration, expressed as a Unix
-- timestamp, in milliseconds. Optional.
cExpiration :: Lens' Channel (Maybe Int64)
cExpiration
  = lens _cExpiration (\ s a -> s{_cExpiration = a}) .
      mapping _Coerce

-- | An arbitrary string delivered to the target address with each
-- notification delivered over this channel. Optional.
cToken :: Lens' Channel (Maybe Text)
cToken = lens _cToken (\ s a -> s{_cToken = a})

-- | The address where notifications are delivered for this channel.
cAddress :: Lens' Channel (Maybe Text)
cAddress = lens _cAddress (\ s a -> s{_cAddress = a})

-- | A Boolean value to indicate whether payload is wanted. Optional.
cPayload :: Lens' Channel (Maybe Bool)
cPayload = lens _cPayload (\ s a -> s{_cPayload = a})

-- | Additional parameters controlling delivery channel behavior. Optional.
cParams :: Lens' Channel (Maybe ChannelParams)
cParams = lens _cParams (\ s a -> s{_cParams = a})

-- | A UUID or similar unique string that identifies this channel.
cId :: Lens' Channel (Maybe Text)
cId = lens _cId (\ s a -> s{_cId = a})

-- | The type of delivery mechanism used for this channel.
cType :: Lens' Channel (Maybe Text)
cType = lens _cType (\ s a -> s{_cType = a})

instance FromJSON Channel where
        parseJSON
          = withObject "Channel"
              (\ o ->
                 Channel' <$>
                   (o .:? "resourceUri") <*> (o .:? "resourceId") <*>
                     (o .:? "kind" .!= "api#channel")
                     <*> (o .:? "expiration")
                     <*> (o .:? "token")
                     <*> (o .:? "address")
                     <*> (o .:? "payload")
                     <*> (o .:? "params")
                     <*> (o .:? "id")
                     <*> (o .:? "type"))

instance ToJSON Channel where
        toJSON Channel'{..}
          = object
              (catMaybes
                 [("resourceUri" .=) <$> _cResourceURI,
                  ("resourceId" .=) <$> _cResourceId,
                  Just ("kind" .= _cKind),
                  ("expiration" .=) <$> _cExpiration,
                  ("token" .=) <$> _cToken,
                  ("address" .=) <$> _cAddress,
                  ("payload" .=) <$> _cPayload,
                  ("params" .=) <$> _cParams, ("id" .=) <$> _cId,
                  ("type" .=) <$> _cType])

--
-- /See:/ 'bucketLifecycleRuleItem' smart constructor.
data BucketLifecycleRuleItem = BucketLifecycleRuleItem'
    { _blriAction    :: !(Maybe BucketLifecycleRuleItemAction)
    , _blriCondition :: !(Maybe BucketLifecycleRuleItemCondition)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketLifecycleRuleItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blriAction'
--
-- * 'blriCondition'
bucketLifecycleRuleItem
    :: BucketLifecycleRuleItem
bucketLifecycleRuleItem =
    BucketLifecycleRuleItem'
    { _blriAction = Nothing
    , _blriCondition = Nothing
    }

-- | The action to take.
blriAction :: Lens' BucketLifecycleRuleItem (Maybe BucketLifecycleRuleItemAction)
blriAction
  = lens _blriAction (\ s a -> s{_blriAction = a})

-- | The condition(s) under which the action will be taken.
blriCondition :: Lens' BucketLifecycleRuleItem (Maybe BucketLifecycleRuleItemCondition)
blriCondition
  = lens _blriCondition
      (\ s a -> s{_blriCondition = a})

instance FromJSON BucketLifecycleRuleItem where
        parseJSON
          = withObject "BucketLifecycleRuleItem"
              (\ o ->
                 BucketLifecycleRuleItem' <$>
                   (o .:? "action") <*> (o .:? "condition"))

instance ToJSON BucketLifecycleRuleItem where
        toJSON BucketLifecycleRuleItem'{..}
          = object
              (catMaybes
                 [("action" .=) <$> _blriAction,
                  ("condition" .=) <$> _blriCondition])

--
-- /See:/ 'bucketCORSItem' smart constructor.
data BucketCORSItem = BucketCORSItem'
    { _bciMaxAgeSeconds  :: !(Maybe (Textual Int32))
    , _bciOrigin         :: !(Maybe [Text])
    , _bciResponseHeader :: !(Maybe [Text])
    , _bciMethod         :: !(Maybe [Text])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketCORSItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bciMaxAgeSeconds'
--
-- * 'bciOrigin'
--
-- * 'bciResponseHeader'
--
-- * 'bciMethod'
bucketCORSItem
    :: BucketCORSItem
bucketCORSItem =
    BucketCORSItem'
    { _bciMaxAgeSeconds = Nothing
    , _bciOrigin = Nothing
    , _bciResponseHeader = Nothing
    , _bciMethod = Nothing
    }

-- | The value, in seconds, to return in the Access-Control-Max-Age header
-- used in preflight responses.
bciMaxAgeSeconds :: Lens' BucketCORSItem (Maybe Int32)
bciMaxAgeSeconds
  = lens _bciMaxAgeSeconds
      (\ s a -> s{_bciMaxAgeSeconds = a})
      . mapping _Coerce

-- | The list of Origins eligible to receive CORS response headers. Note:
-- \"*\" is permitted in the list of origins, and means \"any Origin\".
bciOrigin :: Lens' BucketCORSItem [Text]
bciOrigin
  = lens _bciOrigin (\ s a -> s{_bciOrigin = a}) .
      _Default
      . _Coerce

-- | The list of HTTP headers other than the simple response headers to give
-- permission for the user-agent to share across domains.
bciResponseHeader :: Lens' BucketCORSItem [Text]
bciResponseHeader
  = lens _bciResponseHeader
      (\ s a -> s{_bciResponseHeader = a})
      . _Default
      . _Coerce

-- | The list of HTTP methods on which to include CORS response headers,
-- (GET, OPTIONS, POST, etc) Note: \"*\" is permitted in the list of
-- methods, and means \"any method\".
bciMethod :: Lens' BucketCORSItem [Text]
bciMethod
  = lens _bciMethod (\ s a -> s{_bciMethod = a}) .
      _Default
      . _Coerce

instance FromJSON BucketCORSItem where
        parseJSON
          = withObject "BucketCORSItem"
              (\ o ->
                 BucketCORSItem' <$>
                   (o .:? "maxAgeSeconds") <*>
                     (o .:? "origin" .!= mempty)
                     <*> (o .:? "responseHeader" .!= mempty)
                     <*> (o .:? "method" .!= mempty))

instance ToJSON BucketCORSItem where
        toJSON BucketCORSItem'{..}
          = object
              (catMaybes
                 [("maxAgeSeconds" .=) <$> _bciMaxAgeSeconds,
                  ("origin" .=) <$> _bciOrigin,
                  ("responseHeader" .=) <$> _bciResponseHeader,
                  ("method" .=) <$> _bciMethod])

-- | The project team associated with the entity, if any.
--
-- /See:/ 'objectAccessControlProjectTeam' smart constructor.
data ObjectAccessControlProjectTeam = ObjectAccessControlProjectTeam'
    { _oacptProjectNumber :: !(Maybe Text)
    , _oacptTeam          :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectAccessControlProjectTeam' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oacptProjectNumber'
--
-- * 'oacptTeam'
objectAccessControlProjectTeam
    :: ObjectAccessControlProjectTeam
objectAccessControlProjectTeam =
    ObjectAccessControlProjectTeam'
    { _oacptProjectNumber = Nothing
    , _oacptTeam = Nothing
    }

-- | The project number.
oacptProjectNumber :: Lens' ObjectAccessControlProjectTeam (Maybe Text)
oacptProjectNumber
  = lens _oacptProjectNumber
      (\ s a -> s{_oacptProjectNumber = a})

-- | The team.
oacptTeam :: Lens' ObjectAccessControlProjectTeam (Maybe Text)
oacptTeam
  = lens _oacptTeam (\ s a -> s{_oacptTeam = a})

instance FromJSON ObjectAccessControlProjectTeam
         where
        parseJSON
          = withObject "ObjectAccessControlProjectTeam"
              (\ o ->
                 ObjectAccessControlProjectTeam' <$>
                   (o .:? "projectNumber") <*> (o .:? "team"))

instance ToJSON ObjectAccessControlProjectTeam where
        toJSON ObjectAccessControlProjectTeam'{..}
          = object
              (catMaybes
                 [("projectNumber" .=) <$> _oacptProjectNumber,
                  ("team" .=) <$> _oacptTeam])

-- | Metadata of customer-supplied encryption key, if the object is encrypted
-- by such a key.
--
-- /See:/ 'objectCustomerEncryption' smart constructor.
data ObjectCustomerEncryption = ObjectCustomerEncryption'
    { _oceKeySha256           :: !(Maybe Text)
    , _oceEncryptionAlgorithm :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectCustomerEncryption' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oceKeySha256'
--
-- * 'oceEncryptionAlgorithm'
objectCustomerEncryption
    :: ObjectCustomerEncryption
objectCustomerEncryption =
    ObjectCustomerEncryption'
    { _oceKeySha256 = Nothing
    , _oceEncryptionAlgorithm = Nothing
    }

-- | SHA256 hash value of the encryption key.
oceKeySha256 :: Lens' ObjectCustomerEncryption (Maybe Text)
oceKeySha256
  = lens _oceKeySha256 (\ s a -> s{_oceKeySha256 = a})

-- | The encryption algorithm.
oceEncryptionAlgorithm :: Lens' ObjectCustomerEncryption (Maybe Text)
oceEncryptionAlgorithm
  = lens _oceEncryptionAlgorithm
      (\ s a -> s{_oceEncryptionAlgorithm = a})

instance FromJSON ObjectCustomerEncryption where
        parseJSON
          = withObject "ObjectCustomerEncryption"
              (\ o ->
                 ObjectCustomerEncryption' <$>
                   (o .:? "keySha256") <*>
                     (o .:? "encryptionAlgorithm"))

instance ToJSON ObjectCustomerEncryption where
        toJSON ObjectCustomerEncryption'{..}
          = object
              (catMaybes
                 [("keySha256" .=) <$> _oceKeySha256,
                  ("encryptionAlgorithm" .=) <$>
                    _oceEncryptionAlgorithm])

-- | A bucket.
--
-- /See:/ 'bucket' smart constructor.
data Bucket = Bucket'
    { _bucEtag             :: !(Maybe Text)
    , _bucLocation         :: !(Maybe Text)
    , _bucKind             :: !Text
    , _bucWebsite          :: !(Maybe BucketWebsite)
    , _bucProjectNumber    :: !(Maybe (Textual Word64))
    , _bucLifecycle        :: !(Maybe BucketLifecycle)
    , _bucOwner            :: !(Maybe BucketOwner)
    , _bucSelfLink         :: !(Maybe Text)
    , _bucName             :: !(Maybe Text)
    , _bucStorageClass     :: !(Maybe Text)
    , _bucVersioning       :: !(Maybe BucketVersioning)
    , _bucCORS             :: !(Maybe [BucketCORSItem])
    , _bucTimeCreated      :: !(Maybe DateTime')
    , _bucId               :: !(Maybe Text)
    , _bucUpdated          :: !(Maybe DateTime')
    , _bucDefaultObjectACL :: !(Maybe [ObjectAccessControl])
    , _bucMetageneration   :: !(Maybe (Textual Int64))
    , _bucLogging          :: !(Maybe BucketLogging)
    , _bucACL              :: !(Maybe [BucketAccessControl])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Bucket' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bucEtag'
--
-- * 'bucLocation'
--
-- * 'bucKind'
--
-- * 'bucWebsite'
--
-- * 'bucProjectNumber'
--
-- * 'bucLifecycle'
--
-- * 'bucOwner'
--
-- * 'bucSelfLink'
--
-- * 'bucName'
--
-- * 'bucStorageClass'
--
-- * 'bucVersioning'
--
-- * 'bucCORS'
--
-- * 'bucTimeCreated'
--
-- * 'bucId'
--
-- * 'bucUpdated'
--
-- * 'bucDefaultObjectACL'
--
-- * 'bucMetageneration'
--
-- * 'bucLogging'
--
-- * 'bucACL'
bucket
    :: Bucket
bucket =
    Bucket'
    { _bucEtag = Nothing
    , _bucLocation = Nothing
    , _bucKind = "storage#bucket"
    , _bucWebsite = Nothing
    , _bucProjectNumber = Nothing
    , _bucLifecycle = Nothing
    , _bucOwner = Nothing
    , _bucSelfLink = Nothing
    , _bucName = Nothing
    , _bucStorageClass = Nothing
    , _bucVersioning = Nothing
    , _bucCORS = Nothing
    , _bucTimeCreated = Nothing
    , _bucId = Nothing
    , _bucUpdated = Nothing
    , _bucDefaultObjectACL = Nothing
    , _bucMetageneration = Nothing
    , _bucLogging = Nothing
    , _bucACL = Nothing
    }

-- | HTTP 1.1 Entity tag for the bucket.
bucEtag :: Lens' Bucket (Maybe Text)
bucEtag = lens _bucEtag (\ s a -> s{_bucEtag = a})

-- | The location of the bucket. Object data for objects in the bucket
-- resides in physical storage within this region. Defaults to US. See the
-- developer\'s guide for the authoritative list.
bucLocation :: Lens' Bucket (Maybe Text)
bucLocation
  = lens _bucLocation (\ s a -> s{_bucLocation = a})

-- | The kind of item this is. For buckets, this is always storage#bucket.
bucKind :: Lens' Bucket Text
bucKind = lens _bucKind (\ s a -> s{_bucKind = a})

-- | The bucket\'s website configuration, controlling how the service behaves
-- when accessing bucket contents as a web site. See the Static Website
-- Examples for more information.
bucWebsite :: Lens' Bucket (Maybe BucketWebsite)
bucWebsite
  = lens _bucWebsite (\ s a -> s{_bucWebsite = a})

-- | The project number of the project the bucket belongs to.
bucProjectNumber :: Lens' Bucket (Maybe Word64)
bucProjectNumber
  = lens _bucProjectNumber
      (\ s a -> s{_bucProjectNumber = a})
      . mapping _Coerce

-- | The bucket\'s lifecycle configuration. See lifecycle management for more
-- information.
bucLifecycle :: Lens' Bucket (Maybe BucketLifecycle)
bucLifecycle
  = lens _bucLifecycle (\ s a -> s{_bucLifecycle = a})

-- | The owner of the bucket. This is always the project team\'s owner group.
bucOwner :: Lens' Bucket (Maybe BucketOwner)
bucOwner = lens _bucOwner (\ s a -> s{_bucOwner = a})

-- | The URI of this bucket.
bucSelfLink :: Lens' Bucket (Maybe Text)
bucSelfLink
  = lens _bucSelfLink (\ s a -> s{_bucSelfLink = a})

-- | The name of the bucket.
bucName :: Lens' Bucket (Maybe Text)
bucName = lens _bucName (\ s a -> s{_bucName = a})

-- | The bucket\'s default storage class, used whenever no storageClass is
-- specified for a newly-created object. This defines how objects in the
-- bucket are stored and determines the SLA and the cost of storage. Values
-- include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and
-- DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the
-- bucket is created, it will default to STANDARD. For more information,
-- see storage classes.
bucStorageClass :: Lens' Bucket (Maybe Text)
bucStorageClass
  = lens _bucStorageClass
      (\ s a -> s{_bucStorageClass = a})

-- | The bucket\'s versioning configuration.
bucVersioning :: Lens' Bucket (Maybe BucketVersioning)
bucVersioning
  = lens _bucVersioning
      (\ s a -> s{_bucVersioning = a})

-- | The bucket\'s Cross-Origin Resource Sharing (CORS) configuration.
bucCORS :: Lens' Bucket [BucketCORSItem]
bucCORS
  = lens _bucCORS (\ s a -> s{_bucCORS = a}) . _Default
      . _Coerce

-- | The creation time of the bucket in RFC 3339 format.
bucTimeCreated :: Lens' Bucket (Maybe UTCTime)
bucTimeCreated
  = lens _bucTimeCreated
      (\ s a -> s{_bucTimeCreated = a})
      . mapping _DateTime

-- | The ID of the bucket.
bucId :: Lens' Bucket (Maybe Text)
bucId = lens _bucId (\ s a -> s{_bucId = a})

-- | The modification time of the bucket in RFC 3339 format.
bucUpdated :: Lens' Bucket (Maybe UTCTime)
bucUpdated
  = lens _bucUpdated (\ s a -> s{_bucUpdated = a}) .
      mapping _DateTime

-- | Default access controls to apply to new objects when no ACL is provided.
bucDefaultObjectACL :: Lens' Bucket [ObjectAccessControl]
bucDefaultObjectACL
  = lens _bucDefaultObjectACL
      (\ s a -> s{_bucDefaultObjectACL = a})
      . _Default
      . _Coerce

-- | The metadata generation of this bucket.
bucMetageneration :: Lens' Bucket (Maybe Int64)
bucMetageneration
  = lens _bucMetageneration
      (\ s a -> s{_bucMetageneration = a})
      . mapping _Coerce

-- | The bucket\'s logging configuration, which defines the destination
-- bucket and optional name prefix for the current bucket\'s logs.
bucLogging :: Lens' Bucket (Maybe BucketLogging)
bucLogging
  = lens _bucLogging (\ s a -> s{_bucLogging = a})

-- | Access controls on the bucket.
bucACL :: Lens' Bucket [BucketAccessControl]
bucACL
  = lens _bucACL (\ s a -> s{_bucACL = a}) . _Default .
      _Coerce

instance FromJSON Bucket where
        parseJSON
          = withObject "Bucket"
              (\ o ->
                 Bucket' <$>
                   (o .:? "etag") <*> (o .:? "location") <*>
                     (o .:? "kind" .!= "storage#bucket")
                     <*> (o .:? "website")
                     <*> (o .:? "projectNumber")
                     <*> (o .:? "lifecycle")
                     <*> (o .:? "owner")
                     <*> (o .:? "selfLink")
                     <*> (o .:? "name")
                     <*> (o .:? "storageClass")
                     <*> (o .:? "versioning")
                     <*> (o .:? "cors" .!= mempty)
                     <*> (o .:? "timeCreated")
                     <*> (o .:? "id")
                     <*> (o .:? "updated")
                     <*> (o .:? "defaultObjectAcl" .!= mempty)
                     <*> (o .:? "metageneration")
                     <*> (o .:? "logging")
                     <*> (o .:? "acl" .!= mempty))

instance ToJSON Bucket where
        toJSON Bucket'{..}
          = object
              (catMaybes
                 [("etag" .=) <$> _bucEtag,
                  ("location" .=) <$> _bucLocation,
                  Just ("kind" .= _bucKind),
                  ("website" .=) <$> _bucWebsite,
                  ("projectNumber" .=) <$> _bucProjectNumber,
                  ("lifecycle" .=) <$> _bucLifecycle,
                  ("owner" .=) <$> _bucOwner,
                  ("selfLink" .=) <$> _bucSelfLink,
                  ("name" .=) <$> _bucName,
                  ("storageClass" .=) <$> _bucStorageClass,
                  ("versioning" .=) <$> _bucVersioning,
                  ("cors" .=) <$> _bucCORS,
                  ("timeCreated" .=) <$> _bucTimeCreated,
                  ("id" .=) <$> _bucId, ("updated" .=) <$> _bucUpdated,
                  ("defaultObjectAcl" .=) <$> _bucDefaultObjectACL,
                  ("metageneration" .=) <$> _bucMetageneration,
                  ("logging" .=) <$> _bucLogging,
                  ("acl" .=) <$> _bucACL])

-- | A list of objects.
--
-- /See:/ 'objects' smart constructor.
data Objects = Objects'
    { _oNextPageToken :: !(Maybe Text)
    , _oKind          :: !Text
    , _oItems         :: !(Maybe [Object])
    , _oPrefixes      :: !(Maybe [Text])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Objects' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oNextPageToken'
--
-- * 'oKind'
--
-- * 'oItems'
--
-- * 'oPrefixes'
objects
    :: Objects
objects =
    Objects'
    { _oNextPageToken = Nothing
    , _oKind = "storage#objects"
    , _oItems = Nothing
    , _oPrefixes = Nothing
    }

-- | The continuation token, used to page through large result sets. Provide
-- this value in a subsequent request to return the next page of results.
oNextPageToken :: Lens' Objects (Maybe Text)
oNextPageToken
  = lens _oNextPageToken
      (\ s a -> s{_oNextPageToken = a})

-- | The kind of item this is. For lists of objects, this is always
-- storage#objects.
oKind :: Lens' Objects Text
oKind = lens _oKind (\ s a -> s{_oKind = a})

-- | The list of items.
oItems :: Lens' Objects [Object]
oItems
  = lens _oItems (\ s a -> s{_oItems = a}) . _Default .
      _Coerce

-- | The list of prefixes of objects matching-but-not-listed up to and
-- including the requested delimiter.
oPrefixes :: Lens' Objects [Text]
oPrefixes
  = lens _oPrefixes (\ s a -> s{_oPrefixes = a}) .
      _Default
      . _Coerce

instance FromJSON Objects where
        parseJSON
          = withObject "Objects"
              (\ o ->
                 Objects' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "storage#objects")
                     <*> (o .:? "items" .!= mempty)
                     <*> (o .:? "prefixes" .!= mempty))

instance ToJSON Objects where
        toJSON Objects'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _oNextPageToken,
                  Just ("kind" .= _oKind), ("items" .=) <$> _oItems,
                  ("prefixes" .=) <$> _oPrefixes])

-- | An access-control list.
--
-- /See:/ 'bucketAccessControls' smart constructor.
data BucketAccessControls = BucketAccessControls'
    { _bacKind  :: !Text
    , _bacItems :: !(Maybe [BucketAccessControl])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketAccessControls' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bacKind'
--
-- * 'bacItems'
bucketAccessControls
    :: BucketAccessControls
bucketAccessControls =
    BucketAccessControls'
    { _bacKind = "storage#bucketAccessControls"
    , _bacItems = Nothing
    }

-- | The kind of item this is. For lists of bucket access control entries,
-- this is always storage#bucketAccessControls.
bacKind :: Lens' BucketAccessControls Text
bacKind = lens _bacKind (\ s a -> s{_bacKind = a})

-- | The list of items.
bacItems :: Lens' BucketAccessControls [BucketAccessControl]
bacItems
  = lens _bacItems (\ s a -> s{_bacItems = a}) .
      _Default
      . _Coerce

instance FromJSON BucketAccessControls where
        parseJSON
          = withObject "BucketAccessControls"
              (\ o ->
                 BucketAccessControls' <$>
                   (o .:? "kind" .!= "storage#bucketAccessControls") <*>
                     (o .:? "items" .!= mempty))

instance ToJSON BucketAccessControls where
        toJSON BucketAccessControls'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _bacKind),
                  ("items" .=) <$> _bacItems])

-- | A Compose request.
--
-- /See:/ 'composeRequest' smart constructor.
data ComposeRequest = ComposeRequest'
    { _crDestination   :: !(Maybe Object)
    , _crKind          :: !Text
    , _crSourceObjects :: !(Maybe [ComposeRequestSourceObjectsItem])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ComposeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crDestination'
--
-- * 'crKind'
--
-- * 'crSourceObjects'
composeRequest
    :: ComposeRequest
composeRequest =
    ComposeRequest'
    { _crDestination = Nothing
    , _crKind = "storage#composeRequest"
    , _crSourceObjects = Nothing
    }

-- | Properties of the resulting object.
crDestination :: Lens' ComposeRequest (Maybe Object)
crDestination
  = lens _crDestination
      (\ s a -> s{_crDestination = a})

-- | The kind of item this is.
crKind :: Lens' ComposeRequest Text
crKind = lens _crKind (\ s a -> s{_crKind = a})

-- | The list of source objects that will be concatenated into a single
-- object.
crSourceObjects :: Lens' ComposeRequest [ComposeRequestSourceObjectsItem]
crSourceObjects
  = lens _crSourceObjects
      (\ s a -> s{_crSourceObjects = a})
      . _Default
      . _Coerce

instance FromJSON ComposeRequest where
        parseJSON
          = withObject "ComposeRequest"
              (\ o ->
                 ComposeRequest' <$>
                   (o .:? "destination") <*>
                     (o .:? "kind" .!= "storage#composeRequest")
                     <*> (o .:? "sourceObjects" .!= mempty))

instance ToJSON ComposeRequest where
        toJSON ComposeRequest'{..}
          = object
              (catMaybes
                 [("destination" .=) <$> _crDestination,
                  Just ("kind" .= _crKind),
                  ("sourceObjects" .=) <$> _crSourceObjects])

-- | The owner of the bucket. This is always the project team\'s owner group.
--
-- /See:/ 'bucketOwner' smart constructor.
data BucketOwner = BucketOwner'
    { _boEntity   :: !(Maybe Text)
    , _boEntityId :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketOwner' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'boEntity'
--
-- * 'boEntityId'
bucketOwner
    :: BucketOwner
bucketOwner =
    BucketOwner'
    { _boEntity = Nothing
    , _boEntityId = Nothing
    }

-- | The entity, in the form project-owner-projectId.
boEntity :: Lens' BucketOwner (Maybe Text)
boEntity = lens _boEntity (\ s a -> s{_boEntity = a})

-- | The ID for the entity.
boEntityId :: Lens' BucketOwner (Maybe Text)
boEntityId
  = lens _boEntityId (\ s a -> s{_boEntityId = a})

instance FromJSON BucketOwner where
        parseJSON
          = withObject "BucketOwner"
              (\ o ->
                 BucketOwner' <$>
                   (o .:? "entity") <*> (o .:? "entityId"))

instance ToJSON BucketOwner where
        toJSON BucketOwner'{..}
          = object
              (catMaybes
                 [("entity" .=) <$> _boEntity,
                  ("entityId" .=) <$> _boEntityId])

--
-- /See:/ 'composeRequestSourceObjectsItem' smart constructor.
data ComposeRequestSourceObjectsItem = ComposeRequestSourceObjectsItem'
    { _crsoiName                :: !(Maybe Text)
    , _crsoiObjectPreconditions :: !(Maybe ComposeRequestSourceObjectsItemObjectPreconditions)
    , _crsoiGeneration          :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ComposeRequestSourceObjectsItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crsoiName'
--
-- * 'crsoiObjectPreconditions'
--
-- * 'crsoiGeneration'
composeRequestSourceObjectsItem
    :: ComposeRequestSourceObjectsItem
composeRequestSourceObjectsItem =
    ComposeRequestSourceObjectsItem'
    { _crsoiName = Nothing
    , _crsoiObjectPreconditions = Nothing
    , _crsoiGeneration = Nothing
    }

-- | The source object\'s name. The source object\'s bucket is implicitly the
-- destination bucket.
crsoiName :: Lens' ComposeRequestSourceObjectsItem (Maybe Text)
crsoiName
  = lens _crsoiName (\ s a -> s{_crsoiName = a})

-- | Conditions that must be met for this operation to execute.
crsoiObjectPreconditions :: Lens' ComposeRequestSourceObjectsItem (Maybe ComposeRequestSourceObjectsItemObjectPreconditions)
crsoiObjectPreconditions
  = lens _crsoiObjectPreconditions
      (\ s a -> s{_crsoiObjectPreconditions = a})

-- | The generation of this object to use as the source.
crsoiGeneration :: Lens' ComposeRequestSourceObjectsItem (Maybe Int64)
crsoiGeneration
  = lens _crsoiGeneration
      (\ s a -> s{_crsoiGeneration = a})
      . mapping _Coerce

instance FromJSON ComposeRequestSourceObjectsItem
         where
        parseJSON
          = withObject "ComposeRequestSourceObjectsItem"
              (\ o ->
                 ComposeRequestSourceObjectsItem' <$>
                   (o .:? "name") <*> (o .:? "objectPreconditions") <*>
                     (o .:? "generation"))

instance ToJSON ComposeRequestSourceObjectsItem where
        toJSON ComposeRequestSourceObjectsItem'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _crsoiName,
                  ("objectPreconditions" .=) <$>
                    _crsoiObjectPreconditions,
                  ("generation" .=) <$> _crsoiGeneration])

-- | Additional parameters controlling delivery channel behavior. Optional.
--
-- /See:/ 'channelParams' smart constructor.
newtype ChannelParams = ChannelParams'
    { _cpAddtional :: HashMap Text Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ChannelParams' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cpAddtional'
channelParams
    :: HashMap Text Text -- ^ 'cpAddtional'
    -> ChannelParams
channelParams pCpAddtional_ =
    ChannelParams'
    { _cpAddtional = _Coerce # pCpAddtional_
    }

-- | Declares a new parameter by name.
cpAddtional :: Lens' ChannelParams (HashMap Text Text)
cpAddtional
  = lens _cpAddtional (\ s a -> s{_cpAddtional = a}) .
      _Coerce

instance FromJSON ChannelParams where
        parseJSON
          = withObject "ChannelParams"
              (\ o -> ChannelParams' <$> (parseJSONObject o))

instance ToJSON ChannelParams where
        toJSON = toJSON . _cpAddtional

-- | An object.
--
-- /See:/ 'object'' smart constructor.
data Object = Object'
    { _objEtag                    :: !(Maybe Text)
    , _objTimeStorageClassUpdated :: !(Maybe DateTime')
    , _objSize                    :: !(Maybe (Textual Word64))
    , _objKind                    :: !Text
    , _objTimeDeleted             :: !(Maybe DateTime')
    , _objCrc32c                  :: !(Maybe Text)
    , _objCustomerEncryption      :: !(Maybe ObjectCustomerEncryption)
    , _objBucket                  :: !(Maybe Text)
    , _objOwner                   :: !(Maybe ObjectOwner)
    , _objSelfLink                :: !(Maybe Text)
    , _objMediaLink               :: !(Maybe Text)
    , _objComponentCount          :: !(Maybe (Textual Int32))
    , _objName                    :: !(Maybe Text)
    , _objStorageClass            :: !(Maybe Text)
    , _objContentEncoding         :: !(Maybe Text)
    , _objMetadata                :: !(Maybe ObjectMetadata)
    , _objTimeCreated             :: !(Maybe DateTime')
    , _objId                      :: !(Maybe Text)
    , _objUpdated                 :: !(Maybe DateTime')
    , _objContentLanguage         :: !(Maybe Text)
    , _objCacheControl            :: !(Maybe Text)
    , _objMetageneration          :: !(Maybe (Textual Int64))
    , _objGeneration              :: !(Maybe (Textual Int64))
    , _objACL                     :: !(Maybe [ObjectAccessControl])
    , _objContentDisPosition      :: !(Maybe Text)
    , _objMD5Hash                 :: !(Maybe Text)
    , _objContentType             :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Object' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'objEtag'
--
-- * 'objTimeStorageClassUpdated'
--
-- * 'objSize'
--
-- * 'objKind'
--
-- * 'objTimeDeleted'
--
-- * 'objCrc32c'
--
-- * 'objCustomerEncryption'
--
-- * 'objBucket'
--
-- * 'objOwner'
--
-- * 'objSelfLink'
--
-- * 'objMediaLink'
--
-- * 'objComponentCount'
--
-- * 'objName'
--
-- * 'objStorageClass'
--
-- * 'objContentEncoding'
--
-- * 'objMetadata'
--
-- * 'objTimeCreated'
--
-- * 'objId'
--
-- * 'objUpdated'
--
-- * 'objContentLanguage'
--
-- * 'objCacheControl'
--
-- * 'objMetageneration'
--
-- * 'objGeneration'
--
-- * 'objACL'
--
-- * 'objContentDisPosition'
--
-- * 'objMD5Hash'
--
-- * 'objContentType'
object'
    :: Object
object' =
    Object'
    { _objEtag = Nothing
    , _objTimeStorageClassUpdated = Nothing
    , _objSize = Nothing
    , _objKind = "storage#object"
    , _objTimeDeleted = Nothing
    , _objCrc32c = Nothing
    , _objCustomerEncryption = Nothing
    , _objBucket = Nothing
    , _objOwner = Nothing
    , _objSelfLink = Nothing
    , _objMediaLink = Nothing
    , _objComponentCount = Nothing
    , _objName = Nothing
    , _objStorageClass = Nothing
    , _objContentEncoding = Nothing
    , _objMetadata = Nothing
    , _objTimeCreated = Nothing
    , _objId = Nothing
    , _objUpdated = Nothing
    , _objContentLanguage = Nothing
    , _objCacheControl = Nothing
    , _objMetageneration = Nothing
    , _objGeneration = Nothing
    , _objACL = Nothing
    , _objContentDisPosition = Nothing
    , _objMD5Hash = Nothing
    , _objContentType = Nothing
    }

-- | HTTP 1.1 Entity tag for the object.
objEtag :: Lens' Object (Maybe Text)
objEtag = lens _objEtag (\ s a -> s{_objEtag = a})

-- | The time at which the object\'s storage class was last changed. When the
-- object is initially created, it will be set to timeCreated.
objTimeStorageClassUpdated :: Lens' Object (Maybe UTCTime)
objTimeStorageClassUpdated
  = lens _objTimeStorageClassUpdated
      (\ s a -> s{_objTimeStorageClassUpdated = a})
      . mapping _DateTime

-- | Content-Length of the data in bytes.
objSize :: Lens' Object (Maybe Word64)
objSize
  = lens _objSize (\ s a -> s{_objSize = a}) .
      mapping _Coerce

-- | The kind of item this is. For objects, this is always storage#object.
objKind :: Lens' Object Text
objKind = lens _objKind (\ s a -> s{_objKind = a})

-- | The deletion time of the object in RFC 3339 format. Will be returned if
-- and only if this version of the object has been deleted.
objTimeDeleted :: Lens' Object (Maybe UTCTime)
objTimeDeleted
  = lens _objTimeDeleted
      (\ s a -> s{_objTimeDeleted = a})
      . mapping _DateTime

-- | CRC32c checksum, as described in RFC 4960, Appendix B; encoded using
-- base64 in big-endian byte order. For more information about using the
-- CRC32c checksum, see Hashes and ETags: Best Practices.
objCrc32c :: Lens' Object (Maybe Text)
objCrc32c
  = lens _objCrc32c (\ s a -> s{_objCrc32c = a})

-- | Metadata of customer-supplied encryption key, if the object is encrypted
-- by such a key.
objCustomerEncryption :: Lens' Object (Maybe ObjectCustomerEncryption)
objCustomerEncryption
  = lens _objCustomerEncryption
      (\ s a -> s{_objCustomerEncryption = a})

-- | The name of the bucket containing this object.
objBucket :: Lens' Object (Maybe Text)
objBucket
  = lens _objBucket (\ s a -> s{_objBucket = a})

-- | The owner of the object. This will always be the uploader of the object.
objOwner :: Lens' Object (Maybe ObjectOwner)
objOwner = lens _objOwner (\ s a -> s{_objOwner = a})

-- | The link to this object.
objSelfLink :: Lens' Object (Maybe Text)
objSelfLink
  = lens _objSelfLink (\ s a -> s{_objSelfLink = a})

-- | Media download link.
objMediaLink :: Lens' Object (Maybe Text)
objMediaLink
  = lens _objMediaLink (\ s a -> s{_objMediaLink = a})

-- | Number of underlying components that make up this object. Components are
-- accumulated by compose operations.
objComponentCount :: Lens' Object (Maybe Int32)
objComponentCount
  = lens _objComponentCount
      (\ s a -> s{_objComponentCount = a})
      . mapping _Coerce

-- | The name of this object. Required if not specified by URL parameter.
objName :: Lens' Object (Maybe Text)
objName = lens _objName (\ s a -> s{_objName = a})

-- | Storage class of the object.
objStorageClass :: Lens' Object (Maybe Text)
objStorageClass
  = lens _objStorageClass
      (\ s a -> s{_objStorageClass = a})

-- | Content-Encoding of the object data.
objContentEncoding :: Lens' Object (Maybe Text)
objContentEncoding
  = lens _objContentEncoding
      (\ s a -> s{_objContentEncoding = a})

-- | User-provided metadata, in key\/value pairs.
objMetadata :: Lens' Object (Maybe ObjectMetadata)
objMetadata
  = lens _objMetadata (\ s a -> s{_objMetadata = a})

-- | The creation time of the object in RFC 3339 format.
objTimeCreated :: Lens' Object (Maybe UTCTime)
objTimeCreated
  = lens _objTimeCreated
      (\ s a -> s{_objTimeCreated = a})
      . mapping _DateTime

-- | The ID of the object.
objId :: Lens' Object (Maybe Text)
objId = lens _objId (\ s a -> s{_objId = a})

-- | The modification time of the object metadata in RFC 3339 format.
objUpdated :: Lens' Object (Maybe UTCTime)
objUpdated
  = lens _objUpdated (\ s a -> s{_objUpdated = a}) .
      mapping _DateTime

-- | Content-Language of the object data.
objContentLanguage :: Lens' Object (Maybe Text)
objContentLanguage
  = lens _objContentLanguage
      (\ s a -> s{_objContentLanguage = a})

-- | Cache-Control directive for the object data. If omitted, and the object
-- is accessible to all anonymous users, the default will be public,
-- max-age=3600.
objCacheControl :: Lens' Object (Maybe Text)
objCacheControl
  = lens _objCacheControl
      (\ s a -> s{_objCacheControl = a})

-- | The version of the metadata for this object at this generation. Used for
-- preconditions and for detecting changes in metadata. A metageneration
-- number is only meaningful in the context of a particular generation of a
-- particular object.
objMetageneration :: Lens' Object (Maybe Int64)
objMetageneration
  = lens _objMetageneration
      (\ s a -> s{_objMetageneration = a})
      . mapping _Coerce

-- | The content generation of this object. Used for object versioning.
objGeneration :: Lens' Object (Maybe Int64)
objGeneration
  = lens _objGeneration
      (\ s a -> s{_objGeneration = a})
      . mapping _Coerce

-- | Access controls on the object.
objACL :: Lens' Object [ObjectAccessControl]
objACL
  = lens _objACL (\ s a -> s{_objACL = a}) . _Default .
      _Coerce

-- | Content-Disposition of the object data.
objContentDisPosition :: Lens' Object (Maybe Text)
objContentDisPosition
  = lens _objContentDisPosition
      (\ s a -> s{_objContentDisPosition = a})

-- | MD5 hash of the data; encoded using base64. For more information about
-- using the MD5 hash, see Hashes and ETags: Best Practices.
objMD5Hash :: Lens' Object (Maybe Text)
objMD5Hash
  = lens _objMD5Hash (\ s a -> s{_objMD5Hash = a})

-- | Content-Type of the object data. If contentType is not specified, object
-- downloads will be served as application\/octet-stream.
objContentType :: Lens' Object (Maybe Text)
objContentType
  = lens _objContentType
      (\ s a -> s{_objContentType = a})

instance FromJSON Object where
        parseJSON
          = withObject "Object"
              (\ o ->
                 Object' <$>
                   (o .:? "etag") <*> (o .:? "timeStorageClassUpdated")
                     <*> (o .:? "size")
                     <*> (o .:? "kind" .!= "storage#object")
                     <*> (o .:? "timeDeleted")
                     <*> (o .:? "crc32c")
                     <*> (o .:? "customerEncryption")
                     <*> (o .:? "bucket")
                     <*> (o .:? "owner")
                     <*> (o .:? "selfLink")
                     <*> (o .:? "mediaLink")
                     <*> (o .:? "componentCount")
                     <*> (o .:? "name")
                     <*> (o .:? "storageClass")
                     <*> (o .:? "contentEncoding")
                     <*> (o .:? "metadata")
                     <*> (o .:? "timeCreated")
                     <*> (o .:? "id")
                     <*> (o .:? "updated")
                     <*> (o .:? "contentLanguage")
                     <*> (o .:? "cacheControl")
                     <*> (o .:? "metageneration")
                     <*> (o .:? "generation")
                     <*> (o .:? "acl" .!= mempty)
                     <*> (o .:? "contentDisposition")
                     <*> (o .:? "md5Hash")
                     <*> (o .:? "contentType"))

instance ToJSON Object where
        toJSON Object'{..}
          = object
              (catMaybes
                 [("etag" .=) <$> _objEtag,
                  ("timeStorageClassUpdated" .=) <$>
                    _objTimeStorageClassUpdated,
                  ("size" .=) <$> _objSize, Just ("kind" .= _objKind),
                  ("timeDeleted" .=) <$> _objTimeDeleted,
                  ("crc32c" .=) <$> _objCrc32c,
                  ("customerEncryption" .=) <$> _objCustomerEncryption,
                  ("bucket" .=) <$> _objBucket,
                  ("owner" .=) <$> _objOwner,
                  ("selfLink" .=) <$> _objSelfLink,
                  ("mediaLink" .=) <$> _objMediaLink,
                  ("componentCount" .=) <$> _objComponentCount,
                  ("name" .=) <$> _objName,
                  ("storageClass" .=) <$> _objStorageClass,
                  ("contentEncoding" .=) <$> _objContentEncoding,
                  ("metadata" .=) <$> _objMetadata,
                  ("timeCreated" .=) <$> _objTimeCreated,
                  ("id" .=) <$> _objId, ("updated" .=) <$> _objUpdated,
                  ("contentLanguage" .=) <$> _objContentLanguage,
                  ("cacheControl" .=) <$> _objCacheControl,
                  ("metageneration" .=) <$> _objMetageneration,
                  ("generation" .=) <$> _objGeneration,
                  ("acl" .=) <$> _objACL,
                  ("contentDisposition" .=) <$> _objContentDisPosition,
                  ("md5Hash" .=) <$> _objMD5Hash,
                  ("contentType" .=) <$> _objContentType])

-- | Conditions that must be met for this operation to execute.
--
-- /See:/ 'composeRequestSourceObjectsItemObjectPreconditions' smart constructor.
newtype ComposeRequestSourceObjectsItemObjectPreconditions = ComposeRequestSourceObjectsItemObjectPreconditions'
    { _crsoiopIfGenerationMatch :: Maybe (Textual Int64)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ComposeRequestSourceObjectsItemObjectPreconditions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crsoiopIfGenerationMatch'
composeRequestSourceObjectsItemObjectPreconditions
    :: ComposeRequestSourceObjectsItemObjectPreconditions
composeRequestSourceObjectsItemObjectPreconditions =
    ComposeRequestSourceObjectsItemObjectPreconditions'
    { _crsoiopIfGenerationMatch = Nothing
    }

-- | Only perform the composition if the generation of the source object that
-- would be used matches this value. If this value and a generation are
-- both specified, they must be the same value or the call will fail.
crsoiopIfGenerationMatch :: Lens' ComposeRequestSourceObjectsItemObjectPreconditions (Maybe Int64)
crsoiopIfGenerationMatch
  = lens _crsoiopIfGenerationMatch
      (\ s a -> s{_crsoiopIfGenerationMatch = a})
      . mapping _Coerce

instance FromJSON
         ComposeRequestSourceObjectsItemObjectPreconditions
         where
        parseJSON
          = withObject
              "ComposeRequestSourceObjectsItemObjectPreconditions"
              (\ o ->
                 ComposeRequestSourceObjectsItemObjectPreconditions'
                   <$> (o .:? "ifGenerationMatch"))

instance ToJSON
         ComposeRequestSourceObjectsItemObjectPreconditions
         where
        toJSON
          ComposeRequestSourceObjectsItemObjectPreconditions'{..}
          = object
              (catMaybes
                 [("ifGenerationMatch" .=) <$>
                    _crsoiopIfGenerationMatch])

-- | The project team associated with the entity, if any.
--
-- /See:/ 'bucketAccessControlProjectTeam' smart constructor.
data BucketAccessControlProjectTeam = BucketAccessControlProjectTeam'
    { _bacptProjectNumber :: !(Maybe Text)
    , _bacptTeam          :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketAccessControlProjectTeam' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bacptProjectNumber'
--
-- * 'bacptTeam'
bucketAccessControlProjectTeam
    :: BucketAccessControlProjectTeam
bucketAccessControlProjectTeam =
    BucketAccessControlProjectTeam'
    { _bacptProjectNumber = Nothing
    , _bacptTeam = Nothing
    }

-- | The project number.
bacptProjectNumber :: Lens' BucketAccessControlProjectTeam (Maybe Text)
bacptProjectNumber
  = lens _bacptProjectNumber
      (\ s a -> s{_bacptProjectNumber = a})

-- | The team.
bacptTeam :: Lens' BucketAccessControlProjectTeam (Maybe Text)
bacptTeam
  = lens _bacptTeam (\ s a -> s{_bacptTeam = a})

instance FromJSON BucketAccessControlProjectTeam
         where
        parseJSON
          = withObject "BucketAccessControlProjectTeam"
              (\ o ->
                 BucketAccessControlProjectTeam' <$>
                   (o .:? "projectNumber") <*> (o .:? "team"))

instance ToJSON BucketAccessControlProjectTeam where
        toJSON BucketAccessControlProjectTeam'{..}
          = object
              (catMaybes
                 [("projectNumber" .=) <$> _bacptProjectNumber,
                  ("team" .=) <$> _bacptTeam])

-- | An access-control list.
--
-- /See:/ 'objectAccessControls' smart constructor.
data ObjectAccessControls = ObjectAccessControls'
    { _oacKind  :: !Text
    , _oacItems :: !(Maybe [ObjectAccessControl])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectAccessControls' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oacKind'
--
-- * 'oacItems'
objectAccessControls
    :: ObjectAccessControls
objectAccessControls =
    ObjectAccessControls'
    { _oacKind = "storage#objectAccessControls"
    , _oacItems = Nothing
    }

-- | The kind of item this is. For lists of object access control entries,
-- this is always storage#objectAccessControls.
oacKind :: Lens' ObjectAccessControls Text
oacKind = lens _oacKind (\ s a -> s{_oacKind = a})

-- | The list of items.
oacItems :: Lens' ObjectAccessControls [ObjectAccessControl]
oacItems
  = lens _oacItems (\ s a -> s{_oacItems = a}) .
      _Default
      . _Coerce

instance FromJSON ObjectAccessControls where
        parseJSON
          = withObject "ObjectAccessControls"
              (\ o ->
                 ObjectAccessControls' <$>
                   (o .:? "kind" .!= "storage#objectAccessControls") <*>
                     (o .:? "items" .!= mempty))

instance ToJSON ObjectAccessControls where
        toJSON ObjectAccessControls'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _oacKind),
                  ("items" .=) <$> _oacItems])

-- | The bucket\'s website configuration, controlling how the service behaves
-- when accessing bucket contents as a web site. See the Static Website
-- Examples for more information.
--
-- /See:/ 'bucketWebsite' smart constructor.
data BucketWebsite = BucketWebsite'
    { _bwMainPageSuffix :: !(Maybe Text)
    , _bwNotFoundPage   :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketWebsite' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bwMainPageSuffix'
--
-- * 'bwNotFoundPage'
bucketWebsite
    :: BucketWebsite
bucketWebsite =
    BucketWebsite'
    { _bwMainPageSuffix = Nothing
    , _bwNotFoundPage = Nothing
    }

-- | If the requested object path is missing, the service will ensure the
-- path has a trailing \'\/\', append this suffix, and attempt to retrieve
-- the resulting object. This allows the creation of index.html objects to
-- represent directory pages.
bwMainPageSuffix :: Lens' BucketWebsite (Maybe Text)
bwMainPageSuffix
  = lens _bwMainPageSuffix
      (\ s a -> s{_bwMainPageSuffix = a})

-- | If the requested object path is missing, and any mainPageSuffix object
-- is missing, if applicable, the service will return the named object from
-- this bucket as the content for a 404 Not Found result.
bwNotFoundPage :: Lens' BucketWebsite (Maybe Text)
bwNotFoundPage
  = lens _bwNotFoundPage
      (\ s a -> s{_bwNotFoundPage = a})

instance FromJSON BucketWebsite where
        parseJSON
          = withObject "BucketWebsite"
              (\ o ->
                 BucketWebsite' <$>
                   (o .:? "mainPageSuffix") <*> (o .:? "notFoundPage"))

instance ToJSON BucketWebsite where
        toJSON BucketWebsite'{..}
          = object
              (catMaybes
                 [("mainPageSuffix" .=) <$> _bwMainPageSuffix,
                  ("notFoundPage" .=) <$> _bwNotFoundPage])

-- | An access-control entry.
--
-- /See:/ 'bucketAccessControl' smart constructor.
data BucketAccessControl = BucketAccessControl'
    { _bacaEmail       :: !(Maybe Text)
    , _bacaEtag        :: !(Maybe Text)
    , _bacaKind        :: !Text
    , _bacaDomain      :: !(Maybe Text)
    , _bacaBucket      :: !(Maybe Text)
    , _bacaRole        :: !(Maybe Text)
    , _bacaSelfLink    :: !(Maybe Text)
    , _bacaId          :: !(Maybe Text)
    , _bacaProjectTeam :: !(Maybe BucketAccessControlProjectTeam)
    , _bacaEntity      :: !(Maybe Text)
    , _bacaEntityId    :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketAccessControl' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bacaEmail'
--
-- * 'bacaEtag'
--
-- * 'bacaKind'
--
-- * 'bacaDomain'
--
-- * 'bacaBucket'
--
-- * 'bacaRole'
--
-- * 'bacaSelfLink'
--
-- * 'bacaId'
--
-- * 'bacaProjectTeam'
--
-- * 'bacaEntity'
--
-- * 'bacaEntityId'
bucketAccessControl
    :: BucketAccessControl
bucketAccessControl =
    BucketAccessControl'
    { _bacaEmail = Nothing
    , _bacaEtag = Nothing
    , _bacaKind = "storage#bucketAccessControl"
    , _bacaDomain = Nothing
    , _bacaBucket = Nothing
    , _bacaRole = Nothing
    , _bacaSelfLink = Nothing
    , _bacaId = Nothing
    , _bacaProjectTeam = Nothing
    , _bacaEntity = Nothing
    , _bacaEntityId = Nothing
    }

-- | The email address associated with the entity, if any.
bacaEmail :: Lens' BucketAccessControl (Maybe Text)
bacaEmail
  = lens _bacaEmail (\ s a -> s{_bacaEmail = a})

-- | HTTP 1.1 Entity tag for the access-control entry.
bacaEtag :: Lens' BucketAccessControl (Maybe Text)
bacaEtag = lens _bacaEtag (\ s a -> s{_bacaEtag = a})

-- | The kind of item this is. For bucket access control entries, this is
-- always storage#bucketAccessControl.
bacaKind :: Lens' BucketAccessControl Text
bacaKind = lens _bacaKind (\ s a -> s{_bacaKind = a})

-- | The domain associated with the entity, if any.
bacaDomain :: Lens' BucketAccessControl (Maybe Text)
bacaDomain
  = lens _bacaDomain (\ s a -> s{_bacaDomain = a})

-- | The name of the bucket.
bacaBucket :: Lens' BucketAccessControl (Maybe Text)
bacaBucket
  = lens _bacaBucket (\ s a -> s{_bacaBucket = a})

-- | The access permission for the entity.
bacaRole :: Lens' BucketAccessControl (Maybe Text)
bacaRole = lens _bacaRole (\ s a -> s{_bacaRole = a})

-- | The link to this access-control entry.
bacaSelfLink :: Lens' BucketAccessControl (Maybe Text)
bacaSelfLink
  = lens _bacaSelfLink (\ s a -> s{_bacaSelfLink = a})

-- | The ID of the access-control entry.
bacaId :: Lens' BucketAccessControl (Maybe Text)
bacaId = lens _bacaId (\ s a -> s{_bacaId = a})

-- | The project team associated with the entity, if any.
bacaProjectTeam :: Lens' BucketAccessControl (Maybe BucketAccessControlProjectTeam)
bacaProjectTeam
  = lens _bacaProjectTeam
      (\ s a -> s{_bacaProjectTeam = a})

-- | The entity holding the permission, in one of the following forms: -
-- user-userId - user-email - group-groupId - group-email - domain-domain -
-- project-team-projectId - allUsers - allAuthenticatedUsers Examples: -
-- The user liz\'example.com would be user-liz\'example.com. - The group
-- example\'googlegroups.com would be group-example\'googlegroups.com. - To
-- refer to all members of the Google Apps for Business domain example.com,
-- the entity would be domain-example.com.
bacaEntity :: Lens' BucketAccessControl (Maybe Text)
bacaEntity
  = lens _bacaEntity (\ s a -> s{_bacaEntity = a})

-- | The ID for the entity, if any.
bacaEntityId :: Lens' BucketAccessControl (Maybe Text)
bacaEntityId
  = lens _bacaEntityId (\ s a -> s{_bacaEntityId = a})

instance FromJSON BucketAccessControl where
        parseJSON
          = withObject "BucketAccessControl"
              (\ o ->
                 BucketAccessControl' <$>
                   (o .:? "email") <*> (o .:? "etag") <*>
                     (o .:? "kind" .!= "storage#bucketAccessControl")
                     <*> (o .:? "domain")
                     <*> (o .:? "bucket")
                     <*> (o .:? "role")
                     <*> (o .:? "selfLink")
                     <*> (o .:? "id")
                     <*> (o .:? "projectTeam")
                     <*> (o .:? "entity")
                     <*> (o .:? "entityId"))

instance ToJSON BucketAccessControl where
        toJSON BucketAccessControl'{..}
          = object
              (catMaybes
                 [("email" .=) <$> _bacaEmail,
                  ("etag" .=) <$> _bacaEtag,
                  Just ("kind" .= _bacaKind),
                  ("domain" .=) <$> _bacaDomain,
                  ("bucket" .=) <$> _bacaBucket,
                  ("role" .=) <$> _bacaRole,
                  ("selfLink" .=) <$> _bacaSelfLink,
                  ("id" .=) <$> _bacaId,
                  ("projectTeam" .=) <$> _bacaProjectTeam,
                  ("entity" .=) <$> _bacaEntity,
                  ("entityId" .=) <$> _bacaEntityId])

-- | The action to take.
--
-- /See:/ 'bucketLifecycleRuleItemAction' smart constructor.
data BucketLifecycleRuleItemAction = BucketLifecycleRuleItemAction'
    { _blriaStorageClass :: !(Maybe Text)
    , _blriaType         :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BucketLifecycleRuleItemAction' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blriaStorageClass'
--
-- * 'blriaType'
bucketLifecycleRuleItemAction
    :: BucketLifecycleRuleItemAction
bucketLifecycleRuleItemAction =
    BucketLifecycleRuleItemAction'
    { _blriaStorageClass = Nothing
    , _blriaType = Nothing
    }

-- | Target storage class. Required iff the type of the action is
-- SetStorageClass.
blriaStorageClass :: Lens' BucketLifecycleRuleItemAction (Maybe Text)
blriaStorageClass
  = lens _blriaStorageClass
      (\ s a -> s{_blriaStorageClass = a})

-- | Type of the action. Currently, only Delete and SetStorageClass are
-- supported.
blriaType :: Lens' BucketLifecycleRuleItemAction (Maybe Text)
blriaType
  = lens _blriaType (\ s a -> s{_blriaType = a})

instance FromJSON BucketLifecycleRuleItemAction where
        parseJSON
          = withObject "BucketLifecycleRuleItemAction"
              (\ o ->
                 BucketLifecycleRuleItemAction' <$>
                   (o .:? "storageClass") <*> (o .:? "type"))

instance ToJSON BucketLifecycleRuleItemAction where
        toJSON BucketLifecycleRuleItemAction'{..}
          = object
              (catMaybes
                 [("storageClass" .=) <$> _blriaStorageClass,
                  ("type" .=) <$> _blriaType])

-- | An access-control entry.
--
-- /See:/ 'objectAccessControl' smart constructor.
data ObjectAccessControl = ObjectAccessControl'
    { _oacaEmail       :: !(Maybe Text)
    , _oacaEtag        :: !(Maybe Text)
    , _oacaKind        :: !Text
    , _oacaDomain      :: !(Maybe Text)
    , _oacaBucket      :: !(Maybe Text)
    , _oacaRole        :: !(Maybe Text)
    , _oacaSelfLink    :: !(Maybe Text)
    , _oacaObject      :: !(Maybe Text)
    , _oacaId          :: !(Maybe Text)
    , _oacaProjectTeam :: !(Maybe ObjectAccessControlProjectTeam)
    , _oacaEntity      :: !(Maybe Text)
    , _oacaGeneration  :: !(Maybe (Textual Int64))
    , _oacaEntityId    :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ObjectAccessControl' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oacaEmail'
--
-- * 'oacaEtag'
--
-- * 'oacaKind'
--
-- * 'oacaDomain'
--
-- * 'oacaBucket'
--
-- * 'oacaRole'
--
-- * 'oacaSelfLink'
--
-- * 'oacaObject'
--
-- * 'oacaId'
--
-- * 'oacaProjectTeam'
--
-- * 'oacaEntity'
--
-- * 'oacaGeneration'
--
-- * 'oacaEntityId'
objectAccessControl
    :: ObjectAccessControl
objectAccessControl =
    ObjectAccessControl'
    { _oacaEmail = Nothing
    , _oacaEtag = Nothing
    , _oacaKind = "storage#objectAccessControl"
    , _oacaDomain = Nothing
    , _oacaBucket = Nothing
    , _oacaRole = Nothing
    , _oacaSelfLink = Nothing
    , _oacaObject = Nothing
    , _oacaId = Nothing
    , _oacaProjectTeam = Nothing
    , _oacaEntity = Nothing
    , _oacaGeneration = Nothing
    , _oacaEntityId = Nothing
    }

-- | The email address associated with the entity, if any.
oacaEmail :: Lens' ObjectAccessControl (Maybe Text)
oacaEmail
  = lens _oacaEmail (\ s a -> s{_oacaEmail = a})

-- | HTTP 1.1 Entity tag for the access-control entry.
oacaEtag :: Lens' ObjectAccessControl (Maybe Text)
oacaEtag = lens _oacaEtag (\ s a -> s{_oacaEtag = a})

-- | The kind of item this is. For object access control entries, this is
-- always storage#objectAccessControl.
oacaKind :: Lens' ObjectAccessControl Text
oacaKind = lens _oacaKind (\ s a -> s{_oacaKind = a})

-- | The domain associated with the entity, if any.
oacaDomain :: Lens' ObjectAccessControl (Maybe Text)
oacaDomain
  = lens _oacaDomain (\ s a -> s{_oacaDomain = a})

-- | The name of the bucket.
oacaBucket :: Lens' ObjectAccessControl (Maybe Text)
oacaBucket
  = lens _oacaBucket (\ s a -> s{_oacaBucket = a})

-- | The access permission for the entity.
oacaRole :: Lens' ObjectAccessControl (Maybe Text)
oacaRole = lens _oacaRole (\ s a -> s{_oacaRole = a})

-- | The link to this access-control entry.
oacaSelfLink :: Lens' ObjectAccessControl (Maybe Text)
oacaSelfLink
  = lens _oacaSelfLink (\ s a -> s{_oacaSelfLink = a})

-- | The name of the object, if applied to an object.
oacaObject :: Lens' ObjectAccessControl (Maybe Text)
oacaObject
  = lens _oacaObject (\ s a -> s{_oacaObject = a})

-- | The ID of the access-control entry.
oacaId :: Lens' ObjectAccessControl (Maybe Text)
oacaId = lens _oacaId (\ s a -> s{_oacaId = a})

-- | The project team associated with the entity, if any.
oacaProjectTeam :: Lens' ObjectAccessControl (Maybe ObjectAccessControlProjectTeam)
oacaProjectTeam
  = lens _oacaProjectTeam
      (\ s a -> s{_oacaProjectTeam = a})

-- | The entity holding the permission, in one of the following forms: -
-- user-userId - user-email - group-groupId - group-email - domain-domain -
-- project-team-projectId - allUsers - allAuthenticatedUsers Examples: -
-- The user liz\'example.com would be user-liz\'example.com. - The group
-- example\'googlegroups.com would be group-example\'googlegroups.com. - To
-- refer to all members of the Google Apps for Business domain example.com,
-- the entity would be domain-example.com.
oacaEntity :: Lens' ObjectAccessControl (Maybe Text)
oacaEntity
  = lens _oacaEntity (\ s a -> s{_oacaEntity = a})

-- | The content generation of the object, if applied to an object.
oacaGeneration :: Lens' ObjectAccessControl (Maybe Int64)
oacaGeneration
  = lens _oacaGeneration
      (\ s a -> s{_oacaGeneration = a})
      . mapping _Coerce

-- | The ID for the entity, if any.
oacaEntityId :: Lens' ObjectAccessControl (Maybe Text)
oacaEntityId
  = lens _oacaEntityId (\ s a -> s{_oacaEntityId = a})

instance FromJSON ObjectAccessControl where
        parseJSON
          = withObject "ObjectAccessControl"
              (\ o ->
                 ObjectAccessControl' <$>
                   (o .:? "email") <*> (o .:? "etag") <*>
                     (o .:? "kind" .!= "storage#objectAccessControl")
                     <*> (o .:? "domain")
                     <*> (o .:? "bucket")
                     <*> (o .:? "role")
                     <*> (o .:? "selfLink")
                     <*> (o .:? "object")
                     <*> (o .:? "id")
                     <*> (o .:? "projectTeam")
                     <*> (o .:? "entity")
                     <*> (o .:? "generation")
                     <*> (o .:? "entityId"))

instance ToJSON ObjectAccessControl where
        toJSON ObjectAccessControl'{..}
          = object
              (catMaybes
                 [("email" .=) <$> _oacaEmail,
                  ("etag" .=) <$> _oacaEtag,
                  Just ("kind" .= _oacaKind),
                  ("domain" .=) <$> _oacaDomain,
                  ("bucket" .=) <$> _oacaBucket,
                  ("role" .=) <$> _oacaRole,
                  ("selfLink" .=) <$> _oacaSelfLink,
                  ("object" .=) <$> _oacaObject, ("id" .=) <$> _oacaId,
                  ("projectTeam" .=) <$> _oacaProjectTeam,
                  ("entity" .=) <$> _oacaEntity,
                  ("generation" .=) <$> _oacaGeneration,
                  ("entityId" .=) <$> _oacaEntityId])

-- | A rewrite response.
--
-- /See:/ 'rewriteResponse' smart constructor.
data RewriteResponse = RewriteResponse'
    { _rrKind                :: !Text
    , _rrDone                :: !(Maybe Bool)
    , _rrResource            :: !(Maybe Object)
    , _rrObjectSize          :: !(Maybe (Textual Word64))
    , _rrTotalBytesRewritten :: !(Maybe (Textual Word64))
    , _rrRewriteToken        :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RewriteResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rrKind'
--
-- * 'rrDone'
--
-- * 'rrResource'
--
-- * 'rrObjectSize'
--
-- * 'rrTotalBytesRewritten'
--
-- * 'rrRewriteToken'
rewriteResponse
    :: RewriteResponse
rewriteResponse =
    RewriteResponse'
    { _rrKind = "storage#rewriteResponse"
    , _rrDone = Nothing
    , _rrResource = Nothing
    , _rrObjectSize = Nothing
    , _rrTotalBytesRewritten = Nothing
    , _rrRewriteToken = Nothing
    }

-- | The kind of item this is.
rrKind :: Lens' RewriteResponse Text
rrKind = lens _rrKind (\ s a -> s{_rrKind = a})

-- | true if the copy is finished; otherwise, false if the copy is in
-- progress. This property is always present in the response.
rrDone :: Lens' RewriteResponse (Maybe Bool)
rrDone = lens _rrDone (\ s a -> s{_rrDone = a})

-- | A resource containing the metadata for the copied-to object. This
-- property is present in the response only when copying completes.
rrResource :: Lens' RewriteResponse (Maybe Object)
rrResource
  = lens _rrResource (\ s a -> s{_rrResource = a})

-- | The total size of the object being copied in bytes. This property is
-- always present in the response.
rrObjectSize :: Lens' RewriteResponse (Maybe Word64)
rrObjectSize
  = lens _rrObjectSize (\ s a -> s{_rrObjectSize = a})
      . mapping _Coerce

-- | The total bytes written so far, which can be used to provide a waiting
-- user with a progress indicator. This property is always present in the
-- response.
rrTotalBytesRewritten :: Lens' RewriteResponse (Maybe Word64)
rrTotalBytesRewritten
  = lens _rrTotalBytesRewritten
      (\ s a -> s{_rrTotalBytesRewritten = a})
      . mapping _Coerce

-- | A token to use in subsequent requests to continue copying data. This
-- token is present in the response only when there is more data to copy.
rrRewriteToken :: Lens' RewriteResponse (Maybe Text)
rrRewriteToken
  = lens _rrRewriteToken
      (\ s a -> s{_rrRewriteToken = a})

instance FromJSON RewriteResponse where
        parseJSON
          = withObject "RewriteResponse"
              (\ o ->
                 RewriteResponse' <$>
                   (o .:? "kind" .!= "storage#rewriteResponse") <*>
                     (o .:? "done")
                     <*> (o .:? "resource")
                     <*> (o .:? "objectSize")
                     <*> (o .:? "totalBytesRewritten")
                     <*> (o .:? "rewriteToken"))

instance ToJSON RewriteResponse where
        toJSON RewriteResponse'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _rrKind), ("done" .=) <$> _rrDone,
                  ("resource" .=) <$> _rrResource,
                  ("objectSize" .=) <$> _rrObjectSize,
                  ("totalBytesRewritten" .=) <$>
                    _rrTotalBytesRewritten,
                  ("rewriteToken" .=) <$> _rrRewriteToken])