Skip to content

Commit

Permalink
feat: Allow v1 api calls for some dataset_service, llm_utility_servic…
Browse files Browse the repository at this point in the history
…e, and prediction_service apis without project and location (#7584)

* feat: add reservation affinity proto
feat: add spot field to Vertex Prediction's Dedicated Resources and Custom Training's Scheduling Strategy
docs: update the description for the deprecated GPU (K80)
PiperOrigin-RevId: 659693494
Source-Link: googleapis/googleapis@f907e15
Source-Link: googleapis/googleapis-gen@9ad32e0
Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiOWFkMzJlMDc4N2U5OGUwY2M2MmVhNGFjNzFmOWI2MTA2NjNmZTdlNSJ9

* feat: add evaluation service proto to v1
PiperOrigin-RevId: 660115183
Source-Link: googleapis/googleapis@9d6389c
Source-Link: googleapis/googleapis-gen@aa9597b
Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiYWE5NTk3YmVhOTAyNzk3YzA0NmI4ZTg2MDBkOTgzYTUwN2IxN2JiMiJ9

* feat: Allow v1 api calls for some dataset_service, llm_utility_service, and prediction_service apis without project and location
PiperOrigin-RevId: 660169876
Source-Link: googleapis/googleapis@1f17bca
Source-Link: googleapis/googleapis-gen@2394698
Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiMjM5NDY5ODZmNWE2ZjRkNDFjYWFkOTgzMWM0MjU5MjEwNDdkNDg0YiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Aug 9, 2024
1 parent 1c33473 commit 5741c30
Show file tree
Hide file tree
Showing 143 changed files with 17,337 additions and 16 deletions.
Binary file modified AiPlatform/metadata/V1/CustomJob.php
Binary file not shown.
Binary file modified AiPlatform/metadata/V1/DatasetService.php
Binary file not shown.
Binary file added AiPlatform/metadata/V1/EvaluationService.php
Binary file not shown.
10 changes: 5 additions & 5 deletions AiPlatform/metadata/V1/LlmUtilityService.php

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

12 changes: 7 additions & 5 deletions AiPlatform/metadata/V1/MachineResources.php

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

Binary file modified AiPlatform/metadata/V1/PredictionService.php
Binary file not shown.
Binary file added AiPlatform/metadata/V1/ReservationAffinity.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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 aiplatform_v1_generated_EvaluationService_EvaluateInstances_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\EvaluationServiceClient;
use Google\Cloud\AIPlatform\V1\EvaluateInstancesRequest;
use Google\Cloud\AIPlatform\V1\EvaluateInstancesResponse;

/**
* Evaluates instances based on a given metric.
*
* @param string $formattedLocation The resource name of the Location to evaluate the instances.
* Format: `projects/{project}/locations/{location}`
* Please see {@see EvaluationServiceClient::locationName()} for help formatting this field.
*/
function evaluate_instances_sample(string $formattedLocation): void
{
// Create a client.
$evaluationServiceClient = new EvaluationServiceClient();

// Prepare the request message.
$request = (new EvaluateInstancesRequest())
->setLocation($formattedLocation);

// Call the API and handle any network failures.
try {
/** @var EvaluateInstancesResponse $response */
$response = $evaluationServiceClient->evaluateInstances($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
{
$formattedLocation = EvaluationServiceClient::locationName('[PROJECT]', '[LOCATION]');

evaluate_instances_sample($formattedLocation);
}
// [END aiplatform_v1_generated_EvaluationService_EvaluateInstances_sync]
72 changes: 72 additions & 0 deletions AiPlatform/samples/V1/EvaluationServiceClient/get_iam_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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 aiplatform_v1_generated_EvaluationService_GetIamPolicy_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\EvaluationServiceClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;

/**
* Gets the access control policy for a resource. Returns an empty policy
if the resource exists and does not have a policy set.
*
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$evaluationServiceClient = new EvaluationServiceClient();

// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);

// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $evaluationServiceClient->getIamPolicy($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
{
$resource = '[RESOURCE]';

get_iam_policy_sample($resource);
}
// [END aiplatform_v1_generated_EvaluationService_GetIamPolicy_sync]
57 changes: 57 additions & 0 deletions AiPlatform/samples/V1/EvaluationServiceClient/get_location.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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 aiplatform_v1_generated_EvaluationService_GetLocation_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\EvaluationServiceClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;

/**
* Gets information about a location.
*
* 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.
$evaluationServiceClient = new EvaluationServiceClient();

// Prepare the request message.
$request = new GetLocationRequest();

// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $evaluationServiceClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END aiplatform_v1_generated_EvaluationService_GetLocation_sync]
62 changes: 62 additions & 0 deletions AiPlatform/samples/V1/EvaluationServiceClient/list_locations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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 aiplatform_v1_generated_EvaluationService_ListLocations_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\EvaluationServiceClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;

/**
* Lists information about the supported locations for this service.
*
* 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.
$evaluationServiceClient = new EvaluationServiceClient();

// Prepare the request message.
$request = new ListLocationsRequest();

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $evaluationServiceClient->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());
}
}
// [END aiplatform_v1_generated_EvaluationService_ListLocations_sync]
77 changes: 77 additions & 0 deletions AiPlatform/samples/V1/EvaluationServiceClient/set_iam_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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 aiplatform_v1_generated_EvaluationService_SetIamPolicy_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\EvaluationServiceClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

/**
* Sets the access control policy on the specified resource. Replaces
any existing policy.
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
errors.
*
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$evaluationServiceClient = new EvaluationServiceClient();

// Prepare the request message.
$policy = new Policy();
$request = (new SetIamPolicyRequest())
->setResource($resource)
->setPolicy($policy);

// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $evaluationServiceClient->setIamPolicy($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
{
$resource = '[RESOURCE]';

set_iam_policy_sample($resource);
}
// [END aiplatform_v1_generated_EvaluationService_SetIamPolicy_sync]
Loading

0 comments on commit 5741c30

Please sign in to comment.