<?php
/*
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * GENERATED CODE WARNING
 * Generated by gapic-generator-php from the file
 * https://github.com/googleapis/googleapis/blob/master/google/cloud/dataform/v1beta1/dataform.proto
 * Updates to the above are reflected here through a refresh process.
 *
 * @experimental
 */

namespace Google\Cloud\Dataform\V1beta1\Gapic;

use Google\ApiCore\ApiException;
use Google\ApiCore\Call;
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\GapicClientTrait;
use Google\ApiCore\PathTemplate;
use Google\ApiCore\RequestParamsHeaderDescriptor;
use Google\ApiCore\RetrySettings;
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use Google\Cloud\Dataform\V1beta1\CancelWorkflowInvocationRequest;
use Google\Cloud\Dataform\V1beta1\CommitAuthor;
use Google\Cloud\Dataform\V1beta1\CommitMetadata;
use Google\Cloud\Dataform\V1beta1\CommitRepositoryChangesRequest;
use Google\Cloud\Dataform\V1beta1\CommitWorkspaceChangesRequest;
use Google\Cloud\Dataform\V1beta1\CompilationResult;
use Google\Cloud\Dataform\V1beta1\ComputeRepositoryAccessTokenStatusRequest;
use Google\Cloud\Dataform\V1beta1\ComputeRepositoryAccessTokenStatusResponse;
use Google\Cloud\Dataform\V1beta1\CreateCompilationResultRequest;
use Google\Cloud\Dataform\V1beta1\CreateReleaseConfigRequest;
use Google\Cloud\Dataform\V1beta1\CreateRepositoryRequest;
use Google\Cloud\Dataform\V1beta1\CreateWorkflowConfigRequest;
use Google\Cloud\Dataform\V1beta1\CreateWorkflowInvocationRequest;
use Google\Cloud\Dataform\V1beta1\CreateWorkspaceRequest;
use Google\Cloud\Dataform\V1beta1\DeleteReleaseConfigRequest;
use Google\Cloud\Dataform\V1beta1\DeleteRepositoryRequest;
use Google\Cloud\Dataform\V1beta1\DeleteWorkflowConfigRequest;
use Google\Cloud\Dataform\V1beta1\DeleteWorkflowInvocationRequest;
use Google\Cloud\Dataform\V1beta1\DeleteWorkspaceRequest;
use Google\Cloud\Dataform\V1beta1\FetchFileDiffRequest;
use Google\Cloud\Dataform\V1beta1\FetchFileDiffResponse;
use Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesRequest;
use Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse;
use Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindRequest;
use Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindResponse;
use Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesRequest;
use Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesResponse;
use Google\Cloud\Dataform\V1beta1\FetchRepositoryHistoryRequest;
use Google\Cloud\Dataform\V1beta1\FetchRepositoryHistoryResponse;
use Google\Cloud\Dataform\V1beta1\GetCompilationResultRequest;
use Google\Cloud\Dataform\V1beta1\GetReleaseConfigRequest;
use Google\Cloud\Dataform\V1beta1\GetRepositoryRequest;
use Google\Cloud\Dataform\V1beta1\GetWorkflowConfigRequest;
use Google\Cloud\Dataform\V1beta1\GetWorkflowInvocationRequest;
use Google\Cloud\Dataform\V1beta1\GetWorkspaceRequest;
use Google\Cloud\Dataform\V1beta1\InstallNpmPackagesRequest;
use Google\Cloud\Dataform\V1beta1\InstallNpmPackagesResponse;
use Google\Cloud\Dataform\V1beta1\ListCompilationResultsRequest;
use Google\Cloud\Dataform\V1beta1\ListCompilationResultsResponse;
use Google\Cloud\Dataform\V1beta1\ListReleaseConfigsRequest;
use Google\Cloud\Dataform\V1beta1\ListReleaseConfigsResponse;
use Google\Cloud\Dataform\V1beta1\ListRepositoriesRequest;
use Google\Cloud\Dataform\V1beta1\ListRepositoriesResponse;
use Google\Cloud\Dataform\V1beta1\ListWorkflowConfigsRequest;
use Google\Cloud\Dataform\V1beta1\ListWorkflowConfigsResponse;
use Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsRequest;
use Google\Cloud\Dataform\V1beta1\ListWorkflowInvocationsResponse;
use Google\Cloud\Dataform\V1beta1\ListWorkspacesRequest;
use Google\Cloud\Dataform\V1beta1\ListWorkspacesResponse;
use Google\Cloud\Dataform\V1beta1\MakeDirectoryRequest;
use Google\Cloud\Dataform\V1beta1\MakeDirectoryResponse;
use Google\Cloud\Dataform\V1beta1\MoveDirectoryRequest;
use Google\Cloud\Dataform\V1beta1\MoveDirectoryResponse;
use Google\Cloud\Dataform\V1beta1\MoveFileRequest;
use Google\Cloud\Dataform\V1beta1\MoveFileResponse;
use Google\Cloud\Dataform\V1beta1\PullGitCommitsRequest;
use Google\Cloud\Dataform\V1beta1\PushGitCommitsRequest;
use Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsRequest;
use Google\Cloud\Dataform\V1beta1\QueryCompilationResultActionsResponse;
use Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsRequest;
use Google\Cloud\Dataform\V1beta1\QueryDirectoryContentsResponse;
use Google\Cloud\Dataform\V1beta1\QueryRepositoryDirectoryContentsRequest;
use Google\Cloud\Dataform\V1beta1\QueryRepositoryDirectoryContentsResponse;
use Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsRequest;
use Google\Cloud\Dataform\V1beta1\QueryWorkflowInvocationActionsResponse;
use Google\Cloud\Dataform\V1beta1\ReadFileRequest;
use Google\Cloud\Dataform\V1beta1\ReadFileResponse;
use Google\Cloud\Dataform\V1beta1\ReadRepositoryFileRequest;
use Google\Cloud\Dataform\V1beta1\ReadRepositoryFileResponse;
use Google\Cloud\Dataform\V1beta1\ReleaseConfig;
use Google\Cloud\Dataform\V1beta1\RemoveDirectoryRequest;
use Google\Cloud\Dataform\V1beta1\RemoveFileRequest;
use Google\Cloud\Dataform\V1beta1\Repository;
use Google\Cloud\Dataform\V1beta1\ResetWorkspaceChangesRequest;
use Google\Cloud\Dataform\V1beta1\UpdateReleaseConfigRequest;
use Google\Cloud\Dataform\V1beta1\UpdateRepositoryRequest;
use Google\Cloud\Dataform\V1beta1\UpdateWorkflowConfigRequest;
use Google\Cloud\Dataform\V1beta1\WorkflowConfig;
use Google\Cloud\Dataform\V1beta1\WorkflowInvocation;
use Google\Cloud\Dataform\V1beta1\Workspace;
use Google\Cloud\Dataform\V1beta1\WriteFileRequest;
use Google\Cloud\Dataform\V1beta1\WriteFileResponse;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\GetPolicyOptions;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\ListLocationsResponse;
use Google\Cloud\Location\Location;
use Google\Protobuf\FieldMask;
use Google\Protobuf\GPBEmpty;

/**
 * Service Description: Dataform is a service to develop, create, document, test, and update curated
 * tables in BigQuery.
 *
 * This class provides the ability to make remote calls to the backing service through method
 * calls that map to API methods. Sample code to get started:
 *
 * ```
 * $dataformClient = new DataformClient();
 * try {
 *     $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]');
 *     $dataformClient->cancelWorkflowInvocation($formattedName);
 * } finally {
 *     $dataformClient->close();
 * }
 * ```
 *
 * Many parameters require resource names to be formatted in a particular way. To
 * assist with these names, this class includes a format method for each type of
 * name, and additionally a parseName method to extract the individual identifiers
 * contained within formatted names that are returned by the API.
 *
 * @experimental
 *
 * @deprecated Please use the new service client {@see \Google\Cloud\Dataform\V1beta1\Client\DataformClient}.
 */
class DataformGapicClient
{
    use GapicClientTrait;

    /** The name of the service. */
    const SERVICE_NAME = 'google.cloud.dataform.v1beta1.Dataform';

    /**
     * The default address of the service.
     *
     * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
     */
    const SERVICE_ADDRESS = 'dataform.googleapis.com';

    /** The address template of the service. */
    private const SERVICE_ADDRESS_TEMPLATE = 'dataform.UNIVERSE_DOMAIN';

    /** The default port of the service. */
    const DEFAULT_SERVICE_PORT = 443;

    /** The name of the code generator, to be included in the agent header. */
    const CODEGEN_NAME = 'gapic';

    /** The default scopes required by the service. */
    public static $serviceScopes = [
        'https://www.googleapis.com/auth/cloud-platform',
    ];

    private static $compilationResultNameTemplate;

    private static $locationNameTemplate;

    private static $releaseConfigNameTemplate;

    private static $repositoryNameTemplate;

    private static $secretVersionNameTemplate;

    private static $workflowConfigNameTemplate;

    private static $workflowInvocationNameTemplate;

    private static $workspaceNameTemplate;

    private static $pathTemplateMap;

    private static function getClientDefaults()
    {
        return [
            'serviceName' => self::SERVICE_NAME,
            'apiEndpoint' =>
                self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
            'clientConfig' =>
                __DIR__ . '/../resources/dataform_client_config.json',
            'descriptorsConfigPath' =>
                __DIR__ . '/../resources/dataform_descriptor_config.php',
            'gcpApiConfigPath' =>
                __DIR__ . '/../resources/dataform_grpc_config.json',
            'credentialsConfig' => [
                'defaultScopes' => self::$serviceScopes,
            ],
            'transportConfig' => [
                'rest' => [
                    'restClientConfigPath' =>
                        __DIR__ .
                        '/../resources/dataform_rest_client_config.php',
                ],
            ],
        ];
    }

    private static function getCompilationResultNameTemplate()
    {
        if (self::$compilationResultNameTemplate == null) {
            self::$compilationResultNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result}'
            );
        }

        return self::$compilationResultNameTemplate;
    }

    private static function getLocationNameTemplate()
    {
        if (self::$locationNameTemplate == null) {
            self::$locationNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}'
            );
        }

        return self::$locationNameTemplate;
    }

    private static function getReleaseConfigNameTemplate()
    {
        if (self::$releaseConfigNameTemplate == null) {
            self::$releaseConfigNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}/releaseConfigs/{release_config}'
            );
        }

        return self::$releaseConfigNameTemplate;
    }

    private static function getRepositoryNameTemplate()
    {
        if (self::$repositoryNameTemplate == null) {
            self::$repositoryNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}'
            );
        }

        return self::$repositoryNameTemplate;
    }

    private static function getSecretVersionNameTemplate()
    {
        if (self::$secretVersionNameTemplate == null) {
            self::$secretVersionNameTemplate = new PathTemplate(
                'projects/{project}/secrets/{secret}/versions/{version}'
            );
        }

        return self::$secretVersionNameTemplate;
    }

    private static function getWorkflowConfigNameTemplate()
    {
        if (self::$workflowConfigNameTemplate == null) {
            self::$workflowConfigNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}/workflowConfigs/{workflow_config}'
            );
        }

        return self::$workflowConfigNameTemplate;
    }

    private static function getWorkflowInvocationNameTemplate()
    {
        if (self::$workflowInvocationNameTemplate == null) {
            self::$workflowInvocationNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation}'
            );
        }

        return self::$workflowInvocationNameTemplate;
    }

    private static function getWorkspaceNameTemplate()
    {
        if (self::$workspaceNameTemplate == null) {
            self::$workspaceNameTemplate = new PathTemplate(
                'projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace}'
            );
        }

        return self::$workspaceNameTemplate;
    }

    private static function getPathTemplateMap()
    {
        if (self::$pathTemplateMap == null) {
            self::$pathTemplateMap = [
                'compilationResult' => self::getCompilationResultNameTemplate(),
                'location' => self::getLocationNameTemplate(),
                'releaseConfig' => self::getReleaseConfigNameTemplate(),
                'repository' => self::getRepositoryNameTemplate(),
                'secretVersion' => self::getSecretVersionNameTemplate(),
                'workflowConfig' => self::getWorkflowConfigNameTemplate(),
                'workflowInvocation' => self::getWorkflowInvocationNameTemplate(),
                'workspace' => self::getWorkspaceNameTemplate(),
            ];
        }

        return self::$pathTemplateMap;
    }

    /**
     * Formats a string containing the fully-qualified path to represent a
     * compilation_result resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     * @param string $compilationResult
     *
     * @return string The formatted compilation_result resource.
     *
     * @experimental
     */
    public static function compilationResultName(
        $project,
        $location,
        $repository,
        $compilationResult
    ) {
        return self::getCompilationResultNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
            'compilation_result' => $compilationResult,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a location
     * resource.
     *
     * @param string $project
     * @param string $location
     *
     * @return string The formatted location resource.
     *
     * @experimental
     */
    public static function locationName($project, $location)
    {
        return self::getLocationNameTemplate()->render([
            'project' => $project,
            'location' => $location,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a
     * release_config resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     * @param string $releaseConfig
     *
     * @return string The formatted release_config resource.
     *
     * @experimental
     */
    public static function releaseConfigName(
        $project,
        $location,
        $repository,
        $releaseConfig
    ) {
        return self::getReleaseConfigNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
            'release_config' => $releaseConfig,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a repository
     * resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     *
     * @return string The formatted repository resource.
     *
     * @experimental
     */
    public static function repositoryName($project, $location, $repository)
    {
        return self::getRepositoryNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a
     * secret_version resource.
     *
     * @param string $project
     * @param string $secret
     * @param string $version
     *
     * @return string The formatted secret_version resource.
     *
     * @experimental
     */
    public static function secretVersionName($project, $secret, $version)
    {
        return self::getSecretVersionNameTemplate()->render([
            'project' => $project,
            'secret' => $secret,
            'version' => $version,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a
     * workflow_config resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     * @param string $workflowConfig
     *
     * @return string The formatted workflow_config resource.
     *
     * @experimental
     */
    public static function workflowConfigName(
        $project,
        $location,
        $repository,
        $workflowConfig
    ) {
        return self::getWorkflowConfigNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
            'workflow_config' => $workflowConfig,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a
     * workflow_invocation resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     * @param string $workflowInvocation
     *
     * @return string The formatted workflow_invocation resource.
     *
     * @experimental
     */
    public static function workflowInvocationName(
        $project,
        $location,
        $repository,
        $workflowInvocation
    ) {
        return self::getWorkflowInvocationNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
            'workflow_invocation' => $workflowInvocation,
        ]);
    }

    /**
     * Formats a string containing the fully-qualified path to represent a workspace
     * resource.
     *
     * @param string $project
     * @param string $location
     * @param string $repository
     * @param string $workspace
     *
     * @return string The formatted workspace resource.
     *
     * @experimental
     */
    public static function workspaceName(
        $project,
        $location,
        $repository,
        $workspace
    ) {
        return self::getWorkspaceNameTemplate()->render([
            'project' => $project,
            'location' => $location,
            'repository' => $repository,
            'workspace' => $workspace,
        ]);
    }

    /**
     * Parses a formatted name string and returns an associative array of the components in the name.
     * The following name formats are supported:
     * Template: Pattern
     * - compilationResult: projects/{project}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result}
     * - location: projects/{project}/locations/{location}
     * - releaseConfig: projects/{project}/locations/{location}/repositories/{repository}/releaseConfigs/{release_config}
     * - repository: projects/{project}/locations/{location}/repositories/{repository}
     * - secretVersion: projects/{project}/secrets/{secret}/versions/{version}
     * - workflowConfig: projects/{project}/locations/{location}/repositories/{repository}/workflowConfigs/{workflow_config}
     * - workflowInvocation: projects/{project}/locations/{location}/repositories/{repository}/workflowInvocations/{workflow_invocation}
     * - workspace: projects/{project}/locations/{location}/repositories/{repository}/workspaces/{workspace}
     *
     * The optional $template argument can be supplied to specify a particular pattern,
     * and must match one of the templates listed above. If no $template argument is
     * provided, or if the $template argument does not match one of the templates
     * listed, then parseName will check each of the supported templates, and return
     * the first match.
     *
     * @param string $formattedName The formatted name string
     * @param string $template      Optional name of template to match
     *
     * @return array An associative array from name component IDs to component values.
     *
     * @throws ValidationException If $formattedName could not be matched.
     *
     * @experimental
     */
    public static function parseName($formattedName, $template = null)
    {
        $templateMap = self::getPathTemplateMap();
        if ($template) {
            if (!isset($templateMap[$template])) {
                throw new ValidationException(
                    "Template name $template does not exist"
                );
            }

            return $templateMap[$template]->match($formattedName);
        }

        foreach ($templateMap as $templateName => $pathTemplate) {
            try {
                return $pathTemplate->match($formattedName);
            } catch (ValidationException $ex) {
                // Swallow the exception to continue trying other path templates
            }
        }

        throw new ValidationException(
            "Input did not match any known format. Input: $formattedName"
        );
    }

    /**
     * Constructor.
     *
     * @param array $options {
     *     Optional. Options for configuring the service API wrapper.
     *
     *     @type string $apiEndpoint
     *           The address of the API remote host. May optionally include the port, formatted
     *           as "<uri>:<port>". Default 'dataform.googleapis.com:443'.
     *     @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
     *           The credentials to be used by the client to authorize API calls. This option
     *           accepts either a path to a credentials file, or a decoded credentials file as a
     *           PHP array.
     *           *Advanced usage*: In addition, this option can also accept a pre-constructed
     *           {@see \Google\Auth\FetchAuthTokenInterface} object or
     *           {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
     *           objects are provided, any settings in $credentialsConfig will be ignored.
     *     @type array $credentialsConfig
     *           Options used to configure credentials, including auth token caching, for the
     *           client. For a full list of supporting configuration options, see
     *           {@see \Google\ApiCore\CredentialsWrapper::build()} .
     *     @type bool $disableRetries
     *           Determines whether or not retries defined by the client configuration should be
     *           disabled. Defaults to `false`.
     *     @type string|array $clientConfig
     *           Client method configuration, including retry settings. This option can be either
     *           a path to a JSON file, or a PHP array containing the decoded JSON data. By
     *           default this settings points to the default client config file, which is
     *           provided in the resources folder.
     *     @type string|TransportInterface $transport
     *           The transport used for executing network requests. May be either the string
     *           `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
     *           *Advanced usage*: Additionally, it is possible to pass in an already
     *           instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
     *           that when this object is provided, any settings in $transportConfig, and any
     *           $apiEndpoint setting, will be ignored.
     *     @type array $transportConfig
     *           Configuration options that will be used to construct the transport. Options for
     *           each supported transport type should be passed in a key for that transport. For
     *           example:
     *           $transportConfig = [
     *               'grpc' => [...],
     *               'rest' => [...],
     *           ];
     *           See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
     *           {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
     *           supported options.
     *     @type callable $clientCertSource
     *           A callable which returns the client cert as a string. This can be used to
     *           provide a certificate and private key to the transport layer for mTLS.
     * }
     *
     * @throws ValidationException
     *
     * @experimental
     */
    public function __construct(array $options = [])
    {
        $clientOptions = $this->buildClientOptions($options);
        $this->setClientOptions($clientOptions);
    }

    /**
     * Requests cancellation of a running WorkflowInvocation.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]');
     *     $dataformClient->cancelWorkflowInvocation($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow invocation resource's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function cancelWorkflowInvocation($name, array $optionalArgs = [])
    {
        $request = new CancelWorkflowInvocationRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CancelWorkflowInvocation',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Applies a Git commit to a Repository. The Repository must not have a value
     * for `git_remote_settings.url`.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $commitMetadata = new CommitMetadata();
     *     $dataformClient->commitRepositoryChanges($formattedName, $commitMetadata);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string         $name           Required. The repository's name.
     * @param CommitMetadata $commitMetadata Required. The changes to commit to the repository.
     * @param array          $optionalArgs   {
     *     Optional.
     *
     *     @type string $requiredHeadCommitSha
     *           Optional. The commit SHA which must be the repository's current HEAD before
     *           applying this commit; otherwise this request will fail. If unset, no
     *           validation on the current HEAD commit SHA is performed.
     *     @type array $fileOperations
     *           A map to the path of the file to the operation. The path is the full file
     *           path including filename, from repository root.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function commitRepositoryChanges(
        $name,
        $commitMetadata,
        array $optionalArgs = []
    ) {
        $request = new CommitRepositoryChangesRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $request->setCommitMetadata($commitMetadata);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['requiredHeadCommitSha'])) {
            $request->setRequiredHeadCommitSha(
                $optionalArgs['requiredHeadCommitSha']
            );
        }

        if (isset($optionalArgs['fileOperations'])) {
            $request->setFileOperations($optionalArgs['fileOperations']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CommitRepositoryChanges',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Applies a Git commit for uncommitted files in a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $author = new CommitAuthor();
     *     $dataformClient->commitWorkspaceChanges($formattedName, $author);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string       $name         Required. The workspace's name.
     * @param CommitAuthor $author       Required. The commit's author.
     * @param array        $optionalArgs {
     *     Optional.
     *
     *     @type string $commitMessage
     *           Optional. The commit's message.
     *     @type string[] $paths
     *           Optional. Full file paths to commit including filename, rooted at workspace
     *           root. If left empty, all files will be committed.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function commitWorkspaceChanges(
        $name,
        $author,
        array $optionalArgs = []
    ) {
        $request = new CommitWorkspaceChangesRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $request->setAuthor($author);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['commitMessage'])) {
            $request->setCommitMessage($optionalArgs['commitMessage']);
        }

        if (isset($optionalArgs['paths'])) {
            $request->setPaths($optionalArgs['paths']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CommitWorkspaceChanges',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Computes a Repository's Git access token status.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $response = $dataformClient->computeRepositoryAccessTokenStatus($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ComputeRepositoryAccessTokenStatusResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function computeRepositoryAccessTokenStatus(
        $name,
        array $optionalArgs = []
    ) {
        $request = new ComputeRepositoryAccessTokenStatusRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'ComputeRepositoryAccessTokenStatus',
            ComputeRepositoryAccessTokenStatusResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new CompilationResult in a given project and location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $compilationResult = new CompilationResult();
     *     $response = $dataformClient->createCompilationResult($formattedParent, $compilationResult);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string            $parent            Required. The repository in which to create the compilation result. Must be
     *                                             in the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param CompilationResult $compilationResult Required. The compilation result to create.
     * @param array             $optionalArgs      {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\CompilationResult
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createCompilationResult(
        $parent,
        $compilationResult,
        array $optionalArgs = []
    ) {
        $request = new CreateCompilationResultRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setCompilationResult($compilationResult);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateCompilationResult',
            CompilationResult::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new ReleaseConfig in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $releaseConfig = new ReleaseConfig();
     *     $releaseConfigId = 'release_config_id';
     *     $response = $dataformClient->createReleaseConfig($formattedParent, $releaseConfig, $releaseConfigId);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string        $parent          Required. The repository in which to create the release config. Must be in
     *                                       the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param ReleaseConfig $releaseConfig   Required. The release config to create.
     * @param string        $releaseConfigId Required. The ID to use for the release config, which will become the final
     *                                       component of the release config's resource name.
     * @param array         $optionalArgs    {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ReleaseConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createReleaseConfig(
        $parent,
        $releaseConfig,
        $releaseConfigId,
        array $optionalArgs = []
    ) {
        $request = new CreateReleaseConfigRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setReleaseConfig($releaseConfig);
        $request->setReleaseConfigId($releaseConfigId);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateReleaseConfig',
            ReleaseConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new Repository in a given project and location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->locationName('[PROJECT]', '[LOCATION]');
     *     $repository = new Repository();
     *     $repositoryId = 'repository_id';
     *     $response = $dataformClient->createRepository($formattedParent, $repository, $repositoryId);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string     $parent       Required. The location in which to create the repository. Must be in the
     *                                 format `projects/&#42;/locations/*`.
     * @param Repository $repository   Required. The repository to create.
     * @param string     $repositoryId Required. The ID to use for the repository, which will become the final
     *                                 component of the repository's resource name.
     * @param array      $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\Repository
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createRepository(
        $parent,
        $repository,
        $repositoryId,
        array $optionalArgs = []
    ) {
        $request = new CreateRepositoryRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setRepository($repository);
        $request->setRepositoryId($repositoryId);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateRepository',
            Repository::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new WorkflowConfig in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $workflowConfig = new WorkflowConfig();
     *     $workflowConfigId = 'workflow_config_id';
     *     $response = $dataformClient->createWorkflowConfig($formattedParent, $workflowConfig, $workflowConfigId);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string         $parent           Required. The repository in which to create the workflow config. Must be in
     *                                         the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param WorkflowConfig $workflowConfig   Required. The workflow config to create.
     * @param string         $workflowConfigId Required. The ID to use for the workflow config, which will become the
     *                                         final component of the workflow config's resource name.
     * @param array          $optionalArgs     {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WorkflowConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createWorkflowConfig(
        $parent,
        $workflowConfig,
        $workflowConfigId,
        array $optionalArgs = []
    ) {
        $request = new CreateWorkflowConfigRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setWorkflowConfig($workflowConfig);
        $request->setWorkflowConfigId($workflowConfigId);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateWorkflowConfig',
            WorkflowConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new WorkflowInvocation in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $workflowInvocation = new WorkflowInvocation();
     *     $response = $dataformClient->createWorkflowInvocation($formattedParent, $workflowInvocation);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string             $parent             Required. The repository in which to create the workflow invocation. Must
     *                                               be in the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param WorkflowInvocation $workflowInvocation Required. The workflow invocation resource to create.
     * @param array              $optionalArgs       {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WorkflowInvocation
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createWorkflowInvocation(
        $parent,
        $workflowInvocation,
        array $optionalArgs = []
    ) {
        $request = new CreateWorkflowInvocationRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setWorkflowInvocation($workflowInvocation);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateWorkflowInvocation',
            WorkflowInvocation::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Creates a new Workspace in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $workspace = new Workspace();
     *     $workspaceId = 'workspace_id';
     *     $response = $dataformClient->createWorkspace($formattedParent, $workspace, $workspaceId);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string    $parent       Required. The repository in which to create the workspace. Must be in the
     *                                format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param Workspace $workspace    Required. The workspace to create.
     * @param string    $workspaceId  Required. The ID to use for the workspace, which will become the final
     *                                component of the workspace's resource name.
     * @param array     $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\Workspace
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function createWorkspace(
        $parent,
        $workspace,
        $workspaceId,
        array $optionalArgs = []
    ) {
        $request = new CreateWorkspaceRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $request->setWorkspace($workspace);
        $request->setWorkspaceId($workspaceId);
        $requestParamHeaders['parent'] = $parent;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'CreateWorkspace',
            Workspace::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a single ReleaseConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->releaseConfigName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[RELEASE_CONFIG]');
     *     $dataformClient->deleteReleaseConfig($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The release config's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function deleteReleaseConfig($name, array $optionalArgs = [])
    {
        $request = new DeleteReleaseConfigRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'DeleteReleaseConfig',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a single Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $dataformClient->deleteRepository($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type bool $force
     *           If set to true, any child resources of this repository will also be
     *           deleted. (Otherwise, the request will only succeed if the repository has no
     *           child resources.)
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function deleteRepository($name, array $optionalArgs = [])
    {
        $request = new DeleteRepositoryRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['force'])) {
            $request->setForce($optionalArgs['force']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'DeleteRepository',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a single WorkflowConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowConfigName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_CONFIG]');
     *     $dataformClient->deleteWorkflowConfig($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow config's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function deleteWorkflowConfig($name, array $optionalArgs = [])
    {
        $request = new DeleteWorkflowConfigRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'DeleteWorkflowConfig',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a single WorkflowInvocation.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]');
     *     $dataformClient->deleteWorkflowInvocation($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow invocation resource's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function deleteWorkflowInvocation($name, array $optionalArgs = [])
    {
        $request = new DeleteWorkflowInvocationRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'DeleteWorkflowInvocation',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a single Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $dataformClient->deleteWorkspace($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace resource's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function deleteWorkspace($name, array $optionalArgs = [])
    {
        $request = new DeleteWorkspaceRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'DeleteWorkspace',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches Git diff for an uncommitted file in a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $response = $dataformClient->fetchFileDiff($formattedWorkspace, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The file's full path including filename, relative to the
     *                             workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\FetchFileDiffResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function fetchFileDiff($workspace, $path, array $optionalArgs = [])
    {
        $request = new FetchFileDiffRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'FetchFileDiff',
            FetchFileDiffResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches Git statuses for the files in a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $response = $dataformClient->fetchFileGitStatuses($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\FetchFileGitStatusesResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function fetchFileGitStatuses($name, array $optionalArgs = [])
    {
        $request = new FetchFileGitStatusesRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'FetchFileGitStatuses',
            FetchFileGitStatusesResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches Git ahead/behind against a remote branch.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $response = $dataformClient->fetchGitAheadBehind($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string $remoteBranch
     *           Optional. The name of the branch in the Git remote against which this
     *           workspace should be compared. If left unset, the repository's default
     *           branch name will be used.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\FetchGitAheadBehindResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function fetchGitAheadBehind($name, array $optionalArgs = [])
    {
        $request = new FetchGitAheadBehindRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['remoteBranch'])) {
            $request->setRemoteBranch($optionalArgs['remoteBranch']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'FetchGitAheadBehind',
            FetchGitAheadBehindResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a Repository's remote branches.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $response = $dataformClient->fetchRemoteBranches($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\FetchRemoteBranchesResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function fetchRemoteBranches($name, array $optionalArgs = [])
    {
        $request = new FetchRemoteBranchesRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'FetchRemoteBranches',
            FetchRemoteBranchesResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a Repository's history of commits.  The Repository must not have a
     * value for `git_remote_settings.url`.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->fetchRepositoryHistory($formattedName);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->fetchRepositoryHistory($formattedName);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function fetchRepositoryHistory($name, array $optionalArgs = [])
    {
        $request = new FetchRepositoryHistoryRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'FetchRepositoryHistory',
            $optionalArgs,
            FetchRepositoryHistoryResponse::class,
            $request
        );
    }

    /**
     * Fetches a single CompilationResult.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]');
     *     $response = $dataformClient->getCompilationResult($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The compilation result's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\CompilationResult
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getCompilationResult($name, array $optionalArgs = [])
    {
        $request = new GetCompilationResultRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetCompilationResult',
            CompilationResult::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a single ReleaseConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->releaseConfigName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[RELEASE_CONFIG]');
     *     $response = $dataformClient->getReleaseConfig($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The release config's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ReleaseConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getReleaseConfig($name, array $optionalArgs = [])
    {
        $request = new GetReleaseConfigRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetReleaseConfig',
            ReleaseConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a single Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $response = $dataformClient->getRepository($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\Repository
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getRepository($name, array $optionalArgs = [])
    {
        $request = new GetRepositoryRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetRepository',
            Repository::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a single WorkflowConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowConfigName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_CONFIG]');
     *     $response = $dataformClient->getWorkflowConfig($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow config's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WorkflowConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getWorkflowConfig($name, array $optionalArgs = [])
    {
        $request = new GetWorkflowConfigRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetWorkflowConfig',
            WorkflowConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a single WorkflowInvocation.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]');
     *     $response = $dataformClient->getWorkflowInvocation($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow invocation resource's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WorkflowInvocation
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getWorkflowInvocation($name, array $optionalArgs = [])
    {
        $request = new GetWorkflowInvocationRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetWorkflowInvocation',
            WorkflowInvocation::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Fetches a single Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $response = $dataformClient->getWorkspace($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\Workspace
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getWorkspace($name, array $optionalArgs = [])
    {
        $request = new GetWorkspaceRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetWorkspace',
            Workspace::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Installs dependency NPM packages (inside a Workspace).
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $response = $dataformClient->installNpmPackages($formattedWorkspace);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\InstallNpmPackagesResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function installNpmPackages($workspace, array $optionalArgs = [])
    {
        $request = new InstallNpmPackagesRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'InstallNpmPackages',
            InstallNpmPackagesResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Lists CompilationResults in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listCompilationResults($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listCompilationResults($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The repository in which to list compilation results. Must be in
     *                             the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listCompilationResults($parent, array $optionalArgs = [])
    {
        $request = new ListCompilationResultsRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListCompilationResults',
            $optionalArgs,
            ListCompilationResultsResponse::class,
            $request
        );
    }

    /**
     * Lists ReleaseConfigs in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listReleaseConfigs($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listReleaseConfigs($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The repository in which to list release configs. Must be in the
     *                             format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listReleaseConfigs($parent, array $optionalArgs = [])
    {
        $request = new ListReleaseConfigsRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListReleaseConfigs',
            $optionalArgs,
            ListReleaseConfigsResponse::class,
            $request
        );
    }

    /**
     * Lists Repositories in a given project and location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->locationName('[PROJECT]', '[LOCATION]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listRepositories($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listRepositories($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The location in which to list repositories. Must be in the format
     *                             `projects/&#42;/locations/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type string $orderBy
     *           Optional. This field only supports ordering by `name`. If unspecified, the
     *           server will choose the ordering. If specified, the default order is
     *           ascending for the `name` field.
     *     @type string $filter
     *           Optional. Filter for the returned list.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listRepositories($parent, array $optionalArgs = [])
    {
        $request = new ListRepositoriesRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        if (isset($optionalArgs['orderBy'])) {
            $request->setOrderBy($optionalArgs['orderBy']);
        }

        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListRepositories',
            $optionalArgs,
            ListRepositoriesResponse::class,
            $request
        );
    }

    /**
     * Lists WorkflowConfigs in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listWorkflowConfigs($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listWorkflowConfigs($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The repository in which to list workflow configs. Must be in the
     *                             format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listWorkflowConfigs($parent, array $optionalArgs = [])
    {
        $request = new ListWorkflowConfigsRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListWorkflowConfigs',
            $optionalArgs,
            ListWorkflowConfigsResponse::class,
            $request
        );
    }

    /**
     * Lists WorkflowInvocations in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listWorkflowInvocations($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listWorkflowInvocations($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The parent resource of the WorkflowInvocation type. Must be in
     *                             the format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type string $orderBy
     *           Optional. This field only supports ordering by `name`. If unspecified, the
     *           server will choose the ordering. If specified, the default order is
     *           ascending for the `name` field.
     *     @type string $filter
     *           Optional. Filter for the returned list.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listWorkflowInvocations($parent, array $optionalArgs = [])
    {
        $request = new ListWorkflowInvocationsRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        if (isset($optionalArgs['orderBy'])) {
            $request->setOrderBy($optionalArgs['orderBy']);
        }

        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListWorkflowInvocations',
            $optionalArgs,
            ListWorkflowInvocationsResponse::class,
            $request
        );
    }

    /**
     * Lists Workspaces in a given Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedParent = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listWorkspaces($formattedParent);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listWorkspaces($formattedParent);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $parent       Required. The repository in which to list workspaces. Must be in the
     *                             format `projects/&#42;/locations/&#42;/repositories/*`.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type string $orderBy
     *           Optional. This field only supports ordering by `name`. If unspecified, the
     *           server will choose the ordering. If specified, the default order is
     *           ascending for the `name` field.
     *     @type string $filter
     *           Optional. Filter for the returned list.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listWorkspaces($parent, array $optionalArgs = [])
    {
        $request = new ListWorkspacesRequest();
        $requestParamHeaders = [];
        $request->setParent($parent);
        $requestParamHeaders['parent'] = $parent;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        if (isset($optionalArgs['orderBy'])) {
            $request->setOrderBy($optionalArgs['orderBy']);
        }

        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListWorkspaces',
            $optionalArgs,
            ListWorkspacesResponse::class,
            $request
        );
    }

    /**
     * Creates a directory inside a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $response = $dataformClient->makeDirectory($formattedWorkspace, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The directory's full path including directory name, relative to
     *                             the workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\MakeDirectoryResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function makeDirectory($workspace, $path, array $optionalArgs = [])
    {
        $request = new MakeDirectoryRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'MakeDirectory',
            MakeDirectoryResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Moves a directory (inside a Workspace), and all of its contents, to a new
     * location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $newPath = 'new_path';
     *     $response = $dataformClient->moveDirectory($formattedWorkspace, $path, $newPath);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The directory's full path including directory name, relative to
     *                             the workspace root.
     * @param string $newPath      Required. The new path for the directory including directory name, rooted
     *                             at workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\MoveDirectoryResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function moveDirectory(
        $workspace,
        $path,
        $newPath,
        array $optionalArgs = []
    ) {
        $request = new MoveDirectoryRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $request->setNewPath($newPath);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'MoveDirectory',
            MoveDirectoryResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Moves a file (inside a Workspace) to a new location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $newPath = 'new_path';
     *     $response = $dataformClient->moveFile($formattedWorkspace, $path, $newPath);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The file's full path including filename, relative to the
     *                             workspace root.
     * @param string $newPath      Required. The file's new path including filename, relative to the workspace
     *                             root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\MoveFileResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function moveFile(
        $workspace,
        $path,
        $newPath,
        array $optionalArgs = []
    ) {
        $request = new MoveFileRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $request->setNewPath($newPath);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'MoveFile',
            MoveFileResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Pulls Git commits from the Repository's remote into a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $author = new CommitAuthor();
     *     $dataformClient->pullGitCommits($formattedName, $author);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string       $name         Required. The workspace's name.
     * @param CommitAuthor $author       Required. The author of any merge commit which may be created as a result
     *                                   of merging fetched Git commits into this workspace.
     * @param array        $optionalArgs {
     *     Optional.
     *
     *     @type string $remoteBranch
     *           Optional. The name of the branch in the Git remote from which to pull
     *           commits. If left unset, the repository's default branch name will be used.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function pullGitCommits($name, $author, array $optionalArgs = [])
    {
        $request = new PullGitCommitsRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $request->setAuthor($author);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['remoteBranch'])) {
            $request->setRemoteBranch($optionalArgs['remoteBranch']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'PullGitCommits',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Pushes Git commits from a Workspace to the Repository's remote.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $dataformClient->pushGitCommits($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string $remoteBranch
     *           Optional. The name of the branch in the Git remote to which commits should
     *           be pushed. If left unset, the repository's default branch name will be
     *           used.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function pushGitCommits($name, array $optionalArgs = [])
    {
        $request = new PushGitCommitsRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['remoteBranch'])) {
            $request->setRemoteBranch($optionalArgs['remoteBranch']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'PushGitCommits',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Returns CompilationResultActions in a given CompilationResult.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->compilationResultName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[COMPILATION_RESULT]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->queryCompilationResultActions($formattedName);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->queryCompilationResultActions($formattedName);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The compilation result's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type string $filter
     *           Optional. Optional filter for the returned list. Filtering is only
     *           currently supported on the `file_path` field.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function queryCompilationResultActions(
        $name,
        array $optionalArgs = []
    ) {
        $request = new QueryCompilationResultActionsRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'QueryCompilationResultActions',
            $optionalArgs,
            QueryCompilationResultActionsResponse::class,
            $request
        );
    }

    /**
     * Returns the contents of a given Workspace directory.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->queryDirectoryContents($formattedWorkspace);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->queryDirectoryContents($formattedWorkspace);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string $path
     *           Optional. The directory's full path including directory name, relative to
     *           the workspace root. If left unset, the workspace root is used.
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function queryDirectoryContents($workspace, array $optionalArgs = [])
    {
        $request = new QueryDirectoryContentsRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $requestParamHeaders['workspace'] = $workspace;
        if (isset($optionalArgs['path'])) {
            $request->setPath($optionalArgs['path']);
        }

        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'QueryDirectoryContents',
            $optionalArgs,
            QueryDirectoryContentsResponse::class,
            $request
        );
    }

    /**
     * Returns the contents of a given Repository directory. The Repository must
     * not have a value for `git_remote_settings.url`.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->queryRepositoryDirectoryContents($formattedName);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->queryRepositoryDirectoryContents($formattedName);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string $commitSha
     *           Optional. The Commit SHA for the commit to query from. If unset, the
     *           directory will be queried from HEAD.
     *     @type string $path
     *           Optional. The directory's full path including directory name, relative to
     *           root. If left unset, the root is used.
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function queryRepositoryDirectoryContents(
        $name,
        array $optionalArgs = []
    ) {
        $request = new QueryRepositoryDirectoryContentsRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['commitSha'])) {
            $request->setCommitSha($optionalArgs['commitSha']);
        }

        if (isset($optionalArgs['path'])) {
            $request->setPath($optionalArgs['path']);
        }

        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'QueryRepositoryDirectoryContents',
            $optionalArgs,
            QueryRepositoryDirectoryContentsResponse::class,
            $request
        );
    }

    /**
     * Returns WorkflowInvocationActions in a given WorkflowInvocation.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workflowInvocationName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKFLOW_INVOCATION]');
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->queryWorkflowInvocationActions($formattedName);
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->queryWorkflowInvocationActions($formattedName);
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workflow invocation's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function queryWorkflowInvocationActions(
        $name,
        array $optionalArgs = []
    ) {
        $request = new QueryWorkflowInvocationActionsRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'QueryWorkflowInvocationActions',
            $optionalArgs,
            QueryWorkflowInvocationActionsResponse::class,
            $request
        );
    }

    /**
     * Returns the contents of a file (inside a Workspace).
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $response = $dataformClient->readFile($formattedWorkspace, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The file's full path including filename, relative to the
     *                             workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ReadFileResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function readFile($workspace, $path, array $optionalArgs = [])
    {
        $request = new ReadFileRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'ReadFile',
            ReadFileResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Returns the contents of a file (inside a Repository). The Repository
     * must not have a value for `git_remote_settings.url`.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->repositoryName('[PROJECT]', '[LOCATION]', '[REPOSITORY]');
     *     $path = 'path';
     *     $response = $dataformClient->readRepositoryFile($formattedName, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The repository's name.
     * @param string $path         Required. Full file path to read including filename, from repository root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string $commitSha
     *           Optional. The commit SHA for the commit to read from. If unset, the file
     *           will be read from HEAD.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ReadRepositoryFileResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function readRepositoryFile($name, $path, array $optionalArgs = [])
    {
        $request = new ReadRepositoryFileRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $request->setPath($path);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['commitSha'])) {
            $request->setCommitSha($optionalArgs['commitSha']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'ReadRepositoryFile',
            ReadRepositoryFileResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a directory (inside a Workspace) and all of its contents.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $dataformClient->removeDirectory($formattedWorkspace, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The directory's full path including directory name, relative to
     *                             the workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function removeDirectory($workspace, $path, array $optionalArgs = [])
    {
        $request = new RemoveDirectoryRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'RemoveDirectory',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Deletes a file (inside a Workspace).
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $dataformClient->removeFile($formattedWorkspace, $path);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The file's full path including filename, relative to the
     *                             workspace root.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function removeFile($workspace, $path, array $optionalArgs = [])
    {
        $request = new RemoveFileRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'RemoveFile',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Performs a Git reset for uncommitted files in a Workspace.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedName = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $dataformClient->resetWorkspaceChanges($formattedName);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $name         Required. The workspace's name.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type string[] $paths
     *           Optional. Full file paths to reset back to their committed state including
     *           filename, rooted at workspace root. If left empty, all files will be reset.
     *     @type bool $clean
     *           Optional. If set to true, untracked files will be deleted.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function resetWorkspaceChanges($name, array $optionalArgs = [])
    {
        $request = new ResetWorkspaceChangesRequest();
        $requestParamHeaders = [];
        $request->setName($name);
        $requestParamHeaders['name'] = $name;
        if (isset($optionalArgs['paths'])) {
            $request->setPaths($optionalArgs['paths']);
        }

        if (isset($optionalArgs['clean'])) {
            $request->setClean($optionalArgs['clean']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'ResetWorkspaceChanges',
            GPBEmpty::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Updates a single ReleaseConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $releaseConfig = new ReleaseConfig();
     *     $response = $dataformClient->updateReleaseConfig($releaseConfig);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param ReleaseConfig $releaseConfig Required. The release config to update.
     * @param array         $optionalArgs  {
     *     Optional.
     *
     *     @type FieldMask $updateMask
     *           Optional. Specifies the fields to be updated in the release config. If left
     *           unset, all fields will be updated.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\ReleaseConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function updateReleaseConfig(
        $releaseConfig,
        array $optionalArgs = []
    ) {
        $request = new UpdateReleaseConfigRequest();
        $requestParamHeaders = [];
        $request->setReleaseConfig($releaseConfig);
        $requestParamHeaders['release_config.name'] = $releaseConfig->getName();
        if (isset($optionalArgs['updateMask'])) {
            $request->setUpdateMask($optionalArgs['updateMask']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'UpdateReleaseConfig',
            ReleaseConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Updates a single Repository.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $repository = new Repository();
     *     $response = $dataformClient->updateRepository($repository);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param Repository $repository   Required. The repository to update.
     * @param array      $optionalArgs {
     *     Optional.
     *
     *     @type FieldMask $updateMask
     *           Optional. Specifies the fields to be updated in the repository. If left
     *           unset, all fields will be updated.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\Repository
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function updateRepository($repository, array $optionalArgs = [])
    {
        $request = new UpdateRepositoryRequest();
        $requestParamHeaders = [];
        $request->setRepository($repository);
        $requestParamHeaders['repository.name'] = $repository->getName();
        if (isset($optionalArgs['updateMask'])) {
            $request->setUpdateMask($optionalArgs['updateMask']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'UpdateRepository',
            Repository::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Updates a single WorkflowConfig.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $workflowConfig = new WorkflowConfig();
     *     $response = $dataformClient->updateWorkflowConfig($workflowConfig);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param WorkflowConfig $workflowConfig Required. The workflow config to update.
     * @param array          $optionalArgs   {
     *     Optional.
     *
     *     @type FieldMask $updateMask
     *           Optional. Specifies the fields to be updated in the workflow config. If
     *           left unset, all fields will be updated.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WorkflowConfig
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function updateWorkflowConfig(
        $workflowConfig,
        array $optionalArgs = []
    ) {
        $request = new UpdateWorkflowConfigRequest();
        $requestParamHeaders = [];
        $request->setWorkflowConfig($workflowConfig);
        $requestParamHeaders[
            'workflow_config.name'
        ] = $workflowConfig->getName();
        if (isset($optionalArgs['updateMask'])) {
            $request->setUpdateMask($optionalArgs['updateMask']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'UpdateWorkflowConfig',
            WorkflowConfig::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Writes to a file (inside a Workspace).
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $formattedWorkspace = $dataformClient->workspaceName('[PROJECT]', '[LOCATION]', '[REPOSITORY]', '[WORKSPACE]');
     *     $path = 'path';
     *     $contents = '...';
     *     $response = $dataformClient->writeFile($formattedWorkspace, $path, $contents);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $workspace    Required. The workspace's name.
     * @param string $path         Required. The file.
     * @param string $contents     Required. The file's contents.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Dataform\V1beta1\WriteFileResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function writeFile(
        $workspace,
        $path,
        $contents,
        array $optionalArgs = []
    ) {
        $request = new WriteFileRequest();
        $requestParamHeaders = [];
        $request->setWorkspace($workspace);
        $request->setPath($path);
        $request->setContents($contents);
        $requestParamHeaders['workspace'] = $workspace;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'WriteFile',
            WriteFileResponse::class,
            $optionalArgs,
            $request
        )->wait();
    }

    /**
     * Gets information about a location.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $response = $dataformClient->getLocation();
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param array $optionalArgs {
     *     Optional.
     *
     *     @type string $name
     *           Resource name for the location.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Location\Location
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getLocation(array $optionalArgs = [])
    {
        $request = new GetLocationRequest();
        $requestParamHeaders = [];
        if (isset($optionalArgs['name'])) {
            $request->setName($optionalArgs['name']);
            $requestParamHeaders['name'] = $optionalArgs['name'];
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetLocation',
            Location::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.cloud.location.Locations'
        )->wait();
    }

    /**
     * Lists information about the supported locations for this service.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     // Iterate over pages of elements
     *     $pagedResponse = $dataformClient->listLocations();
     *     foreach ($pagedResponse->iteratePages() as $page) {
     *         foreach ($page as $element) {
     *             // doSomethingWith($element);
     *         }
     *     }
     *     // Alternatively:
     *     // Iterate through all elements
     *     $pagedResponse = $dataformClient->listLocations();
     *     foreach ($pagedResponse->iterateAllElements() as $element) {
     *         // doSomethingWith($element);
     *     }
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param array $optionalArgs {
     *     Optional.
     *
     *     @type string $name
     *           The resource that owns the locations collection, if applicable.
     *     @type string $filter
     *           The standard list filter.
     *     @type int $pageSize
     *           The maximum number of resources contained in the underlying API
     *           response. The API may return fewer values in a page, even if
     *           there are additional values to be retrieved.
     *     @type string $pageToken
     *           A page token is used to specify a page of values to be returned.
     *           If no page token is specified (the default), the first page
     *           of values will be returned. Any page token used here must have
     *           been generated by a previous call to the API.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\ApiCore\PagedListResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function listLocations(array $optionalArgs = [])
    {
        $request = new ListLocationsRequest();
        $requestParamHeaders = [];
        if (isset($optionalArgs['name'])) {
            $request->setName($optionalArgs['name']);
            $requestParamHeaders['name'] = $optionalArgs['name'];
        }

        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }

        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }

        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->getPagedListResponse(
            'ListLocations',
            $optionalArgs,
            ListLocationsResponse::class,
            $request,
            'google.cloud.location.Locations'
        );
    }

    /**
     * Gets the access control policy for a resource. Returns an empty policy
    if the resource exists and does not have a policy set.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $resource = 'resource';
     *     $response = $dataformClient->getIamPolicy($resource);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $resource     REQUIRED: The resource for which the policy is being requested.
     *                             See the operation documentation for the appropriate value for this field.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type GetPolicyOptions $options
     *           OPTIONAL: A `GetPolicyOptions` object for specifying options to
     *           `GetIamPolicy`.
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Iam\V1\Policy
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function getIamPolicy($resource, array $optionalArgs = [])
    {
        $request = new GetIamPolicyRequest();
        $requestParamHeaders = [];
        $request->setResource($resource);
        $requestParamHeaders['resource'] = $resource;
        if (isset($optionalArgs['options'])) {
            $request->setOptions($optionalArgs['options']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'GetIamPolicy',
            Policy::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.iam.v1.IAMPolicy'
        )->wait();
    }

    /**
     * Sets the access control policy on the specified resource. Replaces
    any existing policy.

    Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    errors.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $resource = 'resource';
     *     $policy = new Policy();
     *     $response = $dataformClient->setIamPolicy($resource, $policy);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string $resource     REQUIRED: The resource for which the policy is being specified.
     *                             See the operation documentation for the appropriate value for this field.
     * @param Policy $policy       REQUIRED: The complete policy to be applied to the `resource`. The size of
     *                             the policy is limited to a few 10s of KB. An empty policy is a
     *                             valid policy but certain Cloud Platform services (such as Projects)
     *                             might reject them.
     * @param array  $optionalArgs {
     *     Optional.
     *
     *     @type FieldMask $updateMask
     *           OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
     *           the fields in the mask will be modified. If no mask is provided, the
     *           following default mask is used:
     *
     *           `paths: "bindings, etag"`
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Iam\V1\Policy
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function setIamPolicy($resource, $policy, array $optionalArgs = [])
    {
        $request = new SetIamPolicyRequest();
        $requestParamHeaders = [];
        $request->setResource($resource);
        $request->setPolicy($policy);
        $requestParamHeaders['resource'] = $resource;
        if (isset($optionalArgs['updateMask'])) {
            $request->setUpdateMask($optionalArgs['updateMask']);
        }

        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'SetIamPolicy',
            Policy::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.iam.v1.IAMPolicy'
        )->wait();
    }

    /**
     * Returns permissions that a caller has on the specified resource. If the
    resource does not exist, this will return an empty set of
    permissions, not a `NOT_FOUND` error.

    Note: This operation is designed to be used for building
    permission-aware UIs and command-line tools, not for authorization
    checking. This operation may "fail open" without warning.
     *
     * Sample code:
     * ```
     * $dataformClient = new DataformClient();
     * try {
     *     $resource = 'resource';
     *     $permissions = [];
     *     $response = $dataformClient->testIamPermissions($resource, $permissions);
     * } finally {
     *     $dataformClient->close();
     * }
     * ```
     *
     * @param string   $resource     REQUIRED: The resource for which the policy detail is being requested.
     *                               See the operation documentation for the appropriate value for this field.
     * @param string[] $permissions  The set of permissions to check for the `resource`. Permissions with
     *                               wildcards (such as '*' or 'storage.*') are not allowed. For more
     *                               information see
     *                               [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
     * @param array    $optionalArgs {
     *     Optional.
     *
     *     @type RetrySettings|array $retrySettings
     *           Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
     *           associative array of retry settings parameters. See the documentation on
     *           {@see RetrySettings} for example usage.
     * }
     *
     * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse
     *
     * @throws ApiException if the remote call fails
     *
     * @experimental
     */
    public function testIamPermissions(
        $resource,
        $permissions,
        array $optionalArgs = []
    ) {
        $request = new TestIamPermissionsRequest();
        $requestParamHeaders = [];
        $request->setResource($resource);
        $request->setPermissions($permissions);
        $requestParamHeaders['resource'] = $resource;
        $requestParams = new RequestParamsHeaderDescriptor(
            $requestParamHeaders
        );
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();
        return $this->startCall(
            'TestIamPermissions',
            TestIamPermissionsResponse::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.iam.v1.IAMPolicy'
        )->wait();
    }
}
