Reference documentation and code samples for the Google Cloud Service Management V1 Client class ServiceManagerClient.
Service Description: Google Service Management API
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Namespace
Google \ Cloud \ ServiceManagement \ V1 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
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 |
↳ 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 |
↳ 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. |
createService
Creates a new managed service.
A managed service is immutable, and is subject to mandatory 30-day data retention. You cannot move a service or recreate it within 30 days after deletion.
One producer project can own no more than 500 services. For security and reliability purposes, a production service should be hosted in a dedicated producer project.
Operation<response: ManagedService>
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::createServiceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\CreateServiceRequest;
use Google\Cloud\ServiceManagement\V1\ManagedService;
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 create_service_sample(): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$service = new ManagedService();
$request = (new CreateServiceRequest())
->setService($service);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $serviceManagerClient->createService($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ManagedService $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());
}
}
createServiceConfig
Creates a new service configuration (version) for a managed service.
This method only stores the service configuration. To roll out the service configuration to backend systems please call CreateServiceRollout.
Only the 100 most recent service configurations and ones referenced by existing rollouts are kept for each service. The rest will be deleted eventually.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::createServiceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceConfigRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Api\Service |
use Google\ApiCore\ApiException;
use Google\Api\Service;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\CreateServiceConfigRequest;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function create_service_config_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$serviceConfig = new Service();
$request = (new CreateServiceConfigRequest())
->setServiceName($serviceName)
->setServiceConfig($serviceConfig);
// Call the API and handle any network failures.
try {
/** @var Service $response */
$response = $serviceManagerClient->createServiceConfig($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
{
$serviceName = '[SERVICE_NAME]';
create_service_config_sample($serviceName);
}
createServiceRollout
Creates a new service configuration rollout. Based on rollout, the Google Service Management will roll out the service configurations to different backend services. For example, the logging configuration will be pushed to Google Cloud Logging.
Please note that any previous pending and running Rollouts and associated Operations will be automatically cancelled so that the latest Rollout will not be blocked by previous Rollouts.
Only the 100 most recent (in any state) and the last 10 successful (if not already part of the set of 100 most recent) rollouts are kept for each service. The rest will be deleted eventually.
Operation<response: Rollout>
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::createServiceRolloutAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceRolloutRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\CreateServiceRolloutRequest;
use Google\Cloud\ServiceManagement\V1\Rollout;
use Google\Rpc\Status;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function create_service_rollout_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$rollout = new Rollout();
$request = (new CreateServiceRolloutRequest())
->setServiceName($serviceName)
->setRollout($rollout);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $serviceManagerClient->createServiceRollout($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Rollout $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
{
$serviceName = '[SERVICE_NAME]';
create_service_rollout_sample($serviceName);
}
deleteService
Deletes a managed service. This method will change the service to the
Soft-Delete
state for 30 days. Within this period, service producers may
call
UndeleteService
to restore the service. After 30 days, the service will be permanently
deleted.
Operation<response: google.protobuf.Empty>
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::deleteServiceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\DeleteServiceRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\DeleteServiceRequest;
use Google\Rpc\Status;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function delete_service_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new DeleteServiceRequest())
->setServiceName($serviceName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $serviceManagerClient->deleteService($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
{
$serviceName = '[SERVICE_NAME]';
delete_service_sample($serviceName);
}
generateConfigReport
Generates and returns a report (errors, warnings and changes from existing configurations) associated with GenerateConfigReportRequest.new_value
If GenerateConfigReportRequest.old_value is specified, GenerateConfigReportRequest will contain a single ChangeReport based on the comparison between GenerateConfigReportRequest.new_value and GenerateConfigReportRequest.old_value. If GenerateConfigReportRequest.old_value is not specified, this method will compare GenerateConfigReportRequest.new_value with the last pushed service configuration.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::generateConfigReportAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GenerateConfigReportRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\ServiceManagement\V1\GenerateConfigReportResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\GenerateConfigReportRequest;
use Google\Cloud\ServiceManagement\V1\GenerateConfigReportResponse;
use Google\Protobuf\Any;
/**
* 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 generate_config_report_sample(): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$newConfig = new Any();
$request = (new GenerateConfigReportRequest())
->setNewConfig($newConfig);
// Call the API and handle any network failures.
try {
/** @var GenerateConfigReportResponse $response */
$response = $serviceManagerClient->generateConfigReport($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getService
Gets a managed service. Authentication is required unless the service is public.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::getServiceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\ServiceManagement\V1\ManagedService |
use Google\ApiCore\ApiException;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\GetServiceRequest;
use Google\Cloud\ServiceManagement\V1\ManagedService;
/**
* @param string $serviceName The name of the service. See the `ServiceManager` overview for
* naming requirements. For example: `example.googleapis.com`.
*/
function get_service_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new GetServiceRequest())
->setServiceName($serviceName);
// Call the API and handle any network failures.
try {
/** @var ManagedService $response */
$response = $serviceManagerClient->getService($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
{
$serviceName = '[SERVICE_NAME]';
get_service_sample($serviceName);
}
getServiceConfig
Gets a service configuration (version) for a managed service.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::getServiceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceConfigRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Api\Service |
use Google\ApiCore\ApiException;
use Google\Api\Service;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\GetServiceConfigRequest;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
* @param string $configId The id of the service configuration resource.
*
* This field must be specified for the server to return all fields, including
* `SourceInfo`.
*/
function get_service_config_sample(string $serviceName, string $configId): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new GetServiceConfigRequest())
->setServiceName($serviceName)
->setConfigId($configId);
// Call the API and handle any network failures.
try {
/** @var Service $response */
$response = $serviceManagerClient->getServiceConfig($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
{
$serviceName = '[SERVICE_NAME]';
$configId = '[CONFIG_ID]';
get_service_config_sample($serviceName, $configId);
}
getServiceRollout
Gets a service configuration rollout.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::getServiceRolloutAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceRolloutRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\ServiceManagement\V1\Rollout |
use Google\ApiCore\ApiException;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\GetServiceRolloutRequest;
use Google\Cloud\ServiceManagement\V1\Rollout;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
* @param string $rolloutId The id of the rollout resource.
*/
function get_service_rollout_sample(string $serviceName, string $rolloutId): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new GetServiceRolloutRequest())
->setServiceName($serviceName)
->setRolloutId($rolloutId);
// Call the API and handle any network failures.
try {
/** @var Rollout $response */
$response = $serviceManagerClient->getServiceRollout($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
{
$serviceName = '[SERVICE_NAME]';
$rolloutId = '[ROLLOUT_ID]';
get_service_rollout_sample($serviceName, $rolloutId);
}
listServiceConfigs
Lists the history of the service configuration for a managed service, from the newest to the oldest.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::listServiceConfigsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServiceConfigsRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Api\Service;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\ListServiceConfigsRequest;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function list_service_configs_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new ListServiceConfigsRequest())
->setServiceName($serviceName);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $serviceManagerClient->listServiceConfigs($request);
/** @var Service $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
{
$serviceName = '[SERVICE_NAME]';
list_service_configs_sample($serviceName);
}
listServiceRollouts
Lists the history of the service configuration rollouts for a managed service, from the newest to the oldest.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::listServiceRolloutsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServiceRolloutsRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\ListServiceRolloutsRequest;
use Google\Cloud\ServiceManagement\V1\Rollout;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
* @param string $filter Use `filter` to return subset of rollouts.
* The following filters are supported:
*
* -- By [status]
* [google.api.servicemanagement.v1.Rollout.RolloutStatus]. For example,
* `filter='status=SUCCESS'`
*
* -- By [strategy]
* [google.api.servicemanagement.v1.Rollout.strategy]. For example,
* `filter='strategy=TrafficPercentStrategy'`
*/
function list_service_rollouts_sample(string $serviceName, string $filter): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new ListServiceRolloutsRequest())
->setServiceName($serviceName)
->setFilter($filter);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $serviceManagerClient->listServiceRollouts($request);
/** @var Rollout $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
{
$serviceName = '[SERVICE_NAME]';
$filter = '[FILTER]';
list_service_rollouts_sample($serviceName, $filter);
}
listServices
Lists managed services.
Returns all public services. For authenticated users, also returns all services the calling user has "servicemanagement.services.get" permission for.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::listServicesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServicesRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\ListServicesRequest;
use Google\Cloud\ServiceManagement\V1\ManagedService;
/**
* 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_services_sample(): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = new ListServicesRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $serviceManagerClient->listServices($request);
/** @var ManagedService $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());
}
}
submitConfigSource
Creates a new service configuration (version) for a managed service based on user-supplied configuration source files (for example: OpenAPI Specification). This method stores the source configurations as well as the generated service configuration. To rollout the service configuration to other services, please call CreateServiceRollout.
Only the 100 most recent configuration sources and ones referenced by existing service configurtions are kept for each service. The rest will be deleted eventually.
Operation<response: SubmitConfigSourceResponse>
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::submitConfigSourceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\SubmitConfigSourceRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\ConfigSource;
use Google\Cloud\ServiceManagement\V1\SubmitConfigSourceRequest;
use Google\Cloud\ServiceManagement\V1\SubmitConfigSourceResponse;
use Google\Rpc\Status;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function submit_config_source_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$configSource = new ConfigSource();
$request = (new SubmitConfigSourceRequest())
->setServiceName($serviceName)
->setConfigSource($configSource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $serviceManagerClient->submitConfigSource($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var SubmitConfigSourceResponse $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
{
$serviceName = '[SERVICE_NAME]';
submit_config_source_sample($serviceName);
}
undeleteService
Revives a previously deleted managed service. The method restores the service using the configuration at the time the service was deleted.
The target service must exist and must have been deleted within the last 30 days.
Operation<response: UndeleteServiceResponse>
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::undeleteServiceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\UndeleteServiceRequest
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. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
use Google\Cloud\ServiceManagement\V1\UndeleteServiceRequest;
use Google\Cloud\ServiceManagement\V1\UndeleteServiceResponse;
use Google\Rpc\Status;
/**
* @param string $serviceName The name of the service. See the
* [overview](https://cloud.google.com/service-management/overview) for naming
* requirements. For example: `example.googleapis.com`.
*/
function undelete_service_sample(string $serviceName): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new UndeleteServiceRequest())
->setServiceName($serviceName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $serviceManagerClient->undeleteService($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var UndeleteServiceResponse $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
{
$serviceName = '[SERVICE_NAME]';
undelete_service_sample($serviceName);
}
getIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::getIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
/**
* @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.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $serviceManagerClient->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);
}
setIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::setIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
/**
* @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.
$serviceManagerClient = new ServiceManagerClient();
// 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 = $serviceManagerClient->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);
}
testIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
The async variant is Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient::testIamPermissionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
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. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\ServiceManagement\V1\Client\ServiceManagerClient;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$serviceManagerClient = new ServiceManagerClient();
// Prepare the request message.
$permissions = [$permissionsElement,];
$request = (new TestIamPermissionsRequest())
->setResource($resource)
->setPermissions($permissions);
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $serviceManagerClient->testIamPermissions($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]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
createServiceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createServiceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createServiceRolloutAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\CreateServiceRolloutRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteServiceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\DeleteServiceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
generateConfigReportAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GenerateConfigReportRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getServiceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getServiceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getServiceRolloutAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\GetServiceRolloutRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listServiceConfigsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServiceConfigsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listServiceRolloutsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServiceRolloutsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listServicesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\ListServicesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
submitConfigSourceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\SubmitConfigSourceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
undeleteServiceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ServiceManagement\V1\UndeleteServiceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
setIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
testIamPermissionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
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.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |