{-# 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.Jobs.Projects.Tenants.Patch
-- 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)
--
-- Updates specified tenant.
--
-- /See:/ <https://cloud.google.com/talent-solution/job-search/docs/ Cloud Talent Solution API Reference> for @jobs.projects.tenants.patch@.
module Network.Google.Resource.Jobs.Projects.Tenants.Patch
    (
    -- * REST Resource
      ProjectsTenantsPatchResource

    -- * Creating a Request
    , projectsTenantsPatch
    , ProjectsTenantsPatch

    -- * Request Lenses
    , ptpXgafv
    , ptpUploadProtocol
    , ptpUpdateMask
    , ptpAccessToken
    , ptpUploadType
    , ptpPayload
    , ptpName
    , ptpCallback
    ) where

import Network.Google.Jobs.Types
import Network.Google.Prelude

-- | A resource alias for @jobs.projects.tenants.patch@ method which the
-- 'ProjectsTenantsPatch' request conforms to.
type ProjectsTenantsPatchResource =
     "v4" :>
       Capture "name" Text :>
         QueryParam "$.xgafv" Xgafv :>
           QueryParam "upload_protocol" Text :>
             QueryParam "updateMask" GFieldMask :>
               QueryParam "access_token" Text :>
                 QueryParam "uploadType" Text :>
                   QueryParam "callback" Text :>
                     QueryParam "alt" AltJSON :>
                       ReqBody '[JSON] Tenant :> Patch '[JSON] Tenant

-- | Updates specified tenant.
--
-- /See:/ 'projectsTenantsPatch' smart constructor.
data ProjectsTenantsPatch =
  ProjectsTenantsPatch'
    { _ptpXgafv :: !(Maybe Xgafv)
    , _ptpUploadProtocol :: !(Maybe Text)
    , _ptpUpdateMask :: !(Maybe GFieldMask)
    , _ptpAccessToken :: !(Maybe Text)
    , _ptpUploadType :: !(Maybe Text)
    , _ptpPayload :: !Tenant
    , _ptpName :: !Text
    , _ptpCallback :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ProjectsTenantsPatch' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptpXgafv'
--
-- * 'ptpUploadProtocol'
--
-- * 'ptpUpdateMask'
--
-- * 'ptpAccessToken'
--
-- * 'ptpUploadType'
--
-- * 'ptpPayload'
--
-- * 'ptpName'
--
-- * 'ptpCallback'
projectsTenantsPatch
    :: Tenant -- ^ 'ptpPayload'
    -> Text -- ^ 'ptpName'
    -> ProjectsTenantsPatch
projectsTenantsPatch pPtpPayload_ pPtpName_ =
  ProjectsTenantsPatch'
    { _ptpXgafv = Nothing
    , _ptpUploadProtocol = Nothing
    , _ptpUpdateMask = Nothing
    , _ptpAccessToken = Nothing
    , _ptpUploadType = Nothing
    , _ptpPayload = pPtpPayload_
    , _ptpName = pPtpName_
    , _ptpCallback = Nothing
    }


-- | V1 error format.
ptpXgafv :: Lens' ProjectsTenantsPatch (Maybe Xgafv)
ptpXgafv = lens _ptpXgafv (\ s a -> s{_ptpXgafv = a})

-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
ptpUploadProtocol :: Lens' ProjectsTenantsPatch (Maybe Text)
ptpUploadProtocol
  = lens _ptpUploadProtocol
      (\ s a -> s{_ptpUploadProtocol = a})

-- | Strongly recommended for the best service experience. If update_mask is
-- provided, only the specified fields in tenant are updated. Otherwise all
-- the fields are updated. A field mask to specify the tenant fields to be
-- updated. Only top level fields of Tenant are supported.
ptpUpdateMask :: Lens' ProjectsTenantsPatch (Maybe GFieldMask)
ptpUpdateMask
  = lens _ptpUpdateMask
      (\ s a -> s{_ptpUpdateMask = a})

-- | OAuth access token.
ptpAccessToken :: Lens' ProjectsTenantsPatch (Maybe Text)
ptpAccessToken
  = lens _ptpAccessToken
      (\ s a -> s{_ptpAccessToken = a})

-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
ptpUploadType :: Lens' ProjectsTenantsPatch (Maybe Text)
ptpUploadType
  = lens _ptpUploadType
      (\ s a -> s{_ptpUploadType = a})

-- | Multipart request metadata.
ptpPayload :: Lens' ProjectsTenantsPatch Tenant
ptpPayload
  = lens _ptpPayload (\ s a -> s{_ptpPayload = a})

-- | Required during tenant update. The resource name for a tenant. This is
-- generated by the service when a tenant is created. The format is
-- \"projects\/{project_id}\/tenants\/{tenant_id}\", for example,
-- \"projects\/foo\/tenants\/bar\".
ptpName :: Lens' ProjectsTenantsPatch Text
ptpName = lens _ptpName (\ s a -> s{_ptpName = a})

-- | JSONP
ptpCallback :: Lens' ProjectsTenantsPatch (Maybe Text)
ptpCallback
  = lens _ptpCallback (\ s a -> s{_ptpCallback = a})

instance GoogleRequest ProjectsTenantsPatch where
        type Rs ProjectsTenantsPatch = Tenant
        type Scopes ProjectsTenantsPatch =
             '["https://www.googleapis.com/auth/cloud-platform",
               "https://www.googleapis.com/auth/jobs"]
        requestClient ProjectsTenantsPatch'{..}
          = go _ptpName _ptpXgafv _ptpUploadProtocol
              _ptpUpdateMask
              _ptpAccessToken
              _ptpUploadType
              _ptpCallback
              (Just AltJSON)
              _ptpPayload
              jobsService
          where go
                  = buildClient
                      (Proxy :: Proxy ProjectsTenantsPatchResource)
                      mempty
