public final class ResourceDescriptor extends GeneratedMessageV3 implements ResourceDescriptorOrBuilder
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"
name_descriptor: {
pattern: "projects/{project}/topics/{topic}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
parent_name_extractor: "projects/{project}"
}
};
}
The ResourceDescriptor Yaml config will look like:
resources:
- type: "pubsub.googleapis.com/Topic"
name_descriptor:
- pattern: "projects/{project}/topics/{topic}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
parent_name_extractor: "projects/{project}"
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"
name_descriptor: {
pattern: "projects/{project}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
parent_name_extractor: "projects/{project}"
}
name_descriptor: {
pattern: "folders/{folder}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Folder"
parent_name_extractor: "folders/{folder}"
}
name_descriptor: {
pattern: "organizations/{organization}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Organization"
parent_name_extractor: "organizations/{organization}"
}
name_descriptor: {
pattern: "billingAccounts/{billing_account}/logs/{log}"
parent_type: "billing.googleapis.com/BillingAccount"
parent_name_extractor: "billingAccounts/{billing_account}"
}
};
}
The ResourceDescriptor Yaml config will look like:
resources:
- type: 'logging.googleapis.com/LogEntry'
name_descriptor:
- pattern: "projects/{project}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
parent_name_extractor: "projects/{project}"
- pattern: "folders/{folder}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Folder"
parent_name_extractor: "folders/{folder}"
- pattern: "organizations/{organization}/logs/{log}"
parent_type: "cloudresourcemanager.googleapis.com/Organization"
parent_name_extractor: "organizations/{organization}"
- pattern: "billingAccounts/{billing_account}/logs/{log}"
parent_type: "billing.googleapis.com/BillingAccount"
parent_name_extractor: "billingAccounts/{billing_account}"
For flexible resources, the resource name doesn't contain parent names, but
the resource itself has parents for policy evaluation.
Example:
message Shelf {
option (google.api.resource) = {
type: "library.googleapis.com/Shelf"
name_descriptor: {
pattern: "shelves/{shelf}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
}
name_descriptor: {
pattern: "shelves/{shelf}"
parent_type: "cloudresourcemanager.googleapis.com/Folder"
}
};
}
The ResourceDescriptor Yaml config will look like:
resources:
- type: 'library.googleapis.com/Shelf'
name_descriptor:
- pattern: "shelves/{shelf}"
parent_type: "cloudresourcemanager.googleapis.com/Project"
- pattern: "shelves/{shelf}"
parent_type: "cloudresourcemanager.googleapis.com/Folder"
Protobuf type google.api.ResourceDescriptor| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceDescriptor.Builder
A simple descriptor of a resource type.
|
static class |
ResourceDescriptor.History
A description of the historical or future-looking state of the
resource pattern.
|
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage,BuilderType extends GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.FieldAccessorTable| Modifier and Type | Field and Description |
|---|---|
static int |
HISTORY_FIELD_NUMBER |
static int |
NAME_FIELD_FIELD_NUMBER |
static int |
PATTERN_FIELD_NUMBER |
static int |
PLURAL_FIELD_NUMBER |
static int |
SINGULAR_FIELD_NUMBER |
static int |
TYPE_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFieldsmemoizedSizememoizedHashCode| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static ResourceDescriptor |
getDefaultInstance() |
ResourceDescriptor |
getDefaultInstanceForType() |
static Descriptors.Descriptor |
getDescriptor() |
ResourceDescriptor.History |
getHistory()
Optional.
|
int |
getHistoryValue()
Optional.
|
java.lang.String |
getNameField()
Optional.
|
ByteString |
getNameFieldBytes()
Optional.
|
Parser<ResourceDescriptor> |
getParserForType() |
java.lang.String |
getPattern(int index)
Optional.
|
ByteString |
getPatternBytes(int index)
Optional.
|
int |
getPatternCount()
Optional.
|
ProtocolStringList |
getPatternList()
Optional.
|
java.lang.String |
getPlural()
The plural name used in the resource name, such as 'projects' for
the name of 'projects/{project}'.
|
ByteString |
getPluralBytes()
The plural name used in the resource name, such as 'projects' for
the name of 'projects/{project}'.
|
int |
getSerializedSize() |
java.lang.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.
|
ByteString |
getSingularBytes()
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.
|
java.lang.String |
getType()
The resource type.
|
ByteString |
getTypeBytes()
The resource type.
|
UnknownFieldSet |
getUnknownFields() |
int |
hashCode() |
protected GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static ResourceDescriptor.Builder |
newBuilder() |
static ResourceDescriptor.Builder |
newBuilder(ResourceDescriptor prototype) |
ResourceDescriptor.Builder |
newBuilderForType() |
protected ResourceDescriptor.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent) |
static ResourceDescriptor |
parseDelimitedFrom(java.io.InputStream input) |
static ResourceDescriptor |
parseDelimitedFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static ResourceDescriptor |
parseFrom(byte[] data) |
static ResourceDescriptor |
parseFrom(byte[] data,
ExtensionRegistryLite extensionRegistry) |
static ResourceDescriptor |
parseFrom(java.nio.ByteBuffer data) |
static ResourceDescriptor |
parseFrom(java.nio.ByteBuffer data,
ExtensionRegistryLite extensionRegistry) |
static ResourceDescriptor |
parseFrom(ByteString data) |
static ResourceDescriptor |
parseFrom(ByteString data,
ExtensionRegistryLite extensionRegistry) |
static ResourceDescriptor |
parseFrom(CodedInputStream input) |
static ResourceDescriptor |
parseFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
static ResourceDescriptor |
parseFrom(java.io.InputStream input) |
static ResourceDescriptor |
parseFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Parser<ResourceDescriptor> |
parser() |
ResourceDescriptor.Builder |
toBuilder() |
void |
writeTo(CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneoftoByteArray, toByteString, writeDelimitedTo, writeTopublic static final int TYPE_FIELD_NUMBER
public static final int PATTERN_FIELD_NUMBER
public static final int NAME_FIELD_FIELD_NUMBER
public static final int HISTORY_FIELD_NUMBER
public static final int PLURAL_FIELD_NUMBER
public static final int SINGULAR_FIELD_NUMBER
public final UnknownFieldSet getUnknownFields()
getUnknownFields in interface MessageOrBuildergetUnknownFields in class GeneratedMessageV3public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class GeneratedMessageV3public java.lang.String 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.
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.
string type = 1;getType in interface ResourceDescriptorOrBuilderpublic ByteString getTypeBytes()
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.
string type = 1;getTypeBytes in interface ResourceDescriptorOrBuilderpublic ProtocolStringList getPatternList()
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.
repeated string pattern = 2;getPatternList in interface ResourceDescriptorOrBuilderpublic int getPatternCount()
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.
repeated string pattern = 2;getPatternCount in interface ResourceDescriptorOrBuilderpublic java.lang.String getPattern(int index)
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.
repeated string pattern = 2;getPattern in interface ResourceDescriptorOrBuilderpublic ByteString getPatternBytes(int index)
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.
repeated string pattern = 2;getPatternBytes in interface ResourceDescriptorOrBuilderpublic java.lang.String getNameField()
Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".
string name_field = 3;getNameField in interface ResourceDescriptorOrBuilderpublic ByteString getNameFieldBytes()
Optional. The field on the resource that designates the resource name field. If omitted, this is assumed to be "name".
string name_field = 3;getNameFieldBytes in interface ResourceDescriptorOrBuilderpublic int getHistoryValue()
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
};
}
.google.api.ResourceDescriptor.History history = 4;getHistoryValue in interface ResourceDescriptorOrBuilderpublic ResourceDescriptor.History getHistory()
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
};
}
.google.api.ResourceDescriptor.History history = 4;getHistory in interface ResourceDescriptorOrBuilderpublic java.lang.String getPlural()
The plural name used in the resource name, such as 'projects' for
the name of 'projects/{project}'. 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/
string plural = 5;getPlural in interface ResourceDescriptorOrBuilderpublic ByteString getPluralBytes()
The plural name used in the resource name, such as 'projects' for
the name of 'projects/{project}'. 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/
string plural = 5;getPluralBytes in interface ResourceDescriptorOrBuilderpublic java.lang.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.
string singular = 6;getSingular in interface ResourceDescriptorOrBuilderpublic ByteString getSingularBytes()
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.
string singular = 6;getSingularBytes in interface ResourceDescriptorOrBuilderpublic final boolean isInitialized()
isInitialized in interface MessageLiteOrBuilderisInitialized in class GeneratedMessageV3public void writeTo(CodedOutputStream output) throws java.io.IOException
writeTo in interface MessageLitewriteTo in class GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface MessageLitegetSerializedSize in class GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface Messageequals in class AbstractMessagepublic int hashCode()
hashCode in interface MessagehashCode in class AbstractMessagepublic static ResourceDescriptor parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static ResourceDescriptor parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static ResourceDescriptor parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static ResourceDescriptor parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static ResourceDescriptor parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static ResourceDescriptor parseFrom(CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static ResourceDescriptor parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic ResourceDescriptor.Builder newBuilderForType()
newBuilderForType in interface MessagenewBuilderForType in interface MessageLitepublic static ResourceDescriptor.Builder newBuilder()
public static ResourceDescriptor.Builder newBuilder(ResourceDescriptor prototype)
public ResourceDescriptor.Builder toBuilder()
toBuilder in interface MessagetoBuilder in interface MessageLiteprotected ResourceDescriptor.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class GeneratedMessageV3public static ResourceDescriptor getDefaultInstance()
public static Parser<ResourceDescriptor> parser()
public Parser<ResourceDescriptor> getParserForType()
getParserForType in interface MessagegetParserForType in interface MessageLitegetParserForType in class GeneratedMessageV3public ResourceDescriptor getDefaultInstanceForType()
getDefaultInstanceForType in interface MessageLiteOrBuildergetDefaultInstanceForType in interface MessageOrBuilder