{-# LANGUAGE DataKinds          #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE FlexibleInstances  #-}
{-# LANGUAGE NoImplicitPrelude  #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}
{-# LANGUAGE TypeFamilies       #-}
{-# LANGUAGE TypeOperators      #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds      #-}
{-# OPTIONS_GHC -fno-warn-unused-imports    #-}
module Network.Google.Resource.Storage.Objects.Patch
    (
    
      ObjectsPatchResource
    
    , objectsPatch
    , ObjectsPatch
    
    , opIfMetagenerationMatch
    , opIfGenerationNotMatch
    , opIfGenerationMatch
    , opPredefinedACL
    , opBucket
    , opPayload
    , opUserProject
    , opIfMetagenerationNotMatch
    , opObject
    , opProjection
    , opGeneration
    ) where
import           Network.Google.Prelude
import           Network.Google.Storage.Types
type ObjectsPatchResource =
     "storage" :>
       "v1" :>
         "b" :>
           Capture "bucket" Text :>
             "o" :>
               Capture "object" Text :>
                 QueryParam "ifMetagenerationMatch" (Textual Int64) :>
                   QueryParam "ifGenerationNotMatch" (Textual Int64) :>
                     QueryParam "ifGenerationMatch" (Textual Int64) :>
                       QueryParam "predefinedAcl" ObjectsPatchPredefinedACL
                         :>
                         QueryParam "userProject" Text :>
                           QueryParam "ifMetagenerationNotMatch" (Textual Int64)
                             :>
                             QueryParam "projection" ObjectsPatchProjection :>
                               QueryParam "generation" (Textual Int64) :>
                                 QueryParam "alt" AltJSON :>
                                   ReqBody '[JSON] Object :>
                                     Patch '[JSON] Object
data ObjectsPatch =
  ObjectsPatch'
    { _opIfMetagenerationMatch    :: !(Maybe (Textual Int64))
    , _opIfGenerationNotMatch     :: !(Maybe (Textual Int64))
    , _opIfGenerationMatch        :: !(Maybe (Textual Int64))
    , _opPredefinedACL            :: !(Maybe ObjectsPatchPredefinedACL)
    , _opBucket                   :: !Text
    , _opPayload                  :: !Object
    , _opUserProject              :: !(Maybe Text)
    , _opIfMetagenerationNotMatch :: !(Maybe (Textual Int64))
    , _opObject                   :: !Text
    , _opProjection               :: !(Maybe ObjectsPatchProjection)
    , _opGeneration               :: !(Maybe (Textual Int64))
    }
  deriving (Eq, Show, Data, Typeable, Generic)
objectsPatch
    :: Text 
    -> Object 
    -> Text 
    -> ObjectsPatch
objectsPatch pOpBucket_ pOpPayload_ pOpObject_ =
  ObjectsPatch'
    { _opIfMetagenerationMatch = Nothing
    , _opIfGenerationNotMatch = Nothing
    , _opIfGenerationMatch = Nothing
    , _opPredefinedACL = Nothing
    , _opBucket = pOpBucket_
    , _opPayload = pOpPayload_
    , _opUserProject = Nothing
    , _opIfMetagenerationNotMatch = Nothing
    , _opObject = pOpObject_
    , _opProjection = Nothing
    , _opGeneration = Nothing
    }
opIfMetagenerationMatch :: Lens' ObjectsPatch (Maybe Int64)
opIfMetagenerationMatch
  = lens _opIfMetagenerationMatch
      (\ s a -> s{_opIfMetagenerationMatch = a})
      . mapping _Coerce
opIfGenerationNotMatch :: Lens' ObjectsPatch (Maybe Int64)
opIfGenerationNotMatch
  = lens _opIfGenerationNotMatch
      (\ s a -> s{_opIfGenerationNotMatch = a})
      . mapping _Coerce
opIfGenerationMatch :: Lens' ObjectsPatch (Maybe Int64)
opIfGenerationMatch
  = lens _opIfGenerationMatch
      (\ s a -> s{_opIfGenerationMatch = a})
      . mapping _Coerce
opPredefinedACL :: Lens' ObjectsPatch (Maybe ObjectsPatchPredefinedACL)
opPredefinedACL
  = lens _opPredefinedACL
      (\ s a -> s{_opPredefinedACL = a})
opBucket :: Lens' ObjectsPatch Text
opBucket = lens _opBucket (\ s a -> s{_opBucket = a})
opPayload :: Lens' ObjectsPatch Object
opPayload
  = lens _opPayload (\ s a -> s{_opPayload = a})
opUserProject :: Lens' ObjectsPatch (Maybe Text)
opUserProject
  = lens _opUserProject
      (\ s a -> s{_opUserProject = a})
opIfMetagenerationNotMatch :: Lens' ObjectsPatch (Maybe Int64)
opIfMetagenerationNotMatch
  = lens _opIfMetagenerationNotMatch
      (\ s a -> s{_opIfMetagenerationNotMatch = a})
      . mapping _Coerce
opObject :: Lens' ObjectsPatch Text
opObject = lens _opObject (\ s a -> s{_opObject = a})
opProjection :: Lens' ObjectsPatch (Maybe ObjectsPatchProjection)
opProjection
  = lens _opProjection (\ s a -> s{_opProjection = a})
opGeneration :: Lens' ObjectsPatch (Maybe Int64)
opGeneration
  = lens _opGeneration (\ s a -> s{_opGeneration = a})
      . mapping _Coerce
instance GoogleRequest ObjectsPatch where
        type Rs ObjectsPatch = Object
        type Scopes ObjectsPatch =
             '["https://www.googleapis.com/auth/cloud-platform",
               "https://www.googleapis.com/auth/devstorage.full_control"]
        requestClient ObjectsPatch'{..}
          = go _opBucket _opObject _opIfMetagenerationMatch
              _opIfGenerationNotMatch
              _opIfGenerationMatch
              _opPredefinedACL
              _opUserProject
              _opIfMetagenerationNotMatch
              _opProjection
              _opGeneration
              (Just AltJSON)
              _opPayload
              storageService
          where go
                  = buildClient (Proxy :: Proxy ObjectsPatchResource)
                      mempty