Packages

Google Cloud Storage JSON API client library. Stores and retrieves potentially large, immutable data objects.

Current section

Files

Jump to
googly_cloud_storage lib googly cloud_storage notifications.ex
Raw

lib/googly/cloud_storage/notifications.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudStorage.Notifications do
@moduledoc """
Endpoints for the `Notifications` resource.
"""
alias Googly.CloudStorage.Request
@doc """
Permanently deletes a notification subscription.
## Parameters
* `bucket` (*type:* `String.t()`) - The parent bucket of the notification.
* `notification` (*type:* `String.t()`) - ID of the notification to delete.
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `alt` (*type:* `String.t()`) - Data format for the response.
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable").
* `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead.
* `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets.
## Returns
* `{:ok, Req.Response.t()}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec delete(String.t(), String.t(), keyword()) :: {:ok, Req.Response.t()} | {:error, term()}
def delete(bucket, notification, opts \\ []) do
Request.run(
method: :delete,
url: "/storage/v1/b/{bucket}/notificationConfigs/{notification}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"notification" => URI.encode(notification, &(URI.char_unreserved?(&1) or &1 == ?/))
},
query: [],
params: %{
alt: {:query, "alt"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_type: {:query, "uploadType"},
user_ip: {:query, "userIp"},
user_project: {:query, "userProject"}
},
decode: nil,
opts: opts
)
end
@doc """
View a notification configuration.
## Parameters
* `bucket` (*type:* `String.t()`) - The parent bucket of the notification.
* `notification` (*type:* `String.t()`) - Notification ID
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `alt` (*type:* `String.t()`) - Data format for the response.
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable").
* `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead.
* `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets.
## Returns
* `{:ok, %Googly.CloudStorage.Model.Notification{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec get(String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Notification.t()} | {:error, term()}
def get(bucket, notification, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/notificationConfigs/{notification}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"notification" => URI.encode(notification, &(URI.char_unreserved?(&1) or &1 == ?/))
},
query: [],
params: %{
alt: {:query, "alt"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_type: {:query, "uploadType"},
user_ip: {:query, "userIp"},
user_project: {:query, "userProject"}
},
decode: Googly.CloudStorage.Model.Notification,
opts: opts
)
end
@doc """
Creates a notification subscription for a given bucket.
## Parameters
* `bucket` (*type:* `String.t()`) - The parent bucket of the notification.
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `alt` (*type:* `String.t()`) - Data format for the response.
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable").
* `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead.
* `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets.
* `body` (*type:* `Googly.CloudStorage.Model.Notification.t()`) -
## Returns
* `{:ok, %Googly.CloudStorage.Model.Notification{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec insert(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Notification.t()} | {:error, term()}
def insert(bucket, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/notificationConfigs",
path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)},
query: [],
params: %{
alt: {:query, "alt"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_type: {:query, "uploadType"},
user_ip: {:query, "userIp"},
user_project: {:query, "userProject"},
body: {:body, nil}
},
decode: Googly.CloudStorage.Model.Notification,
opts: opts
)
end
@doc """
Retrieves a list of notification subscriptions for a given bucket.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of a Google Cloud Storage bucket.
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `alt` (*type:* `String.t()`) - Data format for the response.
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable").
* `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead.
* `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets.
## Returns
* `{:ok, %Googly.CloudStorage.Model.Notifications{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec list(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Notifications.t()} | {:error, term()}
def list(bucket, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/notificationConfigs",
path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)},
query: [],
params: %{
alt: {:query, "alt"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_type: {:query, "uploadType"},
user_ip: {:query, "userIp"},
user_project: {:query, "userProject"}
},
decode: Googly.CloudStorage.Model.Notifications,
opts: opts
)
end
end