Skip to content

Commit

Permalink
feat: Added new SSL modes ALLOW_UNENCRYPTED_AND_ENCRYPTED, ENCRYPTED_…
Browse files Browse the repository at this point in the history
…ONLY (#6357)

feat: Added ClusterView supporting more granular view of continuous backups
feat: Added new SSL modes ALLOW_UNENCRYPTED_AND_ENCRYPTED, ENCRYPTED_ONLY
feat: Added users API
feat: Added fault injection API
feat: Added instance update policy
feat: Added cluster network config
fix: Deprecated SSL modes SSL_MODE_ALLOW, SSL_MODE_REQUIRE, SSL_MODE_VERIFY_CA
PiperOrigin-RevId: 539728897
Source-Link: googleapis/googleapis@3fcf0b3
Source-Link: googleapis/googleapis-gen@8001a89
Copy-Tag: eyJwIjoiQWxsb3lEYi8uT3dsQm90LnlhbWwiLCJoIjoiODAwMWE4OTdkNDYzYzk1YmJjZjZlNzk1ZGNjOTNjNTgxODBjMDYyMiJ9

* feat: Added new SSL modes ALLOW_UNENCRYPTED_AND_ENCRYPTED, ENCRYPTED_ONLY
feat: Added support for continuous backups
feat: Added support for cross-region replication (secondary clusters/instances and promotion)
feat: Added users API
feat: Added fault injection API
fix: Deprecated SSL modes SSL_MODE_ALLOW, SSL_MODE_REQUIRE, SSL_MODE_VERIFY_CA
PiperOrigin-RevId: 539728978
Source-Link: googleapis/googleapis@cd89742
Source-Link: googleapis/googleapis-gen@87e9145
Copy-Tag: eyJwIjoiQWxsb3lEYi8uT3dsQm90LnlhbWwiLCJoIjoiODdlOTE0NTJkY2UxM2MzZTE3NmEyMDkzMDY1YjNlMzhlMmIwZGM5MCJ9
  • Loading branch information
gcf-owl-bot[bot] authored Jun 13, 2023
1 parent 40aab37 commit 277075e
Show file tree
Hide file tree
Showing 141 changed files with 15,604 additions and 415 deletions.
Binary file modified AlloyDb/metadata/V1/Resources.php
Binary file not shown.
Binary file modified AlloyDb/metadata/V1/Service.php
Binary file not shown.
Binary file modified AlloyDb/metadata/V1Alpha/Resources.php
Binary file not shown.
Binary file modified AlloyDb/metadata/V1Alpha/Service.php
Binary file not shown.
Binary file modified AlloyDb/metadata/V1Beta/Resources.php
Binary file not shown.
Binary file modified AlloyDb/metadata/V1Beta/Service.php
Binary file not shown.
2 changes: 1 addition & 1 deletion AlloyDb/samples/V1/AlloyDBAdminClient/create_backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $backupId ID of the requesting object.
* @param string $formattedBackupClusterName The full resource name of the backup source cluster
* (e.g., projects/<project>/locations/<location>/clusters/<cluster_id>). Please see
* (e.g., projects/{project}/locations/{region}/clusters/{cluster_id}). Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function create_backup_sample(
Expand Down
2 changes: 1 addition & 1 deletion AlloyDb/samples/V1/AlloyDBAdminClient/create_cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Creates a new Cluster in a given project and location.
*
* @param string $formattedParent The name of the parent resource. For the required format, see the
* @param string $formattedParent The location of the new cluster. For the required format, see the
* comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $clusterId ID of the requesting object.
Expand Down
101 changes: 101 additions & 0 deletions AlloyDb/samples/V1/AlloyDBAdminClient/create_secondary_cluster.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START alloydb_v1_generated_AlloyDBAdmin_CreateSecondaryCluster_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\CreateSecondaryClusterRequest;
use Google\Rpc\Status;

/**
* Creates a cluster of type SECONDARY in the given location using
* the primary cluster as the source.
*
* @param string $formattedParent The location of the new cluster. For the required
* format, see the comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $clusterId ID of the requesting object (the secondary cluster).
* @param string $formattedClusterNetwork The resource link for the VPC network in which cluster resources
* are created and from which they are accessible via Private IP. The network
* must belong to the same project as the cluster. It is specified in the
* form: "projects/{project_number}/global/networks/{network_id}". This is
* required to create a cluster. It can be updated, but it cannot be removed. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function create_secondary_cluster_sample(
string $formattedParent,
string $clusterId,
string $formattedClusterNetwork
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();

// Prepare the request message.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
$request = (new CreateSecondaryClusterRequest())
->setParent($formattedParent)
->setClusterId($clusterId)
->setCluster($cluster);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryCluster($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
$clusterId = '[CLUSTER_ID]';
$formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]');

create_secondary_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork);
}
// [END alloydb_v1_generated_AlloyDBAdmin_CreateSecondaryCluster_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START alloydb_v1_generated_AlloyDBAdmin_CreateSecondaryInstance_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateSecondaryInstanceRequest;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\Instance\InstanceType;
use Google\Rpc\Status;

/**
* Creates a new SECONDARY Instance in a given project and location.
*
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $instanceId ID of the requesting object.
* @param int $instanceInstanceType The type of the instance. Specified at creation time.
*/
function create_secondary_instance_sample(
string $formattedParent,
string $instanceId,
int $instanceInstanceType
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();

// Prepare the request message.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
$request = (new CreateSecondaryInstanceRequest())
->setParent($formattedParent)
->setInstanceId($instanceId)
->setInstance($instance);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryInstance($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var Instance $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$instanceId = '[INSTANCE_ID]';
$instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED;

create_secondary_instance_sample($formattedParent, $instanceId, $instanceInstanceType);
}
// [END alloydb_v1_generated_AlloyDBAdmin_CreateSecondaryInstance_sync]
76 changes: 76 additions & 0 deletions AlloyDb/samples/V1/AlloyDBAdminClient/create_user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START alloydb_v1_generated_AlloyDBAdmin_CreateUser_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateUserRequest;
use Google\Cloud\AlloyDb\V1\User;

/**
* Creates a new User in a given project, location, and cluster.
*
* @param string $formattedParent Value for parent. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $userId ID of the requesting object.
*/
function create_user_sample(string $formattedParent, string $userId): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();

// Prepare the request message.
$user = new User();
$request = (new CreateUserRequest())
->setParent($formattedParent)
->setUserId($userId)
->setUser($user);

// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->createUser($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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$userId = '[USER_ID]';

create_user_sample($formattedParent, $userId);
}
// [END alloydb_v1_generated_AlloyDBAdmin_CreateUser_sync]
70 changes: 70 additions & 0 deletions AlloyDb/samples/V1/AlloyDBAdminClient/delete_user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START alloydb_v1_generated_AlloyDBAdmin_DeleteUser_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\DeleteUserRequest;

/**
* Deletes a single User.
*
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the User.name field. Please see
* {@see AlloyDBAdminClient::userName()} for help formatting this field.
*/
function delete_user_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();

// Prepare the request message.
$request = (new DeleteUserRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
$alloyDBAdminClient->deleteUser($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = AlloyDBAdminClient::userName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[USER]');

delete_user_sample($formattedName);
}
// [END alloydb_v1_generated_AlloyDBAdmin_DeleteUser_sync]
Loading

0 comments on commit 277075e

Please sign in to comment.