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: [Config] added annotations #7923

Merged
merged 2 commits into from
Dec 12, 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 Config/metadata/V1/Config.php
Binary file not shown.
28 changes: 20 additions & 8 deletions Config/samples/V1/ConfigClient/create_deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,26 @@
/**
* Creates a [Deployment][google.cloud.config.v1.Deployment].
*
* @param string $formattedParent The parent in whose context the Deployment is created. The parent
* value is in the format: 'projects/{project_id}/locations/{location}'. Please see
* {@see ConfigClient::locationName()} for help formatting this field.
* @param string $deploymentId The Deployment ID.
* @param string $formattedParent The parent in whose context the Deployment is created. The parent
* value is in the format: 'projects/{project_id}/locations/{location}'. Please see
* {@see ConfigClient::locationName()} for help formatting this field.
* @param string $deploymentId The Deployment ID.
* @param string $formattedDeploymentServiceAccount User-specified Service Account (SA) credentials to be used when
* actuating resources.
* Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`
* Please see {@see ConfigClient::serviceAccountName()} for help formatting this field.
*/
function create_deployment_sample(string $formattedParent, string $deploymentId): void
{
function create_deployment_sample(
string $formattedParent,
string $deploymentId,
string $formattedDeploymentServiceAccount
): void {
// Create a client.
$configClient = new ConfigClient();

// Prepare the request message.
$deployment = new Deployment();
$deployment = (new Deployment())
->setServiceAccount($formattedDeploymentServiceAccount);
$request = (new CreateDeploymentRequest())
->setParent($formattedParent)
->setDeploymentId($deploymentId)
Expand Down Expand Up @@ -83,7 +91,11 @@ function callSample(): void
{
$formattedParent = ConfigClient::locationName('[PROJECT]', '[LOCATION]');
$deploymentId = '[DEPLOYMENT_ID]';
$formattedDeploymentServiceAccount = ConfigClient::serviceAccountName(
'[PROJECT]',
'[SERVICE_ACCOUNT]'
);

create_deployment_sample($formattedParent, $deploymentId);
create_deployment_sample($formattedParent, $deploymentId, $formattedDeploymentServiceAccount);
}
// [END config_v1_generated_Config_CreateDeployment_sync]
25 changes: 18 additions & 7 deletions Config/samples/V1/ConfigClient/create_preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,24 @@
/**
* Creates a [Preview][google.cloud.config.v1.Preview].
*
* @param string $formattedParent The parent in whose context the Preview is created. The parent
* value is in the format: 'projects/{project_id}/locations/{location}'. Please see
* {@see ConfigClient::locationName()} for help formatting this field.
* @param string $formattedParent The parent in whose context the Preview is created. The parent
* value is in the format: 'projects/{project_id}/locations/{location}'. Please see
* {@see ConfigClient::locationName()} for help formatting this field.
* @param string $formattedPreviewServiceAccount User-specified Service Account (SA) credentials to be used when
* previewing resources.
* Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`
* Please see {@see ConfigClient::serviceAccountName()} for help formatting this field.
*/
function create_preview_sample(string $formattedParent): void
{
function create_preview_sample(
string $formattedParent,
string $formattedPreviewServiceAccount
): void {
// Create a client.
$configClient = new ConfigClient();

// Prepare the request message.
$preview = new Preview();
$preview = (new Preview())
->setServiceAccount($formattedPreviewServiceAccount);
$request = (new CreatePreviewRequest())
->setParent($formattedParent)
->setPreview($preview);
Expand Down Expand Up @@ -80,7 +87,11 @@ function create_preview_sample(string $formattedParent): void
function callSample(): void
{
$formattedParent = ConfigClient::locationName('[PROJECT]', '[LOCATION]');
$formattedPreviewServiceAccount = ConfigClient::serviceAccountName(
'[PROJECT]',
'[SERVICE_ACCOUNT]'
);

create_preview_sample($formattedParent);
create_preview_sample($formattedParent, $formattedPreviewServiceAccount);
}
// [END config_v1_generated_Config_CreatePreview_sync]
2 changes: 1 addition & 1 deletion Config/samples/V1/ConfigClient/list_resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Google\Cloud\Config\V1\Resource;

/**
* Lists [Resource][google.cloud.config.v1.Resource]s in a given revision.
* Lists [Resources][google.cloud.config.v1.Resource] in a given revision.
*
* @param string $formattedParent The parent in whose context the Resources are listed. The parent
* value is in the format:
Expand Down
33 changes: 26 additions & 7 deletions Config/samples/V1/ConfigClient/update_deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
/**
* Updates a [Deployment][google.cloud.config.v1.Deployment].
*
* 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.
* @param string $formattedDeploymentServiceAccount User-specified Service Account (SA) credentials to be used when
* actuating resources.
* Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`
* Please see {@see ConfigClient::serviceAccountName()} for help formatting this field.
*/
function update_deployment_sample(): void
function update_deployment_sample(string $formattedDeploymentServiceAccount): void
{
// Create a client.
$configClient = new ConfigClient();

// Prepare the request message.
$deployment = new Deployment();
$deployment = (new Deployment())
->setServiceAccount($formattedDeploymentServiceAccount);
$request = (new UpdateDeploymentRequest())
->setDeployment($deployment);

Expand All @@ -68,4 +68,23 @@ function update_deployment_sample(): void
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
{
$formattedDeploymentServiceAccount = ConfigClient::serviceAccountName(
'[PROJECT]',
'[SERVICE_ACCOUNT]'
);

update_deployment_sample($formattedDeploymentServiceAccount);
}
// [END config_v1_generated_Config_UpdateDeployment_sync]
2 changes: 1 addition & 1 deletion Config/src/V1/Client/ConfigClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ public function listPreviews(ListPreviewsRequest $request, array $callOptions =
}

/**
* Lists [Resource][google.cloud.config.v1.Resource]s in a given revision.
* Lists [Resources][google.cloud.config.v1.Resource] in a given revision.
*
* The async variant is {@see ConfigClient::listResourcesAsync()} .
*
Expand Down
14 changes: 7 additions & 7 deletions Config/src/V1/Deployment.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Config/src/V1/ListPreviewsResponse.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Config/src/V1/ListResourcesResponse.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Config/src/V1/OperationMetadata.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading