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"
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}"
Protobuf type google.api.ResourceDescriptor
Inheritance
Object > AbstractMessageLite<MessageType,BuilderType> > AbstractMessage > GeneratedMessageV3 > ResourceDescriptorImplements
ResourceDescriptorOrBuilderStatic Fields
HISTORY_FIELD_NUMBER
public static final int HISTORY_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
NAME_FIELD_FIELD_NUMBER
public static final int NAME_FIELD_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
PATTERN_FIELD_NUMBER
public static final int PATTERN_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
PLURAL_FIELD_NUMBER
public static final int PLURAL_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
SINGULAR_FIELD_NUMBER
public static final int SINGULAR_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
STYLE_FIELD_NUMBER
public static final int STYLE_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
TYPE_FIELD_NUMBER
public static final int TYPE_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
Static Methods
getDefaultInstance()
public static ResourceDescriptor getDefaultInstance()
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns | |
---|---|
Type | Description |
Descriptor |
newBuilder()
public static ResourceDescriptor.Builder newBuilder()
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Builder |
newBuilder(ResourceDescriptor prototype)
public static ResourceDescriptor.Builder newBuilder(ResourceDescriptor prototype)
Parameter | |
---|---|
Name | Description |
prototype |
ResourceDescriptor |
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Builder |
parseDelimitedFrom(InputStream input)
public static ResourceDescriptor parseDelimitedFrom(InputStream input)
Parameter | |
---|---|
Name | Description |
input |
InputStream |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input |
InputStream |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(byte[] data)
public static ResourceDescriptor parseFrom(byte[] data)
Parameter | |
---|---|
Name | Description |
data |
byte[] |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data |
byte[] |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteString data)
public static ResourceDescriptor parseFrom(ByteString data)
Parameter | |
---|---|
Name | Description |
data |
ByteString |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data |
ByteString |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(CodedInputStream input)
public static ResourceDescriptor parseFrom(CodedInputStream input)
Parameter | |
---|---|
Name | Description |
input |
CodedInputStream |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input |
CodedInputStream |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(InputStream input)
public static ResourceDescriptor parseFrom(InputStream input)
Parameter | |
---|---|
Name | Description |
input |
InputStream |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input |
InputStream |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(ByteBuffer data)
public static ResourceDescriptor parseFrom(ByteBuffer data)
Parameter | |
---|---|
Name | Description |
data |
ByteBuffer |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static ResourceDescriptor parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data |
ByteBuffer |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parser()
public static Parser<ResourceDescriptor> parser()
Returns | |
---|---|
Type | Description |
Parser<ResourceDescriptor> |
Methods
equals(Object obj)
public boolean equals(Object obj)
Parameter | |
---|---|
Name | Description |
obj |
Object |
Returns | |
---|---|
Type | Description |
boolean |
getDefaultInstanceForType()
public ResourceDescriptor getDefaultInstanceForType()
Returns | |
---|---|
Type | Description |
ResourceDescriptor |
getHistory()
public 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;
Returns | |
---|---|
Type | Description |
ResourceDescriptor.History |
The history. |
getHistoryValue()
public 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;
Returns | |
---|---|
Type | Description |
int |
The enum numeric value on the wire for history. |
getNameField()
public 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;
Returns | |
---|---|
Type | Description |
String |
The nameField. |
getNameFieldBytes()
public 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;
Returns | |
---|---|
Type | Description |
ByteString |
The bytes for nameField. |
getParserForType()
public Parser<ResourceDescriptor> getParserForType()
Returns | |
---|---|
Type | Description |
Parser<ResourceDescriptor> |
getPattern(int index)
public 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;
Parameter | |
---|---|
Name | Description |
index |
int The index of the element to return. |
Returns | |
---|---|
Type | Description |
String |
The pattern at the given index. |
getPatternBytes(int index)
public 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;
Parameter | |
---|---|
Name | Description |
index |
int The index of the value to return. |
Returns | |
---|---|
Type | Description |
ByteString |
The bytes of the pattern at the given index. |
getPatternCount()
public 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;
Returns | |
---|---|
Type | Description |
int |
The count of pattern. |
getPatternList()
public 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;
Returns | |
---|---|
Type | Description |
ProtocolStringList |
A list containing the pattern. |
getPlural()
public String 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
string plural = 5;
Returns | |
---|---|
Type | Description |
String |
The plural. |
getPluralBytes()
public ByteString getPluralBytes()
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
string plural = 5;
Returns | |
---|---|
Type | Description |
ByteString |
The bytes for plural. |
getSerializedSize()
public int getSerializedSize()
Returns | |
---|---|
Type | Description |
int |
getSingular()
public 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;
Returns | |
---|---|
Type | Description |
String |
The singular. |
getSingularBytes()
public 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;
Returns | |
---|---|
Type | Description |
ByteString |
The bytes for singular. |
getStyle(int index)
public ResourceDescriptor.Style getStyle(int index)
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.
repeated .google.api.ResourceDescriptor.Style style = 10;
Parameter | |
---|---|
Name | Description |
index |
int The index of the element to return. |
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Style |
The style at the given index. |
getStyleCount()
public int getStyleCount()
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.
repeated .google.api.ResourceDescriptor.Style style = 10;
Returns | |
---|---|
Type | Description |
int |
The count of style. |
getStyleList()
public List<ResourceDescriptor.Style> getStyleList()
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.
repeated .google.api.ResourceDescriptor.Style style = 10;
Returns | |
---|---|
Type | Description |
List<Style> |
A list containing the style. |
getStyleValue(int index)
public int getStyleValue(int index)
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.
repeated .google.api.ResourceDescriptor.Style style = 10;
Parameter | |
---|---|
Name | Description |
index |
int The index of the value to return. |
Returns | |
---|---|
Type | Description |
int |
The enum numeric value on the wire of style at the given index. |
getStyleValueList()
public List<Integer> getStyleValueList()
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.
repeated .google.api.ResourceDescriptor.Style style = 10;
Returns | |
---|---|
Type | Description |
List<Integer> |
A list containing the enum numeric values on the wire for style. |
getType()
public 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+/. 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;
Returns | |
---|---|
Type | Description |
String |
The type. |
getTypeBytes()
public 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+/. 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;
Returns | |
---|---|
Type | Description |
ByteString |
The bytes for type. |
hashCode()
public int hashCode()
Returns | |
---|---|
Type | Description |
int |
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns | |
---|---|
Type | Description |
FieldAccessorTable |
isInitialized()
public final boolean isInitialized()
Returns | |
---|---|
Type | Description |
boolean |
newBuilderForType()
public ResourceDescriptor.Builder newBuilderForType()
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected ResourceDescriptor.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter | |
---|---|
Name | Description |
parent |
BuilderParent |
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Builder |
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter | |
---|---|
Name | Description |
unused |
UnusedPrivateParameter |
Returns | |
---|---|
Type | Description |
Object |
toBuilder()
public ResourceDescriptor.Builder toBuilder()
Returns | |
---|---|
Type | Description |
ResourceDescriptor.Builder |
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Parameter | |
---|---|
Name | Description |
output |
CodedOutputStream |
Exceptions | |
---|---|
Type | Description |
IOException |