Documentation

ResourceDescriptor extends Message
in package

A simple descriptor of a resource type.

ResourceDescriptor annotates a resource message (either by means of a protobuf annotation or use in the service config), and associates the resource's schema, the resource type, and the pattern of the resource name. Example: message Topic { // Indicates this message defines a resource schema. // Declares the resource type in the format of {service}/{kind}. // For Kubernetes resources, the format is {api group}/{kind}. option (google.api.resource) = { type: "pubsub.googleapis.com/Topic" pattern: "projects/{project}/topics/{topic}" }; } The ResourceDescriptor Yaml config will look like: resources: - type: "pubsub.googleapis.com/Topic" pattern: "projects/{project}/topics/{topic}" Sometimes, resources have multiple patterns, typically because they can live under multiple parents. Example: message LogEntry { option (google.api.resource) = { type: "logging.googleapis.com/LogEntry" pattern: "projects/{project}/logs/{log}" pattern: "folders/{folder}/logs/{log}" pattern: "organizations/{organization}/logs/{log}" pattern: "billingAccounts/{billing_account}/logs/{log}" }; } The ResourceDescriptor Yaml config will look like: resources: - type: 'logging.googleapis.com/LogEntry' pattern: "projects/{project}/logs/{log}" pattern: "folders/{folder}/logs/{log}" pattern: "organizations/{organization}/logs/{log}" pattern: "billingAccounts/{billing_account}/logs/{log}"

Generated from protobuf message google.api.ResourceDescriptor

Table of Contents

Properties

$history  : mixed
Optional. The historical or future-looking state of the resource pattern.
$name_field  : mixed
Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".
$plural  : mixed
The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156
$singular  : mixed
The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.
$type  : mixed
The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.
$pattern  : mixed
Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.
$style  : mixed
Style flag(s) for this resource.

Methods

__construct()  : mixed
Constructor.
getHistory()  : int
Optional. The historical or future-looking state of the resource pattern.
getNameField()  : string
Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".
getPattern()  : RepeatedField
Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.
getPlural()  : string
The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156
getSingular()  : string
The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.
getStyle()  : RepeatedField
Style flag(s) for this resource.
getType()  : string
The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.
setHistory()  : $this
Optional. The historical or future-looking state of the resource pattern.
setNameField()  : $this
Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".
setPattern()  : $this
Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.
setPlural()  : $this
The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156
setSingular()  : $this
The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.
setStyle()  : $this
Style flag(s) for this resource.
setType()  : $this
The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.

Properties

$history

Optional. The historical or future-looking state of the resource pattern.

protected mixed $history = 0

Example: // The InspectTemplate message originally only supported resource // names with organization, and project was added later. message InspectTemplate { option (google.api.resource) = { type: "dlp.googleapis.com/InspectTemplate" pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" pattern: "projects/{project}/inspectTemplates/{inspect_template}" history: ORIGINALLY_SINGLE_PATTERN }; }

Generated from protobuf field .google.api.ResourceDescriptor.History history = 4 [json_name = "history"];

$name_field

Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".

protected mixed $name_field = ''

Generated from protobuf field string name_field = 3 [json_name = "nameField"];

$plural

The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156

protected mixed $plural = ''

Generated from protobuf field string plural = 5 [json_name = "plural"];

$singular

The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.

protected mixed $singular = ''

Generated from protobuf field string singular = 6 [json_name = "singular"];

$type

The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.

protected mixed $type = ''

Example: storage.googleapis.com/Bucket The value of the resource_type_kind must follow the regular expression /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and should use PascalCase (UpperCamelCase). The maximum number of characters allowed for the resource_type_kind is 100.

Generated from protobuf field string type = 1 [json_name = "type"];

$pattern

Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.

private mixed $pattern

The path pattern must follow the syntax, which aligns with HTTP binding syntax: Template = Segment { "/" Segment } ; Segment = LITERAL | Variable ; Variable = "{" LITERAL "}" ; Examples: - "projects/{project}/topics/{topic}" - "projects/{project}/knowledgeBases/{knowledge_base}" The components in braces correspond to the IDs for each resource in the hierarchy. It is expected that, if multiple patterns are provided, the same component name (e.g. "project") refers to IDs of the same type of resource.

Generated from protobuf field repeated string pattern = 2 [json_name = "pattern"];

$style

Style flag(s) for this resource.

private mixed $style

These indicate that a resource is expected to conform to a given style. See the specific style flags for additional information.

Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10 [json_name = "style"];

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $data = NULL ]) : mixed
Parameters
$data : array<string|int, mixed> = NULL

{ Optional. Data for populating the Message object.

@type string $type
      The resource type. It must be in the format of
      {service_name}/{resource_type_kind}. The `resource_type_kind` must be
      singular and must not include version numbers.
      Example: `storage.googleapis.com/Bucket`
      The value of the resource_type_kind must follow the regular expression
      /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
      should use PascalCase (UpperCamelCase). The maximum number of
      characters allowed for the `resource_type_kind` is 100.
@type array<string>|\Google\Protobuf\Internal\RepeatedField $pattern
      Optional. The relative resource name pattern associated with this resource
      type. The DNS prefix of the full resource name shouldn't be specified here.
      The path pattern must follow the syntax, which aligns with HTTP binding
      syntax:
          Template = Segment { "/" Segment } ;
          Segment = LITERAL | Variable ;
          Variable = "{" LITERAL "}" ;
      Examples:
          - "projects/{project}/topics/{topic}"
          - "projects/{project}/knowledgeBases/{knowledge_base}"
      The components in braces correspond to the IDs for each resource in the
      hierarchy. It is expected that, if multiple patterns are provided,
      the same component name (e.g. "project") refers to IDs of the same
      type of resource.
@type string $name_field
      Optional. The field on the resource that designates the resource name
      field. If omitted, this is assumed to be "name".
@type int $history
      Optional. The historical or future-looking state of the resource pattern.
      Example:
          // The InspectTemplate message originally only supported resource
          // names with organization, and project was added later.
          message InspectTemplate {
            option (google.api.resource) = {
              type: "dlp.googleapis.com/InspectTemplate"
              pattern:
              "organizations/{organization}/inspectTemplates/{inspect_template}"
              pattern: "projects/{project}/inspectTemplates/{inspect_template}"
              history: ORIGINALLY_SINGLE_PATTERN
            };
          }
@type string $plural
      The plural name used in the resource name and permission names, such as
      'projects' for the resource name of 'projects/{project}' and the permission
      name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same
      concept of the `plural` field in k8s CRD spec
      https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
      Note: The plural form is required even for singleton resources. See
      https://aip.dev/156
@type string $singular
      The same concept of the `singular` field in k8s CRD spec
      https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
      Such as "project" for the `resourcemanager.googleapis.com/Project` type.
@type array<int>|\Google\Protobuf\Internal\RepeatedField $style
      Style flag(s) for this resource.
      These indicate that a resource is expected to conform to a given
      style. See the specific style flags for additional information.

}

getHistory()

Optional. The historical or future-looking state of the resource pattern.

public getHistory() : int

Example: // The InspectTemplate message originally only supported resource // names with organization, and project was added later. message InspectTemplate { option (google.api.resource) = { type: "dlp.googleapis.com/InspectTemplate" pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" pattern: "projects/{project}/inspectTemplates/{inspect_template}" history: ORIGINALLY_SINGLE_PATTERN }; }

Generated from protobuf field .google.api.ResourceDescriptor.History history = 4 [json_name = "history"];

Return values
int

getNameField()

Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".

public getNameField() : string

Generated from protobuf field string name_field = 3 [json_name = "nameField"];

Return values
string

getPattern()

Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.

public getPattern() : RepeatedField

The path pattern must follow the syntax, which aligns with HTTP binding syntax: Template = Segment { "/" Segment } ; Segment = LITERAL | Variable ; Variable = "{" LITERAL "}" ; Examples: - "projects/{project}/topics/{topic}" - "projects/{project}/knowledgeBases/{knowledge_base}" The components in braces correspond to the IDs for each resource in the hierarchy. It is expected that, if multiple patterns are provided, the same component name (e.g. "project") refers to IDs of the same type of resource.

Generated from protobuf field repeated string pattern = 2 [json_name = "pattern"];

Return values
RepeatedField

getPlural()

The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156

public getPlural() : string

Generated from protobuf field string plural = 5 [json_name = "plural"];

Return values
string

getSingular()

The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.

public getSingular() : string

Generated from protobuf field string singular = 6 [json_name = "singular"];

Return values
string

getStyle()

Style flag(s) for this resource.

public getStyle() : RepeatedField

These indicate that a resource is expected to conform to a given style. See the specific style flags for additional information.

Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10 [json_name = "style"];

Return values
RepeatedField

getType()

The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.

public getType() : string

Example: storage.googleapis.com/Bucket The value of the resource_type_kind must follow the regular expression /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and should use PascalCase (UpperCamelCase). The maximum number of characters allowed for the resource_type_kind is 100.

Generated from protobuf field string type = 1 [json_name = "type"];

Return values
string

setHistory()

Optional. The historical or future-looking state of the resource pattern.

public setHistory(int $var) : $this

Example: // The InspectTemplate message originally only supported resource // names with organization, and project was added later. message InspectTemplate { option (google.api.resource) = { type: "dlp.googleapis.com/InspectTemplate" pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" pattern: "projects/{project}/inspectTemplates/{inspect_template}" history: ORIGINALLY_SINGLE_PATTERN }; }

Generated from protobuf field .google.api.ResourceDescriptor.History history = 4 [json_name = "history"];

Parameters
$var : int
Return values
$this

setNameField()

Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".

public setNameField(string $var) : $this

Generated from protobuf field string name_field = 3 [json_name = "nameField"];

Parameters
$var : string
Return values
$this

setPattern()

Optional. The relative resource name pattern associated with this resource type. The DNS prefix of the full resource name shouldn't be specified here.

public setPattern(array<string|int, string>|RepeatedField $var) : $this

The path pattern must follow the syntax, which aligns with HTTP binding syntax: Template = Segment { "/" Segment } ; Segment = LITERAL | Variable ; Variable = "{" LITERAL "}" ; Examples: - "projects/{project}/topics/{topic}" - "projects/{project}/knowledgeBases/{knowledge_base}" The components in braces correspond to the IDs for each resource in the hierarchy. It is expected that, if multiple patterns are provided, the same component name (e.g. "project") refers to IDs of the same type of resource.

Generated from protobuf field repeated string pattern = 2 [json_name = "pattern"];

Parameters
$var : array<string|int, string>|RepeatedField
Return values
$this

setPlural()

The plural name used in the resource name and permission names, such as 'projects' for the resource name of 'projects/{project}' and the permission name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same concept of the `plural` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Note: The plural form is required even for singleton resources. See https://aip.dev/156

public setPlural(string $var) : $this

Generated from protobuf field string plural = 5 [json_name = "plural"];

Parameters
$var : string
Return values
$this

setSingular()

The same concept of the `singular` field in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for the `resourcemanager.googleapis.com/Project` type.

public setSingular(string $var) : $this

Generated from protobuf field string singular = 6 [json_name = "singular"];

Parameters
$var : string
Return values
$this

setStyle()

Style flag(s) for this resource.

public setStyle(array<string|int, int>|RepeatedField $var) : $this

These indicate that a resource is expected to conform to a given style. See the specific style flags for additional information.

Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10 [json_name = "style"];

Parameters
$var : array<string|int, int>|RepeatedField
Return values
$this

setType()

The resource type. It must be in the format of {service_name}/{resource_type_kind}. The `resource_type_kind` must be singular and must not include version numbers.

public setType(string $var) : $this

Example: storage.googleapis.com/Bucket The value of the resource_type_kind must follow the regular expression /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and should use PascalCase (UpperCamelCase). The maximum number of characters allowed for the resource_type_kind is 100.

Generated from protobuf field string type = 1 [json_name = "type"];

Parameters
$var : string
Return values
$this

        
On this page

Search results