ResourceDescriptor class final
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}"
- Inheritance
-
- Object
- ProtoMessage
- ResourceDescriptor
Constructors
-
ResourceDescriptor({String type = '', List<
String> pattern = const [], String nameField = '', ResourceDescriptor_History history = ResourceDescriptor_History.$default, String plural = '', String singular = '', List<ResourceDescriptor_Style> style = const []}) - ResourceDescriptor.fromJson(Object? j)
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- history → ResourceDescriptor_History
-
Optional. The historical or future-looking state of the resource pattern.
final
- nameField → String
-
Optional. The field on the resource that designates the resource name
field. If omitted, this is assumed to be "name".
final
-
pattern
→ List<
String> -
Optional. The relative resource name pattern associated with this resource
type. The DNS prefix of the full resource name shouldn't be specified here.
final
- plural → 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'. One exception
to this is for Nested Collections that have stuttering names, as defined
in AIP-122, where the
collection ID in the resource name pattern does not necessarily directly
match the
pluralvalue.final - qualifiedName → String
-
The fully qualified name of this message, i.e.,
google.protobuf.Durationorgoogle.rpc.ErrorInfo.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- singular → String
-
The same concept of the
singularfield in k8s CRD spec https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ Such as "project" for theresourcemanager.googleapis.com/Projecttype.final -
style
→ List<
ResourceDescriptor_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.
final
- type → String
-
The resource type. It must be in the format of
{service_name}/{resource_type_kind}. The
resource_type_kindmust be singular and must not include version numbers.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Object -
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- fullyQualifiedName → const String