{-# 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.FirebaseRules.Projects.Test
(
ProjectsTestResource
, projectsTest
, ProjectsTest
, ptXgafv
, ptUploadProtocol
, ptPp
, ptAccessToken
, ptUploadType
, ptPayload
, ptBearerToken
, ptName
, ptCallback
) where
import Network.Google.FirebaseRules.Types
import Network.Google.Prelude
type ProjectsTestResource =
"v1" :>
CaptureMode "name" "test" Text :>
QueryParam "$.xgafv" Xgafv :>
QueryParam "upload_protocol" Text :>
QueryParam "pp" Bool :>
QueryParam "access_token" Text :>
QueryParam "uploadType" Text :>
QueryParam "bearer_token" Text :>
QueryParam "callback" Text :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] TestRulesetRequest :>
Post '[JSON] TestRulesetResponse
-- | Test \`Source\` for syntactic and semantic correctness. Issues present
-- in the rules, if any, will be returned to the caller with a description,
-- severity, and source location. The test method will typically be
-- executed with a developer provided \`Source\`, but if regression testing
-- is desired, this method may be executed against a \`Ruleset\` resource
-- name and the \`Source\` will be retrieved from the persisted
-- \`Ruleset\`. The following is an example of \`Source\` that permits
-- users to upload images to a bucket bearing their user id and matching
-- the correct metadata: _*Example*_ \/\/ Users are allowed to subscribe
-- and unsubscribe to the blog. service firebase.storage { match
-- \/users\/{userId}\/images\/{imageName} { allow write: if userId ==
-- request.userId && (imageName.endsWith(\'.png\') ||
-- imageName.endsWith(\'.jpg\')) &&
-- resource.mimeType.startsWith(\'image\/\') } }
--
-- /See:/ 'projectsTest' smart constructor.
data ProjectsTest = ProjectsTest'
{ _ptXgafv :: !(Maybe Xgafv)
, _ptUploadProtocol :: !(Maybe Text)
, _ptPp :: !Bool
, _ptAccessToken :: !(Maybe Text)
, _ptUploadType :: !(Maybe Text)
, _ptPayload :: !TestRulesetRequest
, _ptBearerToken :: !(Maybe Text)
, _ptName :: !Text
, _ptCallback :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'ProjectsTest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptXgafv'
--
-- * 'ptUploadProtocol'
--
-- * 'ptPp'
--
-- * 'ptAccessToken'
--
-- * 'ptUploadType'
--
-- * 'ptPayload'
--
-- * 'ptBearerToken'
--
-- * 'ptName'
--
-- * 'ptCallback'
projectsTest
:: TestRulesetRequest -- ^ 'ptPayload'
-> Text -- ^ 'ptName'
-> ProjectsTest
projectsTest pPtPayload_ pPtName_ =
ProjectsTest'
{ _ptXgafv = Nothing
, _ptUploadProtocol = Nothing
, _ptPp = True
, _ptAccessToken = Nothing
, _ptUploadType = Nothing
, _ptPayload = pPtPayload_
, _ptBearerToken = Nothing
, _ptName = pPtName_
, _ptCallback = Nothing
}
-- | V1 error format.
ptXgafv :: Lens' ProjectsTest (Maybe Xgafv)
ptXgafv = lens _ptXgafv (\ s a -> s{_ptXgafv = a})
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
ptUploadProtocol :: Lens' ProjectsTest (Maybe Text)
ptUploadProtocol
= lens _ptUploadProtocol
(\ s a -> s{_ptUploadProtocol = a})
-- | Pretty-print response.
ptPp :: Lens' ProjectsTest Bool
ptPp = lens _ptPp (\ s a -> s{_ptPp = a})
-- | OAuth access token.
ptAccessToken :: Lens' ProjectsTest (Maybe Text)
ptAccessToken
= lens _ptAccessToken
(\ s a -> s{_ptAccessToken = a})
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
ptUploadType :: Lens' ProjectsTest (Maybe Text)
ptUploadType
= lens _ptUploadType (\ s a -> s{_ptUploadType = a})
-- | Multipart request metadata.
ptPayload :: Lens' ProjectsTest TestRulesetRequest
ptPayload
= lens _ptPayload (\ s a -> s{_ptPayload = a})
-- | OAuth bearer token.
ptBearerToken :: Lens' ProjectsTest (Maybe Text)
ptBearerToken
= lens _ptBearerToken
(\ s a -> s{_ptBearerToken = a})
-- | Name of the project. Format: \`projects\/{project_id}\`
ptName :: Lens' ProjectsTest Text
ptName = lens _ptName (\ s a -> s{_ptName = a})
-- | JSONP
ptCallback :: Lens' ProjectsTest (Maybe Text)
ptCallback
= lens _ptCallback (\ s a -> s{_ptCallback = a})
instance GoogleRequest ProjectsTest where
type Rs ProjectsTest = TestRulesetResponse
type Scopes ProjectsTest =
'["https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/firebase",
"https://www.googleapis.com/auth/firebase.readonly"]
requestClient ProjectsTest'{..}
= go _ptName _ptXgafv _ptUploadProtocol (Just _ptPp)
_ptAccessToken
_ptUploadType
_ptBearerToken
_ptCallback
(Just AltJSON)
_ptPayload
firebaseRulesService
where go
= buildClient (Proxy :: Proxy ProjectsTestResource)
mempty