Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [SqlAdmin] Support for the AcquireSsrsLease and ReleaseSsrsLease RPCs #7273

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified SqlAdmin/metadata/V1/CloudSqlInstances.php
Binary file not shown.
Binary file modified SqlAdmin/metadata/V1/CloudSqlResources.php
Binary file not shown.
Binary file modified SqlAdmin/metadata/V1Beta4/CloudSql.php
Binary file not shown.
Binary file modified SqlAdmin/metadata/V1Beta4/CloudSqlResources.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/*
* Copyright 2024 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 sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesAcquireSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseResponse;

/**
* Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
*
* @param string $instance Cloud SQL instance ID. This doesn't include the project ID. It's
* composed of lowercase letters, numbers, and hyphens, and it must start with
* a letter. The total length must be 98 characters or less (Example:
* instance-id).
* @param string $project Project ID of the project that contains the instance (Example:
* project-id).
*/
function acquire_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();

// Prepare the request message.
$body = new InstancesAcquireSsrsLeaseRequest();
$request = (new SqlInstancesAcquireSsrsLeaseRequest())
->setInstance($instance)
->setProject($project)
->setBody($body);

// Call the API and handle any network failures.
try {
/** @var SqlInstancesAcquireSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->acquireSsrsLease($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
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';

acquire_ssrs_lease_sample($instance, $project);
}
// [END sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2024 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 sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseResponse;

/**
* Release a lease for the setup of SQL Server Reporting Services (SSRS).
*
* @param string $instance The Cloud SQL instance ID. This doesn't include the project ID.
* The instance ID contains lowercase letters, numbers, and hyphens, and it
* must start with a letter. This ID can have a maximum length of 98
* characters.
* @param string $project The project ID that contains the instance.
*/
function release_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();

// Prepare the request message.
$request = (new SqlInstancesReleaseSsrsLeaseRequest())
->setInstance($instance)
->setProject($project);

// Call the API and handle any network failures.
try {
/** @var SqlInstancesReleaseSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->releaseSsrsLease($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
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';

release_ssrs_lease_sample($instance, $project);
}
// [END sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/*
* Copyright 2024 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 sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesAcquireSsrsLeaseResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;

/**
* Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
*
* @param string $instance Cloud SQL instance ID. This doesn't include the project ID. It's
* composed of lowercase letters, numbers, and hyphens, and it must start with
* a letter. The total length must be 98 characters or less (Example:
* instance-id).
* @param string $project ID of the project that contains the instance (Example:
* project-id).
*/
function acquire_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();

// Call the API and handle any network failures.
try {
/** @var SqlInstancesAcquireSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->acquireSsrsLease($instance, $project);
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
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';

acquire_ssrs_lease_sample($instance, $project);
}
// [END sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/*
* Copyright 2024 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 sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesReleaseSsrsLeaseResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;

/**
* Release a lease for the setup of SQL Server Reporting Services (SSRS).
*
* @param string $instance The Cloud SQL instance ID. This doesn't include the project ID.
* It's composed of lowercase letters, numbers, and hyphens, and it must start
* with a letter. The total length must be 98 characters or less (Example:
* instance-id).
* @param string $project The ID of the project that contains the instance (Example:
* project-id).
*/
function release_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();

// Call the API and handle any network failures.
try {
/** @var SqlInstancesReleaseSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->releaseSsrsLease($instance, $project);
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
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';

release_ssrs_lease_sample($instance, $project);
}
// [END sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_sync]
Loading
Loading