{-# 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.RemoteBuildExecution.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.RemoteBuildExecution.Types.Product where

import           Network.Google.Prelude
import           Network.Google.RemoteBuildExecution.Types.Sum

-- | A content digest. A digest for a given blob consists of the size of the
-- blob and its hash. The hash algorithm to use is defined by the server,
-- but servers SHOULD use SHA-256. The size is considered to be an integral
-- part of the digest and cannot be separated. That is, even if the
-- \`hash\` field is correctly specified but \`size_bytes\` is not, the
-- server MUST reject the request. The reason for including the size in the
-- digest is as follows: in a great many cases, the server needs to know
-- the size of the blob it is about to work with prior to starting an
-- operation with it, such as flattening Merkle tree structures or
-- streaming it to a worker. Technically, the server could implement a
-- separate metadata store, but this results in a significantly more
-- complicated implementation as opposed to having the client specify the
-- size up-front (or storing the size along with the digest in every
-- message where digests are embedded). This does mean that the API leaks
-- some implementation details of (what we consider to be) a reasonable
-- server implementation, but we consider this to be a worthwhile tradeoff.
-- When a \`Digest\` is used to refer to a proto message, it always refers
-- to the message in binary encoded form. To ensure consistent hashing,
-- clients and servers MUST ensure that they serialize messages according
-- to the following rules, even if there are alternate valid encodings for
-- the same message: * Fields are serialized in tag order. * There are no
-- unknown fields. * There are no duplicate fields. * Fields are serialized
-- according to the default semantics for their type. Most protocol buffer
-- implementations will always follow these rules when serializing, but
-- care should be taken to avoid shortcuts. For instance, concatenating two
-- messages to merge them may produce duplicate fields.
--
-- /See:/ 'buildBazelRemoteExecutionV2Digest' smart constructor.
data BuildBazelRemoteExecutionV2Digest =
  BuildBazelRemoteExecutionV2Digest'
    { _bbrevdSizeBytes :: !(Maybe (Textual Int64))
    , _bbrevdHash      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2Digest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevdSizeBytes'
--
-- * 'bbrevdHash'
buildBazelRemoteExecutionV2Digest
    :: BuildBazelRemoteExecutionV2Digest
buildBazelRemoteExecutionV2Digest =
  BuildBazelRemoteExecutionV2Digest'
    {_bbrevdSizeBytes = Nothing, _bbrevdHash = Nothing}


-- | The size of the blob, in bytes.
bbrevdSizeBytes :: Lens' BuildBazelRemoteExecutionV2Digest (Maybe Int64)
bbrevdSizeBytes
  = lens _bbrevdSizeBytes
      (\ s a -> s{_bbrevdSizeBytes = a})
      . mapping _Coerce

-- | The hash. In the case of SHA-256, it will always be a lowercase hex
-- string exactly 64 characters long.
bbrevdHash :: Lens' BuildBazelRemoteExecutionV2Digest (Maybe Text)
bbrevdHash
  = lens _bbrevdHash (\ s a -> s{_bbrevdHash = a})

instance FromJSON BuildBazelRemoteExecutionV2Digest
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2Digest"
              (\ o ->
                 BuildBazelRemoteExecutionV2Digest' <$>
                   (o .:? "sizeBytes") <*> (o .:? "hash"))

instance ToJSON BuildBazelRemoteExecutionV2Digest
         where
        toJSON BuildBazelRemoteExecutionV2Digest'{..}
          = object
              (catMaybes
                 [("sizeBytes" .=) <$> _bbrevdSizeBytes,
                  ("hash" .=) <$> _bbrevdHash])

-- | The \`Status\` type defines a logical error model that is suitable for
-- different programming environments, including REST APIs and RPC APIs. It
-- is used by [gRPC](https:\/\/github.com\/grpc). The error model is
-- designed to be: - Simple to use and understand for most users - Flexible
-- enough to meet unexpected needs # Overview The \`Status\` message
-- contains three pieces of data: error code, error message, and error
-- details. The error code should be an enum value of google.rpc.Code, but
-- it may accept additional error codes if needed. The error message should
-- be a developer-facing English message that helps developers *understand*
-- and *resolve* the error. If a localized user-facing error message is
-- needed, put the localized message in the error details or localize it in
-- the client. The optional error details may contain arbitrary information
-- about the error. There is a predefined set of error detail types in the
-- package \`google.rpc\` that can be used for common error conditions. #
-- Language mapping The \`Status\` message is the logical representation of
-- the error model, but it is not necessarily the actual wire format. When
-- the \`Status\` message is exposed in different client libraries and
-- different wire protocols, it can be mapped differently. For example, it
-- will likely be mapped to some exceptions in Java, but more likely mapped
-- to some error codes in C. # Other uses The error model and the
-- \`Status\` message can be used in a variety of environments, either with
-- or without APIs, to provide a consistent developer experience across
-- different environments. Example uses of this error model include: -
-- Partial errors. If a service needs to return partial errors to the
-- client, it may embed the \`Status\` in the normal response to indicate
-- the partial errors. - Workflow errors. A typical workflow has multiple
-- steps. Each step may have a \`Status\` message for error reporting. -
-- Batch operations. If a client uses batch request and batch response, the
-- \`Status\` message should be used directly inside batch response, one
-- for each error sub-response. - Asynchronous operations. If an API call
-- embeds asynchronous operation results in its response, the status of
-- those operations should be represented directly using the \`Status\`
-- message. - Logging. If some API errors are stored in logs, the message
-- \`Status\` could be used directly after any stripping needed for
-- security\/privacy reasons.
--
-- /See:/ 'googleRpcStatus' smart constructor.
data GoogleRpcStatus =
  GoogleRpcStatus'
    { _grsDetails :: !(Maybe [GoogleRpcStatusDetailsItem])
    , _grsCode    :: !(Maybe (Textual Int32))
    , _grsMessage :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleRpcStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grsDetails'
--
-- * 'grsCode'
--
-- * 'grsMessage'
googleRpcStatus
    :: GoogleRpcStatus
googleRpcStatus =
  GoogleRpcStatus'
    {_grsDetails = Nothing, _grsCode = Nothing, _grsMessage = Nothing}


-- | A list of messages that carry the error details. There is a common set
-- of message types for APIs to use.
grsDetails :: Lens' GoogleRpcStatus [GoogleRpcStatusDetailsItem]
grsDetails
  = lens _grsDetails (\ s a -> s{_grsDetails = a}) .
      _Default
      . _Coerce

-- | The status code, which should be an enum value of google.rpc.Code.
grsCode :: Lens' GoogleRpcStatus (Maybe Int32)
grsCode
  = lens _grsCode (\ s a -> s{_grsCode = a}) .
      mapping _Coerce

-- | A developer-facing error message, which should be in English. Any
-- user-facing error message should be localized and sent in the
-- google.rpc.Status.details field, or localized by the client.
grsMessage :: Lens' GoogleRpcStatus (Maybe Text)
grsMessage
  = lens _grsMessage (\ s a -> s{_grsMessage = a})

instance FromJSON GoogleRpcStatus where
        parseJSON
          = withObject "GoogleRpcStatus"
              (\ o ->
                 GoogleRpcStatus' <$>
                   (o .:? "details" .!= mempty) <*> (o .:? "code") <*>
                     (o .:? "message"))

instance ToJSON GoogleRpcStatus where
        toJSON GoogleRpcStatus'{..}
          = object
              (catMaybes
                 [("details" .=) <$> _grsDetails,
                  ("code" .=) <$> _grsCode,
                  ("message" .=) <$> _grsMessage])

-- | The request used for GetWorkerPool.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest' smart constructor.
newtype GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest'
    { _gdravgwprName :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravgwprName'
googleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest
googleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest'
    {_gdravgwprName = Nothing}


-- | Name of the worker pool to retrieve. Format:
-- \`projects\/[PROJECT_ID]\/instances\/[INSTANCE_ID]\/workerpools\/[POOL_ID]\`.
gdravgwprName :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest (Maybe Text)
gdravgwprName
  = lens _gdravgwprName
      (\ s a -> s{_gdravgwprName = a})

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

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaGetWorkerPoolRequest'{..}
          = object (catMaybes [("name" .=) <$> _gdravgwprName])

-- | An \`OutputDirectory\` is the output in an \`ActionResult\`
-- corresponding to a directory\'s full contents rather than a single file.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testOutputDirectory' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testOutputDirectory =
  GoogleDevtoolsRemoteexecutionV1testOutputDirectory'
    { _gdrvodPath       :: !(Maybe Text)
    , _gdrvodDigest     :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    , _gdrvodTreeDigest :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testOutputDirectory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvodPath'
--
-- * 'gdrvodDigest'
--
-- * 'gdrvodTreeDigest'
googleDevtoolsRemoteexecutionV1testOutputDirectory
    :: GoogleDevtoolsRemoteexecutionV1testOutputDirectory
googleDevtoolsRemoteexecutionV1testOutputDirectory =
  GoogleDevtoolsRemoteexecutionV1testOutputDirectory'
    { _gdrvodPath = Nothing
    , _gdrvodDigest = Nothing
    , _gdrvodTreeDigest = Nothing
    }


-- | The full path of the directory relative to the working directory. The
-- path separator is a forward slash \`\/\`. Since this is a relative path,
-- it MUST NOT begin with a leading forward slash. The empty string value
-- is allowed, and it denotes the entire working directory.
gdrvodPath :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputDirectory (Maybe Text)
gdrvodPath
  = lens _gdrvodPath (\ s a -> s{_gdrvodPath = a})

-- | DEPRECATED: This field is deprecated and should no longer be used.
gdrvodDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputDirectory (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvodDigest
  = lens _gdrvodDigest (\ s a -> s{_gdrvodDigest = a})

-- | The digest of the encoded Tree proto containing the directory\'s
-- contents.
gdrvodTreeDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputDirectory (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvodTreeDigest
  = lens _gdrvodTreeDigest
      (\ s a -> s{_gdrvodTreeDigest = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testOutputDirectory
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testOutputDirectory"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testOutputDirectory'
                   <$>
                   (o .:? "path") <*> (o .:? "digest") <*>
                     (o .:? "treeDigest"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testOutputDirectory
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testOutputDirectory'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _gdrvodPath,
                  ("digest" .=) <$> _gdrvodDigest,
                  ("treeDigest" .=) <$> _gdrvodTreeDigest])

-- | An \`OutputSymlink\` is similar to a Symlink, but it is used as an
-- output in an \`ActionResult\`. \`OutputSymlink\` is binary-compatible
-- with \`SymlinkNode\`.
--
-- /See:/ 'buildBazelRemoteExecutionV2OutputSymlink' smart constructor.
data BuildBazelRemoteExecutionV2OutputSymlink =
  BuildBazelRemoteExecutionV2OutputSymlink'
    { _bbrevosPath   :: !(Maybe Text)
    , _bbrevosTarget :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2OutputSymlink' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevosPath'
--
-- * 'bbrevosTarget'
buildBazelRemoteExecutionV2OutputSymlink
    :: BuildBazelRemoteExecutionV2OutputSymlink
buildBazelRemoteExecutionV2OutputSymlink =
  BuildBazelRemoteExecutionV2OutputSymlink'
    {_bbrevosPath = Nothing, _bbrevosTarget = Nothing}


-- | The full path of the symlink relative to the working directory,
-- including the filename. The path separator is a forward slash \`\/\`.
-- Since this is a relative path, it MUST NOT begin with a leading forward
-- slash.
bbrevosPath :: Lens' BuildBazelRemoteExecutionV2OutputSymlink (Maybe Text)
bbrevosPath
  = lens _bbrevosPath (\ s a -> s{_bbrevosPath = a})

-- | The target path of the symlink. The path separator is a forward slash
-- \`\/\`. The target path can be relative to the parent directory of the
-- symlink or it can be an absolute path starting with \`\/\`. Support for
-- absolute paths can be checked using the Capabilities API. The canonical
-- form forbids the substrings \`\/.\/\` and \`\/\/\` in the target path.
-- \`..\` components are allowed anywhere in the target path.
bbrevosTarget :: Lens' BuildBazelRemoteExecutionV2OutputSymlink (Maybe Text)
bbrevosTarget
  = lens _bbrevosTarget
      (\ s a -> s{_bbrevosTarget = a})

instance FromJSON
           BuildBazelRemoteExecutionV2OutputSymlink
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2OutputSymlink"
              (\ o ->
                 BuildBazelRemoteExecutionV2OutputSymlink' <$>
                   (o .:? "path") <*> (o .:? "target"))

instance ToJSON
           BuildBazelRemoteExecutionV2OutputSymlink
         where
        toJSON BuildBazelRemoteExecutionV2OutputSymlink'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _bbrevosPath,
                  ("target" .=) <$> _bbrevosTarget])

-- | A \`Tree\` contains all the Directory protos in a single directory
-- Merkle tree, compressed into one message.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testTree' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testTree =
  GoogleDevtoolsRemoteexecutionV1testTree'
    { _gdrvtChildren :: !(Maybe [GoogleDevtoolsRemoteexecutionV1testDirectory])
    , _gdrvtRoot     :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDirectory)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testTree' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvtChildren'
--
-- * 'gdrvtRoot'
googleDevtoolsRemoteexecutionV1testTree
    :: GoogleDevtoolsRemoteexecutionV1testTree
googleDevtoolsRemoteexecutionV1testTree =
  GoogleDevtoolsRemoteexecutionV1testTree'
    {_gdrvtChildren = Nothing, _gdrvtRoot = Nothing}


-- | All the child directories: the directories referred to by the root and,
-- recursively, all its children. In order to reconstruct the directory
-- tree, the client must take the digests of each of the child directories
-- and then build up a tree starting from the \`root\`.
gdrvtChildren :: Lens' GoogleDevtoolsRemoteexecutionV1testTree [GoogleDevtoolsRemoteexecutionV1testDirectory]
gdrvtChildren
  = lens _gdrvtChildren
      (\ s a -> s{_gdrvtChildren = a})
      . _Default
      . _Coerce

-- | The root directory in the tree.
gdrvtRoot :: Lens' GoogleDevtoolsRemoteexecutionV1testTree (Maybe GoogleDevtoolsRemoteexecutionV1testDirectory)
gdrvtRoot
  = lens _gdrvtRoot (\ s a -> s{_gdrvtRoot = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testTree
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testTree"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testTree' <$>
                   (o .:? "children" .!= mempty) <*> (o .:? "root"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testTree
         where
        toJSON GoogleDevtoolsRemoteexecutionV1testTree'{..}
          = object
              (catMaybes
                 [("children" .=) <$> _gdrvtChildren,
                  ("root" .=) <$> _gdrvtRoot])

-- | The metadata for a file. Similar to the equivalent message in the Remote
-- Execution API.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2FileMetadata' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2FileMetadata =
  GoogleDevtoolsRemoteworkersV1test2FileMetadata'
    { _gdrvfmContents     :: !(Maybe Bytes)
    , _gdrvfmPath         :: !(Maybe Text)
    , _gdrvfmIsExecutable :: !(Maybe Bool)
    , _gdrvfmDigest       :: !(Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2FileMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvfmContents'
--
-- * 'gdrvfmPath'
--
-- * 'gdrvfmIsExecutable'
--
-- * 'gdrvfmDigest'
googleDevtoolsRemoteworkersV1test2FileMetadata
    :: GoogleDevtoolsRemoteworkersV1test2FileMetadata
googleDevtoolsRemoteworkersV1test2FileMetadata =
  GoogleDevtoolsRemoteworkersV1test2FileMetadata'
    { _gdrvfmContents = Nothing
    , _gdrvfmPath = Nothing
    , _gdrvfmIsExecutable = Nothing
    , _gdrvfmDigest = Nothing
    }


-- | If the file is small enough, its contents may also or alternatively be
-- listed here.
gdrvfmContents :: Lens' GoogleDevtoolsRemoteworkersV1test2FileMetadata (Maybe ByteString)
gdrvfmContents
  = lens _gdrvfmContents
      (\ s a -> s{_gdrvfmContents = a})
      . mapping _Bytes

-- | The path of this file. If this message is part of the
-- CommandOutputs.outputs fields, the path is relative to the execution
-- root and must correspond to an entry in CommandTask.outputs.files. If
-- this message is part of a Directory message, then the path is relative
-- to the root of that directory. All paths MUST be delimited by forward
-- slashes.
gdrvfmPath :: Lens' GoogleDevtoolsRemoteworkersV1test2FileMetadata (Maybe Text)
gdrvfmPath
  = lens _gdrvfmPath (\ s a -> s{_gdrvfmPath = a})

-- | Properties of the file
gdrvfmIsExecutable :: Lens' GoogleDevtoolsRemoteworkersV1test2FileMetadata (Maybe Bool)
gdrvfmIsExecutable
  = lens _gdrvfmIsExecutable
      (\ s a -> s{_gdrvfmIsExecutable = a})

-- | A pointer to the contents of the file. The method by which a client
-- retrieves the contents from a CAS system is not defined here.
gdrvfmDigest :: Lens' GoogleDevtoolsRemoteworkersV1test2FileMetadata (Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
gdrvfmDigest
  = lens _gdrvfmDigest (\ s a -> s{_gdrvfmDigest = a})

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2FileMetadata
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2FileMetadata"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2FileMetadata' <$>
                   (o .:? "contents") <*> (o .:? "path") <*>
                     (o .:? "isExecutable")
                     <*> (o .:? "digest"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2FileMetadata
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2FileMetadata'{..}
          = object
              (catMaybes
                 [("contents" .=) <$> _gdrvfmContents,
                  ("path" .=) <$> _gdrvfmPath,
                  ("isExecutable" .=) <$> _gdrvfmIsExecutable,
                  ("digest" .=) <$> _gdrvfmDigest])

-- | Service-specific metadata associated with the operation. It typically
-- contains progress information and common metadata such as create time.
-- Some services might not provide such metadata. Any method that returns a
-- long-running operation should document the metadata type, if any.
--
-- /See:/ 'googleLongrunningOperationMetadata' smart constructor.
newtype GoogleLongrunningOperationMetadata =
  GoogleLongrunningOperationMetadata'
    { _glomAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleLongrunningOperationMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'glomAddtional'
googleLongrunningOperationMetadata
    :: HashMap Text JSONValue -- ^ 'glomAddtional'
    -> GoogleLongrunningOperationMetadata
googleLongrunningOperationMetadata pGlomAddtional_ =
  GoogleLongrunningOperationMetadata'
    {_glomAddtional = _Coerce # pGlomAddtional_}


-- | Properties of the object. Contains field \'type with type URL.
glomAddtional :: Lens' GoogleLongrunningOperationMetadata (HashMap Text JSONValue)
glomAddtional
  = lens _glomAddtional
      (\ s a -> s{_glomAddtional = a})
      . _Coerce

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

instance ToJSON GoogleLongrunningOperationMetadata
         where
        toJSON = toJSON . _glomAddtional

-- | The CommandTask and CommandResult messages assume the existence of a
-- service that can serve blobs of content, identified by a hash and size
-- known as a \"digest.\" The method by which these blobs may be retrieved
-- is not specified here, but a model implementation is in the Remote
-- Execution API\'s \"ContentAddressibleStorage\" interface. In the context
-- of the RWAPI, a Digest will virtually always refer to the contents of a
-- file or a directory. The latter is represented by the byte-encoded
-- Directory message.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2Digest' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2Digest =
  GoogleDevtoolsRemoteworkersV1test2Digest'
    { _gdrvdSizeBytes :: !(Maybe (Textual Int64))
    , _gdrvdHash      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2Digest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvdSizeBytes'
--
-- * 'gdrvdHash'
googleDevtoolsRemoteworkersV1test2Digest
    :: GoogleDevtoolsRemoteworkersV1test2Digest
googleDevtoolsRemoteworkersV1test2Digest =
  GoogleDevtoolsRemoteworkersV1test2Digest'
    {_gdrvdSizeBytes = Nothing, _gdrvdHash = Nothing}


-- | The size of the contents. While this is not strictly required as part of
-- an identifier (after all, any given hash will have exactly one canonical
-- size), it\'s useful in almost all cases when one might want to send or
-- retrieve blobs of content and is included here for this reason.
gdrvdSizeBytes :: Lens' GoogleDevtoolsRemoteworkersV1test2Digest (Maybe Int64)
gdrvdSizeBytes
  = lens _gdrvdSizeBytes
      (\ s a -> s{_gdrvdSizeBytes = a})
      . mapping _Coerce

-- | A string-encoded hash (eg \"1a2b3c\", not the byte array [0x1a, 0x2b,
-- 0x3c]) using an implementation-defined hash algorithm (eg SHA-256).
gdrvdHash :: Lens' GoogleDevtoolsRemoteworkersV1test2Digest (Maybe Text)
gdrvdHash
  = lens _gdrvdHash (\ s a -> s{_gdrvdHash = a})

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2Digest
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2Digest"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2Digest' <$>
                   (o .:? "sizeBytes") <*> (o .:? "hash"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2Digest
         where
        toJSON GoogleDevtoolsRemoteworkersV1test2Digest'{..}
          = object
              (catMaybes
                 [("sizeBytes" .=) <$> _gdrvdSizeBytes,
                  ("hash" .=) <$> _gdrvdHash])

-- | A response message for Capabilities.GetCapabilities.
--
-- /See:/ 'buildBazelRemoteExecutionV2ServerCapabilities' smart constructor.
data BuildBazelRemoteExecutionV2ServerCapabilities =
  BuildBazelRemoteExecutionV2ServerCapabilities'
    { _bbrevscHighAPIVersion        :: !(Maybe BuildBazelSemverSemVer)
    , _bbrevscExecutionCapabilities :: !(Maybe BuildBazelRemoteExecutionV2ExecutionCapabilities)
    , _bbrevscCacheCapabilities     :: !(Maybe BuildBazelRemoteExecutionV2CacheCapabilities)
    , _bbrevscDeprecatedAPIVersion  :: !(Maybe BuildBazelSemverSemVer)
    , _bbrevscLowAPIVersion         :: !(Maybe BuildBazelSemverSemVer)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2ServerCapabilities' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevscHighAPIVersion'
--
-- * 'bbrevscExecutionCapabilities'
--
-- * 'bbrevscCacheCapabilities'
--
-- * 'bbrevscDeprecatedAPIVersion'
--
-- * 'bbrevscLowAPIVersion'
buildBazelRemoteExecutionV2ServerCapabilities
    :: BuildBazelRemoteExecutionV2ServerCapabilities
buildBazelRemoteExecutionV2ServerCapabilities =
  BuildBazelRemoteExecutionV2ServerCapabilities'
    { _bbrevscHighAPIVersion = Nothing
    , _bbrevscExecutionCapabilities = Nothing
    , _bbrevscCacheCapabilities = Nothing
    , _bbrevscDeprecatedAPIVersion = Nothing
    , _bbrevscLowAPIVersion = Nothing
    }


-- | Latest RE API version supported.
bbrevscHighAPIVersion :: Lens' BuildBazelRemoteExecutionV2ServerCapabilities (Maybe BuildBazelSemverSemVer)
bbrevscHighAPIVersion
  = lens _bbrevscHighAPIVersion
      (\ s a -> s{_bbrevscHighAPIVersion = a})

-- | Capabilities of the remote execution system.
bbrevscExecutionCapabilities :: Lens' BuildBazelRemoteExecutionV2ServerCapabilities (Maybe BuildBazelRemoteExecutionV2ExecutionCapabilities)
bbrevscExecutionCapabilities
  = lens _bbrevscExecutionCapabilities
      (\ s a -> s{_bbrevscExecutionCapabilities = a})

-- | Capabilities of the remote cache system.
bbrevscCacheCapabilities :: Lens' BuildBazelRemoteExecutionV2ServerCapabilities (Maybe BuildBazelRemoteExecutionV2CacheCapabilities)
bbrevscCacheCapabilities
  = lens _bbrevscCacheCapabilities
      (\ s a -> s{_bbrevscCacheCapabilities = a})

-- | Earliest RE API version supported, including deprecated versions.
bbrevscDeprecatedAPIVersion :: Lens' BuildBazelRemoteExecutionV2ServerCapabilities (Maybe BuildBazelSemverSemVer)
bbrevscDeprecatedAPIVersion
  = lens _bbrevscDeprecatedAPIVersion
      (\ s a -> s{_bbrevscDeprecatedAPIVersion = a})

-- | Earliest non-deprecated RE API version supported.
bbrevscLowAPIVersion :: Lens' BuildBazelRemoteExecutionV2ServerCapabilities (Maybe BuildBazelSemverSemVer)
bbrevscLowAPIVersion
  = lens _bbrevscLowAPIVersion
      (\ s a -> s{_bbrevscLowAPIVersion = a})

instance FromJSON
           BuildBazelRemoteExecutionV2ServerCapabilities
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2ServerCapabilities"
              (\ o ->
                 BuildBazelRemoteExecutionV2ServerCapabilities' <$>
                   (o .:? "highApiVersion") <*>
                     (o .:? "executionCapabilities")
                     <*> (o .:? "cacheCapabilities")
                     <*> (o .:? "deprecatedApiVersion")
                     <*> (o .:? "lowApiVersion"))

instance ToJSON
           BuildBazelRemoteExecutionV2ServerCapabilities
         where
        toJSON
          BuildBazelRemoteExecutionV2ServerCapabilities'{..}
          = object
              (catMaybes
                 [("highApiVersion" .=) <$> _bbrevscHighAPIVersion,
                  ("executionCapabilities" .=) <$>
                    _bbrevscExecutionCapabilities,
                  ("cacheCapabilities" .=) <$>
                    _bbrevscCacheCapabilities,
                  ("deprecatedApiVersion" .=) <$>
                    _bbrevscDeprecatedAPIVersion,
                  ("lowApiVersion" .=) <$> _bbrevscLowAPIVersion])

-- | An \`Action\` captures all the information about an execution which is
-- required to reproduce it. \`Action\`s are the core component of the
-- [Execution] service. A single \`Action\` represents a repeatable action
-- that can be performed by the execution service. \`Action\`s can be
-- succinctly identified by the digest of their wire format encoding and,
-- once an \`Action\` has been executed, will be cached in the action
-- cache. Future requests can then use the cached result rather than
-- needing to run afresh. When a server completes execution of an Action,
-- it MAY choose to cache the result in the ActionCache unless
-- \`do_not_cache\` is \`true\`. Clients SHOULD expect the server to do so.
-- By default, future calls to Execute the same \`Action\` will also serve
-- their results from the cache. Clients must take care to understand the
-- caching behaviour. Ideally, all \`Action\`s will be reproducible so that
-- serving a result from cache is always desirable and correct.
--
-- /See:/ 'buildBazelRemoteExecutionV2Action' smart constructor.
data BuildBazelRemoteExecutionV2Action =
  BuildBazelRemoteExecutionV2Action'
    { _bbrevaDoNotCache      :: !(Maybe Bool)
    , _bbrevaCommandDigest   :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    , _bbrevaInputRootDigest :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    , _bbrevaTimeout         :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2Action' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevaDoNotCache'
--
-- * 'bbrevaCommandDigest'
--
-- * 'bbrevaInputRootDigest'
--
-- * 'bbrevaTimeout'
buildBazelRemoteExecutionV2Action
    :: BuildBazelRemoteExecutionV2Action
buildBazelRemoteExecutionV2Action =
  BuildBazelRemoteExecutionV2Action'
    { _bbrevaDoNotCache = Nothing
    , _bbrevaCommandDigest = Nothing
    , _bbrevaInputRootDigest = Nothing
    , _bbrevaTimeout = Nothing
    }


-- | If true, then the \`Action\`\'s result cannot be cached.
bbrevaDoNotCache :: Lens' BuildBazelRemoteExecutionV2Action (Maybe Bool)
bbrevaDoNotCache
  = lens _bbrevaDoNotCache
      (\ s a -> s{_bbrevaDoNotCache = a})

-- | The digest of the Command to run, which MUST be present in the
-- ContentAddressableStorage.
bbrevaCommandDigest :: Lens' BuildBazelRemoteExecutionV2Action (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevaCommandDigest
  = lens _bbrevaCommandDigest
      (\ s a -> s{_bbrevaCommandDigest = a})

-- | The digest of the root Directory for the input files. The files in the
-- directory tree are available in the correct location on the build
-- machine before the command is executed. The root directory, as well as
-- every subdirectory and content blob referred to, MUST be in the
-- ContentAddressableStorage.
bbrevaInputRootDigest :: Lens' BuildBazelRemoteExecutionV2Action (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevaInputRootDigest
  = lens _bbrevaInputRootDigest
      (\ s a -> s{_bbrevaInputRootDigest = a})

-- | A timeout after which the execution should be killed. If the timeout is
-- absent, then the client is specifying that the execution should continue
-- as long as the server will let it. The server SHOULD impose a timeout if
-- the client does not specify one, however, if the client does specify a
-- timeout that is longer than the server\'s maximum timeout, the server
-- MUST reject the request. The timeout is a part of the Action message,
-- and therefore two \`Actions\` with different timeouts are different,
-- even if they are otherwise identical. This is because, if they were not,
-- running an \`Action\` with a lower timeout than is required might result
-- in a cache hit from an execution run with a longer timeout, hiding the
-- fact that the timeout is too short. By encoding it directly in the
-- \`Action\`, a lower timeout will result in a cache miss and the
-- execution timeout will fail immediately, rather than whenever the cache
-- entry gets evicted.
bbrevaTimeout :: Lens' BuildBazelRemoteExecutionV2Action (Maybe Scientific)
bbrevaTimeout
  = lens _bbrevaTimeout
      (\ s a -> s{_bbrevaTimeout = a})
      . mapping _GDuration

instance FromJSON BuildBazelRemoteExecutionV2Action
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2Action"
              (\ o ->
                 BuildBazelRemoteExecutionV2Action' <$>
                   (o .:? "doNotCache") <*> (o .:? "commandDigest") <*>
                     (o .:? "inputRootDigest")
                     <*> (o .:? "timeout"))

instance ToJSON BuildBazelRemoteExecutionV2Action
         where
        toJSON BuildBazelRemoteExecutionV2Action'{..}
          = object
              (catMaybes
                 [("doNotCache" .=) <$> _bbrevaDoNotCache,
                  ("commandDigest" .=) <$> _bbrevaCommandDigest,
                  ("inputRootDigest" .=) <$> _bbrevaInputRootDigest,
                  ("timeout" .=) <$> _bbrevaTimeout])

-- | An \`OutputDirectory\` is the output in an \`ActionResult\`
-- corresponding to a directory\'s full contents rather than a single file.
--
-- /See:/ 'buildBazelRemoteExecutionV2OutputDirectory' smart constructor.
data BuildBazelRemoteExecutionV2OutputDirectory =
  BuildBazelRemoteExecutionV2OutputDirectory'
    { _bbrevodPath       :: !(Maybe Text)
    , _bbrevodTreeDigest :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2OutputDirectory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevodPath'
--
-- * 'bbrevodTreeDigest'
buildBazelRemoteExecutionV2OutputDirectory
    :: BuildBazelRemoteExecutionV2OutputDirectory
buildBazelRemoteExecutionV2OutputDirectory =
  BuildBazelRemoteExecutionV2OutputDirectory'
    {_bbrevodPath = Nothing, _bbrevodTreeDigest = Nothing}


-- | The full path of the directory relative to the working directory. The
-- path separator is a forward slash \`\/\`. Since this is a relative path,
-- it MUST NOT begin with a leading forward slash. The empty string value
-- is allowed, and it denotes the entire working directory.
bbrevodPath :: Lens' BuildBazelRemoteExecutionV2OutputDirectory (Maybe Text)
bbrevodPath
  = lens _bbrevodPath (\ s a -> s{_bbrevodPath = a})

-- | The digest of the encoded Tree proto containing the directory\'s
-- contents.
bbrevodTreeDigest :: Lens' BuildBazelRemoteExecutionV2OutputDirectory (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevodTreeDigest
  = lens _bbrevodTreeDigest
      (\ s a -> s{_bbrevodTreeDigest = a})

instance FromJSON
           BuildBazelRemoteExecutionV2OutputDirectory
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2OutputDirectory"
              (\ o ->
                 BuildBazelRemoteExecutionV2OutputDirectory' <$>
                   (o .:? "path") <*> (o .:? "treeDigest"))

instance ToJSON
           BuildBazelRemoteExecutionV2OutputDirectory
         where
        toJSON
          BuildBazelRemoteExecutionV2OutputDirectory'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _bbrevodPath,
                  ("treeDigest" .=) <$> _bbrevodTreeDigest])

-- | A content digest. A digest for a given blob consists of the size of the
-- blob and its hash. The hash algorithm to use is defined by the server,
-- but servers SHOULD use SHA-256. The size is considered to be an integral
-- part of the digest and cannot be separated. That is, even if the
-- \`hash\` field is correctly specified but \`size_bytes\` is not, the
-- server MUST reject the request. The reason for including the size in the
-- digest is as follows: in a great many cases, the server needs to know
-- the size of the blob it is about to work with prior to starting an
-- operation with it, such as flattening Merkle tree structures or
-- streaming it to a worker. Technically, the server could implement a
-- separate metadata store, but this results in a significantly more
-- complicated implementation as opposed to having the client specify the
-- size up-front (or storing the size along with the digest in every
-- message where digests are embedded). This does mean that the API leaks
-- some implementation details of (what we consider to be) a reasonable
-- server implementation, but we consider this to be a worthwhile tradeoff.
-- When a \`Digest\` is used to refer to a proto message, it always refers
-- to the message in binary encoded form. To ensure consistent hashing,
-- clients and servers MUST ensure that they serialize messages according
-- to the following rules, even if there are alternate valid encodings for
-- the same message. - Fields are serialized in tag order. - There are no
-- unknown fields. - There are no duplicate fields. - Fields are serialized
-- according to the default semantics for their type. Most protocol buffer
-- implementations will always follow these rules when serializing, but
-- care should be taken to avoid shortcuts. For instance, concatenating two
-- messages to merge them may produce duplicate fields.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testDigest' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testDigest =
  GoogleDevtoolsRemoteexecutionV1testDigest'
    { _gSizeBytes :: !(Maybe (Textual Int64))
    , _gHash      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testDigest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gSizeBytes'
--
-- * 'gHash'
googleDevtoolsRemoteexecutionV1testDigest
    :: GoogleDevtoolsRemoteexecutionV1testDigest
googleDevtoolsRemoteexecutionV1testDigest =
  GoogleDevtoolsRemoteexecutionV1testDigest'
    {_gSizeBytes = Nothing, _gHash = Nothing}


-- | The size of the blob, in bytes.
gSizeBytes :: Lens' GoogleDevtoolsRemoteexecutionV1testDigest (Maybe Int64)
gSizeBytes
  = lens _gSizeBytes (\ s a -> s{_gSizeBytes = a}) .
      mapping _Coerce

-- | The hash. In the case of SHA-256, it will always be a lowercase hex
-- string exactly 64 characters long.
gHash :: Lens' GoogleDevtoolsRemoteexecutionV1testDigest (Maybe Text)
gHash = lens _gHash (\ s a -> s{_gHash = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testDigest
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testDigest"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testDigest' <$>
                   (o .:? "sizeBytes") <*> (o .:? "hash"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testDigest
         where
        toJSON GoogleDevtoolsRemoteexecutionV1testDigest'{..}
          = object
              (catMaybes
                 [("sizeBytes" .=) <$> _gSizeBytes,
                  ("hash" .=) <$> _gHash])

-- | A \`Tree\` contains all the Directory protos in a single directory
-- Merkle tree, compressed into one message.
--
-- /See:/ 'buildBazelRemoteExecutionV2Tree' smart constructor.
data BuildBazelRemoteExecutionV2Tree =
  BuildBazelRemoteExecutionV2Tree'
    { _bbrevtChildren :: !(Maybe [BuildBazelRemoteExecutionV2Directory])
    , _bbrevtRoot     :: !(Maybe BuildBazelRemoteExecutionV2Directory)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2Tree' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevtChildren'
--
-- * 'bbrevtRoot'
buildBazelRemoteExecutionV2Tree
    :: BuildBazelRemoteExecutionV2Tree
buildBazelRemoteExecutionV2Tree =
  BuildBazelRemoteExecutionV2Tree'
    {_bbrevtChildren = Nothing, _bbrevtRoot = Nothing}


-- | All the child directories: the directories referred to by the root and,
-- recursively, all its children. In order to reconstruct the directory
-- tree, the client must take the digests of each of the child directories
-- and then build up a tree starting from the \`root\`.
bbrevtChildren :: Lens' BuildBazelRemoteExecutionV2Tree [BuildBazelRemoteExecutionV2Directory]
bbrevtChildren
  = lens _bbrevtChildren
      (\ s a -> s{_bbrevtChildren = a})
      . _Default
      . _Coerce

-- | The root directory in the tree.
bbrevtRoot :: Lens' BuildBazelRemoteExecutionV2Tree (Maybe BuildBazelRemoteExecutionV2Directory)
bbrevtRoot
  = lens _bbrevtRoot (\ s a -> s{_bbrevtRoot = a})

instance FromJSON BuildBazelRemoteExecutionV2Tree
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2Tree"
              (\ o ->
                 BuildBazelRemoteExecutionV2Tree' <$>
                   (o .:? "children" .!= mempty) <*> (o .:? "root"))

instance ToJSON BuildBazelRemoteExecutionV2Tree where
        toJSON BuildBazelRemoteExecutionV2Tree'{..}
          = object
              (catMaybes
                 [("children" .=) <$> _bbrevtChildren,
                  ("root" .=) <$> _bbrevtRoot])

-- | An ActionResult represents the result of an Action being run.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testActionResult' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testActionResult =
  GoogleDevtoolsRemoteexecutionV1testActionResult'
    { _gdrvarOutputDirectories :: !(Maybe [GoogleDevtoolsRemoteexecutionV1testOutputDirectory])
    , _gdrvarOutputFiles       :: !(Maybe [GoogleDevtoolsRemoteexecutionV1testOutputFile])
    , _gdrvarStderrRaw         :: !(Maybe Bytes)
    , _gdrvarExitCode          :: !(Maybe (Textual Int32))
    , _gdrvarStdoutDigest      :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    , _gdrvarStderrDigest      :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    , _gdrvarStdoutRaw         :: !(Maybe Bytes)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testActionResult' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvarOutputDirectories'
--
-- * 'gdrvarOutputFiles'
--
-- * 'gdrvarStderrRaw'
--
-- * 'gdrvarExitCode'
--
-- * 'gdrvarStdoutDigest'
--
-- * 'gdrvarStderrDigest'
--
-- * 'gdrvarStdoutRaw'
googleDevtoolsRemoteexecutionV1testActionResult
    :: GoogleDevtoolsRemoteexecutionV1testActionResult
googleDevtoolsRemoteexecutionV1testActionResult =
  GoogleDevtoolsRemoteexecutionV1testActionResult'
    { _gdrvarOutputDirectories = Nothing
    , _gdrvarOutputFiles = Nothing
    , _gdrvarStderrRaw = Nothing
    , _gdrvarExitCode = Nothing
    , _gdrvarStdoutDigest = Nothing
    , _gdrvarStderrDigest = Nothing
    , _gdrvarStdoutRaw = Nothing
    }


-- | The output directories of the action. For each output directory
-- requested in the \`output_directories\` field of the Action, if the
-- corresponding directory existed after the action completed, a single
-- entry will be present in the output list, which will contain the digest
-- of a Tree message containing the directory tree, and the path equal
-- exactly to the corresponding Action output_directories member. As an
-- example, suppose the Action had an output directory \`a\/b\/dir\` and
-- the execution produced the following contents in \`a\/b\/dir\`: a file
-- named \`bar\` and a directory named \`foo\` with an executable file
-- named \`baz\`. Then, output_directory will contain (hashes shortened for
-- readability): \`\`\`json \/\/ OutputDirectory proto: { path:
-- \"a\/b\/dir\" tree_digest: { hash: \"4a73bc9d03...\", size: 55 } } \/\/
-- Tree proto with hash \"4a73bc9d03...\" and size 55: { root: { files: [ {
-- name: \"bar\", digest: { hash: \"4a73bc9d03...\", size: 65534 } } ],
-- directories: [ { name: \"foo\", digest: { hash: \"4cf2eda940...\", size:
-- 43 } } ] } children : { \/\/ (Directory proto with hash
-- \"4cf2eda940...\" and size 43) files: [ { name: \"baz\", digest: { hash:
-- \"b2c941073e...\", size: 1294, }, is_executable: true } ] } } \`\`\`
gdrvarOutputDirectories :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult [GoogleDevtoolsRemoteexecutionV1testOutputDirectory]
gdrvarOutputDirectories
  = lens _gdrvarOutputDirectories
      (\ s a -> s{_gdrvarOutputDirectories = a})
      . _Default
      . _Coerce

-- | The output files of the action. For each output file requested in the
-- \`output_files\` field of the Action, if the corresponding file existed
-- after the action completed, a single entry will be present in the output
-- list. If the action does not produce the requested output, or produces a
-- directory where a regular file is expected or vice versa, then that
-- output will be omitted from the list. The server is free to arrange the
-- output list as desired; clients MUST NOT assume that the output list is
-- sorted.
gdrvarOutputFiles :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult [GoogleDevtoolsRemoteexecutionV1testOutputFile]
gdrvarOutputFiles
  = lens _gdrvarOutputFiles
      (\ s a -> s{_gdrvarOutputFiles = a})
      . _Default
      . _Coerce

-- | The standard error buffer of the action. The server will determine,
-- based on the size of the buffer, whether to return it in raw form or to
-- return a digest in \`stderr_digest\` that points to the buffer. If
-- neither is set, then the buffer is empty. The client SHOULD NOT assume
-- it will get one of the raw buffer or a digest on any given request and
-- should be prepared to handle either.
gdrvarStderrRaw :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult (Maybe ByteString)
gdrvarStderrRaw
  = lens _gdrvarStderrRaw
      (\ s a -> s{_gdrvarStderrRaw = a})
      . mapping _Bytes

-- | The exit code of the command.
gdrvarExitCode :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult (Maybe Int32)
gdrvarExitCode
  = lens _gdrvarExitCode
      (\ s a -> s{_gdrvarExitCode = a})
      . mapping _Coerce

-- | The digest for a blob containing the standard output of the action,
-- which can be retrieved from the ContentAddressableStorage. See
-- \`stdout_raw\` for when this will be set.
gdrvarStdoutDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvarStdoutDigest
  = lens _gdrvarStdoutDigest
      (\ s a -> s{_gdrvarStdoutDigest = a})

-- | The digest for a blob containing the standard error of the action, which
-- can be retrieved from the ContentAddressableStorage. See \`stderr_raw\`
-- for when this will be set.
gdrvarStderrDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvarStderrDigest
  = lens _gdrvarStderrDigest
      (\ s a -> s{_gdrvarStderrDigest = a})

-- | The standard output buffer of the action. The server will determine,
-- based on the size of the buffer, whether to return it in raw form or to
-- return a digest in \`stdout_digest\` that points to the buffer. If
-- neither is set, then the buffer is empty. The client SHOULD NOT assume
-- it will get one of the raw buffer or a digest on any given request and
-- should be prepared to handle either.
gdrvarStdoutRaw :: Lens' GoogleDevtoolsRemoteexecutionV1testActionResult (Maybe ByteString)
gdrvarStdoutRaw
  = lens _gdrvarStdoutRaw
      (\ s a -> s{_gdrvarStdoutRaw = a})
      . mapping _Bytes

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testActionResult
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testActionResult"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testActionResult' <$>
                   (o .:? "outputDirectories" .!= mempty) <*>
                     (o .:? "outputFiles" .!= mempty)
                     <*> (o .:? "stderrRaw")
                     <*> (o .:? "exitCode")
                     <*> (o .:? "stdoutDigest")
                     <*> (o .:? "stderrDigest")
                     <*> (o .:? "stdoutRaw"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testActionResult
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testActionResult'{..}
          = object
              (catMaybes
                 [("outputDirectories" .=) <$>
                    _gdrvarOutputDirectories,
                  ("outputFiles" .=) <$> _gdrvarOutputFiles,
                  ("stderrRaw" .=) <$> _gdrvarStderrRaw,
                  ("exitCode" .=) <$> _gdrvarExitCode,
                  ("stdoutDigest" .=) <$> _gdrvarStdoutDigest,
                  ("stderrDigest" .=) <$> _gdrvarStderrDigest,
                  ("stdoutRaw" .=) <$> _gdrvarStdoutRaw])

-- | Supported range of priorities, including boundaries.
--
-- /See:/ 'buildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange' smart constructor.
data BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange =
  BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange'
    { _bbrevpcprMinPriority :: !(Maybe (Textual Int32))
    , _bbrevpcprMaxPriority :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevpcprMinPriority'
--
-- * 'bbrevpcprMaxPriority'
buildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange
    :: BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange
buildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange =
  BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange'
    {_bbrevpcprMinPriority = Nothing, _bbrevpcprMaxPriority = Nothing}


bbrevpcprMinPriority :: Lens' BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange (Maybe Int32)
bbrevpcprMinPriority
  = lens _bbrevpcprMinPriority
      (\ s a -> s{_bbrevpcprMinPriority = a})
      . mapping _Coerce

bbrevpcprMaxPriority :: Lens' BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange (Maybe Int32)
bbrevpcprMaxPriority
  = lens _bbrevpcprMaxPriority
      (\ s a -> s{_bbrevpcprMaxPriority = a})
      . mapping _Coerce

instance FromJSON
           BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange"
              (\ o ->
                 BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange'
                   <$> (o .:? "minPriority") <*> (o .:? "maxPriority"))

instance ToJSON
           BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange
         where
        toJSON
          BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange'{..}
          = object
              (catMaybes
                 [("minPriority" .=) <$> _bbrevpcprMinPriority,
                  ("maxPriority" .=) <$> _bbrevpcprMaxPriority])

-- | An \`OutputFile\` is similar to a FileNode, but it is used as an output
-- in an \`ActionResult\`. It allows a full file path rather than only a
-- name. \`OutputFile\` is binary-compatible with \`FileNode\`.
--
-- /See:/ 'buildBazelRemoteExecutionV2OutputFile' smart constructor.
data BuildBazelRemoteExecutionV2OutputFile =
  BuildBazelRemoteExecutionV2OutputFile'
    { _bbrevofPath         :: !(Maybe Text)
    , _bbrevofIsExecutable :: !(Maybe Bool)
    , _bbrevofDigest       :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2OutputFile' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevofPath'
--
-- * 'bbrevofIsExecutable'
--
-- * 'bbrevofDigest'
buildBazelRemoteExecutionV2OutputFile
    :: BuildBazelRemoteExecutionV2OutputFile
buildBazelRemoteExecutionV2OutputFile =
  BuildBazelRemoteExecutionV2OutputFile'
    { _bbrevofPath = Nothing
    , _bbrevofIsExecutable = Nothing
    , _bbrevofDigest = Nothing
    }


-- | The full path of the file relative to the working directory, including
-- the filename. The path separator is a forward slash \`\/\`. Since this
-- is a relative path, it MUST NOT begin with a leading forward slash.
bbrevofPath :: Lens' BuildBazelRemoteExecutionV2OutputFile (Maybe Text)
bbrevofPath
  = lens _bbrevofPath (\ s a -> s{_bbrevofPath = a})

-- | True if file is executable, false otherwise.
bbrevofIsExecutable :: Lens' BuildBazelRemoteExecutionV2OutputFile (Maybe Bool)
bbrevofIsExecutable
  = lens _bbrevofIsExecutable
      (\ s a -> s{_bbrevofIsExecutable = a})

-- | The digest of the file\'s content.
bbrevofDigest :: Lens' BuildBazelRemoteExecutionV2OutputFile (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevofDigest
  = lens _bbrevofDigest
      (\ s a -> s{_bbrevofDigest = a})

instance FromJSON
           BuildBazelRemoteExecutionV2OutputFile
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2OutputFile"
              (\ o ->
                 BuildBazelRemoteExecutionV2OutputFile' <$>
                   (o .:? "path") <*> (o .:? "isExecutable") <*>
                     (o .:? "digest"))

instance ToJSON BuildBazelRemoteExecutionV2OutputFile
         where
        toJSON BuildBazelRemoteExecutionV2OutputFile'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _bbrevofPath,
                  ("isExecutable" .=) <$> _bbrevofIsExecutable,
                  ("digest" .=) <$> _bbrevofDigest])

-- | The request used for \`CreateInstance\`.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest' smart constructor.
data GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest'
    { _gdravcirParent     :: !(Maybe Text)
    , _gdravcirInstanceId :: !(Maybe Text)
    , _gdravcirInstance   :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravcirParent'
--
-- * 'gdravcirInstanceId'
--
-- * 'gdravcirInstance'
googleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest
googleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest'
    { _gdravcirParent = Nothing
    , _gdravcirInstanceId = Nothing
    , _gdravcirInstance = Nothing
    }


-- | Resource name of the project containing the instance. Format:
-- \`projects\/[PROJECT_ID]\`.
gdravcirParent :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest (Maybe Text)
gdravcirParent
  = lens _gdravcirParent
      (\ s a -> s{_gdravcirParent = a})

-- | ID of the created instance. A valid \`instance_id\` must: be 6-50
-- characters long, contain only lowercase letters, digits, hyphens and
-- underscores, start with a lowercase letter, and end with a lowercase
-- letter or a digit.
gdravcirInstanceId :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest (Maybe Text)
gdravcirInstanceId
  = lens _gdravcirInstanceId
      (\ s a -> s{_gdravcirInstanceId = a})

-- | Specifies the instance to create. The name in the instance, if specified
-- in the instance, is ignored.
gdravcirInstance :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance)
gdravcirInstance
  = lens _gdravcirInstance
      (\ s a -> s{_gdravcirInstance = a})

instance FromJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest"
              (\ o ->
                 GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest'
                   <$>
                   (o .:? "parent") <*> (o .:? "instanceId") <*>
                     (o .:? "instance"))

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateInstanceRequest'{..}
          = object
              (catMaybes
                 [("parent" .=) <$> _gdravcirParent,
                  ("instanceId" .=) <$> _gdravcirInstanceId,
                  ("instance" .=) <$> _gdravcirInstance])

-- | A \`Directory\` represents a directory node in a file tree, containing
-- zero or more children FileNodes, DirectoryNodes and SymlinkNodes. Each
-- \`Node\` contains its name in the directory, either the digest of its
-- content (either a file blob or a \`Directory\` proto) or a symlink
-- target, as well as possibly some metadata about the file or directory.
-- In order to ensure that two equivalent directory trees hash to the same
-- value, the following restrictions MUST be obeyed when constructing a a
-- \`Directory\`: * Every child in the directory must have a path of
-- exactly one segment. Multiple levels of directory hierarchy may not be
-- collapsed. * Each child in the directory must have a unique path segment
-- (file name). * The files, directories and symlinks in the directory must
-- each be sorted in lexicographical order by path. The path strings must
-- be sorted by code point, equivalently, by UTF-8 bytes. A \`Directory\`
-- that obeys the restrictions is said to be in canonical form. As an
-- example, the following could be used for a file named \`bar\` and a
-- directory named \`foo\` with an executable file named \`baz\` (hashes
-- shortened for readability): \`\`\`json \/\/ (Directory proto) { files: [
-- { name: \"bar\", digest: { hash: \"4a73bc9d03...\", size: 65534 } } ],
-- directories: [ { name: \"foo\", digest: { hash: \"4cf2eda940...\", size:
-- 43 } } ] } \/\/ (Directory proto with hash \"4cf2eda940...\" and size
-- 43) { files: [ { name: \"baz\", digest: { hash: \"b2c941073e...\", size:
-- 1294, }, is_executable: true } ] } \`\`\`
--
-- /See:/ 'buildBazelRemoteExecutionV2Directory' smart constructor.
data BuildBazelRemoteExecutionV2Directory =
  BuildBazelRemoteExecutionV2Directory'
    { _bbrevdDirectories :: !(Maybe [BuildBazelRemoteExecutionV2DirectoryNode])
    , _bbrevdSymlinks    :: !(Maybe [BuildBazelRemoteExecutionV2SymlinkNode])
    , _bbrevdFiles       :: !(Maybe [BuildBazelRemoteExecutionV2FileNode])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2Directory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevdDirectories'
--
-- * 'bbrevdSymlinks'
--
-- * 'bbrevdFiles'
buildBazelRemoteExecutionV2Directory
    :: BuildBazelRemoteExecutionV2Directory
buildBazelRemoteExecutionV2Directory =
  BuildBazelRemoteExecutionV2Directory'
    { _bbrevdDirectories = Nothing
    , _bbrevdSymlinks = Nothing
    , _bbrevdFiles = Nothing
    }


-- | The subdirectories in the directory.
bbrevdDirectories :: Lens' BuildBazelRemoteExecutionV2Directory [BuildBazelRemoteExecutionV2DirectoryNode]
bbrevdDirectories
  = lens _bbrevdDirectories
      (\ s a -> s{_bbrevdDirectories = a})
      . _Default
      . _Coerce

-- | The symlinks in the directory.
bbrevdSymlinks :: Lens' BuildBazelRemoteExecutionV2Directory [BuildBazelRemoteExecutionV2SymlinkNode]
bbrevdSymlinks
  = lens _bbrevdSymlinks
      (\ s a -> s{_bbrevdSymlinks = a})
      . _Default
      . _Coerce

-- | The files in the directory.
bbrevdFiles :: Lens' BuildBazelRemoteExecutionV2Directory [BuildBazelRemoteExecutionV2FileNode]
bbrevdFiles
  = lens _bbrevdFiles (\ s a -> s{_bbrevdFiles = a}) .
      _Default
      . _Coerce

instance FromJSON
           BuildBazelRemoteExecutionV2Directory
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2Directory"
              (\ o ->
                 BuildBazelRemoteExecutionV2Directory' <$>
                   (o .:? "directories" .!= mempty) <*>
                     (o .:? "symlinks" .!= mempty)
                     <*> (o .:? "files" .!= mempty))

instance ToJSON BuildBazelRemoteExecutionV2Directory
         where
        toJSON BuildBazelRemoteExecutionV2Directory'{..}
          = object
              (catMaybes
                 [("directories" .=) <$> _bbrevdDirectories,
                  ("symlinks" .=) <$> _bbrevdSymlinks,
                  ("files" .=) <$> _bbrevdFiles])

-- | A \`DirectoryNode\` represents a child of a Directory which is itself a
-- \`Directory\` and its associated metadata.
--
-- /See:/ 'buildBazelRemoteExecutionV2DirectoryNode' smart constructor.
data BuildBazelRemoteExecutionV2DirectoryNode =
  BuildBazelRemoteExecutionV2DirectoryNode'
    { _bbrevdnName   :: !(Maybe Text)
    , _bbrevdnDigest :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2DirectoryNode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevdnName'
--
-- * 'bbrevdnDigest'
buildBazelRemoteExecutionV2DirectoryNode
    :: BuildBazelRemoteExecutionV2DirectoryNode
buildBazelRemoteExecutionV2DirectoryNode =
  BuildBazelRemoteExecutionV2DirectoryNode'
    {_bbrevdnName = Nothing, _bbrevdnDigest = Nothing}


-- | The name of the directory.
bbrevdnName :: Lens' BuildBazelRemoteExecutionV2DirectoryNode (Maybe Text)
bbrevdnName
  = lens _bbrevdnName (\ s a -> s{_bbrevdnName = a})

-- | The digest of the Directory object represented. See Digest for
-- information about how to take the digest of a proto message.
bbrevdnDigest :: Lens' BuildBazelRemoteExecutionV2DirectoryNode (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevdnDigest
  = lens _bbrevdnDigest
      (\ s a -> s{_bbrevdnDigest = a})

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

instance ToJSON
           BuildBazelRemoteExecutionV2DirectoryNode
         where
        toJSON BuildBazelRemoteExecutionV2DirectoryNode'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _bbrevdnName,
                  ("digest" .=) <$> _bbrevdnDigest])

-- | Describes the timeouts associated with this task.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandTaskTimeouts' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts =
  GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts'
    { _gdrvcttIdle      :: !(Maybe GDuration)
    , _gdrvcttShutdown  :: !(Maybe GDuration)
    , _gdrvcttExecution :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcttIdle'
--
-- * 'gdrvcttShutdown'
--
-- * 'gdrvcttExecution'
googleDevtoolsRemoteworkersV1test2CommandTaskTimeouts
    :: GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts
googleDevtoolsRemoteworkersV1test2CommandTaskTimeouts =
  GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts'
    { _gdrvcttIdle = Nothing
    , _gdrvcttShutdown = Nothing
    , _gdrvcttExecution = Nothing
    }


-- | This specifies the maximum amount of time the task can be idle - that
-- is, go without generating some output in either stdout or stderr. If the
-- process is silent for more than the specified time, the worker will
-- terminate the task.
gdrvcttIdle :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts (Maybe Scientific)
gdrvcttIdle
  = lens _gdrvcttIdle (\ s a -> s{_gdrvcttIdle = a}) .
      mapping _GDuration

-- | If the execution or IO timeouts are exceeded, the worker will try to
-- gracefully terminate the task and return any existing logs. However,
-- tasks may be hard-frozen in which case this process will fail. This
-- timeout specifies how long to wait for a terminated task to shut down
-- gracefully (e.g. via SIGTERM) before we bring down the hammer (e.g.
-- SIGKILL on *nix, CTRL_BREAK_EVENT on Windows).
gdrvcttShutdown :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts (Maybe Scientific)
gdrvcttShutdown
  = lens _gdrvcttShutdown
      (\ s a -> s{_gdrvcttShutdown = a})
      . mapping _GDuration

-- | This specifies the maximum time that the task can run, excluding the
-- time required to download inputs or upload outputs. That is, the worker
-- will terminate the task if it runs longer than this.
gdrvcttExecution :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts (Maybe Scientific)
gdrvcttExecution
  = lens _gdrvcttExecution
      (\ s a -> s{_gdrvcttExecution = a})
      . mapping _GDuration

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts'
                   <$>
                   (o .:? "idle") <*> (o .:? "shutdown") <*>
                     (o .:? "execution"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2CommandTaskTimeouts'{..}
          = object
              (catMaybes
                 [("idle" .=) <$> _gdrvcttIdle,
                  ("shutdown" .=) <$> _gdrvcttShutdown,
                  ("execution" .=) <$> _gdrvcttExecution])

-- | Instance conceptually encapsulates all Remote Build Execution resources
-- for remote builds. An instance consists of storage and compute resources
-- (for example, \`ContentAddressableStorage\`, \`ActionCache\`,
-- \`WorkerPools\`) used for running remote builds. All Remote Build
-- Execution API calls are scoped to an instance.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaInstance' smart constructor.
data GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance'
    { _gdraviState          :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstanceState)
    , _gdraviLocation       :: !(Maybe Text)
    , _gdraviName           :: !(Maybe Text)
    , _gdraviLoggingEnabled :: !(Maybe Bool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdraviState'
--
-- * 'gdraviLocation'
--
-- * 'gdraviName'
--
-- * 'gdraviLoggingEnabled'
googleDevtoolsRemotebuildexecutionAdminV1alphaInstance
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance
googleDevtoolsRemotebuildexecutionAdminV1alphaInstance =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance'
    { _gdraviState = Nothing
    , _gdraviLocation = Nothing
    , _gdraviName = Nothing
    , _gdraviLoggingEnabled = Nothing
    }


-- | Output only. State of the instance.
gdraviState :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstanceState)
gdraviState
  = lens _gdraviState (\ s a -> s{_gdraviState = a})

-- | The location is a GCP region. Currently only \`us-central1\` is
-- supported.
gdraviLocation :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance (Maybe Text)
gdraviLocation
  = lens _gdraviLocation
      (\ s a -> s{_gdraviLocation = a})

-- | Output only. Instance resource name formatted as:
-- \`projects\/[PROJECT_ID]\/instances\/[INSTANCE_ID]\`. Name should not be
-- populated when creating an instance since it is provided in the
-- \`instance_id\` field.
gdraviName :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance (Maybe Text)
gdraviName
  = lens _gdraviName (\ s a -> s{_gdraviName = a})

-- | Output only. Whether stack driver logging is enabled for the instance.
gdraviLoggingEnabled :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance (Maybe Bool)
gdraviLoggingEnabled
  = lens _gdraviLoggingEnabled
      (\ s a -> s{_gdraviLoggingEnabled = a})

instance FromJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance"
              (\ o ->
                 GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance'
                   <$>
                   (o .:? "state") <*> (o .:? "location") <*>
                     (o .:? "name")
                     <*> (o .:? "loggingEnabled"))

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaInstance'{..}
          = object
              (catMaybes
                 [("state" .=) <$> _gdraviState,
                  ("location" .=) <$> _gdraviLocation,
                  ("name" .=) <$> _gdraviName,
                  ("loggingEnabled" .=) <$> _gdraviLoggingEnabled])

-- | Details for the tool used to call the API.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testToolDetails' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testToolDetails =
  GoogleDevtoolsRemoteexecutionV1testToolDetails'
    { _gdrvtdToolName    :: !(Maybe Text)
    , _gdrvtdToolVersion :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testToolDetails' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvtdToolName'
--
-- * 'gdrvtdToolVersion'
googleDevtoolsRemoteexecutionV1testToolDetails
    :: GoogleDevtoolsRemoteexecutionV1testToolDetails
googleDevtoolsRemoteexecutionV1testToolDetails =
  GoogleDevtoolsRemoteexecutionV1testToolDetails'
    {_gdrvtdToolName = Nothing, _gdrvtdToolVersion = Nothing}


-- | Name of the tool, e.g. bazel.
gdrvtdToolName :: Lens' GoogleDevtoolsRemoteexecutionV1testToolDetails (Maybe Text)
gdrvtdToolName
  = lens _gdrvtdToolName
      (\ s a -> s{_gdrvtdToolName = a})

-- | Version of the tool used for the request, e.g. 5.0.3.
gdrvtdToolVersion :: Lens' GoogleDevtoolsRemoteexecutionV1testToolDetails (Maybe Text)
gdrvtdToolVersion
  = lens _gdrvtdToolVersion
      (\ s a -> s{_gdrvtdToolVersion = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testToolDetails
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testToolDetails"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testToolDetails' <$>
                   (o .:? "toolName") <*> (o .:? "toolVersion"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testToolDetails
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testToolDetails'{..}
          = object
              (catMaybes
                 [("toolName" .=) <$> _gdrvtdToolName,
                  ("toolVersion" .=) <$> _gdrvtdToolVersion])

-- | Capabilities of the remote execution system.
--
-- /See:/ 'buildBazelRemoteExecutionV2ExecutionCapabilities' smart constructor.
data BuildBazelRemoteExecutionV2ExecutionCapabilities =
  BuildBazelRemoteExecutionV2ExecutionCapabilities'
    { _bbrevecExecutionPriorityCapabilities :: !(Maybe BuildBazelRemoteExecutionV2PriorityCapabilities)
    , _bbrevecExecEnabled                   :: !(Maybe Bool)
    , _bbrevecDigestFunction                :: !(Maybe BuildBazelRemoteExecutionV2ExecutionCapabilitiesDigestFunction)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2ExecutionCapabilities' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevecExecutionPriorityCapabilities'
--
-- * 'bbrevecExecEnabled'
--
-- * 'bbrevecDigestFunction'
buildBazelRemoteExecutionV2ExecutionCapabilities
    :: BuildBazelRemoteExecutionV2ExecutionCapabilities
buildBazelRemoteExecutionV2ExecutionCapabilities =
  BuildBazelRemoteExecutionV2ExecutionCapabilities'
    { _bbrevecExecutionPriorityCapabilities = Nothing
    , _bbrevecExecEnabled = Nothing
    , _bbrevecDigestFunction = Nothing
    }


-- | Supported execution priority range.
bbrevecExecutionPriorityCapabilities :: Lens' BuildBazelRemoteExecutionV2ExecutionCapabilities (Maybe BuildBazelRemoteExecutionV2PriorityCapabilities)
bbrevecExecutionPriorityCapabilities
  = lens _bbrevecExecutionPriorityCapabilities
      (\ s a ->
         s{_bbrevecExecutionPriorityCapabilities = a})

-- | Whether remote execution is enabled for the particular server\/instance.
bbrevecExecEnabled :: Lens' BuildBazelRemoteExecutionV2ExecutionCapabilities (Maybe Bool)
bbrevecExecEnabled
  = lens _bbrevecExecEnabled
      (\ s a -> s{_bbrevecExecEnabled = a})

-- | Remote execution may only support a single digest function.
bbrevecDigestFunction :: Lens' BuildBazelRemoteExecutionV2ExecutionCapabilities (Maybe BuildBazelRemoteExecutionV2ExecutionCapabilitiesDigestFunction)
bbrevecDigestFunction
  = lens _bbrevecDigestFunction
      (\ s a -> s{_bbrevecDigestFunction = a})

instance FromJSON
           BuildBazelRemoteExecutionV2ExecutionCapabilities
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2ExecutionCapabilities"
              (\ o ->
                 BuildBazelRemoteExecutionV2ExecutionCapabilities' <$>
                   (o .:? "executionPriorityCapabilities") <*>
                     (o .:? "execEnabled")
                     <*> (o .:? "digestFunction"))

instance ToJSON
           BuildBazelRemoteExecutionV2ExecutionCapabilities
         where
        toJSON
          BuildBazelRemoteExecutionV2ExecutionCapabilities'{..}
          = object
              (catMaybes
                 [("executionPriorityCapabilities" .=) <$>
                    _bbrevecExecutionPriorityCapabilities,
                  ("execEnabled" .=) <$> _bbrevecExecEnabled,
                  ("digestFunction" .=) <$> _bbrevecDigestFunction])

-- | The request used for UpdateWorkerPool.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest' smart constructor.
data GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest'
    { _gdravuwprUpdateMask :: !(Maybe GFieldMask)
    , _gdravuwprWorkerPool :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravuwprUpdateMask'
--
-- * 'gdravuwprWorkerPool'
googleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest
googleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest'
    {_gdravuwprUpdateMask = Nothing, _gdravuwprWorkerPool = Nothing}


-- | The update mask applies to worker_pool. For the \`FieldMask\`
-- definition, see
-- https:\/\/developers.google.com\/protocol-buffers\/docs\/reference\/google.protobuf#fieldmask
-- If an empty update_mask is provided, only the non-default valued field
-- in the worker pool field will be updated. Note that in order to update a
-- field to the default value (zero, false, empty string) an explicit
-- update_mask must be provided.
gdravuwprUpdateMask :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest (Maybe GFieldMask)
gdravuwprUpdateMask
  = lens _gdravuwprUpdateMask
      (\ s a -> s{_gdravuwprUpdateMask = a})

-- | Specifies the worker pool to update.
gdravuwprWorkerPool :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool)
gdravuwprWorkerPool
  = lens _gdravuwprWorkerPool
      (\ s a -> s{_gdravuwprWorkerPool = a})

instance FromJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest"
              (\ o ->
                 GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest'
                   <$> (o .:? "updateMask") <*> (o .:? "workerPool"))

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest'{..}
          = object
              (catMaybes
                 [("updateMask" .=) <$> _gdravuwprUpdateMask,
                  ("workerPool" .=) <$> _gdravuwprWorkerPool])

-- | A request message for ContentAddressableStorage.BatchReadBlobs.
--
-- /See:/ 'buildBazelRemoteExecutionV2BatchReadBlobsRequest' smart constructor.
newtype BuildBazelRemoteExecutionV2BatchReadBlobsRequest =
  BuildBazelRemoteExecutionV2BatchReadBlobsRequest'
    { _bbrevbrbrDigests :: Maybe [BuildBazelRemoteExecutionV2Digest]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2BatchReadBlobsRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevbrbrDigests'
buildBazelRemoteExecutionV2BatchReadBlobsRequest
    :: BuildBazelRemoteExecutionV2BatchReadBlobsRequest
buildBazelRemoteExecutionV2BatchReadBlobsRequest =
  BuildBazelRemoteExecutionV2BatchReadBlobsRequest'
    {_bbrevbrbrDigests = Nothing}


-- | The individual blob digests.
bbrevbrbrDigests :: Lens' BuildBazelRemoteExecutionV2BatchReadBlobsRequest [BuildBazelRemoteExecutionV2Digest]
bbrevbrbrDigests
  = lens _bbrevbrbrDigests
      (\ s a -> s{_bbrevbrbrDigests = a})
      . _Default
      . _Coerce

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

instance ToJSON
           BuildBazelRemoteExecutionV2BatchReadBlobsRequest
         where
        toJSON
          BuildBazelRemoteExecutionV2BatchReadBlobsRequest'{..}
          = object
              (catMaybes [("digests" .=) <$> _bbrevbrbrDigests])

-- | An \`OutputFile\` is similar to a FileNode, but it is tailored for
-- output as part of an \`ActionResult\`. It allows a full file path rather
-- than only a name, and allows the server to include content inline.
-- \`OutputFile\` is binary-compatible with \`FileNode\`.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testOutputFile' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testOutputFile =
  GoogleDevtoolsRemoteexecutionV1testOutputFile'
    { _gdrvofPath         :: !(Maybe Text)
    , _gdrvofContent      :: !(Maybe Bytes)
    , _gdrvofIsExecutable :: !(Maybe Bool)
    , _gdrvofDigest       :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testOutputFile' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvofPath'
--
-- * 'gdrvofContent'
--
-- * 'gdrvofIsExecutable'
--
-- * 'gdrvofDigest'
googleDevtoolsRemoteexecutionV1testOutputFile
    :: GoogleDevtoolsRemoteexecutionV1testOutputFile
googleDevtoolsRemoteexecutionV1testOutputFile =
  GoogleDevtoolsRemoteexecutionV1testOutputFile'
    { _gdrvofPath = Nothing
    , _gdrvofContent = Nothing
    , _gdrvofIsExecutable = Nothing
    , _gdrvofDigest = Nothing
    }


-- | The full path of the file relative to the input root, including the
-- filename. The path separator is a forward slash \`\/\`. Since this is a
-- relative path, it MUST NOT begin with a leading forward slash.
gdrvofPath :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputFile (Maybe Text)
gdrvofPath
  = lens _gdrvofPath (\ s a -> s{_gdrvofPath = a})

-- | The raw content of the file. This field may be used by the server to
-- provide the content of a file inline in an ActionResult and avoid
-- requiring that the client make a separate call to
-- [ContentAddressableStorage.GetBlob] to retrieve it. The client SHOULD
-- NOT assume that it will get raw content with any request, and always be
-- prepared to retrieve it via \`digest\`.
gdrvofContent :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputFile (Maybe ByteString)
gdrvofContent
  = lens _gdrvofContent
      (\ s a -> s{_gdrvofContent = a})
      . mapping _Bytes

-- | True if file is executable, false otherwise.
gdrvofIsExecutable :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputFile (Maybe Bool)
gdrvofIsExecutable
  = lens _gdrvofIsExecutable
      (\ s a -> s{_gdrvofIsExecutable = a})

-- | The digest of the file\'s content.
gdrvofDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testOutputFile (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvofDigest
  = lens _gdrvofDigest (\ s a -> s{_gdrvofDigest = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testOutputFile
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testOutputFile"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testOutputFile' <$>
                   (o .:? "path") <*> (o .:? "content") <*>
                     (o .:? "isExecutable")
                     <*> (o .:? "digest"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testOutputFile
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testOutputFile'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _gdrvofPath,
                  ("content" .=) <$> _gdrvofContent,
                  ("isExecutable" .=) <$> _gdrvofIsExecutable,
                  ("digest" .=) <$> _gdrvofDigest])

-- | A worker pool resource in the Remote Build Execution API.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool' smart constructor.
data GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool'
    { _gdravwpWorkerConfig :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig)
    , _gdravwpState        :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPoolState)
    , _gdravwpWorkerCount  :: !(Maybe (Textual Int64))
    , _gdravwpName         :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravwpWorkerConfig'
--
-- * 'gdravwpState'
--
-- * 'gdravwpWorkerCount'
--
-- * 'gdravwpName'
googleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool
googleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool'
    { _gdravwpWorkerConfig = Nothing
    , _gdravwpState = Nothing
    , _gdravwpWorkerCount = Nothing
    , _gdravwpName = Nothing
    }


-- | Specifies the properties, such as machine type and disk size, used for
-- creating workers in a worker pool.
gdravwpWorkerConfig :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig)
gdravwpWorkerConfig
  = lens _gdravwpWorkerConfig
      (\ s a -> s{_gdravwpWorkerConfig = a})

-- | Output only. State of the worker pool.
gdravwpState :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPoolState)
gdravwpState
  = lens _gdravwpState (\ s a -> s{_gdravwpState = a})

-- | The desired number of workers in the worker pool. Must be a value
-- between 0 and 1000.
gdravwpWorkerCount :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool (Maybe Int64)
gdravwpWorkerCount
  = lens _gdravwpWorkerCount
      (\ s a -> s{_gdravwpWorkerCount = a})
      . mapping _Coerce

-- | WorkerPool resource name formatted as:
-- \`projects\/[PROJECT_ID]\/instances\/[INSTANCE_ID]\/workerpools\/[POOL_ID]\`.
-- name should not be populated when creating a worker pool since it is
-- provided in the \`poolId\` field.
gdravwpName :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool (Maybe Text)
gdravwpName
  = lens _gdravwpName (\ s a -> s{_gdravwpName = a})

instance FromJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool"
              (\ o ->
                 GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool'
                   <$>
                   (o .:? "workerConfig") <*> (o .:? "state") <*>
                     (o .:? "workerCount")
                     <*> (o .:? "name"))

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool'{..}
          = object
              (catMaybes
                 [("workerConfig" .=) <$> _gdravwpWorkerConfig,
                  ("state" .=) <$> _gdravwpState,
                  ("workerCount" .=) <$> _gdravwpWorkerCount,
                  ("name" .=) <$> _gdravwpName])

-- | A \`SymlinkNode\` represents a symbolic link.
--
-- /See:/ 'buildBazelRemoteExecutionV2SymlinkNode' smart constructor.
data BuildBazelRemoteExecutionV2SymlinkNode =
  BuildBazelRemoteExecutionV2SymlinkNode'
    { _bbrevsnName   :: !(Maybe Text)
    , _bbrevsnTarget :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2SymlinkNode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevsnName'
--
-- * 'bbrevsnTarget'
buildBazelRemoteExecutionV2SymlinkNode
    :: BuildBazelRemoteExecutionV2SymlinkNode
buildBazelRemoteExecutionV2SymlinkNode =
  BuildBazelRemoteExecutionV2SymlinkNode'
    {_bbrevsnName = Nothing, _bbrevsnTarget = Nothing}


-- | The name of the symlink.
bbrevsnName :: Lens' BuildBazelRemoteExecutionV2SymlinkNode (Maybe Text)
bbrevsnName
  = lens _bbrevsnName (\ s a -> s{_bbrevsnName = a})

-- | The target path of the symlink. The path separator is a forward slash
-- \`\/\`. The target path can be relative to the parent directory of the
-- symlink or it can be an absolute path starting with \`\/\`. Support for
-- absolute paths can be checked using the Capabilities API. The canonical
-- form forbids the substrings \`\/.\/\` and \`\/\/\` in the target path.
-- \`..\` components are allowed anywhere in the target path.
bbrevsnTarget :: Lens' BuildBazelRemoteExecutionV2SymlinkNode (Maybe Text)
bbrevsnTarget
  = lens _bbrevsnTarget
      (\ s a -> s{_bbrevsnTarget = a})

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

instance ToJSON
           BuildBazelRemoteExecutionV2SymlinkNode
         where
        toJSON BuildBazelRemoteExecutionV2SymlinkNode'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _bbrevsnName,
                  ("target" .=) <$> _bbrevsnTarget])

--
-- /See:/ 'googleRpcStatusDetailsItem' smart constructor.
newtype GoogleRpcStatusDetailsItem =
  GoogleRpcStatusDetailsItem'
    { _grsdiAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleRpcStatusDetailsItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grsdiAddtional'
googleRpcStatusDetailsItem
    :: HashMap Text JSONValue -- ^ 'grsdiAddtional'
    -> GoogleRpcStatusDetailsItem
googleRpcStatusDetailsItem pGrsdiAddtional_ =
  GoogleRpcStatusDetailsItem' {_grsdiAddtional = _Coerce # pGrsdiAddtional_}


-- | Properties of the object. Contains field \'type with type URL.
grsdiAddtional :: Lens' GoogleRpcStatusDetailsItem (HashMap Text JSONValue)
grsdiAddtional
  = lens _grsdiAddtional
      (\ s a -> s{_grsdiAddtional = a})
      . _Coerce

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

instance ToJSON GoogleRpcStatusDetailsItem where
        toJSON = toJSON . _grsdiAddtional

-- | A \`DirectoryNode\` represents a child of a Directory which is itself a
-- \`Directory\` and its associated metadata.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testDirectoryNode' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testDirectoryNode =
  GoogleDevtoolsRemoteexecutionV1testDirectoryNode'
    { _gdrvdnName   :: !(Maybe Text)
    , _gdrvdnDigest :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testDirectoryNode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvdnName'
--
-- * 'gdrvdnDigest'
googleDevtoolsRemoteexecutionV1testDirectoryNode
    :: GoogleDevtoolsRemoteexecutionV1testDirectoryNode
googleDevtoolsRemoteexecutionV1testDirectoryNode =
  GoogleDevtoolsRemoteexecutionV1testDirectoryNode'
    {_gdrvdnName = Nothing, _gdrvdnDigest = Nothing}


-- | The name of the directory.
gdrvdnName :: Lens' GoogleDevtoolsRemoteexecutionV1testDirectoryNode (Maybe Text)
gdrvdnName
  = lens _gdrvdnName (\ s a -> s{_gdrvdnName = a})

-- | The digest of the Directory object represented. See Digest for
-- information about how to take the digest of a proto message.
gdrvdnDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testDirectoryNode (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvdnDigest
  = lens _gdrvdnDigest (\ s a -> s{_gdrvdnDigest = a})

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

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testDirectoryNode
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testDirectoryNode'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _gdrvdnName,
                  ("digest" .=) <$> _gdrvdnDigest])

-- | The metadata for a directory. Similar to the equivalent message in the
-- Remote Execution API.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2DirectoryMetadata' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata =
  GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata'
    { _gdrvdmPath   :: !(Maybe Text)
    , _gdrvdmDigest :: !(Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvdmPath'
--
-- * 'gdrvdmDigest'
googleDevtoolsRemoteworkersV1test2DirectoryMetadata
    :: GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata
googleDevtoolsRemoteworkersV1test2DirectoryMetadata =
  GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata'
    {_gdrvdmPath = Nothing, _gdrvdmDigest = Nothing}


-- | The path of the directory, as in FileMetadata.path.
gdrvdmPath :: Lens' GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata (Maybe Text)
gdrvdmPath
  = lens _gdrvdmPath (\ s a -> s{_gdrvdmPath = a})

-- | A pointer to the contents of the directory, in the form of a marshalled
-- Directory message.
gdrvdmDigest :: Lens' GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata (Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
gdrvdmDigest
  = lens _gdrvdmDigest (\ s a -> s{_gdrvdmDigest = a})

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata'
                   <$> (o .:? "path") <*> (o .:? "digest"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata'{..}
          = object
              (catMaybes
                 [("path" .=) <$> _gdrvdmPath,
                  ("digest" .=) <$> _gdrvdmDigest])

-- | A \`Directory\` represents a directory node in a file tree, containing
-- zero or more children FileNodes and DirectoryNodes. Each \`Node\`
-- contains its name in the directory, the digest of its content (either a
-- file blob or a \`Directory\` proto), as well as possibly some metadata
-- about the file or directory. In order to ensure that two equivalent
-- directory trees hash to the same value, the following restrictions MUST
-- be obeyed when constructing a a \`Directory\`: - Every child in the
-- directory must have a path of exactly one segment. Multiple levels of
-- directory hierarchy may not be collapsed. - Each child in the directory
-- must have a unique path segment (file name). - The files and directories
-- in the directory must each be sorted in lexicographical order by path.
-- The path strings must be sorted by code point, equivalently, by UTF-8
-- bytes. A \`Directory\` that obeys the restrictions is said to be in
-- canonical form. As an example, the following could be used for a file
-- named \`bar\` and a directory named \`foo\` with an executable file
-- named \`baz\` (hashes shortened for readability): \`\`\`json \/\/
-- (Directory proto) { files: [ { name: \"bar\", digest: { hash:
-- \"4a73bc9d03...\", size: 65534 } } ], directories: [ { name: \"foo\",
-- digest: { hash: \"4cf2eda940...\", size: 43 } } ] } \/\/ (Directory
-- proto with hash \"4cf2eda940...\" and size 43) { files: [ { name:
-- \"baz\", digest: { hash: \"b2c941073e...\", size: 1294, },
-- is_executable: true } ] } \`\`\`
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testDirectory' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testDirectory =
  GoogleDevtoolsRemoteexecutionV1testDirectory'
    { _gdrvdDirectories :: !(Maybe [GoogleDevtoolsRemoteexecutionV1testDirectoryNode])
    , _gdrvdFiles       :: !(Maybe [GoogleDevtoolsRemoteexecutionV1testFileNode])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testDirectory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvdDirectories'
--
-- * 'gdrvdFiles'
googleDevtoolsRemoteexecutionV1testDirectory
    :: GoogleDevtoolsRemoteexecutionV1testDirectory
googleDevtoolsRemoteexecutionV1testDirectory =
  GoogleDevtoolsRemoteexecutionV1testDirectory'
    {_gdrvdDirectories = Nothing, _gdrvdFiles = Nothing}


-- | The subdirectories in the directory.
gdrvdDirectories :: Lens' GoogleDevtoolsRemoteexecutionV1testDirectory [GoogleDevtoolsRemoteexecutionV1testDirectoryNode]
gdrvdDirectories
  = lens _gdrvdDirectories
      (\ s a -> s{_gdrvdDirectories = a})
      . _Default
      . _Coerce

-- | The files in the directory.
gdrvdFiles :: Lens' GoogleDevtoolsRemoteexecutionV1testDirectory [GoogleDevtoolsRemoteexecutionV1testFileNode]
gdrvdFiles
  = lens _gdrvdFiles (\ s a -> s{_gdrvdFiles = a}) .
      _Default
      . _Coerce

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testDirectory
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testDirectory"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testDirectory' <$>
                   (o .:? "directories" .!= mempty) <*>
                     (o .:? "files" .!= mempty))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testDirectory
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testDirectory'{..}
          = object
              (catMaybes
                 [("directories" .=) <$> _gdrvdDirectories,
                  ("files" .=) <$> _gdrvdFiles])

-- | An ActionResult represents the result of an Action being run.
--
-- /See:/ 'buildBazelRemoteExecutionV2ActionResult' smart constructor.
data BuildBazelRemoteExecutionV2ActionResult =
  BuildBazelRemoteExecutionV2ActionResult'
    { _bbrevarExecutionMetadata       :: !(Maybe BuildBazelRemoteExecutionV2ExecutedActionMetadata)
    , _bbrevarOutputDirectorySymlinks :: !(Maybe [BuildBazelRemoteExecutionV2OutputSymlink])
    , _bbrevarOutputFileSymlinks      :: !(Maybe [BuildBazelRemoteExecutionV2OutputSymlink])
    , _bbrevarOutputDirectories       :: !(Maybe [BuildBazelRemoteExecutionV2OutputDirectory])
    , _bbrevarOutputFiles             :: !(Maybe [BuildBazelRemoteExecutionV2OutputFile])
    , _bbrevarStderrRaw               :: !(Maybe Bytes)
    , _bbrevarExitCode                :: !(Maybe (Textual Int32))
    , _bbrevarStdoutDigest            :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    , _bbrevarStderrDigest            :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    , _bbrevarStdoutRaw               :: !(Maybe Bytes)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2ActionResult' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevarExecutionMetadata'
--
-- * 'bbrevarOutputDirectorySymlinks'
--
-- * 'bbrevarOutputFileSymlinks'
--
-- * 'bbrevarOutputDirectories'
--
-- * 'bbrevarOutputFiles'
--
-- * 'bbrevarStderrRaw'
--
-- * 'bbrevarExitCode'
--
-- * 'bbrevarStdoutDigest'
--
-- * 'bbrevarStderrDigest'
--
-- * 'bbrevarStdoutRaw'
buildBazelRemoteExecutionV2ActionResult
    :: BuildBazelRemoteExecutionV2ActionResult
buildBazelRemoteExecutionV2ActionResult =
  BuildBazelRemoteExecutionV2ActionResult'
    { _bbrevarExecutionMetadata = Nothing
    , _bbrevarOutputDirectorySymlinks = Nothing
    , _bbrevarOutputFileSymlinks = Nothing
    , _bbrevarOutputDirectories = Nothing
    , _bbrevarOutputFiles = Nothing
    , _bbrevarStderrRaw = Nothing
    , _bbrevarExitCode = Nothing
    , _bbrevarStdoutDigest = Nothing
    , _bbrevarStderrDigest = Nothing
    , _bbrevarStdoutRaw = Nothing
    }


-- | The details of the execution that originally produced this result.
bbrevarExecutionMetadata :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe BuildBazelRemoteExecutionV2ExecutedActionMetadata)
bbrevarExecutionMetadata
  = lens _bbrevarExecutionMetadata
      (\ s a -> s{_bbrevarExecutionMetadata = a})

-- | The output directories of the action that are symbolic links to other
-- directories. Those may be links to other output directories, or input
-- directories, or even absolute paths outside of the working directory, if
-- the server supports SymlinkAbsolutePathStrategy.ALLOWED. For each output
-- directory requested in the \`output_directories\` field of the Action,
-- if the directory file existed after the action completed, a single entry
-- will be present either in this field, or in the \`output_directories\`
-- field, if the directory was not a symbolic link. If the action does not
-- produce the requested output, or produces a file where a directory is
-- expected or vice versa, then that output will be omitted from the list.
-- The server is free to arrange the output list as desired; clients MUST
-- NOT assume that the output list is sorted.
bbrevarOutputDirectorySymlinks :: Lens' BuildBazelRemoteExecutionV2ActionResult [BuildBazelRemoteExecutionV2OutputSymlink]
bbrevarOutputDirectorySymlinks
  = lens _bbrevarOutputDirectorySymlinks
      (\ s a -> s{_bbrevarOutputDirectorySymlinks = a})
      . _Default
      . _Coerce

-- | The output files of the action that are symbolic links to other files.
-- Those may be links to other output files, or input files, or even
-- absolute paths outside of the working directory, if the server supports
-- SymlinkAbsolutePathStrategy.ALLOWED. For each output file requested in
-- the \`output_files\` field of the Action, if the corresponding file
-- existed after the action completed, a single entry will be present
-- either in this field, or in the \`output_files\` field, if the file was
-- not a symbolic link. If the action does not produce the requested
-- output, or produces a directory where a regular file is expected or vice
-- versa, then that output will be omitted from the list. The server is
-- free to arrange the output list as desired; clients MUST NOT assume that
-- the output list is sorted.
bbrevarOutputFileSymlinks :: Lens' BuildBazelRemoteExecutionV2ActionResult [BuildBazelRemoteExecutionV2OutputSymlink]
bbrevarOutputFileSymlinks
  = lens _bbrevarOutputFileSymlinks
      (\ s a -> s{_bbrevarOutputFileSymlinks = a})
      . _Default
      . _Coerce

-- | The output directories of the action. For each output directory
-- requested in the \`output_directories\` field of the Action, if the
-- corresponding directory existed after the action completed, a single
-- entry will be present in the output list, which will contain the digest
-- of a Tree message containing the directory tree, and the path equal
-- exactly to the corresponding Action output_directories member. As an
-- example, suppose the Action had an output directory \`a\/b\/dir\` and
-- the execution produced the following contents in \`a\/b\/dir\`: a file
-- named \`bar\` and a directory named \`foo\` with an executable file
-- named \`baz\`. Then, output_directory will contain (hashes shortened for
-- readability): \`\`\`json \/\/ OutputDirectory proto: { path:
-- \"a\/b\/dir\" tree_digest: { hash: \"4a73bc9d03...\", size: 55 } } \/\/
-- Tree proto with hash \"4a73bc9d03...\" and size 55: { root: { files: [ {
-- name: \"bar\", digest: { hash: \"4a73bc9d03...\", size: 65534 } } ],
-- directories: [ { name: \"foo\", digest: { hash: \"4cf2eda940...\", size:
-- 43 } } ] } children : { \/\/ (Directory proto with hash
-- \"4cf2eda940...\" and size 43) files: [ { name: \"baz\", digest: { hash:
-- \"b2c941073e...\", size: 1294, }, is_executable: true } ] } } \`\`\`
bbrevarOutputDirectories :: Lens' BuildBazelRemoteExecutionV2ActionResult [BuildBazelRemoteExecutionV2OutputDirectory]
bbrevarOutputDirectories
  = lens _bbrevarOutputDirectories
      (\ s a -> s{_bbrevarOutputDirectories = a})
      . _Default
      . _Coerce

-- | The output files of the action. For each output file requested in the
-- \`output_files\` field of the Action, if the corresponding file existed
-- after the action completed, a single entry will be present either in
-- this field, or in the output_file_symlinks field, if the file was a
-- symbolic link to another file. If the action does not produce the
-- requested output, or produces a directory where a regular file is
-- expected or vice versa, then that output will be omitted from the list.
-- The server is free to arrange the output list as desired; clients MUST
-- NOT assume that the output list is sorted.
bbrevarOutputFiles :: Lens' BuildBazelRemoteExecutionV2ActionResult [BuildBazelRemoteExecutionV2OutputFile]
bbrevarOutputFiles
  = lens _bbrevarOutputFiles
      (\ s a -> s{_bbrevarOutputFiles = a})
      . _Default
      . _Coerce

-- | The standard error buffer of the action. The server will determine,
-- based on the size of the buffer, whether to return it in raw form or to
-- return a digest in \`stderr_digest\` that points to the buffer. If
-- neither is set, then the buffer is empty. The client SHOULD NOT assume
-- it will get one of the raw buffer or a digest on any given request and
-- should be prepared to handle either.
bbrevarStderrRaw :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe ByteString)
bbrevarStderrRaw
  = lens _bbrevarStderrRaw
      (\ s a -> s{_bbrevarStderrRaw = a})
      . mapping _Bytes

-- | The exit code of the command.
bbrevarExitCode :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe Int32)
bbrevarExitCode
  = lens _bbrevarExitCode
      (\ s a -> s{_bbrevarExitCode = a})
      . mapping _Coerce

-- | The digest for a blob containing the standard output of the action,
-- which can be retrieved from the ContentAddressableStorage. See
-- \`stdout_raw\` for when this will be set.
bbrevarStdoutDigest :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevarStdoutDigest
  = lens _bbrevarStdoutDigest
      (\ s a -> s{_bbrevarStdoutDigest = a})

-- | The digest for a blob containing the standard error of the action, which
-- can be retrieved from the ContentAddressableStorage. See \`stderr_raw\`
-- for when this will be set.
bbrevarStderrDigest :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevarStderrDigest
  = lens _bbrevarStderrDigest
      (\ s a -> s{_bbrevarStderrDigest = a})

-- | The standard output buffer of the action. The server will determine,
-- based on the size of the buffer, whether to return it in raw form or to
-- return a digest in \`stdout_digest\` that points to the buffer. If
-- neither is set, then the buffer is empty. The client SHOULD NOT assume
-- it will get one of the raw buffer or a digest on any given request and
-- should be prepared to handle either.
bbrevarStdoutRaw :: Lens' BuildBazelRemoteExecutionV2ActionResult (Maybe ByteString)
bbrevarStdoutRaw
  = lens _bbrevarStdoutRaw
      (\ s a -> s{_bbrevarStdoutRaw = a})
      . mapping _Bytes

instance FromJSON
           BuildBazelRemoteExecutionV2ActionResult
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2ActionResult"
              (\ o ->
                 BuildBazelRemoteExecutionV2ActionResult' <$>
                   (o .:? "executionMetadata") <*>
                     (o .:? "outputDirectorySymlinks" .!= mempty)
                     <*> (o .:? "outputFileSymlinks" .!= mempty)
                     <*> (o .:? "outputDirectories" .!= mempty)
                     <*> (o .:? "outputFiles" .!= mempty)
                     <*> (o .:? "stderrRaw")
                     <*> (o .:? "exitCode")
                     <*> (o .:? "stdoutDigest")
                     <*> (o .:? "stderrDigest")
                     <*> (o .:? "stdoutRaw"))

instance ToJSON
           BuildBazelRemoteExecutionV2ActionResult
         where
        toJSON BuildBazelRemoteExecutionV2ActionResult'{..}
          = object
              (catMaybes
                 [("executionMetadata" .=) <$>
                    _bbrevarExecutionMetadata,
                  ("outputDirectorySymlinks" .=) <$>
                    _bbrevarOutputDirectorySymlinks,
                  ("outputFileSymlinks" .=) <$>
                    _bbrevarOutputFileSymlinks,
                  ("outputDirectories" .=) <$>
                    _bbrevarOutputDirectories,
                  ("outputFiles" .=) <$> _bbrevarOutputFiles,
                  ("stderrRaw" .=) <$> _bbrevarStderrRaw,
                  ("exitCode" .=) <$> _bbrevarExitCode,
                  ("stdoutDigest" .=) <$> _bbrevarStdoutDigest,
                  ("stderrDigest" .=) <$> _bbrevarStderrDigest,
                  ("stdoutRaw" .=) <$> _bbrevarStdoutRaw])

-- | The request used for DeleteWorkerPool.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest' smart constructor.
newtype GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest'
    { _gdravdwprName :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravdwprName'
googleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest
googleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest'
    {_gdravdwprName = Nothing}


-- | Name of the worker pool to delete. Format:
-- \`projects\/[PROJECT_ID]\/instances\/[INSTANCE_ID]\/workerpools\/[POOL_ID]\`.
gdravdwprName :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest (Maybe Text)
gdravdwprName
  = lens _gdravdwprName
      (\ s a -> s{_gdravdwprName = a})

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

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaDeleteWorkerPoolRequest'{..}
          = object (catMaybes [("name" .=) <$> _gdravdwprName])

-- | An environment variable required by this task.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable =
  GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable'
    { _gdrvctievValue :: !(Maybe Text)
    , _gdrvctievName  :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvctievValue'
--
-- * 'gdrvctievName'
googleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable
    :: GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable
googleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable =
  GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable'
    {_gdrvctievValue = Nothing, _gdrvctievName = Nothing}


-- | The envvar value.
gdrvctievValue :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable (Maybe Text)
gdrvctievValue
  = lens _gdrvctievValue
      (\ s a -> s{_gdrvctievValue = a})

-- | The envvar name.
gdrvctievName :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable (Maybe Text)
gdrvctievName
  = lens _gdrvctievName
      (\ s a -> s{_gdrvctievName = a})

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

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2CommandTaskInputsEnvironmentVariable'{..}
          = object
              (catMaybes
                 [("value" .=) <$> _gdrvctievValue,
                  ("name" .=) <$> _gdrvctievName])

-- | The response message for Execution.Execute, which will be contained in
-- the response field of the Operation.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testExecuteResponse' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testExecuteResponse =
  GoogleDevtoolsRemoteexecutionV1testExecuteResponse'
    { _gdrverStatus       :: !(Maybe GoogleRpcStatus)
    , _gdrverServerLogs   :: !(Maybe GoogleDevtoolsRemoteexecutionV1testExecuteResponseServerLogs)
    , _gdrverResult       :: !(Maybe GoogleDevtoolsRemoteexecutionV1testActionResult)
    , _gdrverCachedResult :: !(Maybe Bool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testExecuteResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrverStatus'
--
-- * 'gdrverServerLogs'
--
-- * 'gdrverResult'
--
-- * 'gdrverCachedResult'
googleDevtoolsRemoteexecutionV1testExecuteResponse
    :: GoogleDevtoolsRemoteexecutionV1testExecuteResponse
googleDevtoolsRemoteexecutionV1testExecuteResponse =
  GoogleDevtoolsRemoteexecutionV1testExecuteResponse'
    { _gdrverStatus = Nothing
    , _gdrverServerLogs = Nothing
    , _gdrverResult = Nothing
    , _gdrverCachedResult = Nothing
    }


-- | If the status has a code other than \`OK\`, it indicates that the action
-- did not finish execution. For example, if the operation times out during
-- execution, the status will have a \`DEADLINE_EXCEEDED\` code. Servers
-- MUST use this field for errors in execution, rather than the error field
-- on the \`Operation\` object. If the status code is other than \`OK\`,
-- then the result MUST NOT be cached. For an error status, the \`result\`
-- field is optional; the server may populate the output-, stdout-, and
-- stderr-related fields if it has any information available, such as the
-- stdout and stderr of a timed-out action.
gdrverStatus :: Lens' GoogleDevtoolsRemoteexecutionV1testExecuteResponse (Maybe GoogleRpcStatus)
gdrverStatus
  = lens _gdrverStatus (\ s a -> s{_gdrverStatus = a})

-- | An optional list of additional log outputs the server wishes to provide.
-- A server can use this to return execution-specific logs however it
-- wishes. This is intended primarily to make it easier for users to debug
-- issues that may be outside of the actual job execution, such as by
-- identifying the worker executing the action or by providing logs from
-- the worker\'s setup phase. The keys SHOULD be human readable so that a
-- client can display them to a user.
gdrverServerLogs :: Lens' GoogleDevtoolsRemoteexecutionV1testExecuteResponse (Maybe GoogleDevtoolsRemoteexecutionV1testExecuteResponseServerLogs)
gdrverServerLogs
  = lens _gdrverServerLogs
      (\ s a -> s{_gdrverServerLogs = a})

-- | The result of the action.
gdrverResult :: Lens' GoogleDevtoolsRemoteexecutionV1testExecuteResponse (Maybe GoogleDevtoolsRemoteexecutionV1testActionResult)
gdrverResult
  = lens _gdrverResult (\ s a -> s{_gdrverResult = a})

-- | True if the result was served from cache, false if it was executed.
gdrverCachedResult :: Lens' GoogleDevtoolsRemoteexecutionV1testExecuteResponse (Maybe Bool)
gdrverCachedResult
  = lens _gdrverCachedResult
      (\ s a -> s{_gdrverCachedResult = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testExecuteResponse
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testExecuteResponse"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testExecuteResponse'
                   <$>
                   (o .:? "status") <*> (o .:? "serverLogs") <*>
                     (o .:? "result")
                     <*> (o .:? "cachedResult"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testExecuteResponse
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testExecuteResponse'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _gdrverStatus,
                  ("serverLogs" .=) <$> _gdrverServerLogs,
                  ("result" .=) <$> _gdrverResult,
                  ("cachedResult" .=) <$> _gdrverCachedResult])

-- | The full version of a given tool.
--
-- /See:/ 'buildBazelSemverSemVer' smart constructor.
data BuildBazelSemverSemVer =
  BuildBazelSemverSemVer'
    { _bbssvMinor      :: !(Maybe (Textual Int32))
    , _bbssvMajor      :: !(Maybe (Textual Int32))
    , _bbssvPatch      :: !(Maybe (Textual Int32))
    , _bbssvPrerelease :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelSemverSemVer' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbssvMinor'
--
-- * 'bbssvMajor'
--
-- * 'bbssvPatch'
--
-- * 'bbssvPrerelease'
buildBazelSemverSemVer
    :: BuildBazelSemverSemVer
buildBazelSemverSemVer =
  BuildBazelSemverSemVer'
    { _bbssvMinor = Nothing
    , _bbssvMajor = Nothing
    , _bbssvPatch = Nothing
    , _bbssvPrerelease = Nothing
    }


-- | The minor version, e.g. 2 for 10.2.3.
bbssvMinor :: Lens' BuildBazelSemverSemVer (Maybe Int32)
bbssvMinor
  = lens _bbssvMinor (\ s a -> s{_bbssvMinor = a}) .
      mapping _Coerce

-- | The major version, e.g 10 for 10.2.3.
bbssvMajor :: Lens' BuildBazelSemverSemVer (Maybe Int32)
bbssvMajor
  = lens _bbssvMajor (\ s a -> s{_bbssvMajor = a}) .
      mapping _Coerce

-- | The patch version, e.g 3 for 10.2.3.
bbssvPatch :: Lens' BuildBazelSemverSemVer (Maybe Int32)
bbssvPatch
  = lens _bbssvPatch (\ s a -> s{_bbssvPatch = a}) .
      mapping _Coerce

-- | The pre-release version. Either this field or major\/minor\/patch fields
-- must be filled. They are mutually exclusive. Pre-release versions are
-- assumed to be earlier than any released versions.
bbssvPrerelease :: Lens' BuildBazelSemverSemVer (Maybe Text)
bbssvPrerelease
  = lens _bbssvPrerelease
      (\ s a -> s{_bbssvPrerelease = a})

instance FromJSON BuildBazelSemverSemVer where
        parseJSON
          = withObject "BuildBazelSemverSemVer"
              (\ o ->
                 BuildBazelSemverSemVer' <$>
                   (o .:? "minor") <*> (o .:? "major") <*>
                     (o .:? "patch")
                     <*> (o .:? "prerelease"))

instance ToJSON BuildBazelSemverSemVer where
        toJSON BuildBazelSemverSemVer'{..}
          = object
              (catMaybes
                 [("minor" .=) <$> _bbssvMinor,
                  ("major" .=) <$> _bbssvMajor,
                  ("patch" .=) <$> _bbssvPatch,
                  ("prerelease" .=) <$> _bbssvPrerelease])

-- | DEPRECATED - use CommandResult instead. Can be used as part of
-- CompleteRequest.metadata, or are part of a more sophisticated message.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandOverhead' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2CommandOverhead =
  GoogleDevtoolsRemoteworkersV1test2CommandOverhead'
    { _gdrvcoOverhead :: !(Maybe GDuration)
    , _gdrvcoDuration :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandOverhead' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcoOverhead'
--
-- * 'gdrvcoDuration'
googleDevtoolsRemoteworkersV1test2CommandOverhead
    :: GoogleDevtoolsRemoteworkersV1test2CommandOverhead
googleDevtoolsRemoteworkersV1test2CommandOverhead =
  GoogleDevtoolsRemoteworkersV1test2CommandOverhead'
    {_gdrvcoOverhead = Nothing, _gdrvcoDuration = Nothing}


-- | The amount of time *not* spent executing the command (ie
-- uploading\/downloading files).
gdrvcoOverhead :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandOverhead (Maybe Scientific)
gdrvcoOverhead
  = lens _gdrvcoOverhead
      (\ s a -> s{_gdrvcoOverhead = a})
      . mapping _GDuration

-- | The elapsed time between calling Accept and Complete. The server will
-- also have its own idea of what this should be, but this excludes the
-- overhead of the RPCs and the bot response time.
gdrvcoDuration :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandOverhead (Maybe Scientific)
gdrvcoDuration
  = lens _gdrvcoDuration
      (\ s a -> s{_gdrvcoDuration = a})
      . mapping _GDuration

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2CommandOverhead
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2CommandOverhead"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2CommandOverhead'
                   <$> (o .:? "overhead") <*> (o .:? "duration"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandOverhead
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2CommandOverhead'{..}
          = object
              (catMaybes
                 [("overhead" .=) <$> _gdrvcoOverhead,
                  ("duration" .=) <$> _gdrvcoDuration])

-- | A \`LogFile\` is a log stored in the CAS.
--
-- /See:/ 'buildBazelRemoteExecutionV2LogFile' smart constructor.
data BuildBazelRemoteExecutionV2LogFile =
  BuildBazelRemoteExecutionV2LogFile'
    { _bbrevlfHumanReadable :: !(Maybe Bool)
    , _bbrevlfDigest        :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2LogFile' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevlfHumanReadable'
--
-- * 'bbrevlfDigest'
buildBazelRemoteExecutionV2LogFile
    :: BuildBazelRemoteExecutionV2LogFile
buildBazelRemoteExecutionV2LogFile =
  BuildBazelRemoteExecutionV2LogFile'
    {_bbrevlfHumanReadable = Nothing, _bbrevlfDigest = Nothing}


-- | This is a hint as to the purpose of the log, and is set to true if the
-- log is human-readable text that can be usefully displayed to a user, and
-- false otherwise. For instance, if a command-line client wishes to print
-- the server logs to the terminal for a failed action, this allows it to
-- avoid displaying a binary file.
bbrevlfHumanReadable :: Lens' BuildBazelRemoteExecutionV2LogFile (Maybe Bool)
bbrevlfHumanReadable
  = lens _bbrevlfHumanReadable
      (\ s a -> s{_bbrevlfHumanReadable = a})

-- | The digest of the log contents.
bbrevlfDigest :: Lens' BuildBazelRemoteExecutionV2LogFile (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevlfDigest
  = lens _bbrevlfDigest
      (\ s a -> s{_bbrevlfDigest = a})

instance FromJSON BuildBazelRemoteExecutionV2LogFile
         where
        parseJSON
          = withObject "BuildBazelRemoteExecutionV2LogFile"
              (\ o ->
                 BuildBazelRemoteExecutionV2LogFile' <$>
                   (o .:? "humanReadable") <*> (o .:? "digest"))

instance ToJSON BuildBazelRemoteExecutionV2LogFile
         where
        toJSON BuildBazelRemoteExecutionV2LogFile'{..}
          = object
              (catMaybes
                 [("humanReadable" .=) <$> _bbrevlfHumanReadable,
                  ("digest" .=) <$> _bbrevlfDigest])

-- | The request used for \`CreateWorkerPool\`.
--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest' smart constructor.
data GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest'
    { _gdravcwprParent     :: !(Maybe Text)
    , _gdravcwprPoolId     :: !(Maybe Text)
    , _gdravcwprWorkerPool :: !(Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravcwprParent'
--
-- * 'gdravcwprPoolId'
--
-- * 'gdravcwprWorkerPool'
googleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest
googleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest'
    { _gdravcwprParent = Nothing
    , _gdravcwprPoolId = Nothing
    , _gdravcwprWorkerPool = Nothing
    }


-- | Resource name of the instance in which to create the new worker pool.
-- Format: \`projects\/[PROJECT_ID]\/instances\/[INSTANCE_ID]\`.
gdravcwprParent :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest (Maybe Text)
gdravcwprParent
  = lens _gdravcwprParent
      (\ s a -> s{_gdravcwprParent = a})

-- | ID of the created worker pool. A valid pool ID must: be 6-50 characters
-- long, contain only lowercase letters, digits, hyphens and underscores,
-- start with a lowercase letter, and end with a lowercase letter or a
-- digit.
gdravcwprPoolId :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest (Maybe Text)
gdravcwprPoolId
  = lens _gdravcwprPoolId
      (\ s a -> s{_gdravcwprPoolId = a})

-- | Specifies the worker pool to create. The name in the worker pool, if
-- specified, is ignored.
gdravcwprWorkerPool :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest (Maybe GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool)
gdravcwprWorkerPool
  = lens _gdravcwprWorkerPool
      (\ s a -> s{_gdravcwprWorkerPool = a})

instance FromJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest"
              (\ o ->
                 GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest'
                   <$>
                   (o .:? "parent") <*> (o .:? "poolId") <*>
                     (o .:? "workerPool"))

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaCreateWorkerPoolRequest'{..}
          = object
              (catMaybes
                 [("parent" .=) <$> _gdravcwprParent,
                  ("poolId" .=) <$> _gdravcwprPoolId,
                  ("workerPool" .=) <$> _gdravcwprWorkerPool])

-- | An \`EnvironmentVariable\` is one variable to set in the running
-- program\'s environment.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable =
  GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable'
    { _gdrvcevValue :: !(Maybe Text)
    , _gdrvcevName  :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcevValue'
--
-- * 'gdrvcevName'
googleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable
    :: GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable
googleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable =
  GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable'
    {_gdrvcevValue = Nothing, _gdrvcevName = Nothing}


-- | The variable value.
gdrvcevValue :: Lens' GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable (Maybe Text)
gdrvcevValue
  = lens _gdrvcevValue (\ s a -> s{_gdrvcevValue = a})

-- | The variable name.
gdrvcevName :: Lens' GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable (Maybe Text)
gdrvcevName
  = lens _gdrvcevName (\ s a -> s{_gdrvcevName = a})

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

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testCommandEnvironmentVariable'{..}
          = object
              (catMaybes
                 [("value" .=) <$> _gdrvcevValue,
                  ("name" .=) <$> _gdrvcevName])

-- | A response message for ContentAddressableStorage.FindMissingBlobs.
--
-- /See:/ 'buildBazelRemoteExecutionV2FindMissingBlobsResponse' smart constructor.
newtype BuildBazelRemoteExecutionV2FindMissingBlobsResponse =
  BuildBazelRemoteExecutionV2FindMissingBlobsResponse'
    { _bbrevfmbrMissingBlobDigests :: Maybe [BuildBazelRemoteExecutionV2Digest]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2FindMissingBlobsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevfmbrMissingBlobDigests'
buildBazelRemoteExecutionV2FindMissingBlobsResponse
    :: BuildBazelRemoteExecutionV2FindMissingBlobsResponse
buildBazelRemoteExecutionV2FindMissingBlobsResponse =
  BuildBazelRemoteExecutionV2FindMissingBlobsResponse'
    {_bbrevfmbrMissingBlobDigests = Nothing}


-- | A list of the blobs requested *not* present in the storage.
bbrevfmbrMissingBlobDigests :: Lens' BuildBazelRemoteExecutionV2FindMissingBlobsResponse [BuildBazelRemoteExecutionV2Digest]
bbrevfmbrMissingBlobDigests
  = lens _bbrevfmbrMissingBlobDigests
      (\ s a -> s{_bbrevfmbrMissingBlobDigests = a})
      . _Default
      . _Coerce

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

instance ToJSON
           BuildBazelRemoteExecutionV2FindMissingBlobsResponse
         where
        toJSON
          BuildBazelRemoteExecutionV2FindMissingBlobsResponse'{..}
          = object
              (catMaybes
                 [("missingBlobDigests" .=) <$>
                    _bbrevfmbrMissingBlobDigests])

-- | The contents of a directory. Similar to the equivalent message in the
-- Remote Execution API.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2Directory' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2Directory =
  GoogleDevtoolsRemoteworkersV1test2Directory'
    { _gDirectories :: !(Maybe [GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata])
    , _gFiles       :: !(Maybe [GoogleDevtoolsRemoteworkersV1test2FileMetadata])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2Directory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gDirectories'
--
-- * 'gFiles'
googleDevtoolsRemoteworkersV1test2Directory
    :: GoogleDevtoolsRemoteworkersV1test2Directory
googleDevtoolsRemoteworkersV1test2Directory =
  GoogleDevtoolsRemoteworkersV1test2Directory'
    {_gDirectories = Nothing, _gFiles = Nothing}


-- | Any subdirectories
gDirectories :: Lens' GoogleDevtoolsRemoteworkersV1test2Directory [GoogleDevtoolsRemoteworkersV1test2DirectoryMetadata]
gDirectories
  = lens _gDirectories (\ s a -> s{_gDirectories = a})
      . _Default
      . _Coerce

-- | The files in this directory
gFiles :: Lens' GoogleDevtoolsRemoteworkersV1test2Directory [GoogleDevtoolsRemoteworkersV1test2FileMetadata]
gFiles
  = lens _gFiles (\ s a -> s{_gFiles = a}) . _Default .
      _Coerce

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2Directory
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2Directory"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2Directory' <$>
                   (o .:? "directories" .!= mempty) <*>
                     (o .:? "files" .!= mempty))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2Directory
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2Directory'{..}
          = object
              (catMaybes
                 [("directories" .=) <$> _gDirectories,
                  ("files" .=) <$> _gFiles])

-- | An optional Metadata to attach to any RPC request to tell the server
-- about an external context of the request. The server may use this for
-- logging or other purposes. To use it, the client attaches the header to
-- the call using the canonical proto serialization: name:
-- google.devtools.remoteexecution.v1test.requestmetadata-bin contents: the
-- base64 encoded binary RequestMetadata message.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testRequestMetadata' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testRequestMetadata =
  GoogleDevtoolsRemoteexecutionV1testRequestMetadata'
    { _gdrvrmCorrelatedInvocationsId :: !(Maybe Text)
    , _gdrvrmToolInvocationId        :: !(Maybe Text)
    , _gdrvrmActionId                :: !(Maybe Text)
    , _gdrvrmToolDetails             :: !(Maybe GoogleDevtoolsRemoteexecutionV1testToolDetails)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testRequestMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvrmCorrelatedInvocationsId'
--
-- * 'gdrvrmToolInvocationId'
--
-- * 'gdrvrmActionId'
--
-- * 'gdrvrmToolDetails'
googleDevtoolsRemoteexecutionV1testRequestMetadata
    :: GoogleDevtoolsRemoteexecutionV1testRequestMetadata
googleDevtoolsRemoteexecutionV1testRequestMetadata =
  GoogleDevtoolsRemoteexecutionV1testRequestMetadata'
    { _gdrvrmCorrelatedInvocationsId = Nothing
    , _gdrvrmToolInvocationId = Nothing
    , _gdrvrmActionId = Nothing
    , _gdrvrmToolDetails = Nothing
    }


-- | An identifier to tie multiple tool invocations together. For example,
-- runs of foo_test, bar_test and baz_test on a post-submit of a given
-- patch.
gdrvrmCorrelatedInvocationsId :: Lens' GoogleDevtoolsRemoteexecutionV1testRequestMetadata (Maybe Text)
gdrvrmCorrelatedInvocationsId
  = lens _gdrvrmCorrelatedInvocationsId
      (\ s a -> s{_gdrvrmCorrelatedInvocationsId = a})

-- | An identifier that ties multiple actions together to a final result. For
-- example, multiple actions are required to build and run foo_test.
gdrvrmToolInvocationId :: Lens' GoogleDevtoolsRemoteexecutionV1testRequestMetadata (Maybe Text)
gdrvrmToolInvocationId
  = lens _gdrvrmToolInvocationId
      (\ s a -> s{_gdrvrmToolInvocationId = a})

-- | An identifier that ties multiple requests to the same action. For
-- example, multiple requests to the CAS, Action Cache, and Execution API
-- are used in order to compile foo.cc.
gdrvrmActionId :: Lens' GoogleDevtoolsRemoteexecutionV1testRequestMetadata (Maybe Text)
gdrvrmActionId
  = lens _gdrvrmActionId
      (\ s a -> s{_gdrvrmActionId = a})

-- | The details for the tool invoking the requests.
gdrvrmToolDetails :: Lens' GoogleDevtoolsRemoteexecutionV1testRequestMetadata (Maybe GoogleDevtoolsRemoteexecutionV1testToolDetails)
gdrvrmToolDetails
  = lens _gdrvrmToolDetails
      (\ s a -> s{_gdrvrmToolDetails = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testRequestMetadata
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testRequestMetadata"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testRequestMetadata'
                   <$>
                   (o .:? "correlatedInvocationsId") <*>
                     (o .:? "toolInvocationId")
                     <*> (o .:? "actionId")
                     <*> (o .:? "toolDetails"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testRequestMetadata
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testRequestMetadata'{..}
          = object
              (catMaybes
                 [("correlatedInvocationsId" .=) <$>
                    _gdrvrmCorrelatedInvocationsId,
                  ("toolInvocationId" .=) <$> _gdrvrmToolInvocationId,
                  ("actionId" .=) <$> _gdrvrmActionId,
                  ("toolDetails" .=) <$> _gdrvrmToolDetails])

-- | An \`ExecutionPolicy\` can be used to control the scheduling of the
-- action.
--
-- /See:/ 'buildBazelRemoteExecutionV2ExecutionPolicy' smart constructor.
newtype BuildBazelRemoteExecutionV2ExecutionPolicy =
  BuildBazelRemoteExecutionV2ExecutionPolicy'
    { _bbrevepPriority :: Maybe (Textual Int32)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2ExecutionPolicy' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevepPriority'
buildBazelRemoteExecutionV2ExecutionPolicy
    :: BuildBazelRemoteExecutionV2ExecutionPolicy
buildBazelRemoteExecutionV2ExecutionPolicy =
  BuildBazelRemoteExecutionV2ExecutionPolicy' {_bbrevepPriority = Nothing}


-- | The priority (relative importance) of this action. Generally, a lower
-- value means that the action should be run sooner than actions having a
-- greater priority value, but the interpretation of a given value is
-- server- dependent. A priority of 0 means the *default* priority.
-- Priorities may be positive or negative, and such actions should run
-- later or sooner than actions having the default priority, respectively.
-- The particular semantics of this field is up to the server. In
-- particular, every server will have their own supported range of
-- priorities, and will decide how these map into scheduling policy.
bbrevepPriority :: Lens' BuildBazelRemoteExecutionV2ExecutionPolicy (Maybe Int32)
bbrevepPriority
  = lens _bbrevepPriority
      (\ s a -> s{_bbrevepPriority = a})
      . mapping _Coerce

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

instance ToJSON
           BuildBazelRemoteExecutionV2ExecutionPolicy
         where
        toJSON
          BuildBazelRemoteExecutionV2ExecutionPolicy'{..}
          = object
              (catMaybes [("priority" .=) <$> _bbrevepPriority])

-- | Describes the server\/instance capabilities for updating the action
-- cache.
--
-- /See:/ 'buildBazelRemoteExecutionV2ActionCacheUpdateCapabilities' smart constructor.
newtype BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities =
  BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities'
    { _bbrevacucUpdateEnabled :: Maybe Bool
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevacucUpdateEnabled'
buildBazelRemoteExecutionV2ActionCacheUpdateCapabilities
    :: BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities
buildBazelRemoteExecutionV2ActionCacheUpdateCapabilities =
  BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities'
    {_bbrevacucUpdateEnabled = Nothing}


bbrevacucUpdateEnabled :: Lens' BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities (Maybe Bool)
bbrevacucUpdateEnabled
  = lens _bbrevacucUpdateEnabled
      (\ s a -> s{_bbrevacucUpdateEnabled = a})

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

instance ToJSON
           BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities
         where
        toJSON
          BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities'{..}
          = object
              (catMaybes
                 [("updateEnabled" .=) <$> _bbrevacucUpdateEnabled])

--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandResultMetadataItem' smart constructor.
newtype GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem =
  GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem'
    { _gdrvcrmiAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcrmiAddtional'
googleDevtoolsRemoteworkersV1test2CommandResultMetadataItem
    :: HashMap Text JSONValue -- ^ 'gdrvcrmiAddtional'
    -> GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem
googleDevtoolsRemoteworkersV1test2CommandResultMetadataItem pGdrvcrmiAddtional_ =
  GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem'
    {_gdrvcrmiAddtional = _Coerce # pGdrvcrmiAddtional_}


-- | Properties of the object. Contains field \'type with type URL.
gdrvcrmiAddtional :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem (HashMap Text JSONValue)
gdrvcrmiAddtional
  = lens _gdrvcrmiAddtional
      (\ s a -> s{_gdrvcrmiAddtional = a})
      . _Coerce

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

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem
         where
        toJSON = toJSON . _gdrvcrmiAddtional

-- | A request corresponding to a single blob that the client wants to
-- upload.
--
-- /See:/ 'buildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest' smart constructor.
data BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest =
  BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest'
    { _bbrevbubrrData   :: !(Maybe Bytes)
    , _bbrevbubrrDigest :: !(Maybe BuildBazelRemoteExecutionV2Digest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevbubrrData'
--
-- * 'bbrevbubrrDigest'
buildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest
    :: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest
buildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest =
  BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest'
    {_bbrevbubrrData = Nothing, _bbrevbubrrDigest = Nothing}


-- | The raw binary data.
bbrevbubrrData :: Lens' BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest (Maybe ByteString)
bbrevbubrrData
  = lens _bbrevbubrrData
      (\ s a -> s{_bbrevbubrrData = a})
      . mapping _Bytes

-- | The digest of the blob. This MUST be the digest of \`data\`.
bbrevbubrrDigest :: Lens' BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest (Maybe BuildBazelRemoteExecutionV2Digest)
bbrevbubrrDigest
  = lens _bbrevbubrrDigest
      (\ s a -> s{_bbrevbubrrDigest = a})

instance FromJSON
           BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest"
              (\ o ->
                 BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest'
                   <$> (o .:? "data") <*> (o .:? "digest"))

instance ToJSON
           BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest
         where
        toJSON
          BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest'{..}
          = object
              (catMaybes
                 [("data" .=) <$> _bbrevbubrrData,
                  ("digest" .=) <$> _bbrevbubrrDigest])

--
-- /See:/ 'googleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse' smart constructor.
newtype GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse'
    { _gdravlwprWorkerPools :: Maybe [GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdravlwprWorkerPools'
googleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse
    :: GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse
googleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse =
  GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse'
    {_gdravlwprWorkerPools = Nothing}


-- | The list of worker pools in a given instance.
gdravlwprWorkerPools :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse [GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerPool]
gdravlwprWorkerPools
  = lens _gdravlwprWorkerPools
      (\ s a -> s{_gdravlwprWorkerPools = a})
      . _Default
      . _Coerce

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

instance ToJSON
           GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse
         where
        toJSON
          GoogleDevtoolsRemotebuildexecutionAdminV1alphaListWorkerPoolsResponse'{..}
          = object
              (catMaybes
                 [("workerPools" .=) <$> _gdravlwprWorkerPools])

-- | All information about the execution of a command, suitable for providing
-- as the Bots interface\'s \`Lease.result\` field.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandResult' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2CommandResult =
  GoogleDevtoolsRemoteworkersV1test2CommandResult'
    { _gdrvcrStatus   :: !(Maybe GoogleRpcStatus)
    , _gdrvcrOverhead :: !(Maybe GDuration)
    , _gdrvcrOutputs  :: !(Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
    , _gdrvcrExitCode :: !(Maybe (Textual Int32))
    , _gdrvcrMetadata :: !(Maybe [GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem])
    , _gdrvcrDuration :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandResult' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcrStatus'
--
-- * 'gdrvcrOverhead'
--
-- * 'gdrvcrOutputs'
--
-- * 'gdrvcrExitCode'
--
-- * 'gdrvcrMetadata'
--
-- * 'gdrvcrDuration'
googleDevtoolsRemoteworkersV1test2CommandResult
    :: GoogleDevtoolsRemoteworkersV1test2CommandResult
googleDevtoolsRemoteworkersV1test2CommandResult =
  GoogleDevtoolsRemoteworkersV1test2CommandResult'
    { _gdrvcrStatus = Nothing
    , _gdrvcrOverhead = Nothing
    , _gdrvcrOutputs = Nothing
    , _gdrvcrExitCode = Nothing
    , _gdrvcrMetadata = Nothing
    , _gdrvcrDuration = Nothing
    }


-- | An overall status for the command. For example, if the command timed
-- out, this might have a code of DEADLINE_EXCEEDED; if it was killed by
-- the OS for memory exhaustion, it might have a code of
-- RESOURCE_EXHAUSTED.
gdrvcrStatus :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult (Maybe GoogleRpcStatus)
gdrvcrStatus
  = lens _gdrvcrStatus (\ s a -> s{_gdrvcrStatus = a})

-- | The amount of time *not* spent executing the command (ie
-- uploading\/downloading files).
gdrvcrOverhead :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult (Maybe Scientific)
gdrvcrOverhead
  = lens _gdrvcrOverhead
      (\ s a -> s{_gdrvcrOverhead = a})
      . mapping _GDuration

-- | The output files. The blob referenced by the digest should contain one
-- of the following (implementation-dependent): * A marshalled
-- DirectoryMetadata of the returned filesystem * A LUCI-style .isolated
-- file
gdrvcrOutputs :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult (Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
gdrvcrOutputs
  = lens _gdrvcrOutputs
      (\ s a -> s{_gdrvcrOutputs = a})

-- | The exit code of the process. An exit code of \"0\" should only be
-- trusted if \`status\` has a code of OK (otherwise it may simply be
-- unset).
gdrvcrExitCode :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult (Maybe Int32)
gdrvcrExitCode
  = lens _gdrvcrExitCode
      (\ s a -> s{_gdrvcrExitCode = a})
      . mapping _Coerce

-- | Implementation-dependent metadata about the task. Both servers and bots
-- may define messages which can be encoded here; bots are free to provide
-- metadata in multiple formats, and servers are free to choose one or more
-- of the values to process and ignore others. In particular, it is *not*
-- considered an error for the bot to provide the server with a field that
-- it doesn\'t know about.
gdrvcrMetadata :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult [GoogleDevtoolsRemoteworkersV1test2CommandResultMetadataItem]
gdrvcrMetadata
  = lens _gdrvcrMetadata
      (\ s a -> s{_gdrvcrMetadata = a})
      . _Default
      . _Coerce

-- | The elapsed time between calling Accept and Complete. The server will
-- also have its own idea of what this should be, but this excludes the
-- overhead of the RPCs and the bot response time.
gdrvcrDuration :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandResult (Maybe Scientific)
gdrvcrDuration
  = lens _gdrvcrDuration
      (\ s a -> s{_gdrvcrDuration = a})
      . mapping _GDuration

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2CommandResult
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2CommandResult"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2CommandResult' <$>
                   (o .:? "status") <*> (o .:? "overhead") <*>
                     (o .:? "outputs")
                     <*> (o .:? "exitCode")
                     <*> (o .:? "metadata" .!= mempty)
                     <*> (o .:? "duration"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandResult
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2CommandResult'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _gdrvcrStatus,
                  ("overhead" .=) <$> _gdrvcrOverhead,
                  ("outputs" .=) <$> _gdrvcrOutputs,
                  ("exitCode" .=) <$> _gdrvcrExitCode,
                  ("metadata" .=) <$> _gdrvcrMetadata,
                  ("duration" .=) <$> _gdrvcrDuration])

-- | A \`FileNode\` represents a single file and associated metadata.
--
-- /See:/ 'googleDevtoolsRemoteexecutionV1testFileNode' smart constructor.
data GoogleDevtoolsRemoteexecutionV1testFileNode =
  GoogleDevtoolsRemoteexecutionV1testFileNode'
    { _gdrvfnName         :: !(Maybe Text)
    , _gdrvfnIsExecutable :: !(Maybe Bool)
    , _gdrvfnDigest       :: !(Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteexecutionV1testFileNode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvfnName'
--
-- * 'gdrvfnIsExecutable'
--
-- * 'gdrvfnDigest'
googleDevtoolsRemoteexecutionV1testFileNode
    :: GoogleDevtoolsRemoteexecutionV1testFileNode
googleDevtoolsRemoteexecutionV1testFileNode =
  GoogleDevtoolsRemoteexecutionV1testFileNode'
    { _gdrvfnName = Nothing
    , _gdrvfnIsExecutable = Nothing
    , _gdrvfnDigest = Nothing
    }


-- | The name of the file.
gdrvfnName :: Lens' GoogleDevtoolsRemoteexecutionV1testFileNode (Maybe Text)
gdrvfnName
  = lens _gdrvfnName (\ s a -> s{_gdrvfnName = a})

-- | True if file is executable, false otherwise.
gdrvfnIsExecutable :: Lens' GoogleDevtoolsRemoteexecutionV1testFileNode (Maybe Bool)
gdrvfnIsExecutable
  = lens _gdrvfnIsExecutable
      (\ s a -> s{_gdrvfnIsExecutable = a})

-- | The digest of the file\'s content.
gdrvfnDigest :: Lens' GoogleDevtoolsRemoteexecutionV1testFileNode (Maybe GoogleDevtoolsRemoteexecutionV1testDigest)
gdrvfnDigest
  = lens _gdrvfnDigest (\ s a -> s{_gdrvfnDigest = a})

instance FromJSON
           GoogleDevtoolsRemoteexecutionV1testFileNode
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteexecutionV1testFileNode"
              (\ o ->
                 GoogleDevtoolsRemoteexecutionV1testFileNode' <$>
                   (o .:? "name") <*> (o .:? "isExecutable") <*>
                     (o .:? "digest"))

instance ToJSON
           GoogleDevtoolsRemoteexecutionV1testFileNode
         where
        toJSON
          GoogleDevtoolsRemoteexecutionV1testFileNode'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _gdrvfnName,
                  ("isExecutable" .=) <$> _gdrvfnIsExecutable,
                  ("digest" .=) <$> _gdrvfnDigest])

-- | AdminTemp is a prelimiary set of administration tasks. It\'s called
-- \"Temp\" because we do not yet know the best way to represent admin
-- tasks; it\'s possible that this will be entirely replaced in later
-- versions of this API. If this message proves to be sufficient, it will
-- be renamed in the alpha or beta release of this API. This message
-- (suitably marshalled into a protobuf.Any) can be used as the
-- inline_assignment field in a lease; the lease assignment field should
-- simply be \`\"admin\"\` in these cases. This message is heavily based on
-- Swarming administration tasks from the LUCI project
-- (http:\/\/github.com\/luci\/luci-py\/appengine\/swarming).
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2AdminTemp' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2AdminTemp =
  GoogleDevtoolsRemoteworkersV1test2AdminTemp'
    { _gdrvatCommand :: !(Maybe GoogleDevtoolsRemoteworkersV1test2AdminTempCommand)
    , _gdrvatArg     :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2AdminTemp' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvatCommand'
--
-- * 'gdrvatArg'
googleDevtoolsRemoteworkersV1test2AdminTemp
    :: GoogleDevtoolsRemoteworkersV1test2AdminTemp
googleDevtoolsRemoteworkersV1test2AdminTemp =
  GoogleDevtoolsRemoteworkersV1test2AdminTemp'
    {_gdrvatCommand = Nothing, _gdrvatArg = Nothing}


-- | The admin action; see \`Command\` for legal values.
gdrvatCommand :: Lens' GoogleDevtoolsRemoteworkersV1test2AdminTemp (Maybe GoogleDevtoolsRemoteworkersV1test2AdminTempCommand)
gdrvatCommand
  = lens _gdrvatCommand
      (\ s a -> s{_gdrvatCommand = a})

-- | The argument to the admin action; see \`Command\` for semantics.
gdrvatArg :: Lens' GoogleDevtoolsRemoteworkersV1test2AdminTemp (Maybe Text)
gdrvatArg
  = lens _gdrvatArg (\ s a -> s{_gdrvatArg = a})

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2AdminTemp
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2AdminTemp"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2AdminTemp' <$>
                   (o .:? "command") <*> (o .:? "arg"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2AdminTemp
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2AdminTemp'{..}
          = object
              (catMaybes
                 [("command" .=) <$> _gdrvatCommand,
                  ("arg" .=) <$> _gdrvatArg])

-- | CommandDuration contains the various duration metrics tracked when a bot
-- performs a command.
--
-- /See:/ 'googleDevtoolsRemotebuildbotCommandDurations' smart constructor.
data GoogleDevtoolsRemotebuildbotCommandDurations =
  GoogleDevtoolsRemotebuildbotCommandDurations'
    { _gdrcdStdout      :: !(Maybe GDuration)
    , _gdrcdDockerPrep  :: !(Maybe GDuration)
    , _gdrcdDownload    :: !(Maybe GDuration)
    , _gdrcdOverall     :: !(Maybe GDuration)
    , _gdrcdExecution   :: !(Maybe GDuration)
    , _gdrcdIsoPrepDone :: !(Maybe DateTime')
    , _gdrcdUpload      :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemotebuildbotCommandDurations' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrcdStdout'
--
-- * 'gdrcdDockerPrep'
--
-- * 'gdrcdDownload'
--
-- * 'gdrcdOverall'
--
-- * 'gdrcdExecution'
--
-- * 'gdrcdIsoPrepDone'
--
-- * 'gdrcdUpload'
googleDevtoolsRemotebuildbotCommandDurations
    :: GoogleDevtoolsRemotebuildbotCommandDurations
googleDevtoolsRemotebuildbotCommandDurations =
  GoogleDevtoolsRemotebuildbotCommandDurations'
    { _gdrcdStdout = Nothing
    , _gdrcdDockerPrep = Nothing
    , _gdrcdDownload = Nothing
    , _gdrcdOverall = Nothing
    , _gdrcdExecution = Nothing
    , _gdrcdIsoPrepDone = Nothing
    , _gdrcdUpload = Nothing
    }


-- | The time spent uploading the stdout logs.
gdrcdStdout :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdStdout
  = lens _gdrcdStdout (\ s a -> s{_gdrcdStdout = a}) .
      mapping _GDuration

-- | The time spent preparing the command to be run in a Docker container
-- (includes pulling the Docker image, if necessary).
gdrcdDockerPrep :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdDockerPrep
  = lens _gdrcdDockerPrep
      (\ s a -> s{_gdrcdDockerPrep = a})
      . mapping _GDuration

-- | The time spent downloading the input files and constructing the working
-- directory.
gdrcdDownload :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdDownload
  = lens _gdrcdDownload
      (\ s a -> s{_gdrcdDownload = a})
      . mapping _GDuration

-- | The time spent completing the command, in total.
gdrcdOverall :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdOverall
  = lens _gdrcdOverall (\ s a -> s{_gdrcdOverall = a})
      . mapping _GDuration

-- | The time spent executing the command (i.e., doing useful work).
gdrcdExecution :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdExecution
  = lens _gdrcdExecution
      (\ s a -> s{_gdrcdExecution = a})
      . mapping _GDuration

-- | The timestamp when preparation is done and bot starts downloading files.
gdrcdIsoPrepDone :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe UTCTime)
gdrcdIsoPrepDone
  = lens _gdrcdIsoPrepDone
      (\ s a -> s{_gdrcdIsoPrepDone = a})
      . mapping _DateTime

-- | The time spent uploading the output files.
gdrcdUpload :: Lens' GoogleDevtoolsRemotebuildbotCommandDurations (Maybe Scientific)
gdrcdUpload
  = lens _gdrcdUpload (\ s a -> s{_gdrcdUpload = a}) .
      mapping _GDuration

instance FromJSON
           GoogleDevtoolsRemotebuildbotCommandDurations
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemotebuildbotCommandDurations"
              (\ o ->
                 GoogleDevtoolsRemotebuildbotCommandDurations' <$>
                   (o .:? "stdout") <*> (o .:? "dockerPrep") <*>
                     (o .:? "download")
                     <*> (o .:? "overall")
                     <*> (o .:? "execution")
                     <*> (o .:? "isoPrepDone")
                     <*> (o .:? "upload"))

instance ToJSON
           GoogleDevtoolsRemotebuildbotCommandDurations
         where
        toJSON
          GoogleDevtoolsRemotebuildbotCommandDurations'{..}
          = object
              (catMaybes
                 [("stdout" .=) <$> _gdrcdStdout,
                  ("dockerPrep" .=) <$> _gdrcdDockerPrep,
                  ("download" .=) <$> _gdrcdDownload,
                  ("overall" .=) <$> _gdrcdOverall,
                  ("execution" .=) <$> _gdrcdExecution,
                  ("isoPrepDone" .=) <$> _gdrcdIsoPrepDone,
                  ("upload" .=) <$> _gdrcdUpload])

-- | A single property for the environment. The server is responsible for
-- specifying the property \`name\`s that it accepts. If an unknown
-- \`name\` is provided in the requirements for an Action, the server
-- SHOULD reject the execution request. If permitted by the server, the
-- same \`name\` may occur multiple times. The server is also responsible
-- for specifying the interpretation of property \`value\`s. For instance,
-- a property describing how much RAM must be available may be interpreted
-- as allowing a worker with 16GB to fulfill a request for 8GB, while a
-- property describing the OS environment on which the action must be
-- performed may require an exact match with the worker\'s OS. The server
-- MAY use the \`value\` of one or more properties to determine how it sets
-- up the execution environment, such as by making specific system files
-- available to the worker.
--
-- /See:/ 'buildBazelRemoteExecutionV2PlatformProperty' smart constructor.
data BuildBazelRemoteExecutionV2PlatformProperty =
  BuildBazelRemoteExecutionV2PlatformProperty'
    { _bbrevppValue :: !(Maybe Text)
    , _bbrevppName  :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2PlatformProperty' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bbrevppValue'
--
-- * 'bbrevppName'
buildBazelRemoteExecutionV2PlatformProperty
    :: BuildBazelRemoteExecutionV2PlatformProperty
buildBazelRemoteExecutionV2PlatformProperty =
  BuildBazelRemoteExecutionV2PlatformProperty'
    {_bbrevppValue = Nothing, _bbrevppName = Nothing}


-- | The property value.
bbrevppValue :: Lens' BuildBazelRemoteExecutionV2PlatformProperty (Maybe Text)
bbrevppValue
  = lens _bbrevppValue (\ s a -> s{_bbrevppValue = a})

-- | The property name.
bbrevppName :: Lens' BuildBazelRemoteExecutionV2PlatformProperty (Maybe Text)
bbrevppName
  = lens _bbrevppName (\ s a -> s{_bbrevppName = a})

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

instance ToJSON
           BuildBazelRemoteExecutionV2PlatformProperty
         where
        toJSON
          BuildBazelRemoteExecutionV2PlatformProperty'{..}
          = object
              (catMaybes
                 [("value" .=) <$> _bbrevppValue,
                  ("name" .=) <$> _bbrevppName])

-- | A request message for WaitExecution.
--
-- /See:/ 'buildBazelRemoteExecutionV2WaitExecutionRequest' smart constructor.
data BuildBazelRemoteExecutionV2WaitExecutionRequest =
  BuildBazelRemoteExecutionV2WaitExecutionRequest'
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BuildBazelRemoteExecutionV2WaitExecutionRequest' with the minimum fields required to make a request.
--
buildBazelRemoteExecutionV2WaitExecutionRequest
    :: BuildBazelRemoteExecutionV2WaitExecutionRequest
buildBazelRemoteExecutionV2WaitExecutionRequest =
  BuildBazelRemoteExecutionV2WaitExecutionRequest'


instance FromJSON
           BuildBazelRemoteExecutionV2WaitExecutionRequest
         where
        parseJSON
          = withObject
              "BuildBazelRemoteExecutionV2WaitExecutionRequest"
              (\ o ->
                 pure
                   BuildBazelRemoteExecutionV2WaitExecutionRequest')

instance ToJSON
           BuildBazelRemoteExecutionV2WaitExecutionRequest
         where
        toJSON = const emptyObject

-- | DEPRECATED - use CommandResult instead. Describes the actual outputs
-- from the task.
--
-- /See:/ 'googleDevtoolsRemoteworkersV1test2CommandOutputs' smart constructor.
data GoogleDevtoolsRemoteworkersV1test2CommandOutputs =
  GoogleDevtoolsRemoteworkersV1test2CommandOutputs'
    { _gdrvcoOutputs  :: !(Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
    , _gdrvcoExitCode :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GoogleDevtoolsRemoteworkersV1test2CommandOutputs' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gdrvcoOutputs'
--
-- * 'gdrvcoExitCode'
googleDevtoolsRemoteworkersV1test2CommandOutputs
    :: GoogleDevtoolsRemoteworkersV1test2CommandOutputs
googleDevtoolsRemoteworkersV1test2CommandOutputs =
  GoogleDevtoolsRemoteworkersV1test2CommandOutputs'
    {_gdrvcoOutputs = Nothing, _gdrvcoExitCode = Nothing}


-- | The output files. The blob referenced by the digest should contain one
-- of the following (implementation-dependent): * A marshalled
-- DirectoryMetadata of the returned filesystem * A LUCI-style .isolated
-- file
gdrvcoOutputs :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandOutputs (Maybe GoogleDevtoolsRemoteworkersV1test2Digest)
gdrvcoOutputs
  = lens _gdrvcoOutputs
      (\ s a -> s{_gdrvcoOutputs = a})

-- | exit_code is only fully reliable if the status\' code is OK. If the task
-- exceeded its deadline or was cancelled, the process may still produce an
-- exit code as it is cancelled, and this will be populated, but a
-- successful (zero) is unlikely to be correct unless the status code is
-- OK.
gdrvcoExitCode :: Lens' GoogleDevtoolsRemoteworkersV1test2CommandOutputs (Maybe Int32)
gdrvcoExitCode
  = lens _gdrvcoExitCode
      (\ s a -> s{_gdrvcoExitCode = a})
      . mapping _Coerce

instance FromJSON
           GoogleDevtoolsRemoteworkersV1test2CommandOutputs
         where
        parseJSON
          = withObject
              "GoogleDevtoolsRemoteworkersV1test2CommandOutputs"
              (\ o ->
                 GoogleDevtoolsRemoteworkersV1test2CommandOutputs' <$>
                   (o .:? "outputs") <*> (o .:? "exitCode"))

instance ToJSON
           GoogleDevtoolsRemoteworkersV1test2CommandOutputs
         where
        toJSON
          GoogleDevtoolsRemoteworkersV1test2CommandOutputs'{..}
          = object
              (catMaybes
                 [("outputs" .=) <$> _gdrvcoOutputs,
                  ("exitCode" .=) <$> _gdrvcoExitCode])

-- | ExecutedActionMetadata contains details about a completed execution.
--
-- /See:/ 'buildBazelRemoteExecutionV2ExecutedActionMetadata' smart constructor.
data BuildBazelRemoteExecutionV2ExecutedActionMetadata =
  BuildBazelRemoteExecutionV2ExecutedActionMetadata'
    { _bbreveamOutputUploadCompletedTimestamp :: !(Maybe DateTime')
    , _bbreveamOutputUploadStartTimestamp     :: !(Maybe DateTime')
    , _bbreveamWorkerCompletedTimestamp       :: !(Maybe DateTime')
    , _bbreveamWorkerStartTimestamp           :: !(Maybe DateTime')
    , _bbreveamExecutionStartTimestamp        :: !(Maybe DateTime')
    , _bbreveamInputFetchStartTimestamp       :: !(Maybe DateTime')
    , _bbreveamQueuedTimestamp                :: !(Maybe DateTime')
    , _bbreveamWorker                         :: !(Maybe Text)
    , _bbreveamExecutionCompletedTimestamp    :: !(Maybe