# Google Workspace Events V1 API - Class Google::Apps::Events::Subscriptions::V1::Subscription (v0.8.0)

0.8.0 (latest) 0.7.0 0.6.1 0.5.0 0.4.0 0.3.1 0.2.0 0.1.1 Reference documentation and code samples for the Google Workspace Events V1 API class Google::Apps::Events::Subscriptions::V1::Subscription.

A subscription to receive events about a Google Workspace resource. To learn
more about subscriptions, see the [Google Workspace Events API
overview](https://developers.google.com/workspace/events).

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #authority

    def authority() -> ::String

**Returns**

- (::String) --- 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`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids)
  field from the Directory API.

### #create_time

    def create_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Timestamp)) --- Output only. The time when the subscription is created.

### #etag

    def etag() -> ::String

**Returns**

- (::String) --- 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.

### #etag=

    def etag=(value) -> ::String

**Parameter**

- **value** (::String) --- 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.
**Returns**

- (::String) --- 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.

### #event_types

    def event_types() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- 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](https://developers.google.com/workspace/events/guides#supported-events).

  By default, you also receive events about the [lifecycle of your
  subscription](https://developers.google.com/workspace/events/guides/events-lifecycle).
  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.

### #event_types=

    def event_types=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- 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](https://developers.google.com/workspace/events/guides#supported-events).

  By default, you also receive events about the [lifecycle of your
  subscription](https://developers.google.com/workspace/events/guides/events-lifecycle).
  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.
**Returns**

- (::Array\<::String\>) --- 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](https://developers.google.com/workspace/events/guides#supported-events).

  By default, you also receive events about the [lifecycle of your
  subscription](https://developers.google.com/workspace/events/guides/events-lifecycle).
  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.

### #expire_time

    def expire_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Timestamp)) --- Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.


  Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #expire_time=

    def expire_time=(value) -> ::Google::Protobuf::Timestamp

**Parameter**

- **value** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Timestamp)) --- Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.


  Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Timestamp)) --- Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input.


  Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #name

    def name() -> ::String

**Returns**

- (::String) --- Optional. Immutable. Identifier. Resource name of the subscription.

  Format: `subscriptions/{subscription}`

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::String) --- Optional. Immutable. Identifier. Resource name of the subscription.


  Format: `subscriptions/{subscription}`
**Returns**

- (::String) --- Optional. Immutable. Identifier. Resource name of the subscription.

  Format: `subscriptions/{subscription}`

### #notification_endpoint

    def notification_endpoint() -> ::Google::Apps::Events::Subscriptions::V1::NotificationEndpoint

**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::NotificationEndpoint](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-NotificationEndpoint)) --- Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.

### #notification_endpoint=

    def notification_endpoint=(value) -> ::Google::Apps::Events::Subscriptions::V1::NotificationEndpoint

**Parameter**

- **value** ([::Google::Apps::Events::Subscriptions::V1::NotificationEndpoint](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-NotificationEndpoint)) --- Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.
**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::NotificationEndpoint](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-NotificationEndpoint)) --- Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic.

### #payload_options

    def payload_options() -> ::Google::Apps::Events::Subscriptions::V1::PayloadOptions

**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::PayloadOptions](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-PayloadOptions)) --- Optional. Options about what data to include in the event payload. Only supported for Google Chat events.

### #payload_options=

    def payload_options=(value) -> ::Google::Apps::Events::Subscriptions::V1::PayloadOptions

**Parameter**

- **value** ([::Google::Apps::Events::Subscriptions::V1::PayloadOptions](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-PayloadOptions)) --- Optional. Options about what data to include in the event payload. Only supported for Google Chat events.
**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::PayloadOptions](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-PayloadOptions)) --- Optional. Options about what data to include in the event payload. Only supported for Google Chat events.

### #reconciling

    def reconciling() -> ::Boolean

**Returns**

- (::Boolean) --- Output only. If `true`, the subscription is in the process of being updated.

### #state

    def state() -> ::Google::Apps::Events::Subscriptions::V1::Subscription::State

**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::Subscription::State](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-Subscription-State)) --- Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint.

### #suspension_reason

    def suspension_reason() -> ::Google::Apps::Events::Subscriptions::V1::Subscription::ErrorType

**Returns**

- ([::Google::Apps::Events::Subscriptions::V1::Subscription::ErrorType](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-Subscription-ErrorType)) --- Output only. The error that suspended the subscription.


  To reactivate the subscription, resolve the error and call the
  [`ReactivateSubscription`](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Apps-Events-Subscriptions-V1-SubscriptionsService-Client#Google__Apps__Events__Subscriptions__V1__SubscriptionsService__Client_reactivate_subscription_instance_ "Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client#reactivate_subscription (method)")
  method.

### #target_resource

    def target_resource() -> ::String

**Returns**

- (::String) --- Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the [full resource
  name](https://google.aip.dev/122#full-resource-names). To learn about target resources and the events that they support, see [Supported Google
  Workspace
  events](https://developers.google.com/workspace/events#supported-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.

### #target_resource=

    def target_resource=(value) -> ::String

**Parameter**

- **value** (::String) --- Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the [full resource
  name](https://google.aip.dev/122#full-resource-names). To learn about target resources and the events that they support, see [Supported Google
  Workspace
  events](https://developers.google.com/workspace/events#supported-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.
**Returns**

- (::String) --- Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the [full resource
  name](https://google.aip.dev/122#full-resource-names). To learn about target resources and the events that they support, see [Supported Google
  Workspace
  events](https://developers.google.com/workspace/events#supported-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.

### #ttl

    def ttl() -> ::Google::Protobuf::Duration

**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Duration)) --- Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to `0`, uses the maximum possible duration.


  Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #ttl=

    def ttl=(value) -> ::Google::Protobuf::Duration

**Parameter**

- **value** ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Duration)) --- Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to `0`, uses the maximum possible duration.


  Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Duration)) --- Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to `0`, uses the maximum possible duration.


  Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #uid

    def uid() -> ::String

**Returns**

- (::String) --- Output only. System-assigned unique identifier for the subscription.

### #update_time

    def update_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-apps-events-subscriptions-v1/latest/Google-Protobuf-Timestamp)) --- Output only. The last time that the subscription is updated.