com.google.api.ResourceDescriptor Maven / Gradle / Ivy
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/api/resource.proto
// Protobuf Java Version: 3.25.3
package com.google.api;
/**
*
*
*
* 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 {@code google.api.ResourceDescriptor}
*/
public final class ResourceDescriptor extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.api.ResourceDescriptor)
ResourceDescriptorOrBuilder {
private static final long serialVersionUID = 0L;
// Use ResourceDescriptor.newBuilder() to construct.
private ResourceDescriptor(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private ResourceDescriptor() {
type_ = "";
pattern_ = com.google.protobuf.LazyStringArrayList.emptyList();
nameField_ = "";
history_ = 0;
plural_ = "";
singular_ = "";
style_ = java.util.Collections.emptyList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new ResourceDescriptor();
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.api.ResourceProto.internal_static_google_api_ResourceDescriptor_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.api.ResourceProto
.internal_static_google_api_ResourceDescriptor_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.api.ResourceDescriptor.class,
com.google.api.ResourceDescriptor.Builder.class);
}
/**
*
*
*
* A description of the historical or future-looking state of the
* resource pattern.
*
*
* Protobuf enum {@code google.api.ResourceDescriptor.History}
*/
public enum History implements com.google.protobuf.ProtocolMessageEnum {
/**
*
*
*
* The "unset" value.
*
*
* HISTORY_UNSPECIFIED = 0;
*/
HISTORY_UNSPECIFIED(0),
/**
*
*
*
* The resource originally had one pattern and launched as such, and
* additional patterns were added later.
*
*
* ORIGINALLY_SINGLE_PATTERN = 1;
*/
ORIGINALLY_SINGLE_PATTERN(1),
/**
*
*
*
* The resource has one pattern, but the API owner expects to add more
* later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
* that from being necessary once there are multiple patterns.)
*
*
* FUTURE_MULTI_PATTERN = 2;
*/
FUTURE_MULTI_PATTERN(2),
UNRECOGNIZED(-1),
;
/**
*
*
*
* The "unset" value.
*
*
* HISTORY_UNSPECIFIED = 0;
*/
public static final int HISTORY_UNSPECIFIED_VALUE = 0;
/**
*
*
*
* The resource originally had one pattern and launched as such, and
* additional patterns were added later.
*
*
* ORIGINALLY_SINGLE_PATTERN = 1;
*/
public static final int ORIGINALLY_SINGLE_PATTERN_VALUE = 1;
/**
*
*
*
* The resource has one pattern, but the API owner expects to add more
* later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
* that from being necessary once there are multiple patterns.)
*
*
* FUTURE_MULTI_PATTERN = 2;
*/
public static final int FUTURE_MULTI_PATTERN_VALUE = 2;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static History valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static History forNumber(int value) {
switch (value) {
case 0:
return HISTORY_UNSPECIFIED;
case 1:
return ORIGINALLY_SINGLE_PATTERN;
case 2:
return FUTURE_MULTI_PATTERN;
default:
return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap() {
public History findValueByNumber(int number) {
return History.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
return com.google.api.ResourceDescriptor.getDescriptor().getEnumTypes().get(0);
}
private static final History[] VALUES = values();
public static History valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private History(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:google.api.ResourceDescriptor.History)
}
/**
*
*
*
* A flag representing a specific style that a resource claims to conform to.
*
*
* Protobuf enum {@code google.api.ResourceDescriptor.Style}
*/
public enum Style implements com.google.protobuf.ProtocolMessageEnum {
/**
*
*
*
* The unspecified value. Do not use.
*
*
* STYLE_UNSPECIFIED = 0;
*/
STYLE_UNSPECIFIED(0),
/**
*
*
*
* This resource is intended to be "declarative-friendly".
*
* Declarative-friendly resources must be more strictly consistent, and
* setting this to true communicates to tools that this resource should
* adhere to declarative-friendly expectations.
*
* Note: This is used by the API linter (linter.aip.dev) to enable
* additional checks.
*
*
* DECLARATIVE_FRIENDLY = 1;
*/
DECLARATIVE_FRIENDLY(1),
UNRECOGNIZED(-1),
;
/**
*
*
*
* The unspecified value. Do not use.
*
*
* STYLE_UNSPECIFIED = 0;
*/
public static final int STYLE_UNSPECIFIED_VALUE = 0;
/**
*
*
*
* This resource is intended to be "declarative-friendly".
*
* Declarative-friendly resources must be more strictly consistent, and
* setting this to true communicates to tools that this resource should
* adhere to declarative-friendly expectations.
*
* Note: This is used by the API linter (linter.aip.dev) to enable
* additional checks.
*
*
* DECLARATIVE_FRIENDLY = 1;
*/
public static final int DECLARATIVE_FRIENDLY_VALUE = 1;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static Style valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static Style forNumber(int value) {
switch (value) {
case 0:
return STYLE_UNSPECIFIED;
case 1:
return DECLARATIVE_FRIENDLY;
default:
return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap