<?php
/*
 * Copyright 2023 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/baremetalsolution/v2/baremetalsolution.proto
 * Updates to the above are reflected here through a refresh process.
 */

namespace Google\Cloud\BareMetalSolution\V2\Client\BaseClient;

use Google\ApiCore\ApiException;
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\GapicClientTrait;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\OperationResponse;
use Google\ApiCore\PagedListResponse;
use Google\ApiCore\ResourceHelperTrait;
use Google\ApiCore\RetrySettings;
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use Google\Cloud\BareMetalSolution\V2\DetachLunRequest;
use Google\Cloud\BareMetalSolution\V2\GetInstanceRequest;
use Google\Cloud\BareMetalSolution\V2\GetLunRequest;
use Google\Cloud\BareMetalSolution\V2\GetNetworkRequest;
use Google\Cloud\BareMetalSolution\V2\GetNfsShareRequest;
use Google\Cloud\BareMetalSolution\V2\GetVolumeRequest;
use Google\Cloud\BareMetalSolution\V2\Instance;
use Google\Cloud\BareMetalSolution\V2\ListInstancesRequest;
use Google\Cloud\BareMetalSolution\V2\ListLunsRequest;
use Google\Cloud\BareMetalSolution\V2\ListNetworkUsageRequest;
use Google\Cloud\BareMetalSolution\V2\ListNetworkUsageResponse;
use Google\Cloud\BareMetalSolution\V2\ListNetworksRequest;
use Google\Cloud\BareMetalSolution\V2\ListNfsSharesRequest;
use Google\Cloud\BareMetalSolution\V2\ListVolumesRequest;
use Google\Cloud\BareMetalSolution\V2\Lun;
use Google\Cloud\BareMetalSolution\V2\Network;
use Google\Cloud\BareMetalSolution\V2\NfsShare;
use Google\Cloud\BareMetalSolution\V2\ResetInstanceRequest;
use Google\Cloud\BareMetalSolution\V2\ResizeVolumeRequest;
use Google\Cloud\BareMetalSolution\V2\StartInstanceRequest;
use Google\Cloud\BareMetalSolution\V2\StopInstanceRequest;
use Google\Cloud\BareMetalSolution\V2\UpdateInstanceRequest;
use Google\Cloud\BareMetalSolution\V2\UpdateNetworkRequest;
use Google\Cloud\BareMetalSolution\V2\UpdateNfsShareRequest;
use Google\Cloud\BareMetalSolution\V2\UpdateVolumeRequest;
use Google\Cloud\BareMetalSolution\V2\Volume;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;

/**
 * Service Description: Performs management operations on Bare Metal Solution servers.
 *
 * The `baremetalsolution.googleapis.com` service provides management
 * capabilities for Bare Metal Solution servers. To access the API methods, you
 * must assign Bare Metal Solution IAM roles containing the desired permissions
 * to your staff in your Google Cloud project. You must also enable the Bare
 * Metal Solution API. Once enabled, the methods act
 * upon specific servers in your Bare Metal Solution environment.
 *
 * This class provides the ability to make remote calls to the backing service through method
 * calls that map to API methods.
 *
 * 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.
 *
 * This class is currently experimental and may be subject to changes. See {@see
 * \Google\Cloud\BareMetalSolution\V2\BareMetalSolutionClient} for the stable
 * implementation
 *
 * @experimental
 *
 * @internal
 *
 * @method PromiseInterface detachLunAsync(DetachLunRequest $request, array $optionalArgs = [])
 * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = [])
 * @method PromiseInterface getLunAsync(GetLunRequest $request, array $optionalArgs = [])
 * @method PromiseInterface getNetworkAsync(GetNetworkRequest $request, array $optionalArgs = [])
 * @method PromiseInterface getNfsShareAsync(GetNfsShareRequest $request, array $optionalArgs = [])
 * @method PromiseInterface getVolumeAsync(GetVolumeRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listLunsAsync(ListLunsRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listNetworkUsageAsync(ListNetworkUsageRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listNetworksAsync(ListNetworksRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listNfsSharesAsync(ListNfsSharesRequest $request, array $optionalArgs = [])
 * @method PromiseInterface listVolumesAsync(ListVolumesRequest $request, array $optionalArgs = [])
 * @method PromiseInterface resetInstanceAsync(ResetInstanceRequest $request, array $optionalArgs = [])
 * @method PromiseInterface resizeVolumeAsync(ResizeVolumeRequest $request, array $optionalArgs = [])
 * @method PromiseInterface startInstanceAsync(StartInstanceRequest $request, array $optionalArgs = [])
 * @method PromiseInterface stopInstanceAsync(StopInstanceRequest $request, array $optionalArgs = [])
 * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = [])
 * @method PromiseInterface updateNetworkAsync(UpdateNetworkRequest $request, array $optionalArgs = [])
 * @method PromiseInterface updateNfsShareAsync(UpdateNfsShareRequest $request, array $optionalArgs = [])
 * @method PromiseInterface updateVolumeAsync(UpdateVolumeRequest $request, array $optionalArgs = [])
 */
abstract class BareMetalSolutionBaseClient
{
    use GapicClientTrait;
    use ResourceHelperTrait;

    /** The name of the service. */
    private const SERVICE_NAME = 'google.cloud.baremetalsolution.v2.BareMetalSolution';

    /** The default address of the service. */
    private const SERVICE_ADDRESS = 'baremetalsolution.googleapis.com';

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

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

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

    private $operationsClient;

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

    /**
     * Return an OperationsClient object with the same endpoint as $this.
     *
     * @return OperationsClient
     */
    public function getOperationsClient()
    {
        return $this->operationsClient;
    }

    /**
     * Resume an existing long running operation that was previously started by a long
     * running API method. If $methodName is not provided, or does not match a long
     * running API method, then the operation can still be resumed, but the
     * OperationResponse object will not deserialize the final response.
     *
     * @param string $operationName The name of the long running operation
     * @param string $methodName    The name of the method used to start the operation
     *
     * @return OperationResponse
     */
    public function resumeOperation($operationName, $methodName = null)
    {
        $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
        $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
        $operation->reload();
        return $operation;
    }

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

    /**
     * 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.
     */
    public static function locationName(string $project, string $location): string
    {
        return self::getPathTemplate('location')->render([
            'project' => $project,
            'location' => $location,
        ]);
    }

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

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

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

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

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

    /**
     * Parses a formatted name string and returns an associative array of the components in the name.
     * The following name formats are supported:
     * Template: Pattern
     * - instance: projects/{project}/locations/{location}/instances/{instance}
     * - location: projects/{project}/locations/{location}
     * - lun: projects/{project}/locations/{location}/volumes/{volume}/luns/{lun}
     * - nFSShare: projects/{project}/locations/{location}/nfsShares/{nfs_share}
     * - network: projects/{project}/locations/{location}/networks/{network}
     * - serverNetworkTemplate: projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}
     * - volume: projects/{project}/locations/{location}/volumes/{volume}
     *
     * 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.
     */
    public static function parseName(string $formattedName, string $template = null): array
    {
        return self::parseFormattedName($formattedName, $template);
    }

    /**
     * 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 'baremetalsolution.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
     */
    public function __construct(array $options = [])
    {
        $clientOptions = $this->buildClientOptions($options);
        $this->setClientOptions($clientOptions);
        $this->operationsClient = $this->createOperationsClient($clientOptions);
    }

    /** Handles execution of the async variants for each documented method. */
    public function __call($method, $args)
    {
        if (substr($method, -5) !== 'Async') {
            trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR);
        }

        array_unshift($args, substr($method, 0, -5));
        return call_user_func_array([$this, 'startAsyncCall'], $args);
    }

    /**
     * Detach LUN from Instance.
     *
     * The async variant is {@see self::detachLunAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/detach_lun.php
     *
     * @param DetachLunRequest $request     A request to house fields associated with the call.
     * @param array            $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function detachLun(DetachLunRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('DetachLun', $request, $callOptions)->wait();
    }

    /**
     * Get details about a single server.
     *
     * The async variant is {@see self::getInstanceAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/get_instance.php
     *
     * @param GetInstanceRequest $request     A request to house fields associated with the call.
     * @param array              $callOptions {
     *     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 Instance
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function getInstance(GetInstanceRequest $request, array $callOptions = []): Instance
    {
        return $this->startApiCall('GetInstance', $request, $callOptions)->wait();
    }

    /**
     * Get details of a single storage logical unit number(LUN).
     *
     * The async variant is {@see self::getLunAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/get_lun.php
     *
     * @param GetLunRequest $request     A request to house fields associated with the call.
     * @param array         $callOptions {
     *     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 Lun
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function getLun(GetLunRequest $request, array $callOptions = []): Lun
    {
        return $this->startApiCall('GetLun', $request, $callOptions)->wait();
    }

    /**
     * Get details of a single network.
     *
     * The async variant is {@see self::getNetworkAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/get_network.php
     *
     * @param GetNetworkRequest $request     A request to house fields associated with the call.
     * @param array             $callOptions {
     *     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 Network
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function getNetwork(GetNetworkRequest $request, array $callOptions = []): Network
    {
        return $this->startApiCall('GetNetwork', $request, $callOptions)->wait();
    }

    /**
     * Get details of a single NFS share.
     *
     * The async variant is {@see self::getNfsShareAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/get_nfs_share.php
     *
     * @param GetNfsShareRequest $request     A request to house fields associated with the call.
     * @param array              $callOptions {
     *     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 NfsShare
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function getNfsShare(GetNfsShareRequest $request, array $callOptions = []): NfsShare
    {
        return $this->startApiCall('GetNfsShare', $request, $callOptions)->wait();
    }

    /**
     * Get details of a single storage volume.
     *
     * The async variant is {@see self::getVolumeAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/get_volume.php
     *
     * @param GetVolumeRequest $request     A request to house fields associated with the call.
     * @param array            $callOptions {
     *     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 Volume
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function getVolume(GetVolumeRequest $request, array $callOptions = []): Volume
    {
        return $this->startApiCall('GetVolume', $request, $callOptions)->wait();
    }

    /**
     * List servers in a given project and location.
     *
     * The async variant is {@see self::listInstancesAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_instances.php
     *
     * @param ListInstancesRequest $request     A request to house fields associated with the call.
     * @param array                $callOptions {
     *     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 PagedListResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listInstances(ListInstancesRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('ListInstances', $request, $callOptions);
    }

    /**
     * List storage volume luns for given storage volume.
     *
     * The async variant is {@see self::listLunsAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_luns.php
     *
     * @param ListLunsRequest $request     A request to house fields associated with the call.
     * @param array           $callOptions {
     *     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 PagedListResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listLuns(ListLunsRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('ListLuns', $request, $callOptions);
    }

    /**
     * List all Networks (and used IPs for each Network) in the vendor account
     * associated with the specified project.
     *
     * The async variant is {@see self::listNetworkUsageAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_network_usage.php
     *
     * @param ListNetworkUsageRequest $request     A request to house fields associated with the call.
     * @param array                   $callOptions {
     *     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 ListNetworkUsageResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listNetworkUsage(ListNetworkUsageRequest $request, array $callOptions = []): ListNetworkUsageResponse
    {
        return $this->startApiCall('ListNetworkUsage', $request, $callOptions)->wait();
    }

    /**
     * List network in a given project and location.
     *
     * The async variant is {@see self::listNetworksAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_networks.php
     *
     * @param ListNetworksRequest $request     A request to house fields associated with the call.
     * @param array               $callOptions {
     *     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 PagedListResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listNetworks(ListNetworksRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('ListNetworks', $request, $callOptions);
    }

    /**
     * List NFS shares.
     *
     * The async variant is {@see self::listNfsSharesAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_nfs_shares.php
     *
     * @param ListNfsSharesRequest $request     A request to house fields associated with the call.
     * @param array                $callOptions {
     *     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 PagedListResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listNfsShares(ListNfsSharesRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('ListNfsShares', $request, $callOptions);
    }

    /**
     * List storage volumes in a given project and location.
     *
     * The async variant is {@see self::listVolumesAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/list_volumes.php
     *
     * @param ListVolumesRequest $request     A request to house fields associated with the call.
     * @param array              $callOptions {
     *     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 PagedListResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function listVolumes(ListVolumesRequest $request, array $callOptions = []): PagedListResponse
    {
        return $this->startApiCall('ListVolumes', $request, $callOptions);
    }

    /**
     * Perform an ungraceful, hard reset on a server. Equivalent to shutting the
     * power off and then turning it back on.
     *
     * The async variant is {@see self::resetInstanceAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/reset_instance.php
     *
     * @param ResetInstanceRequest $request     A request to house fields associated with the call.
     * @param array                $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function resetInstance(ResetInstanceRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('ResetInstance', $request, $callOptions)->wait();
    }

    /**
     * Emergency Volume resize.
     *
     * The async variant is {@see self::resizeVolumeAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/resize_volume.php
     *
     * @param ResizeVolumeRequest $request     A request to house fields associated with the call.
     * @param array               $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function resizeVolume(ResizeVolumeRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('ResizeVolume', $request, $callOptions)->wait();
    }

    /**
     * Starts a server that was shutdown.
     *
     * The async variant is {@see self::startInstanceAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/start_instance.php
     *
     * @param StartInstanceRequest $request     A request to house fields associated with the call.
     * @param array                $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function startInstance(StartInstanceRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('StartInstance', $request, $callOptions)->wait();
    }

    /**
     * Stop a running server.
     *
     * The async variant is {@see self::stopInstanceAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/stop_instance.php
     *
     * @param StopInstanceRequest $request     A request to house fields associated with the call.
     * @param array               $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function stopInstance(StopInstanceRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('StopInstance', $request, $callOptions)->wait();
    }

    /**
     * Update details of a single server.
     *
     * The async variant is {@see self::updateInstanceAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/update_instance.php
     *
     * @param UpdateInstanceRequest $request     A request to house fields associated with the call.
     * @param array                 $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function updateInstance(UpdateInstanceRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('UpdateInstance', $request, $callOptions)->wait();
    }

    /**
     * Update details of a single network.
     *
     * The async variant is {@see self::updateNetworkAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/update_network.php
     *
     * @param UpdateNetworkRequest $request     A request to house fields associated with the call.
     * @param array                $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function updateNetwork(UpdateNetworkRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('UpdateNetwork', $request, $callOptions)->wait();
    }

    /**
     * Update details of a single NFS share.
     *
     * The async variant is {@see self::updateNfsShareAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/update_nfs_share.php
     *
     * @param UpdateNfsShareRequest $request     A request to house fields associated with the call.
     * @param array                 $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function updateNfsShare(UpdateNfsShareRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('UpdateNfsShare', $request, $callOptions)->wait();
    }

    /**
     * Update details of a single storage volume.
     *
     * The async variant is {@see self::updateVolumeAsync()} .
     *
     * @example samples/V2/BareMetalSolutionClient/update_volume.php
     *
     * @param UpdateVolumeRequest $request     A request to house fields associated with the call.
     * @param array               $callOptions {
     *     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 OperationResponse
     *
     * @throws ApiException Thrown if the API call fails.
     */
    public function updateVolume(UpdateVolumeRequest $request, array $callOptions = []): OperationResponse
    {
        return $this->startApiCall('UpdateVolume', $request, $callOptions)->wait();
    }
}
