Reference documentation and code samples for the Google Cloud Policy Simulator V1 Client class ResourceContext.
ResourceContext provides the context we know about a resource.
It is similar in concept to google.cloud.asset.v1.Resource, but focuses
on the information specifically used by Simulator.
Generated from protobuf message google.cloud.policysimulator.v1.ResourceContext
Namespace
Google \ Cloud \ PolicySimulator \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ resource
string
The full name of the resource. Example: //compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1 See Resource names for more information.
↳ asset_type
string
The asset type of the resource as defined by CAIS. Example: compute.googleapis.com/Firewall See Supported asset types for more information.
↳ ancestors
array
The ancestry path of the resource in Google Cloud resource hierarchy, represented as a list of relative resource names. An ancestry path starts with the closest ancestor in the hierarchy and ends at root. If the resource is a project, folder, or organization, the ancestry path starts from the resource itself. Example: ["projects/123456789", "folders/5432", "organizations/1234"]
getResource
The full name of the resource. Example:
//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1
See Resource
names
for more information.
Returns
Type
Description
string
setResource
The full name of the resource. Example:
//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1
See Resource
names
for more information.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getAssetType
The asset type of the resource as defined by CAIS.
Example: compute.googleapis.com/Firewall
See Supported asset
types
for more information.
Returns
Type
Description
string
setAssetType
The asset type of the resource as defined by CAIS.
Example: compute.googleapis.com/Firewall
See Supported asset
types
for more information.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getAncestors
The ancestry path of the resource in Google Cloud resource
hierarchy,
represented as a list of relative resource names. An ancestry path starts
with the closest ancestor in the hierarchy and ends at root. If the
resource is a project, folder, or organization, the ancestry path starts
from the resource itself.
The ancestry path of the resource in Google Cloud resource
hierarchy,
represented as a list of relative resource names. An ancestry path starts
with the closest ancestor in the hierarchy and ends at root. If the
resource is a project, folder, or organization, the ancestry path starts
from the resource itself.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Google Cloud Policy Simulator V1 Client - Class ResourceContext (1.2.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.2.0 (latest)](/php/docs/reference/cloud-policysimulator/latest/V1.ResourceContext)\n- [1.1.1](/php/docs/reference/cloud-policysimulator/1.1.1/V1.ResourceContext)\n- [1.0.3](/php/docs/reference/cloud-policysimulator/1.0.3/V1.ResourceContext)\n- [0.2.5](/php/docs/reference/cloud-policysimulator/0.2.5/V1.ResourceContext)\n- [0.1.1](/php/docs/reference/cloud-policysimulator/0.1.1/V1.ResourceContext) \nReference documentation and code samples for the Google Cloud Policy Simulator V1 Client class ResourceContext.\n\nResourceContext provides the context we know about a resource.\n\nIt is similar in concept to google.cloud.asset.v1.Resource, but focuses\non the information specifically used by Simulator.\n\nGenerated from protobuf message `google.cloud.policysimulator.v1.ResourceContext`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ PolicySimulator \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getResource\n\nThe full name of the resource. Example:\n`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`\nSee [Resource\nnames](https://cloud.google.com/apis/design/resource_names#full_resource_name)\nfor more information.\n\n### setResource\n\nThe full name of the resource. Example:\n`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`\nSee [Resource\nnames](https://cloud.google.com/apis/design/resource_names#full_resource_name)\nfor more information.\n\n### getAssetType\n\nThe asset type of the resource as defined by CAIS.\n\nExample: `compute.googleapis.com/Firewall`\nSee [Supported asset\ntypes](https://cloud.google.com/asset-inventory/docs/supported-asset-types)\nfor more information.\n\n### setAssetType\n\nThe asset type of the resource as defined by CAIS.\n\nExample: `compute.googleapis.com/Firewall`\nSee [Supported asset\ntypes](https://cloud.google.com/asset-inventory/docs/supported-asset-types)\nfor more information.\n\n### getAncestors\n\nThe ancestry path of the resource in Google Cloud [resource\nhierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),\nrepresented as a list of relative resource names. An ancestry path starts\nwith the closest ancestor in the hierarchy and ends at root. If the\nresource is a project, folder, or organization, the ancestry path starts\nfrom the resource itself.\n\nExample: `[\"projects/123456789\", \"folders/5432\", \"organizations/1234\"]`\n\n### setAncestors\n\nThe ancestry path of the resource in Google Cloud [resource\nhierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),\nrepresented as a list of relative resource names. An ancestry path starts\nwith the closest ancestor in the hierarchy and ends at root. If the\nresource is a project, folder, or organization, the ancestry path starts\nfrom the resource itself.\n\nExample: `[\"projects/123456789\", \"folders/5432\", \"organizations/1234\"]`"]]