Platform Release 8 April 2020

Subscriptions can now be queried, created, updated, and deleted using the GraphQL API.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Query {
  subscription(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Subscription
  subscriptions(where: String, sort: [String!], limit: Int, offset: Int): SubscriptionQueryResult!
}

extend type Mutation {
  createSubscription(draft: SubscriptionDraft!): Subscription
  deleteSubscription(version: Long!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Subscription
  updateSubscription(version: Long!, actions: [SubscriptionUpdateAction!]!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Subscription
}

type AzureServiceBusDestination implements Destination {
  connectionString: String!
  type: String!
}

input AzureServiceBusDestinationInput {
  connectionString: String!
}

type ChangeSubscription {
  resourceTypeId: String!
}

input ChangeSubscriptionDestination {
  destination: DestinationInput!
}

input ChangeSubscriptionInput {
  resourceTypeId: String!
}

type CloudEventsSubscriptionsFormat implements NotificationFormat {
  type: String!
  cloudEventsVersion: String!
}

input CloudEventsSubscriptionsFormatInput {
  cloudEventsVersion: String!
}

interface Destination {
  type: String!
}

input DestinationInput {
  SQS: SQSDestinationInput
  SNS: SNSDestinationInput
  AzureServiceBus: AzureServiceBusDestinationInput
  EventGrid: EventGridDestinationInput
  GoogleCloudPubSub: GoogleCloudPubSubDestinationInput
}

type EventGridDestination implements Destination {
  uri: String!
  accessKey: String!
  type: String!
}

input EventGridDestinationInput {
  uri: String!
  accessKey: String!
}

type GoogleCloudPubSubDestination implements Destination {
  projectId: String!
  topic: String!
  type: String!
}

input GoogleCloudPubSubDestinationInput {
  projectId: String!
  topic: String!
}

type MessageSubscription {
  resourceTypeId: String!
  types: [String!]!
}

input MessageSubscriptionInput {
  resourceTypeId: String!
  types: [String!]
}

interface NotificationFormat {
  type: String!
}

type PlatformFormat implements NotificationFormat {
  type: String!
}

input PlatformFormatInput {
  dummy: String
}

type SNSDestination implements Destination {
  topicArn: String!
  accessKey: String!
  accessSecret: String!
  type: String!
}

input SNSDestinationInput {
  topicArn: String!
  accessKey: String!
  accessSecret: String!
}

type SQSDestination implements Destination {
  queueUrl: String!
  accessKey: String!
  accessSecret: String!
  region: String!
  type: String!
}

input SQSDestinationInput {
  queueUrl: String!
  accessKey: String!
  accessSecret: String!
  region: String!
}

input SetSubscriptionChanges {
  changes: [ChangeSubscriptionInput!]!
}

input SetSubscriptionKey {
  key: String
}

input SetSubscriptionMessages {
  messages: [MessageSubscriptionInput!]!
}

type Subscription implements Versioned {
  key: String
  destination: Destination!
  messages: [MessageSubscription!]!
  changes: [ChangeSubscription!]!
  format: NotificationFormat!
  status: SubscriptionHealthStatus!
  id: String!
  version: Long!
  createdAt: DateTime!
  lastModifiedAt: DateTime!
  createdBy: Initiator
  lastModifiedBy: Initiator
}

input SubscriptionDraft {
  key: String
  destination: DestinationInput!
  messages: [MessageSubscriptionInput!]
  changes: [ChangeSubscriptionInput!]
  format: SubscriptionFormatInput
}

input SubscriptionFormatInput {
  Platform: PlatformFormatInput
  CloudEvents: CloudEventsSubscriptionsFormatInput
}

enum SubscriptionHealthStatus {
  TemporaryError
  ConfigurationErrorDeliveryStopped
  ConfigurationError
  Healthy
}

type SubscriptionQueryResult {
  offset: Int!
  count: Int!
  total: Long!
  results: [Subscription!]!
}

input SubscriptionUpdateAction {
  changeDestination: ChangeSubscriptionDestination
  setChanges: SetSubscriptionChanges
  setKey: SetSubscriptionKey
  setMessages: SetSubscriptionMessages
}