Class Subscription (0.18.0)

public final class Subscription extends GeneratedMessageV3 implements SubscriptionOrBuilder

A subscription to receive events about a Google Workspace resource. To learn more about subscriptions, see the Google Workspace Events API overview.

Protobuf type google.apps.events.subscriptions.v1.Subscription

Static Fields

AUTHORITY_FIELD_NUMBER

public static final int AUTHORITY_FIELD_NUMBER
Field Value
Type Description
int

CREATE_TIME_FIELD_NUMBER

public static final int CREATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

ETAG_FIELD_NUMBER

public static final int ETAG_FIELD_NUMBER
Field Value
Type Description
int

EVENT_TYPES_FIELD_NUMBER

public static final int EVENT_TYPES_FIELD_NUMBER
Field Value
Type Description
int

EXPIRE_TIME_FIELD_NUMBER

public static final int EXPIRE_TIME_FIELD_NUMBER
Field Value
Type Description
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
Type Description
int

NOTIFICATION_ENDPOINT_FIELD_NUMBER

public static final int NOTIFICATION_ENDPOINT_FIELD_NUMBER
Field Value
Type Description
int

PAYLOAD_OPTIONS_FIELD_NUMBER

public static final int PAYLOAD_OPTIONS_FIELD_NUMBER
Field Value
Type Description
int

RECONCILING_FIELD_NUMBER

public static final int RECONCILING_FIELD_NUMBER
Field Value
Type Description
int

STATE_FIELD_NUMBER

public static final int STATE_FIELD_NUMBER
Field Value
Type Description
int

SUSPENSION_REASON_FIELD_NUMBER

public static final int SUSPENSION_REASON_FIELD_NUMBER
Field Value
Type Description
int

TARGET_RESOURCE_FIELD_NUMBER

public static final int TARGET_RESOURCE_FIELD_NUMBER
Field Value
Type Description
int

TTL_FIELD_NUMBER

public static final int TTL_FIELD_NUMBER
Field Value
Type Description
int

UID_FIELD_NUMBER

public static final int UID_FIELD_NUMBER
Field Value
Type Description
int

UPDATE_TIME_FIELD_NUMBER

public static final int UPDATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Subscription getDefaultInstance()
Returns
Type Description
Subscription

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Subscription.Builder newBuilder()
Returns
Type Description
Subscription.Builder

newBuilder(Subscription prototype)

public static Subscription.Builder newBuilder(Subscription prototype)
Parameter
Name Description
prototype Subscription
Returns
Type Description
Subscription.Builder

parseDelimitedFrom(InputStream input)

public static Subscription parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Subscription parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Subscription parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Subscription parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Subscription parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Subscription parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Subscription parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Subscription parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Subscription parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Subscription parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Subscription parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Subscription parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Subscription
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Subscription> parser()
Returns
Type Description
Parser<Subscription>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAuthority()

public String getAuthority()

Output only. The user who authorized the creation of the subscription.

Format: users/{user}

For Google Workspace users, the {user} value is the user.id field from the Directory API.

string authority = 10 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }

Returns
Type Description
String

The authority.

getAuthorityBytes()

public ByteString getAuthorityBytes()

Output only. The user who authorized the creation of the subscription.

Format: users/{user}

For Google Workspace users, the {user} value is the user.id field from the Directory API.

string authority = 10 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for authority.

getCreateTime()

public Timestamp getCreateTime()

Output only. The time when the subscription is created.

.google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The createTime.

getCreateTimeOrBuilder()

public TimestampOrBuilder getCreateTimeOrBuilder()

Output only. The time when the subscription is created.

.google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getDefaultInstanceForType()

public Subscription getDefaultInstanceForType()
Returns
Type Description
Subscription

getEtag()

public String getEtag()

Optional. This checksum is computed by the server based on the value of other fields, and might be sent on update requests to ensure the client has an up-to-date value before proceeding.

string etag = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The etag.

getEtagBytes()

public ByteString getEtagBytes()

Optional. This checksum is computed by the server based on the value of other fields, and might be sent on update requests to ensure the client has an up-to-date value before proceeding.

string etag = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for etag.

getEventTypes(int index)

public String getEventTypes(int index)

Required. Immutable. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification.

The supported event types depend on the target resource of your subscription. For details, see Supported Google Workspace events.

By default, you also receive events about the lifecycle of your subscription. You don't need to specify lifecycle events for this field.

If you specify an event type that doesn't exist for the target resource, the request returns an HTTP 400 Bad Request status code.

repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The eventTypes at the given index.

getEventTypesBytes(int index)

public ByteString getEventTypesBytes(int index)

Required. Immutable. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification.

The supported event types depend on the target resource of your subscription. For details, see Supported Google Workspace events.

By default, you also receive events about the lifecycle of your subscription. You don't need to specify lifecycle events for this field.

If you specify an event type that doesn't exist for the target resource, the request returns an HTTP 400 Bad Request status code.

repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the eventTypes at the given index.

getEventTypesCount()

public int getEventTypesCount()

Required. Immutable. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification.

The supported event types depend on the target resource of your subscription. For details, see Supported Google Workspace events.

By default, you also receive events about the lifecycle of your subscription. You don't need to specify lifecycle events for this field.

If you specify an event type that doesn't exist for the target resource, the request returns an HTTP 400 Bad Request status code.

repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
int

The count of eventTypes.

getEventTypesList()

public ProtocolStringList getEventTypesList()

Required. Immutable. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification.

The supported event types depend on the target resource of your subscription. For details, see Supported Google Workspace events.

By default, you also receive events about the lifecycle of your subscription. You don't need to specify lifecycle events for this field.

If you specify an event type that doesn't exist for the target resource, the request returns an HTTP 400 Bad Request status code.

repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
ProtocolStringList

A list containing the eventTypes.

getExpirationCase()

public Subscription.ExpirationCase getExpirationCase()
Returns
Type Description
Subscription.ExpirationCase

getExpireTime()

public Timestamp getExpireTime()

Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.

.google.protobuf.Timestamp expire_time = 13 [(.google.api.field_behavior) = NON_EMPTY_DEFAULT];

Returns
Type Description
Timestamp

The expireTime.

getExpireTimeOrBuilder()

public TimestampOrBuilder getExpireTimeOrBuilder()

Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.

.google.protobuf.Timestamp expire_time = 13 [(.google.api.field_behavior) = NON_EMPTY_DEFAULT];

Returns
Type Description
TimestampOrBuilder

getName()

public String getName()

Optional. Immutable. Identifier. Resource name of the subscription.

Format: subscriptions/{subscription}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

Optional. Immutable. Identifier. Resource name of the subscription.

Format: subscriptions/{subscription}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for name.

getNotificationEndpoint()

public NotificationEndpoint getNotificationEndpoint()

Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.

.google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
NotificationEndpoint

The notificationEndpoint.

getNotificationEndpointOrBuilder()

public NotificationEndpointOrBuilder getNotificationEndpointOrBuilder()

Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.

.google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
NotificationEndpointOrBuilder

getParserForType()

public Parser<Subscription> getParserForType()
Returns
Type Description
Parser<Subscription>
Overrides

getPayloadOptions()

public PayloadOptions getPayloadOptions()

Optional. Options about what data to include in the event payload. Only supported for Google Chat events.

.google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
PayloadOptions

The payloadOptions.

getPayloadOptionsOrBuilder()

public PayloadOptionsOrBuilder getPayloadOptionsOrBuilder()

Optional. Options about what data to include in the event payload. Only supported for Google Chat events.

.google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
PayloadOptionsOrBuilder

getReconciling()

public boolean getReconciling()

Output only. If true, the subscription is in the process of being updated.

bool reconciling = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

The reconciling.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getState()

public Subscription.State getState()

Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint.

.google.apps.events.subscriptions.v1.Subscription.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Subscription.State

The state.

getStateValue()

public int getStateValue()

Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint.

.google.apps.events.subscriptions.v1.Subscription.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for state.

getSuspensionReason()

public Subscription.ErrorType getSuspensionReason()

Output only. The error that suspended the subscription.

To reactivate the subscription, resolve the error and call the ReactivateSubscription method.

.google.apps.events.subscriptions.v1.Subscription.ErrorType suspension_reason = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Subscription.ErrorType

The suspensionReason.

getSuspensionReasonValue()

public int getSuspensionReasonValue()

Output only. The error that suspended the subscription.

To reactivate the subscription, resolve the error and call the ReactivateSubscription method.

.google.apps.events.subscriptions.v1.Subscription.ErrorType suspension_reason = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for suspensionReason.

getTargetResource()

public String getTargetResource()

Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the full resource name. To learn about target resources and the events that they support, see Supported Google Workspace events.

A user can only authorize your app to create one subscription for a given target resource. If your app tries to create another subscription with the same user credentials, the request returns an ALREADY_EXISTS error.

string target_resource = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
String

The targetResource.

getTargetResourceBytes()

public ByteString getTargetResourceBytes()

Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the full resource name. To learn about target resources and the events that they support, see Supported Google Workspace events.

A user can only authorize your app to create one subscription for a given target resource. If your app tries to create another subscription with the same user credentials, the request returns an ALREADY_EXISTS error.

string target_resource = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for targetResource.

getTtl()

public Duration getTtl()

Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to 0, uses the maximum possible duration.

.google.protobuf.Duration ttl = 14 [(.google.api.field_behavior) = INPUT_ONLY];

Returns
Type Description
Duration

The ttl.

getTtlOrBuilder()

public DurationOrBuilder getTtlOrBuilder()

Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to 0, uses the maximum possible duration.

.google.protobuf.Duration ttl = 14 [(.google.api.field_behavior) = INPUT_ONLY];

Returns
Type Description
DurationOrBuilder

getUid()

public String getUid()

Output only. System-assigned unique identifier for the subscription.

string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The uid.

getUidBytes()

public ByteString getUidBytes()

Output only. System-assigned unique identifier for the subscription.

string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for uid.

getUpdateTime()

public Timestamp getUpdateTime()

Output only. The last time that the subscription is updated.

.google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The updateTime.

getUpdateTimeOrBuilder()

public TimestampOrBuilder getUpdateTimeOrBuilder()

Output only. The last time that the subscription is updated.

.google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

hasCreateTime()

public boolean hasCreateTime()

Output only. The time when the subscription is created.

.google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the createTime field is set.

hasExpireTime()

public boolean hasExpireTime()

Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.

.google.protobuf.Timestamp expire_time = 13 [(.google.api.field_behavior) = NON_EMPTY_DEFAULT];

Returns
Type Description
boolean

Whether the expireTime field is set.

hasNotificationEndpoint()

public boolean hasNotificationEndpoint()

Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.

.google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
boolean

Whether the notificationEndpoint field is set.

hasPayloadOptions()

public boolean hasPayloadOptions()

Optional. Options about what data to include in the event payload. Only supported for Google Chat events.

.google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the payloadOptions field is set.

hasTtl()

public boolean hasTtl()

Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to 0, uses the maximum possible duration.

.google.protobuf.Duration ttl = 14 [(.google.api.field_behavior) = INPUT_ONLY];

Returns
Type Description
boolean

Whether the ttl field is set.

hasUpdateTime()

public boolean hasUpdateTime()

Output only. The last time that the subscription is updated.

.google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the updateTime field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Subscription.Builder newBuilderForType()
Returns
Type Description
Subscription.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Subscription.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Subscription.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Subscription.Builder toBuilder()
Returns
Type Description
Subscription.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException