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 new CloudControl with type Custom
under a given parent
resource. Built-in
CloudControls are managed by Google and cannot be
created through this API.
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}`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
* @param string $cloudControlId ID of the CloudControl.
* This is the last segment of the CloudControl resource name.
* Format: `^[a-zA-Z][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$`.
* @param string $cloudControlName Identifier. The resource name of the cloud control.
* Format:
* organizations/{organization}/locations/{location}/cloudControls/{cloud_control_id}
*/
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 new Framework with type Custom
under a given parent resource.
Frameworks with type Built-in
are managed by Google and cannot be created
through this API.
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}`. Please see
* {@see ConfigClient::organizationLocationName()} for help formatting this field.
* @param string $frameworkId ID of the framework.
* This is not the full name of the framework.
* This is the last part of the full name of the framework.
* @param string $frameworkName Identifier. The name of the framework.
* Format:
* organizations/{organization}/locations/{location}/frameworks/{framework_id}
*/
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 single Custom CloudControl, including all its major and minor revisions.
- This operation can only be performed on CloudControls with type
CUSTOM. Built-in CloudControls cannot be deleted. - The CloudControl cannot be deleted if any of its revisions are currently referenced by any Framework.
- This action is permanent and cannot be undone.
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 Name of the resource, in the format
* `organizations/{organization}/locations/{location}/CloudControls/{CloudControl}`. 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 single Custom Framework, including all its minor and minor revisions.
- This operation can only be performed on Frameworks with type
CUSTOM. Built-in Frameworks cannot be deleted. - The Framework cannot be deleted if it is currently deployed on any resource.
- This action is permanent and cannot be undone.
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 Name of the resource, in the format
* `organizations/{organization}/locations/{location}/frameworks/{framework}`. 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 of a single CloudControl.
This method retrieves a CloudControl resource, which can be either Built-in or Custom, identified by its name.
By default, the latest major version of the CloudControl is returned.
A specific major version can be retrieved by specifying the 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 cloudcontrol to retrieve in the format:
* organizations/{organization}/locations/{location}/cloudControls/{cloud_control}
* 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 of a single Framework.
This method retrieves a Framework resource, which can be either Built-in or Custom, identified by its name.
By default, the latest major version of the Framework is returned.
A specific major version can be retrieved by specifying the 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.
* Format:
* organizations/{organization}/locations/{location}/frameworks/{framework_id}
* 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 all CloudControls (both Built-in and Custom) available within a given parent resource. This method supports pagination.
The latest major version of each CloudControl is returned.
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}`. 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 all Frameworks (both Built-in and Custom) available within a given parent resource. This method supports pagination.
The latest major version of each Framework is returned.
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}`.
* Only global location is supported. 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 single CloudControl.
This method allows for partial updates of a Custom CloudControl resource. Built-in CloudControls cannot be updated.
- If an
update_maskis provided, only the fields specified in the mask will be updated. - If no
update_maskis provided, all fields present in the request'scloud_controlbody will be used to overwrite the existing resource.
A successful update will result in a new version of the CloudControl.
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 resource name of the cloud control.
* Format:
* organizations/{organization}/locations/{location}/cloudControls/{cloud_control_id}
*/
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 single Framework.
This method allows for partial updates of a Framework resource. The fields
to be updated are specified using the update_mask
.
- If an
update_maskis provided, only the fields specified in the mask will be updated. - If no
update_maskis provided, all fields present in the request'sframeworkbody will be used to overwrite the existing resource.
This operation can only be performed on Frameworks with type CUSTOM
.
A successful update will result in 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.
* Format:
* organizations/{organization}/locations/{location}/frameworks/{framework_id}
*/
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

