Reference documentation and code samples for the Google Cloud Security Compliance V1 Client class ConfigClient.
Service Description: Config Service manages compliance frameworks, cloud controls, and their configurations.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ CloudSecurityCompliance \ V1 \ ClientMethods
__construct
Constructor.
options
array| Google\ApiCore\Options\ClientOptions
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
FetchAuthTokenInterface|CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface
or Google\ApiCore\CredentialsWrapper
object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\CloudSecurityCompliance\V1\ConfigClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new ConfigClient(['credentials' => $creds]);
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
↳ 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 false
.
↳ 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 rest
or grpc
. Defaults to grpc
if gRPC support is detected on the system. Advanced usage
: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface
object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.
↳ 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.
↳ logger
false|LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag
↳ universeDomain
string
The service domain for the client. Defaults to 'googleapis.com'.
createCloudControl
Creates a custom cloud control in a given parent resource.
You can't create built-in cloud controls because those are managed by Google.
The async variant is ConfigClient::createCloudControlAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\CreateCloudControlRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\CloudControl;
use Google\Cloud\CloudSecurityCompliance\V1\CreateCloudControlRequest;
/**
* @param string $formattedParent The parent resource name, in the format
* `organizations/{organization}/locations/{location}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
* @param string $cloudControlId The identifier for the cloud control, which is the last segment
* of the cloud control name. The format is
* `^[a-zA-Z][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$`.
* @param string $cloudControlName Identifier. The name of the cloud control, in the format
* `organizations/{organization}/locations/{location}/cloudControls/{cloud_control_id}`.
* The only supported location is `global`.
*/
function create_cloud_control_sample(
string $formattedParent,
string $cloudControlId,
string $cloudControlName
): void {
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$cloudControl = (new CloudControl())
->setName($cloudControlName);
$request = (new CreateCloudControlRequest())
->setParent($formattedParent)
->setCloudControlId($cloudControlId)
->setCloudControl($cloudControl);
// Call the API and handle any network failures.
try {
/** @var CloudControl $response */
$response = $configClient->createCloudControl($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 = ConfigClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
$cloudControlId = '[CLOUD_CONTROL_ID]';
$cloudControlName = '[NAME]';
create_cloud_control_sample($formattedParent, $cloudControlId, $cloudControlName);
}
createFramework
Creates a custom framework in a given parent resource.
You can't create built-in frameworks because those are managed by Google.
The async variant is ConfigClient::createFrameworkAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\CreateFrameworkRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\CreateFrameworkRequest;
use Google\Cloud\CloudSecurityCompliance\V1\Framework;
/**
* @param string $formattedParent The parent resource name, in the format
* `organizations/{organization}/locations/{location}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
* @param string $frameworkId The identifier (ID) of the framework. The ID is not the full name
* of the framework; it's the last part of the full name of the framework.
* @param string $frameworkName Identifier. The name of the framework, in the format
* `organizations/{organization}/locations/{location}/frameworks/{framework_id}`.
* The only supported location is `global`.
*/
function create_framework_sample(
string $formattedParent,
string $frameworkId,
string $frameworkName
): void {
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$framework = (new Framework())
->setName($frameworkName);
$request = (new CreateFrameworkRequest())
->setParent($formattedParent)
->setFrameworkId($frameworkId)
->setFramework($framework);
// Call the API and handle any network failures.
try {
/** @var Framework $response */
$response = $configClient->createFramework($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 = ConfigClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
$frameworkId = '[FRAMEWORK_ID]';
$frameworkName = '[NAME]';
create_framework_sample($formattedParent, $frameworkId, $frameworkName);
}
deleteCloudControl
Deletes a custom cloud control, including all its major and minor revisions. Consider the following:
- You can't delete built-in cloud controls. You can only delete cloud
controls with type
CUSTOM. - You can't delete cloud controls if any of the versions are referenced by a framework.
- You can't restore a deleted cloud control. This action is permanent.
The async variant is ConfigClient::deleteCloudControlAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\DeleteCloudControlRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\DeleteCloudControlRequest;
/**
* @param string $formattedName The name of the cloud control to delete, in the format
* `organizations/{organization}/locations/{location}/CloudControls/{CloudControl}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::cloudControlName()} for help formatting this field.
*/
function delete_cloud_control_sample(string $formattedName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new DeleteCloudControlRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$configClient->deleteCloudControl($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 = ConfigClient::cloudControlName('[ORGANIZATION]', '[LOCATION]', '[CLOUD_CONTROL]');
delete_cloud_control_sample($formattedName);
}
deleteFramework
Deletes a custom framework, including all its major and minor revisions. Consider the following:
- You can't delete built-in frameworks. You can only delete frameworks
with type
CUSTOM. - You can't delete frameworks that are deployed to a resource.
- You can't restore a deleted framework. This action is permanent.
The async variant is ConfigClient::deleteFrameworkAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\DeleteFrameworkRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\DeleteFrameworkRequest;
/**
* @param string $formattedName The name of the resource, in the format
* `organizations/{organization}/locations/{location}/frameworks/{framework}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::frameworkName()} for help formatting this field.
*/
function delete_framework_sample(string $formattedName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new DeleteFrameworkRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$configClient->deleteFramework($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 = ConfigClient::frameworkName('[ORGANIZATION]', '[LOCATION]', '[FRAMEWORK]');
delete_framework_sample($formattedName);
}
getCloudControl
Gets details about a cloud control.
This method retrieves the latest major version of a cloud control that you identify by name.
By default, the latest major version of the cloud control is returned.
To retrieve a specific major version, include major_revision_id
in
the request.
The async variant is ConfigClient::getCloudControlAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\GetCloudControlRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\CloudControl;
use Google\Cloud\CloudSecurityCompliance\V1\GetCloudControlRequest;
/**
* @param string $formattedName The name of the cloud control to retrieve, in the format
* `organizations/{organization}/locations/{location}/cloudControls/{cloud_control}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::cloudControlName()} for help formatting this field.
*/
function get_cloud_control_sample(string $formattedName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new GetCloudControlRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var CloudControl $response */
$response = $configClient->getCloudControl($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
{
$formattedName = ConfigClient::cloudControlName('[ORGANIZATION]', '[LOCATION]', '[CLOUD_CONTROL]');
get_cloud_control_sample($formattedName);
}
getFramework
Gets details about a framework.
This method retrieves the latest major version of the framework.
To retrieve a specific major version, include major_revision_id
in
the request.
The async variant is ConfigClient::getFrameworkAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\GetFrameworkRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\Framework;
use Google\Cloud\CloudSecurityCompliance\V1\GetFrameworkRequest;
/**
* @param string $formattedName The name of the framework to retrieve, in the format
* `organizations/{organization}/locations/{location}/frameworks/{framework_id}`
* The only supported location is `global`. Please see
* {@see ConfigClient::frameworkName()} for help formatting this field.
*/
function get_framework_sample(string $formattedName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new GetFrameworkRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Framework $response */
$response = $configClient->getFramework($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
{
$formattedName = ConfigClient::frameworkName('[ORGANIZATION]', '[LOCATION]', '[FRAMEWORK]');
get_framework_sample($formattedName);
}
listCloudControls
Lists the cloud controls (both built-in and custom) that are available in a given parent resource. The latest major version of each cloud control is returned.
This method supports pagination.
The async variant is ConfigClient::listCloudControlsAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\ListCloudControlsRequest
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.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\CloudControl;
use Google\Cloud\CloudSecurityCompliance\V1\ListCloudControlsRequest;
/**
* @param string $formattedParent The parent resource name, in the format
* `organizations/{organization}/locations/{location}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
*/
function list_cloud_controls_sample(string $formattedParent): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new ListCloudControlsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $configClient->listCloudControls($request);
/** @var CloudControl $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
{
$formattedParent = ConfigClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
list_cloud_controls_sample($formattedParent);
}
listFrameworks
Lists the frameworks (both built-in and custom) that are available within the parent resource. The latest major version of each framework is returned.
This method supports pagination.
The async variant is ConfigClient::listFrameworksAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\ListFrameworksRequest
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.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\Framework;
use Google\Cloud\CloudSecurityCompliance\V1\ListFrameworksRequest;
/**
* @param string $formattedParent The parent resource name, in the format
* `organizations/{organization}/locations/{location}`.
* The only supported location is `global`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
*/
function list_frameworks_sample(string $formattedParent): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = (new ListFrameworksRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $configClient->listFrameworks($request);
/** @var Framework $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
{
$formattedParent = ConfigClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
list_frameworks_sample($formattedParent);
}
updateCloudControl
Updates a custom cloud control.
This method allows for partial updates of a cloud control. Use the update_mask
to specify which fields to update. Consider the following:
- If you provide an
update_mask, only the fields that are specified in the mask are updated. - If you don't provide an
update_mask, all the fields that are present in the request'scloud_controlbody are used to overwrite the existing resource.
You can only update cloud controls with the CUSTOM
type.
A successful update creates a new version of the cloud control.
The async variant is ConfigClient::updateCloudControlAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\UpdateCloudControlRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\CloudControl;
use Google\Cloud\CloudSecurityCompliance\V1\UpdateCloudControlRequest;
/**
* @param string $cloudControlName Identifier. The name of the cloud control, in the format
* `organizations/{organization}/locations/{location}/cloudControls/{cloud_control_id}`.
* The only supported location is `global`.
*/
function update_cloud_control_sample(string $cloudControlName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$cloudControl = (new CloudControl())
->setName($cloudControlName);
$request = (new UpdateCloudControlRequest())
->setCloudControl($cloudControl);
// Call the API and handle any network failures.
try {
/** @var CloudControl $response */
$response = $configClient->updateCloudControl($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
{
$cloudControlName = '[NAME]';
update_cloud_control_sample($cloudControlName);
}
updateFramework
Updates a custom framework.
This method allows for partial updates of a framework. Use the update_mask
to specify which fields to update. Consider the following:
- If you provide an
update_mask, only the fields that are specified in the mask are updated. - If you don't provide an
update_mask, all the fields that are present in the request'sframeworkbody are used to overwrite the existing resource.
You can only update frameworks with the CUSTOM
type.
A successful update creates a new version of the framework.
The async variant is ConfigClient::updateFrameworkAsync() .
request
Google\Cloud\CloudSecurityCompliance\V1\UpdateFrameworkRequest
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\CloudSecurityCompliance\V1\Framework;
use Google\Cloud\CloudSecurityCompliance\V1\UpdateFrameworkRequest;
/**
* @param string $frameworkName Identifier. The name of the framework, in the format
* `organizations/{organization}/locations/{location}/frameworks/{framework_id}`.
* The only supported location is `global`.
*/
function update_framework_sample(string $frameworkName): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$framework = (new Framework())
->setName($frameworkName);
$request = (new UpdateFrameworkRequest())
->setFramework($framework);
// Call the API and handle any network failures.
try {
/** @var Framework $response */
$response = $configClient->updateFramework($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
{
$frameworkName = '[NAME]';
update_framework_sample($frameworkName);
}
getLocation
Gets information about a location.
The async variant is ConfigClient::getLocationAsync() .
request
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.
use Google\ApiCore\ApiException;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\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.
$configClient = new ConfigClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $configClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
The async variant is ConfigClient::listLocationsAsync() .
request
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.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CloudSecurityCompliance\V1\Client\ConfigClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\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 list_locations_sample(): void
{
// Create a client.
$configClient = new ConfigClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $configClient->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());
}
}
createCloudControlAsync
optionalArgs
array
createFrameworkAsync
optionalArgs
array
deleteCloudControlAsync
optionalArgs
array
deleteFrameworkAsync
optionalArgs
array
getCloudControlAsync
optionalArgs
array
getFrameworkAsync
optionalArgs
array
listCloudControlsAsync
optionalArgs
array
listFrameworksAsync
optionalArgs
array
updateCloudControlAsync
optionalArgs
array
updateFrameworkAsync
optionalArgs
array
getLocationAsync
listLocationsAsync
static::cloudControlName
Formats a string containing the fully-qualified path to represent a cloud_control resource.
organization
string
location
string
cloudControl
string
string
static::frameworkName
Formats a string containing the fully-qualified path to represent a framework resource.
organization
string
location
string
framework
string
string
static::organizationLocationName
Formats a string containing the fully-qualified path to represent a organization_location resource.
organization
string
location
string
string
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- cloudControl: organizations/{organization}/locations/{location}/cloudControls/{cloud_control}
- framework: organizations/{organization}/locations/{location}/frameworks/{framework}
- organizationLocation: organizations/{organization}/locations/{location}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
formattedName
string
The formatted name string
template
?string
Optional name of template to match
array

