{-# 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.ObjectAccessControls.Update
    (
    
      ObjectAccessControlsUpdateResource
    
    , objectAccessControlsUpdate
    , ObjectAccessControlsUpdate
    
    , oacuBucket
    , oacuPayload
    , oacuUserProject
    , oacuObject
    , oacuEntity
    , oacuGeneration
    ) where
import           Network.Google.Prelude
import           Network.Google.Storage.Types
type ObjectAccessControlsUpdateResource =
     "storage" :>
       "v1" :>
         "b" :>
           Capture "bucket" Text :>
             "o" :>
               Capture "object" Text :>
                 "acl" :>
                   Capture "entity" Text :>
                     QueryParam "userProject" Text :>
                       QueryParam "generation" (Textual Int64) :>
                         QueryParam "alt" AltJSON :>
                           ReqBody '[JSON] ObjectAccessControl :>
                             Put '[JSON] ObjectAccessControl
data ObjectAccessControlsUpdate = ObjectAccessControlsUpdate'
    { _oacuBucket      :: !Text
    , _oacuPayload     :: !ObjectAccessControl
    , _oacuUserProject :: !(Maybe Text)
    , _oacuObject      :: !Text
    , _oacuEntity      :: !Text
    , _oacuGeneration  :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)
objectAccessControlsUpdate
    :: Text 
    -> ObjectAccessControl 
    -> Text 
    -> Text 
    -> ObjectAccessControlsUpdate
objectAccessControlsUpdate pOacuBucket_ pOacuPayload_ pOacuObject_ pOacuEntity_ =
    ObjectAccessControlsUpdate'
    { _oacuBucket = pOacuBucket_
    , _oacuPayload = pOacuPayload_
    , _oacuUserProject = Nothing
    , _oacuObject = pOacuObject_
    , _oacuEntity = pOacuEntity_
    , _oacuGeneration = Nothing
    }
oacuBucket :: Lens' ObjectAccessControlsUpdate Text
oacuBucket
  = lens _oacuBucket (\ s a -> s{_oacuBucket = a})
oacuPayload :: Lens' ObjectAccessControlsUpdate ObjectAccessControl
oacuPayload
  = lens _oacuPayload (\ s a -> s{_oacuPayload = a})
oacuUserProject :: Lens' ObjectAccessControlsUpdate (Maybe Text)
oacuUserProject
  = lens _oacuUserProject
      (\ s a -> s{_oacuUserProject = a})
oacuObject :: Lens' ObjectAccessControlsUpdate Text
oacuObject
  = lens _oacuObject (\ s a -> s{_oacuObject = a})
oacuEntity :: Lens' ObjectAccessControlsUpdate Text
oacuEntity
  = lens _oacuEntity (\ s a -> s{_oacuEntity = a})
oacuGeneration :: Lens' ObjectAccessControlsUpdate (Maybe Int64)
oacuGeneration
  = lens _oacuGeneration
      (\ s a -> s{_oacuGeneration = a})
      . mapping _Coerce
instance GoogleRequest ObjectAccessControlsUpdate
         where
        type Rs ObjectAccessControlsUpdate =
             ObjectAccessControl
        type Scopes ObjectAccessControlsUpdate =
             '["https://www.googleapis.com/auth/cloud-platform",
               "https://www.googleapis.com/auth/devstorage.full_control"]
        requestClient ObjectAccessControlsUpdate'{..}
          = go _oacuBucket _oacuObject _oacuEntity
              _oacuUserProject
              _oacuGeneration
              (Just AltJSON)
              _oacuPayload
              storageService
          where go
                  = buildClient
                      (Proxy :: Proxy ObjectAccessControlsUpdateResource)
                      mempty