As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Apps Events Subscriptions v1 API

class google.apps.events_subscriptions_v1.types.CreateSubscriptionMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for CreateSubscription LRO.

class google.apps.events_subscriptions_v1.types.CreateSubscriptionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.CreateSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.CreateSubscription].

subscription

Required. The subscription resource to create.

Type

google.apps.events_subscriptions_v1.types.Subscription

validate_only

Optional. If set to true, validates and previews the request, but doesn’t create the subscription.

Type

bool

class google.apps.events_subscriptions_v1.types.DeleteSubscriptionMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for DeleteSubscription LRO.

class google.apps.events_subscriptions_v1.types.DeleteSubscriptionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.DeleteSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.DeleteSubscription].

name

Required. Resource name of the subscription to delete.

Format: subscriptions/{subscription}

Type

str

validate_only

Optional. If set to true, validates and previews the request, but doesn’t delete the subscription.

Type

bool

allow_missing

Optional. If set to true and the subscription isn’t found, the request succeeds but doesn’t delete the subscription.

Type

bool

etag

Optional. Etag of the subscription.

If present, it must match with the server’s etag. Otherwise, request fails with the status ABORTED.

Type

str

class google.apps.events_subscriptions_v1.types.GetSubscriptionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.GetSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.GetSubscription].

name

Required. Resource name of the subscription.

Format: subscriptions/{subscription}

Type

str

class google.apps.events_subscriptions_v1.types.ListSubscriptionsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.ListSubscriptions][google.apps.events.subscriptions.v1.SubscriptionsService.ListSubscriptions].

page_size

Optional. The maximum number of subscriptions to return. The service might return fewer than this value.

If unspecified or set to 0, up to 50 subscriptions are returned.

The maximum value is 100. If you specify a value more than 100, the system only returns 100 subscriptions.

Type

int

page_token

Optional. A page token, received from a previous list subscriptions call. Provide this parameter to retrieve the subsequent page.

When paginating, the filter value should match the call that provided the page token. Passing a different value might lead to unexpected results.

Type

str

filter

Required. A query filter.

You can filter subscriptions by event type (event_types) and target resource (target_resource).

You must specify at least one event type in your query. To filter for multiple event types, use the OR operator.

To filter by both event type and target resource, use the AND operator and specify the full resource name, such as //chat.googleapis.com/spaces/{space}.

For example, the following queries are valid:

event_types:"google.workspace.chat.membership.v1.updated" OR
  event_types:"google.workspace.chat.message.v1.created"

event_types:"google.workspace.chat.message.v1.created" AND
  target_resource="//chat.googleapis.com/spaces/{space}"

( event_types:"google.workspace.chat.membership.v1.updated" OR
  event_types:"google.workspace.chat.message.v1.created" ) AND
  target_resource="//chat.googleapis.com/spaces/{space}"

The server rejects invalid queries with an INVALID_ARGUMENT error.

Type

str

class google.apps.events_subscriptions_v1.types.ListSubscriptionsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response message for [SubscriptionsService.ListSubscriptions][google.apps.events.subscriptions.v1.SubscriptionsService.ListSubscriptions].

subscriptions

List of subscriptions.

Type

MutableSequence[google.apps.events_subscriptions_v1.types.Subscription]

next_page_token

A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

Type

str

class google.apps.events_subscriptions_v1.types.NotificationEndpoint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The endpoint where the subscription delivers events.

pubsub_topic

Immutable. The Cloud Pub/Sub topic that receives events for the subscription.

Format: projects/{project}/topics/{topic}

You must create the topic in the same Google Cloud project where you create this subscription.

When the topic receives events, the events are encoded as Cloud Pub/Sub messages. For details, see the Google Cloud Pub/Sub Protocol Binding for CloudEvents.

This field is a member of oneof endpoint.

Type

str

class google.apps.events_subscriptions_v1.types.PayloadOptions(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

include_resource

Optional. Whether the event payload includes data about the resource that changed. For example, for an event where a Google Chat message was created, whether the payload contains data about the `Message <https://developers.google.com/chat/api/reference/rest/v1/spaces.messages>`__ resource. If false, the event payload only includes the name of the changed resource.

Type

bool

field_mask

Optional. If include_resource is set to true, the list of fields to include in the event payload. Separate fields with a comma. For example, to include a Google Chat message’s sender and create time, enter message.sender,message.createTime. If omitted, the payload includes all fields for the resource.

If you specify a field that doesn’t exist for the resource, the system ignores the field.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.apps.events_subscriptions_v1.types.ReactivateSubscriptionMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for ReactivateSubscription LRO.

class google.apps.events_subscriptions_v1.types.ReactivateSubscriptionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.ReactivateSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription].

name

Required. Resource name of the subscription.

Format: subscriptions/{subscription}

Type

str

class google.apps.events_subscriptions_v1.types.Subscription(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

expire_time

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

This field is a member of oneof expiration.

Type

google.protobuf.timestamp_pb2.Timestamp

ttl

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

This field is a member of oneof expiration.

Type

google.protobuf.duration_pb2.Duration

name

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

Format: subscriptions/{subscription}

Type

str

uid

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

Type

str

target_resource

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.

Type

str

event_types

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.

Type

MutableSequence[str]

payload_options

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

Type

google.apps.events_subscriptions_v1.types.PayloadOptions

notification_endpoint

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

Type

google.apps.events_subscriptions_v1.types.NotificationEndpoint

state

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

Type

google.apps.events_subscriptions_v1.types.Subscription.State

suspension_reason

Output only. The error that suspended the subscription.

To reactivate the subscription, resolve the error and call the [ReactivateSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription] method.

Type

google.apps.events_subscriptions_v1.types.Subscription.ErrorType

authority

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.

Type

str

create_time

Output only. The time when the subscription is created.

Type

google.protobuf.timestamp_pb2.Timestamp

update_time

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

Type

google.protobuf.timestamp_pb2.Timestamp

reconciling

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

Type

bool

etag

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.

Type

str

class ErrorType(value)[source]

Bases: proto.enums.Enum

Possible errors for a subscription.

Values:
ERROR_TYPE_UNSPECIFIED (0):

Default value. This value is unused.

USER_SCOPE_REVOKED (1):

The authorizing user has revoked the grant of one or more OAuth scopes. To learn more about authorization for Google Workspace, see Configure the OAuth consent screen.

RESOURCE_DELETED (2):

The target resource for the subscription no longer exists.

USER_AUTHORIZATION_FAILURE (3):

The user that authorized the creation of the subscription no longer has access to the subscription’s target resource.

ENDPOINT_PERMISSION_DENIED (4):

The Google Workspace application doesn’t have access to deliver events to your subscription’s notification endpoint.

ENDPOINT_NOT_FOUND (6):

The subscription’s notification endpoint doesn’t exist, or the endpoint can’t be found in the Google Cloud project where you created the subscription.

ENDPOINT_RESOURCE_EXHAUSTED (7):

The subscription’s notification endpoint failed to receive events due to insufficient quota or reaching rate limiting.

OTHER (5):

An unidentified error has occurred.

class State(value)[source]

Bases: proto.enums.Enum

Possible states for the subscription.

Values:
STATE_UNSPECIFIED (0):

Default value. This value is unused.

ACTIVE (1):

The subscription is active and can receive and deliver events to its notification endpoint.

SUSPENDED (2):

The subscription is unable to receive events due to an error. To identify the error, see the [suspension_reason][google.apps.events.subscriptions.v1.Subscription.suspension_reason] field.

DELETED (3):

The subscription is deleted.

class google.apps.events_subscriptions_v1.types.UpdateSubscriptionMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for UpdateSubscription LRO.

class google.apps.events_subscriptions_v1.types.UpdateSubscriptionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request message for [SubscriptionsService.UpdateSubscription][google.apps.events.subscriptions.v1.SubscriptionsService.UpdateSubscription].

subscription

Required. The subscription to update.

The subscription’s name field is used to identify the subscription to update.

Type

google.apps.events_subscriptions_v1.types.Subscription

update_mask

Optional. Required. The field to update.

You can update one of the following fields in a subscription:

  • [expire_time][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the subscription expires.

  • [ttl][google.apps.events.subscriptions.v1.Subscription.ttl]: The time-to-live (TTL) or duration of the subscription.

Type

google.protobuf.field_mask_pb2.FieldMask

validate_only

Optional. If set to true, validates and previews the request, but doesn’t update the subscription.

Type

bool