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 operations.ex
Raw

lib/googly/cloud_storage/operations.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudStorage.Operations do
@moduledoc """
Endpoints for the `Operations` resource.
"""
alias Googly.CloudStorage.Request
@doc """
Starts asynchronous advancement of the relocate bucket operation in the case of required write downtime, to allow it to lock the bucket at the source location, and proceed with the bucket location swap. The server makes a best effort to advance the relocate bucket operation, but success is not guaranteed.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket to advance the relocate for.
* `operation_id` (*type:* `String.t()`) - ID of the operation resource.
* `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.
* `body` (*type:* `Googly.CloudStorage.Model.AdvanceRelocateBucketOperationRequest.t()`) -
## Returns
* `{:ok, Req.Response.t()}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec advance_relocate_bucket(String.t(), String.t(), keyword()) ::
{:ok, Req.Response.t()} | {:error, term()}
def advance_relocate_bucket(bucket, operation_id, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/operations/{operationId}/advanceRelocateBucket",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"operationId" => URI.encode(operation_id, &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"},
body: {:body, nil}
},
decode: nil,
opts: opts
)
end
@doc """
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed.
## Parameters
* `bucket` (*type:* `String.t()`) - The parent bucket of the operation resource.
* `operation_id` (*type:* `String.t()`) - The ID of the operation resource.
* `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.
## Returns
* `{:ok, Req.Response.t()}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec cancel(String.t(), String.t(), keyword()) :: {:ok, Req.Response.t()} | {:error, term()}
def cancel(bucket, operation_id, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/operations/{operationId}/cancel",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"operationId" => URI.encode(operation_id, &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"}
},
decode: nil,
opts: opts
)
end
@doc """
Gets the latest state of a long-running operation.
## Parameters
* `bucket` (*type:* `String.t()`) - The parent bucket of the operation resource.
* `operation_id` (*type:* `String.t()`) - The ID of the operation resource.
* `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.
## Returns
* `{:ok, %Googly.CloudStorage.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec get(String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def get(bucket, operation_id, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/operations/{operationId}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"operationId" => URI.encode(operation_id, &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"}
},
decode: Googly.CloudStorage.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Lists operations that match the specified filter in the request.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which to look for operations.
* `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.
* `filter` (*type:* `String.t()`) - A filter to narrow down results to a preferred subset. The filtering language is documented in more detail in [AIP-160](https://google.aip.dev/160).
* `page_size` (*type:* `integer()`) - Maximum number of items to return in a single page of responses. Fewer total results may be returned than requested. The service uses this parameter or 100 items, whichever is smaller.
* `page_token` (*type:* `String.t()`) - A previously-returned page token representing part of the larger set of results to view.
## Returns
* `{:ok, %Googly.CloudStorage.Model.GoogleLongrunningListOperationsResponse{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec list(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.GoogleLongrunningListOperationsResponse.t()}
| {:error, term()}
def list(bucket, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/operations",
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"},
filter: {:query, "filter"},
page_size: {:query, "pageSize"},
page_token: {:query, "pageToken"}
},
decode: Googly.CloudStorage.Model.GoogleLongrunningListOperationsResponse,
opts: opts
)
end
end