Reference documentation and code samples for the Google Cloud Net App V1 Client class NetAppClient.
Service Description: NetApp Files Google Cloud Service
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.
Namespace
Google \ Cloud \ NetApp \ V1 \ ClientMethods
__construct
Constructor.
options
array
Optional. Options for configuring the service API wrapper.
↳ apiEndpoint
string
The address of the API remote host. May optionally include the port, formatted as "
↳ credentials
string|array|FetchAuthTokenInterface|CredentialsWrapper
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 Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.
↳ credentialsConfig
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .
↳ disableRetries
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to false
.
↳ clientConfig
string|array
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.
↳ transport
string|TransportInterface
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 Google\ApiCore\Transport\TransportInterface
object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.
↳ transportConfig
array
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 Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.
↳ clientCertSource
callable
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.
createActiveDirectory
CreateActiveDirectory Creates the active directory specified in the request.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createActiveDirectoryAsync() .
request
Google\Cloud\NetApp\V1\CreateActiveDirectoryRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\ActiveDirectory;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateActiveDirectoryRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see NetAppClient::locationName()} for help formatting this field.
* @param string $activeDirectoryDomain Name of the Active Directory domain
* @param string $activeDirectoryDns Comma separated list of DNS server IP addresses for the Active
* Directory domain.
* @param string $activeDirectoryNetBiosPrefix NetBIOSPrefix is used as a prefix for SMB server name.
* @param string $activeDirectoryUsername Username of the Active Directory domain administrator.
* @param string $activeDirectoryPassword Password of the Active Directory domain administrator.
* @param string $activeDirectoryId ID of the active directory to create.
*/
function create_active_directory_sample(
string $formattedParent,
string $activeDirectoryDomain,
string $activeDirectoryDns,
string $activeDirectoryNetBiosPrefix,
string $activeDirectoryUsername,
string $activeDirectoryPassword,
string $activeDirectoryId
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$activeDirectory = (new ActiveDirectory())
->setDomain($activeDirectoryDomain)
->setDns($activeDirectoryDns)
->setNetBiosPrefix($activeDirectoryNetBiosPrefix)
->setUsername($activeDirectoryUsername)
->setPassword($activeDirectoryPassword);
$request = (new CreateActiveDirectoryRequest())
->setParent($formattedParent)
->setActiveDirectory($activeDirectory)
->setActiveDirectoryId($activeDirectoryId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createActiveDirectory($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ActiveDirectory $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
$activeDirectoryDomain = '[DOMAIN]';
$activeDirectoryDns = '[DNS]';
$activeDirectoryNetBiosPrefix = '[NET_BIOS_PREFIX]';
$activeDirectoryUsername = '[USERNAME]';
$activeDirectoryPassword = '[PASSWORD]';
$activeDirectoryId = '[ACTIVE_DIRECTORY_ID]';
create_active_directory_sample(
$formattedParent,
$activeDirectoryDomain,
$activeDirectoryDns,
$activeDirectoryNetBiosPrefix,
$activeDirectoryUsername,
$activeDirectoryPassword,
$activeDirectoryId
);
}
createKmsConfig
Creates a new KMS config.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createKmsConfigAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateKmsConfigRequest;
use Google\Cloud\NetApp\V1\KmsConfig;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see NetAppClient::locationName()} for help formatting this field.
* @param string $kmsConfigId Id of the requesting KmsConfig
* If auto-generating Id server-side, remove this field and
* id from the method_signature of Create RPC
* @param string $kmsConfigCryptoKeyName Customer managed crypto key resource full name. Format:
* projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{key}.
*/
function create_kms_config_sample(
string $formattedParent,
string $kmsConfigId,
string $kmsConfigCryptoKeyName
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$kmsConfig = (new KmsConfig())
->setCryptoKeyName($kmsConfigCryptoKeyName);
$request = (new CreateKmsConfigRequest())
->setParent($formattedParent)
->setKmsConfigId($kmsConfigId)
->setKmsConfig($kmsConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createKmsConfig($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var KmsConfig $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
$kmsConfigId = '[KMS_CONFIG_ID]';
$kmsConfigCryptoKeyName = '[CRYPTO_KEY_NAME]';
create_kms_config_sample($formattedParent, $kmsConfigId, $kmsConfigCryptoKeyName);
}
createReplication
Create a new replication for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateReplicationRequest;
use Google\Cloud\NetApp\V1\DestinationVolumeParameters;
use Google\Cloud\NetApp\V1\Replication;
use Google\Cloud\NetApp\V1\Replication\ReplicationSchedule;
use Google\Rpc\Status;
/**
* @param string $formattedParent The NetApp volume to create the replications of, in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}`
* Please see {@see NetAppClient::volumeName()} for help formatting this field.
* @param int $replicationReplicationSchedule Indicates the schedule for replication.
* @param string $formattedReplicationDestinationVolumeParametersStoragePool Existing destination StoragePool name. Please see
* {@see NetAppClient::storagePoolName()} for help formatting this field.
* @param string $replicationId ID of the replication to create.
* This value must start with a lowercase letter followed by up to 62
* lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
*/
function create_replication_sample(
string $formattedParent,
int $replicationReplicationSchedule,
string $formattedReplicationDestinationVolumeParametersStoragePool,
string $replicationId
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$replicationDestinationVolumeParameters = (new DestinationVolumeParameters())
->setStoragePool($formattedReplicationDestinationVolumeParametersStoragePool);
$replication = (new Replication())
->setReplicationSchedule($replicationReplicationSchedule)
->setDestinationVolumeParameters($replicationDestinationVolumeParameters);
$request = (new CreateReplicationRequest())
->setParent($formattedParent)
->setReplication($replication)
->setReplicationId($replicationId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createReplication($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Replication $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
$replicationReplicationSchedule = ReplicationSchedule::REPLICATION_SCHEDULE_UNSPECIFIED;
$formattedReplicationDestinationVolumeParametersStoragePool = NetAppClient::storagePoolName(
'[PROJECT]',
'[LOCATION]',
'[STORAGE_POOL]'
);
$replicationId = '[REPLICATION_ID]';
create_replication_sample(
$formattedParent,
$replicationReplicationSchedule,
$formattedReplicationDestinationVolumeParametersStoragePool,
$replicationId
);
}
createSnapshot
Create a new snapshot for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createSnapshotAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateSnapshotRequest;
use Google\Cloud\NetApp\V1\Snapshot;
use Google\Rpc\Status;
/**
* @param string $formattedParent The NetApp volume to create the snapshots of, in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}`
* Please see {@see NetAppClient::volumeName()} for help formatting this field.
* @param string $snapshotId ID of the snapshot to create.
* This value must start with a lowercase letter followed by up to 62
* lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
*/
function create_snapshot_sample(string $formattedParent, string $snapshotId): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$snapshot = new Snapshot();
$request = (new CreateSnapshotRequest())
->setParent($formattedParent)
->setSnapshot($snapshot)
->setSnapshotId($snapshotId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createSnapshot($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Snapshot $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
$snapshotId = '[SNAPSHOT_ID]';
create_snapshot_sample($formattedParent, $snapshotId);
}
createStoragePool
Creates a new storage pool.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createStoragePoolAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateStoragePoolRequest;
use Google\Cloud\NetApp\V1\ServiceLevel;
use Google\Cloud\NetApp\V1\StoragePool;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see NetAppClient::locationName()} for help formatting this field.
* @param string $storagePoolId Id of the requesting storage pool
* If auto-generating Id server-side, remove this field and
* id from the method_signature of Create RPC
* @param int $storagePoolServiceLevel Service level of the storage pool
* @param int $storagePoolCapacityGib Capacity in GIB of the pool
* @param string $formattedStoragePoolNetwork VPC Network name.
* Format: projects/{project}/global/networks/{network}
* Please see {@see NetAppClient::networkName()} for help formatting this field.
*/
function create_storage_pool_sample(
string $formattedParent,
string $storagePoolId,
int $storagePoolServiceLevel,
int $storagePoolCapacityGib,
string $formattedStoragePoolNetwork
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$storagePool = (new StoragePool())
->setServiceLevel($storagePoolServiceLevel)
->setCapacityGib($storagePoolCapacityGib)
->setNetwork($formattedStoragePoolNetwork);
$request = (new CreateStoragePoolRequest())
->setParent($formattedParent)
->setStoragePoolId($storagePoolId)
->setStoragePool($storagePool);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createStoragePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var StoragePool $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
$storagePoolId = '[STORAGE_POOL_ID]';
$storagePoolServiceLevel = ServiceLevel::SERVICE_LEVEL_UNSPECIFIED;
$storagePoolCapacityGib = 0;
$formattedStoragePoolNetwork = NetAppClient::networkName('[PROJECT]', '[NETWORK]');
create_storage_pool_sample(
$formattedParent,
$storagePoolId,
$storagePoolServiceLevel,
$storagePoolCapacityGib,
$formattedStoragePoolNetwork
);
}
createVolume
Creates a new Volume in a given project and location.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::createVolumeAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\CreateVolumeRequest;
use Google\Cloud\NetApp\V1\Protocols;
use Google\Cloud\NetApp\V1\Volume;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see NetAppClient::locationName()} for help formatting this field.
* @param string $volumeId Id of the requesting volume
* If auto-generating Id server-side, remove this field and
* Id from the method_signature of Create RPC
* @param string $volumeShareName Share name of the volume
* @param string $formattedVolumeStoragePool StoragePool name of the volume
* Please see {@see NetAppClient::storagePoolName()} for help formatting this field.
* @param int $volumeCapacityGib Capacity in GIB of the volume
* @param int $volumeProtocolsElement Protocols required for the volume
*/
function create_volume_sample(
string $formattedParent,
string $volumeId,
string $volumeShareName,
string $formattedVolumeStoragePool,
int $volumeCapacityGib,
int $volumeProtocolsElement
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$volumeProtocols = [$volumeProtocolsElement,];
$volume = (new Volume())
->setShareName($volumeShareName)
->setStoragePool($formattedVolumeStoragePool)
->setCapacityGib($volumeCapacityGib)
->setProtocols($volumeProtocols);
$request = (new CreateVolumeRequest())
->setParent($formattedParent)
->setVolumeId($volumeId)
->setVolume($volume);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->createVolume($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Volume $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
$volumeId = '[VOLUME_ID]';
$volumeShareName = '[SHARE_NAME]';
$formattedVolumeStoragePool = NetAppClient::storagePoolName(
'[PROJECT]',
'[LOCATION]',
'[STORAGE_POOL]'
);
$volumeCapacityGib = 0;
$volumeProtocolsElement = Protocols::PROTOCOLS_UNSPECIFIED;
create_volume_sample(
$formattedParent,
$volumeId,
$volumeShareName,
$formattedVolumeStoragePool,
$volumeCapacityGib,
$volumeProtocolsElement
);
}
deleteActiveDirectory
Delete the active directory specified in the request.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteActiveDirectoryAsync() .
request
Google\Cloud\NetApp\V1\DeleteActiveDirectoryRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteActiveDirectoryRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the active directory. Please see
* {@see NetAppClient::activeDirectoryName()} for help formatting this field.
*/
function delete_active_directory_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteActiveDirectoryRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteActiveDirectory($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::activeDirectoryName('[PROJECT]', '[LOCATION]', '[ACTIVE_DIRECTORY]');
delete_active_directory_sample($formattedName);
}
deleteKmsConfig
Warning! This operation will permanently delete the Kms config.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteKmsConfigAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteKmsConfigRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the KmsConfig. Please see
* {@see NetAppClient::kmsConfigName()} for help formatting this field.
*/
function delete_kms_config_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteKmsConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteKmsConfig($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::kmsConfigName('[PROJECT]', '[LOCATION]', '[KMS_CONFIG]');
delete_kms_config_sample($formattedName);
}
deleteReplication
Deletes a replication.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteReplicationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The replication resource name, in the format
* `projects/*/locations/*/volumes/*/replications/{replication_id}`
* Please see {@see NetAppClient::replicationName()} for help formatting this field.
*/
function delete_replication_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteReplicationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteReplication($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::replicationName(
'[PROJECT]',
'[LOCATION]',
'[VOLUME]',
'[REPLICATION]'
);
delete_replication_sample($formattedName);
}
deleteSnapshot
Deletes a snapshot.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteSnapshotAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteSnapshotRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The snapshot resource name, in the format
* `projects/*/locations/*/volumes/*/snapshots/{snapshot_id}`
* Please see {@see NetAppClient::snapshotName()} for help formatting this field.
*/
function delete_snapshot_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteSnapshotRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteSnapshot($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::snapshotName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[SNAPSHOT]');
delete_snapshot_sample($formattedName);
}
deleteStoragePool
Warning! This operation will permanently delete the storage pool.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteStoragePoolAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteStoragePoolRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the storage pool
* Please see {@see NetAppClient::storagePoolName()} for help formatting this field.
*/
function delete_storage_pool_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteStoragePoolRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteStoragePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::storagePoolName('[PROJECT]', '[LOCATION]', '[STORAGE_POOL]');
delete_storage_pool_sample($formattedName);
}
deleteVolume
Deletes a single Volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::deleteVolumeAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DeleteVolumeRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the volume
* Please see {@see NetAppClient::volumeName()} for help formatting this field.
*/
function delete_volume_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new DeleteVolumeRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->deleteVolume($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
delete_volume_sample($formattedName);
}
encryptVolumes
Encrypt the existing volumes without CMEK encryption with the desired the KMS config for the whole region.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::encryptVolumesAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\EncryptVolumesRequest;
use Google\Cloud\NetApp\V1\KmsConfig;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the KmsConfig. Please see
* {@see NetAppClient::kmsConfigName()} for help formatting this field.
*/
function encrypt_volumes_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new EncryptVolumesRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->encryptVolumes($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var KmsConfig $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::kmsConfigName('[PROJECT]', '[LOCATION]', '[KMS_CONFIG]');
encrypt_volumes_sample($formattedName);
}
getActiveDirectory
Describes a specified active directory.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getActiveDirectoryAsync() .
request
Google\Cloud\NetApp\V1\GetActiveDirectoryRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\ActiveDirectory;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetActiveDirectoryRequest;
/**
* @param string $formattedName Name of the active directory. Please see
* {@see NetAppClient::activeDirectoryName()} for help formatting this field.
*/
function get_active_directory_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetActiveDirectoryRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ActiveDirectory $response */
$response = $netAppClient->getActiveDirectory($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::activeDirectoryName('[PROJECT]', '[LOCATION]', '[ACTIVE_DIRECTORY]');
get_active_directory_sample($formattedName);
}
getKmsConfig
Returns the description of the specified KMS config by kms_config_id.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getKmsConfigAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetKmsConfigRequest;
use Google\Cloud\NetApp\V1\KmsConfig;
/**
* @param string $formattedName Name of the KmsConfig
* Please see {@see NetAppClient::kmsConfigName()} for help formatting this field.
*/
function get_kms_config_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetKmsConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var KmsConfig $response */
$response = $netAppClient->getKmsConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::kmsConfigName('[PROJECT]', '[LOCATION]', '[KMS_CONFIG]');
get_kms_config_sample($formattedName);
}
getReplication
Describe a replication for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetReplicationRequest;
use Google\Cloud\NetApp\V1\Replication;
/**
* @param string $formattedName The replication resource name, in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}/replications/{replication_id}`
* Please see {@see NetAppClient::replicationName()} for help formatting this field.
*/
function get_replication_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetReplicationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Replication $response */
$response = $netAppClient->getReplication($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::replicationName(
'[PROJECT]',
'[LOCATION]',
'[VOLUME]',
'[REPLICATION]'
);
get_replication_sample($formattedName);
}
getSnapshot
Describe a snapshot for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getSnapshotAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetSnapshotRequest;
use Google\Cloud\NetApp\V1\Snapshot;
/**
* @param string $formattedName The snapshot resource name, in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}/snapshots/{snapshot_id}`
* Please see {@see NetAppClient::snapshotName()} for help formatting this field.
*/
function get_snapshot_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetSnapshotRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Snapshot $response */
$response = $netAppClient->getSnapshot($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::snapshotName('[PROJECT]', '[LOCATION]', '[VOLUME]', '[SNAPSHOT]');
get_snapshot_sample($formattedName);
}
getStoragePool
Returns the description of the specified storage pool by poolId.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getStoragePoolAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetStoragePoolRequest;
use Google\Cloud\NetApp\V1\StoragePool;
/**
* @param string $formattedName Name of the storage pool
* Please see {@see NetAppClient::storagePoolName()} for help formatting this field.
*/
function get_storage_pool_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetStoragePoolRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var StoragePool $response */
$response = $netAppClient->getStoragePool($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::storagePoolName('[PROJECT]', '[LOCATION]', '[STORAGE_POOL]');
get_storage_pool_sample($formattedName);
}
getVolume
Gets details of a single Volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getVolumeAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\GetVolumeRequest;
use Google\Cloud\NetApp\V1\Volume;
/**
* @param string $formattedName Name of the volume
* Please see {@see NetAppClient::volumeName()} for help formatting this field.
*/
function get_volume_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new GetVolumeRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Volume $response */
$response = $netAppClient->getVolume($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
get_volume_sample($formattedName);
}
listActiveDirectories
Lists active directories.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listActiveDirectoriesAsync() .
request
Google\Cloud\NetApp\V1\ListActiveDirectoriesRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\ActiveDirectory;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ListActiveDirectoriesRequest;
/**
* @param string $formattedParent Parent value for ListActiveDirectoriesRequest
* Please see {@see NetAppClient::locationName()} for help formatting this field.
*/
function list_active_directories_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListActiveDirectoriesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listActiveDirectories($request);
/** @var ActiveDirectory $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
list_active_directories_sample($formattedParent);
}
listKmsConfigs
Returns descriptions of all KMS configs owned by the caller.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listKmsConfigsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\KmsConfig;
use Google\Cloud\NetApp\V1\ListKmsConfigsRequest;
/**
* @param string $formattedParent Parent value
* Please see {@see NetAppClient::locationName()} for help formatting this field.
*/
function list_kms_configs_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListKmsConfigsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listKmsConfigs($request);
/** @var KmsConfig $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
list_kms_configs_sample($formattedParent);
}
listReplications
Returns descriptions of all replications for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listReplicationsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ListReplicationsRequest;
use Google\Cloud\NetApp\V1\Replication;
/**
* @param string $formattedParent The volume for which to retrieve replication information,
* in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}`. Please see
* {@see NetAppClient::volumeName()} for help formatting this field.
*/
function list_replications_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListReplicationsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listReplications($request);
/** @var Replication $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
list_replications_sample($formattedParent);
}
listSnapshots
Returns descriptions of all snapshots for a volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listSnapshotsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ListSnapshotsRequest;
use Google\Cloud\NetApp\V1\Snapshot;
/**
* @param string $formattedParent The volume for which to retrieve snapshot information,
* in the format
* `projects/{project_id}/locations/{location}/volumes/{volume_id}`. Please see
* {@see NetAppClient::volumeName()} for help formatting this field.
*/
function list_snapshots_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListSnapshotsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listSnapshots($request);
/** @var Snapshot $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
list_snapshots_sample($formattedParent);
}
listStoragePools
Returns descriptions of all storage pools owned by the caller.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listStoragePoolsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ListStoragePoolsRequest;
use Google\Cloud\NetApp\V1\StoragePool;
/**
* @param string $formattedParent Parent value
* Please see {@see NetAppClient::locationName()} for help formatting this field.
*/
function list_storage_pools_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListStoragePoolsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listStoragePools($request);
/** @var StoragePool $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
list_storage_pools_sample($formattedParent);
}
listVolumes
Lists Volumes in a given project.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listVolumesAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ListVolumesRequest;
use Google\Cloud\NetApp\V1\Volume;
/**
* @param string $formattedParent Parent value for ListVolumesRequest
* Please see {@see NetAppClient::locationName()} for help formatting this field.
*/
function list_volumes_sample(string $formattedParent): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ListVolumesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listVolumes($request);
/** @var Volume $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = NetAppClient::locationName('[PROJECT]', '[LOCATION]');
list_volumes_sample($formattedParent);
}
resumeReplication
Resume Cross Region Replication.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::resumeReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\Replication;
use Google\Cloud\NetApp\V1\ResumeReplicationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name of the replication, in the format of
* projects/{project_id}/locations/{location}/volumes/{volume_id}/replications/{replication_id}. Please see
* {@see NetAppClient::replicationName()} for help formatting this field.
*/
function resume_replication_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ResumeReplicationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->resumeReplication($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Replication $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::replicationName(
'[PROJECT]',
'[LOCATION]',
'[VOLUME]',
'[REPLICATION]'
);
resume_replication_sample($formattedName);
}
reverseReplicationDirection
Reverses direction of replication. Source becomes destination and destination becomes source.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::reverseReplicationDirectionAsync() .
request
Google\Cloud\NetApp\V1\ReverseReplicationDirectionRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\Replication;
use Google\Cloud\NetApp\V1\ReverseReplicationDirectionRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name of the replication, in the format of
* projects/{project_id}/locations/{location}/volumes/{volume_id}/replications/{replication_id}. Please see
* {@see NetAppClient::replicationName()} for help formatting this field.
*/
function reverse_replication_direction_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new ReverseReplicationDirectionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->reverseReplicationDirection($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Replication $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::replicationName(
'[PROJECT]',
'[LOCATION]',
'[VOLUME]',
'[REPLICATION]'
);
reverse_replication_direction_sample($formattedName);
}
revertVolume
Revert an existing volume to a specified snapshot.
Warning! This operation will permanently revert all changes made after the snapshot was created.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::revertVolumeAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\RevertVolumeRequest;
use Google\Cloud\NetApp\V1\Volume;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name of the volume, in the format of
* projects/{project_id}/locations/{location}/volumes/{volume_id}. Please see
* {@see NetAppClient::volumeName()} for help formatting this field.
* @param string $snapshotId The snapshot resource ID, in the format 'my-snapshot', where the
* specified ID is the {snapshot_id} of the fully qualified name like
* projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}
*/
function revert_volume_sample(string $formattedName, string $snapshotId): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new RevertVolumeRequest())
->setName($formattedName)
->setSnapshotId($snapshotId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->revertVolume($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Volume $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::volumeName('[PROJECT]', '[LOCATION]', '[VOLUME]');
$snapshotId = '[SNAPSHOT_ID]';
revert_volume_sample($formattedName, $snapshotId);
}
stopReplication
Stop Cross Region Replication.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::stopReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\Replication;
use Google\Cloud\NetApp\V1\StopReplicationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name of the replication, in the format of
* projects/{project_id}/locations/{location}/volumes/{volume_id}/replications/{replication_id}. Please see
* {@see NetAppClient::replicationName()} for help formatting this field.
*/
function stop_replication_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new StopReplicationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->stopReplication($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Replication $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::replicationName(
'[PROJECT]',
'[LOCATION]',
'[VOLUME]',
'[REPLICATION]'
);
stop_replication_sample($formattedName);
}
updateActiveDirectory
Update the parameters of an active directories.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateActiveDirectoryAsync() .
request
Google\Cloud\NetApp\V1\UpdateActiveDirectoryRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\ActiveDirectory;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\UpdateActiveDirectoryRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $activeDirectoryDomain Name of the Active Directory domain
* @param string $activeDirectoryDns Comma separated list of DNS server IP addresses for the Active
* Directory domain.
* @param string $activeDirectoryNetBiosPrefix NetBIOSPrefix is used as a prefix for SMB server name.
* @param string $activeDirectoryUsername Username of the Active Directory domain administrator.
* @param string $activeDirectoryPassword Password of the Active Directory domain administrator.
*/
function update_active_directory_sample(
string $activeDirectoryDomain,
string $activeDirectoryDns,
string $activeDirectoryNetBiosPrefix,
string $activeDirectoryUsername,
string $activeDirectoryPassword
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$activeDirectory = (new ActiveDirectory())
->setDomain($activeDirectoryDomain)
->setDns($activeDirectoryDns)
->setNetBiosPrefix($activeDirectoryNetBiosPrefix)
->setUsername($activeDirectoryUsername)
->setPassword($activeDirectoryPassword);
$request = (new UpdateActiveDirectoryRequest())
->setUpdateMask($updateMask)
->setActiveDirectory($activeDirectory);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateActiveDirectory($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ActiveDirectory $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$activeDirectoryDomain = '[DOMAIN]';
$activeDirectoryDns = '[DNS]';
$activeDirectoryNetBiosPrefix = '[NET_BIOS_PREFIX]';
$activeDirectoryUsername = '[USERNAME]';
$activeDirectoryPassword = '[PASSWORD]';
update_active_directory_sample(
$activeDirectoryDomain,
$activeDirectoryDns,
$activeDirectoryNetBiosPrefix,
$activeDirectoryUsername,
$activeDirectoryPassword
);
}
updateKmsConfig
Updates the Kms config properties with the full spec
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateKmsConfigAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\KmsConfig;
use Google\Cloud\NetApp\V1\UpdateKmsConfigRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $kmsConfigCryptoKeyName Customer managed crypto key resource full name. Format:
* projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{key}.
*/
function update_kms_config_sample(string $kmsConfigCryptoKeyName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$kmsConfig = (new KmsConfig())
->setCryptoKeyName($kmsConfigCryptoKeyName);
$request = (new UpdateKmsConfigRequest())
->setUpdateMask($updateMask)
->setKmsConfig($kmsConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateKmsConfig($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var KmsConfig $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$kmsConfigCryptoKeyName = '[CRYPTO_KEY_NAME]';
update_kms_config_sample($kmsConfigCryptoKeyName);
}
updateReplication
Updates the settings of a specific replication.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateReplicationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\DestinationVolumeParameters;
use Google\Cloud\NetApp\V1\Replication;
use Google\Cloud\NetApp\V1\Replication\ReplicationSchedule;
use Google\Cloud\NetApp\V1\UpdateReplicationRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param int $replicationReplicationSchedule Indicates the schedule for replication.
* @param string $formattedReplicationDestinationVolumeParametersStoragePool Existing destination StoragePool name. Please see
* {@see NetAppClient::storagePoolName()} for help formatting this field.
*/
function update_replication_sample(
int $replicationReplicationSchedule,
string $formattedReplicationDestinationVolumeParametersStoragePool
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$replicationDestinationVolumeParameters = (new DestinationVolumeParameters())
->setStoragePool($formattedReplicationDestinationVolumeParametersStoragePool);
$replication = (new Replication())
->setReplicationSchedule($replicationReplicationSchedule)
->setDestinationVolumeParameters($replicationDestinationVolumeParameters);
$request = (new UpdateReplicationRequest())
->setUpdateMask($updateMask)
->setReplication($replication);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateReplication($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Replication $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$replicationReplicationSchedule = ReplicationSchedule::REPLICATION_SCHEDULE_UNSPECIFIED;
$formattedReplicationDestinationVolumeParametersStoragePool = NetAppClient::storagePoolName(
'[PROJECT]',
'[LOCATION]',
'[STORAGE_POOL]'
);
update_replication_sample(
$replicationReplicationSchedule,
$formattedReplicationDestinationVolumeParametersStoragePool
);
}
updateSnapshot
Updates the settings of a specific snapshot.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateSnapshotAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\Snapshot;
use Google\Cloud\NetApp\V1\UpdateSnapshotRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_snapshot_sample(): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$snapshot = new Snapshot();
$request = (new UpdateSnapshotRequest())
->setUpdateMask($updateMask)
->setSnapshot($snapshot);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateSnapshot($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Snapshot $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateStoragePool
Updates the storage pool properties with the full spec
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateStoragePoolAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\ServiceLevel;
use Google\Cloud\NetApp\V1\StoragePool;
use Google\Cloud\NetApp\V1\UpdateStoragePoolRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param int $storagePoolServiceLevel Service level of the storage pool
* @param int $storagePoolCapacityGib Capacity in GIB of the pool
* @param string $formattedStoragePoolNetwork VPC Network name.
* Format: projects/{project}/global/networks/{network}
* Please see {@see NetAppClient::networkName()} for help formatting this field.
*/
function update_storage_pool_sample(
int $storagePoolServiceLevel,
int $storagePoolCapacityGib,
string $formattedStoragePoolNetwork
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$storagePool = (new StoragePool())
->setServiceLevel($storagePoolServiceLevel)
->setCapacityGib($storagePoolCapacityGib)
->setNetwork($formattedStoragePoolNetwork);
$request = (new UpdateStoragePoolRequest())
->setUpdateMask($updateMask)
->setStoragePool($storagePool);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateStoragePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var StoragePool $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$storagePoolServiceLevel = ServiceLevel::SERVICE_LEVEL_UNSPECIFIED;
$storagePoolCapacityGib = 0;
$formattedStoragePoolNetwork = NetAppClient::networkName('[PROJECT]', '[NETWORK]');
update_storage_pool_sample(
$storagePoolServiceLevel,
$storagePoolCapacityGib,
$formattedStoragePoolNetwork
);
}
updateVolume
Updates the parameters of a single Volume.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::updateVolumeAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\Protocols;
use Google\Cloud\NetApp\V1\UpdateVolumeRequest;
use Google\Cloud\NetApp\V1\Volume;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $volumeShareName Share name of the volume
* @param string $formattedVolumeStoragePool StoragePool name of the volume
* Please see {@see NetAppClient::storagePoolName()} for help formatting this field.
* @param int $volumeCapacityGib Capacity in GIB of the volume
* @param int $volumeProtocolsElement Protocols required for the volume
*/
function update_volume_sample(
string $volumeShareName,
string $formattedVolumeStoragePool,
int $volumeCapacityGib,
int $volumeProtocolsElement
): void {
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$updateMask = new FieldMask();
$volumeProtocols = [$volumeProtocolsElement,];
$volume = (new Volume())
->setShareName($volumeShareName)
->setStoragePool($formattedVolumeStoragePool)
->setCapacityGib($volumeCapacityGib)
->setProtocols($volumeProtocols);
$request = (new UpdateVolumeRequest())
->setUpdateMask($updateMask)
->setVolume($volume);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $netAppClient->updateVolume($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Volume $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$volumeShareName = '[SHARE_NAME]';
$formattedVolumeStoragePool = NetAppClient::storagePoolName(
'[PROJECT]',
'[LOCATION]',
'[STORAGE_POOL]'
);
$volumeCapacityGib = 0;
$volumeProtocolsElement = Protocols::PROTOCOLS_UNSPECIFIED;
update_volume_sample(
$volumeShareName,
$formattedVolumeStoragePool,
$volumeCapacityGib,
$volumeProtocolsElement
);
}
verifyKmsConfig
Verifies KMS config reachability.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::verifyKmsConfigAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
use Google\Cloud\NetApp\V1\VerifyKmsConfigRequest;
use Google\Cloud\NetApp\V1\VerifyKmsConfigResponse;
/**
* @param string $formattedName Name of the KMS Config to be verified. Please see
* {@see NetAppClient::kmsConfigName()} for help formatting this field.
*/
function verify_kms_config_sample(string $formattedName): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = (new VerifyKmsConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var VerifyKmsConfigResponse $response */
$response = $netAppClient->verifyKmsConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = NetAppClient::kmsConfigName('[PROJECT]', '[LOCATION]', '[KMS_CONFIG]');
verify_kms_config_sample($formattedName);
}
getLocation
Gets information about a location.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::getLocationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function get_location_sample(): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $netAppClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
The async variant is Google\Cloud\NetApp\V1\Client\NetAppClient::listLocationsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetApp\V1\Client\NetAppClient;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function list_locations_sample(): void
{
// Create a client.
$netAppClient = new NetAppClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $netAppClient->listLocations($request);
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
createActiveDirectoryAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createKmsConfigAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createSnapshotAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createStoragePoolAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
createVolumeAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteActiveDirectoryAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteKmsConfigAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteSnapshotAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteStoragePoolAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
deleteVolumeAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
encryptVolumesAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getActiveDirectoryAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getKmsConfigAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getSnapshotAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getStoragePoolAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getVolumeAsync
GuzzleHttp\Promise\PromiseInterface
listActiveDirectoriesAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listKmsConfigsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listReplicationsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listSnapshotsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listStoragePoolsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listVolumesAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
resumeReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
reverseReplicationDirectionAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
revertVolumeAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
stopReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateActiveDirectoryAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateKmsConfigAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateReplicationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateSnapshotAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateStoragePoolAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
updateVolumeAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
verifyKmsConfigAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getLocationAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
listLocationsAsync
optionalArgs = []
array
GuzzleHttp\Promise\PromiseInterface
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
resumeOperation
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.
operationName
string
The name of the long running operation
methodName
string
The name of the method used to start the operation
static::activeDirectoryName
Formats a string containing the fully-qualified path to represent a active_directory resource.
project
string
location
string
activeDirectory
string
string
static::kmsConfigName
Formats a string containing the fully-qualified path to represent a kms_config resource.
project
string
location
string
kmsConfig
string
string
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
project
string
location
string
string
static::networkName
Formats a string containing the fully-qualified path to represent a network resource.
project
string
network
string
string
static::replicationName
Formats a string containing the fully-qualified path to represent a replication resource.
project
string
location
string
volume
string
replication
string
string
static::snapshotName
Formats a string containing the fully-qualified path to represent a snapshot resource.
project
string
location
string
volume
string
snapshot
string
string
static::storagePoolName
Formats a string containing the fully-qualified path to represent a storage_pool resource.
project
string
location
string
storagePool
string
string
static::volumeName
Formats a string containing the fully-qualified path to represent a volume resource.
project
string
location
string
volume
string
string
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- activeDirectory: projects/{project}/locations/{location}/activeDirectories/{active_directory}
- kmsConfig: projects/{project}/locations/{location}/kmsConfigs/{kms_config}
- location: projects/{project}/locations/{location}
- network: projects/{project}/global/networks/{network}
- replication: projects/{project}/locations/{location}/volumes/{volume}/replications/{replication}
- snapshot: projects/{project}/locations/{location}/volumes/{volume}/snapshots/{snapshot}
- storagePool: projects/{project}/locations/{location}/storagePools/{storage_pool}
- 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.
formattedName
string
The formatted name string
template
string
Optional name of template to match
array