blob: e32c957ef9430a0a2cf536a61f9ffb562b256a1d [file]
// Copyright 2026 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package storagebatchoperations provides access to the Storage Batch Operations API.
//
// For product documentation, see: https://cloud.google.com/storage/docs/batch-operations/overview
//
// # Library status
//
// These client libraries are officially supported by Google. However, this
// library is considered complete and is in maintenance mode. This means
// that we will address critical bugs and security issues but will not add
// any new features.
//
// When possible, we recommend using our newer
// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
// that are still actively being worked and iterated on.
//
// # Creating a client
//
// Usage example:
//
// import "google.golang.org/api/storagebatchoperations/v1"
// ...
// ctx := context.Background()
// storagebatchoperationsService, err := storagebatchoperations.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for
// authentication. For information on how to create and obtain Application
// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// # Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API
// keys), use [google.golang.org/api/option.WithAPIKey]:
//
// storagebatchoperationsService, err := storagebatchoperations.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
// flow, use [google.golang.org/api/option.WithTokenSource]:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// storagebatchoperationsService, err := storagebatchoperations.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See [google.golang.org/api/option.ClientOption] for details on options.
package storagebatchoperations // import "google.golang.org/api/storagebatchoperations/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"log/slog"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/googleapis/gax-go/v2/internallog"
googleapi "google.golang.org/api/googleapi"
internal "google.golang.org/api/internal"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
internaloption "google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
var _ = internal.Version
var _ = internallog.New
const apiId = "storagebatchoperations:v1"
const apiName = "storagebatchoperations"
const apiVersion = "v1"
const basePath = "https://storagebatchoperations.googleapis.com/"
const basePathTemplate = "https://storagebatchoperations.UNIVERSE_DOMAIN/"
const mtlsBasePath = "https://storagebatchoperations.mtls.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// See, edit, configure, and delete your Google Cloud data and see the email
// address for your Google Account.
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := internaloption.WithDefaultScopes(
"https://www.googleapis.com/auth/cloud-platform",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
opts = append(opts, internaloption.EnableNewAuthLibrary())
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
s.Projects = NewProjectsService(s)
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
return NewService(context.TODO(), option.WithHTTPClient(client))
}
type Service struct {
client *http.Client
logger *slog.Logger
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Projects *ProjectsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProjectsService(s *Service) *ProjectsService {
rs := &ProjectsService{s: s}
rs.Locations = NewProjectsLocationsService(s)
return rs
}
type ProjectsService struct {
s *Service
Locations *ProjectsLocationsService
}
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
rs := &ProjectsLocationsService{s: s}
rs.Jobs = NewProjectsLocationsJobsService(s)
rs.Operations = NewProjectsLocationsOperationsService(s)
return rs
}
type ProjectsLocationsService struct {
s *Service
Jobs *ProjectsLocationsJobsService
Operations *ProjectsLocationsOperationsService
}
func NewProjectsLocationsJobsService(s *Service) *ProjectsLocationsJobsService {
rs := &ProjectsLocationsJobsService{s: s}
rs.BucketOperations = NewProjectsLocationsJobsBucketOperationsService(s)
return rs
}
type ProjectsLocationsJobsService struct {
s *Service
BucketOperations *ProjectsLocationsJobsBucketOperationsService
}
func NewProjectsLocationsJobsBucketOperationsService(s *Service) *ProjectsLocationsJobsBucketOperationsService {
rs := &ProjectsLocationsJobsBucketOperationsService{s: s}
return rs
}
type ProjectsLocationsJobsBucketOperationsService struct {
s *Service
}
func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
rs := &ProjectsLocationsOperationsService{s: s}
return rs
}
type ProjectsLocationsOperationsService struct {
s *Service
}
// AccessControlsUpdates: Represents updates to existing access-control entries
// on an object.
type AccessControlsUpdates struct {
// Grants: Optional. Grants to add or update. If a grant for same entity
// exists, its role is updated.
Grants []*ObjectAccessControl `json:"grants,omitempty"`
// RemoveEntities: Optional. Entities for which all grants should be removed.
// An entity can't be in both `grants` and `remove_entities`.
RemoveEntities []string `json:"removeEntities,omitempty"`
// ForceSendFields is a list of field names (e.g. "Grants") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Grants") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s AccessControlsUpdates) MarshalJSON() ([]byte, error) {
type NoMethod AccessControlsUpdates
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Bucket: Describes configuration of a single bucket and its objects to be
// transformed.
type Bucket struct {
// Bucket: Required. Bucket name for the objects to be transformed.
Bucket string `json:"bucket,omitempty"`
// Manifest: Specifies objects in a manifest file.
Manifest *Manifest `json:"manifest,omitempty"`
// PrefixList: Specifies objects matching a prefix set.
PrefixList *PrefixList `json:"prefixList,omitempty"`
// ForceSendFields is a list of field names (e.g. "Bucket") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Bucket") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Bucket) MarshalJSON() ([]byte, error) {
type NoMethod Bucket
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketList: Describes list of buckets and their objects to be transformed.
type BucketList struct {
// Buckets: Required. List of buckets and their objects to be transformed. You
// can specify only one bucket per job. If multiple buckets are specified, an
// error occurs.
Buckets []*Bucket `json:"buckets,omitempty"`
// ForceSendFields is a list of field names (e.g. "Buckets") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Buckets") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s BucketList) MarshalJSON() ([]byte, error) {
type NoMethod BucketList
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketOperation: BucketOperation represents a bucket-level breakdown of a
// Job.
type BucketOperation struct {
// BucketName: The bucket name of the objects to be transformed in the
// BucketOperation.
BucketName string `json:"bucketName,omitempty"`
// CompleteTime: Output only. The time that the BucketOperation was completed.
CompleteTime string `json:"completeTime,omitempty"`
// Counters: Output only. Information about the progress of the bucket
// operation.
Counters *Counters `json:"counters,omitempty"`
// CreateTime: Output only. The time that the BucketOperation was created.
CreateTime string `json:"createTime,omitempty"`
// DeleteObject: Delete objects.
DeleteObject *DeleteObject `json:"deleteObject,omitempty"`
// ErrorSummaries: Output only. Summarizes errors encountered with sample error
// log entries.
ErrorSummaries []*ErrorSummary `json:"errorSummaries,omitempty"`
// Manifest: Specifies objects in a manifest file.
Manifest *Manifest `json:"manifest,omitempty"`
// Name: Identifier. The resource name of the BucketOperation. This is defined
// by the service. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}/bucketOperations/{bucke
// t_operation}`.
Name string `json:"name,omitempty"`
// PrefixList: Specifies objects matching a prefix set.
PrefixList *PrefixList `json:"prefixList,omitempty"`
// ProjectSource: Specifies objects matching the object filters in a project
// source.
ProjectSource *ProjectSource `json:"projectSource,omitempty"`
// PutMetadata: Updates object metadata. Allows updating fixed-key and custom
// metadata and fixed-key metadata i.e. Cache-Control, Content-Disposition,
// Content-Encoding, Content-Language, Content-Type, Custom-Time.
PutMetadata *PutMetadata `json:"putMetadata,omitempty"`
// PutObjectHold: Changes object hold status.
PutObjectHold *PutObjectHold `json:"putObjectHold,omitempty"`
// RewriteObject: Rewrite the object and updates metadata like KMS key.
RewriteObject *RewriteObject `json:"rewriteObject,omitempty"`
// SetObjectAcls: Updates object ACLs.
SetObjectAcls *SetObjectAcls `json:"setObjectAcls,omitempty"`
// StartTime: Output only. The time that the BucketOperation was started.
StartTime string `json:"startTime,omitempty"`
// State: Output only. State of the BucketOperation.
//
// Possible values:
// "STATE_UNSPECIFIED" - Default value. This value is unused.
// "QUEUED" - Created but not yet started.
// "RUNNING" - In progress.
// "SUCCEEDED" - Completed successfully.
// "CANCELED" - Cancelled by the user.
// "FAILED" - Terminated due to an unrecoverable failure.
State string `json:"state,omitempty"`
// UpdateObjectCustomContext: Update object custom context.
UpdateObjectCustomContext *UpdateObjectCustomContext `json:"updateObjectCustomContext,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "BucketName") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BucketName") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s BucketOperation) MarshalJSON() ([]byte, error) {
type NoMethod BucketOperation
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// CancelJobRequest: Message for Job to Cancel
type CancelJobRequest struct {
// RequestId: Optional. An optional request ID to identify requests. Specify a
// unique request ID in case you need to retry your request. Requests with same
// `request_id` are ignored for at least 60 minutes since the first request.
// The request ID must be a valid UUID with the exception that zero UUID isn't
// supported (00000000-0000-0000-0000-000000000000).
RequestId string `json:"requestId,omitempty"`
// ForceSendFields is a list of field names (e.g. "RequestId") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "RequestId") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s CancelJobRequest) MarshalJSON() ([]byte, error) {
type NoMethod CancelJobRequest
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// CancelJobResponse: Message for response to cancel Job.
type CancelJobResponse struct {
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
}
// CancelOperationRequest: The request message for Operations.CancelOperation.
type CancelOperationRequest struct {
}
// Counters: Describes details about the progress of the job.
type Counters struct {
// FailedObjectCount: Output only. The number of objects that failed due to
// user errors or service errors.
FailedObjectCount int64 `json:"failedObjectCount,omitempty,string"`
// ObjectCustomContextsCreated: Output only. Number of object custom contexts
// created. This field is only populated for jobs with the
// UpdateObjectCustomContext transformation.
ObjectCustomContextsCreated int64 `json:"objectCustomContextsCreated,omitempty,string"`
// ObjectCustomContextsDeleted: Output only. Number of object custom contexts
// deleted. This field is only populated for jobs with the
// UpdateObjectCustomContext transformation.
ObjectCustomContextsDeleted int64 `json:"objectCustomContextsDeleted,omitempty,string"`
// ObjectCustomContextsUpdated: Output only. Number of object custom contexts
// updated. This counter tracks custom contexts where the key already existed,
// but the payload was modified. This field is only populated for jobs with the
// UpdateObjectCustomContext transformation.
ObjectCustomContextsUpdated int64 `json:"objectCustomContextsUpdated,omitempty,string"`
// SucceededObjectCount: Output only. Number of objects completed.
SucceededObjectCount int64 `json:"succeededObjectCount,omitempty,string"`
// TotalBytesFound: Output only. Number of bytes found from source. This field
// is only populated for jobs with a prefix list object configuration.
TotalBytesFound int64 `json:"totalBytesFound,omitempty,string"`
// TotalBytesTransformed: Output only. The total number of bytes affected by
// the transformation. For example, this counts bytes deleted for
// `DeleteObject` operations and bytes rewritten for `RewriteObject`
// operations.
TotalBytesTransformed int64 `json:"totalBytesTransformed,omitempty,string"`
// TotalObjectCount: Output only. Number of objects listed.
TotalObjectCount int64 `json:"totalObjectCount,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "FailedObjectCount") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "FailedObjectCount") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Counters) MarshalJSON() ([]byte, error) {
type NoMethod Counters
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// CustomContextUpdates: Describes a collection of updates to apply to custom
// contexts identified by key.
type CustomContextUpdates struct {
// KeysToClear: Optional. Custom contexts to clear by key. A key can't be
// present in both `updates` and `keys_to_clear`.
KeysToClear []string `json:"keysToClear,omitempty"`
// Updates: Optional. Insert or update the existing custom contexts.
Updates map[string]ObjectCustomContextPayload `json:"updates,omitempty"`
// ForceSendFields is a list of field names (e.g. "KeysToClear") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "KeysToClear") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s CustomContextUpdates) MarshalJSON() ([]byte, error) {
type NoMethod CustomContextUpdates
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// DeleteObject: Describes options to delete an object.
type DeleteObject struct {
// PermanentObjectDeletionEnabled: Required. Controls deletion behavior when
// versioning is enabled for the object's bucket. If true, both live and
// noncurrent objects will be permanently deleted. Otherwise live objects in
// versioned buckets will become noncurrent and objects that were already
// noncurrent will be skipped. This setting doesn't have any impact on the Soft
// Delete feature. All objects deleted by this service can be be restored for
// the duration of the Soft Delete retention duration if enabled. If enabled
// and the manifest doesn't specify an object's generation, a
// `GetObjectMetadata` call is made to determine the live object generation.
PermanentObjectDeletionEnabled bool `json:"permanentObjectDeletionEnabled,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "PermanentObjectDeletionEnabled") to unconditionally include in API
// requests. By default, fields with empty or default values are omitted from
// API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "PermanentObjectDeletionEnabled")
// to include in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s DeleteObject) MarshalJSON() ([]byte, error) {
type NoMethod DeleteObject
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Empty: A generic empty message that you can re-use to avoid defining
// duplicated empty messages in your APIs. A typical example is to use it as
// the request or the response type of an API method. For instance: service Foo
// { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
type Empty struct {
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
}
// ErrorLogEntry: An entry describing an error that has occurred.
type ErrorLogEntry struct {
// ErrorDetails: Optional. Output only. At most 5 error log entries are
// recorded for a given error code for a job.
ErrorDetails []string `json:"errorDetails,omitempty"`
// ObjectUri: Required. Output only. Object URL. e.g. gs://my_bucket/object.txt
ObjectUri string `json:"objectUri,omitempty"`
// ForceSendFields is a list of field names (e.g. "ErrorDetails") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ErrorDetails") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ErrorLogEntry) MarshalJSON() ([]byte, error) {
type NoMethod ErrorLogEntry
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ErrorSummary: A summary of errors by error code, plus a count and sample
// error log entries.
type ErrorSummary struct {
// ErrorCode: Required. The canonical error code.
//
// Possible values:
// "OK" - Not an error; returned on success. HTTP Mapping: 200 OK
// "CANCELLED" - The operation was cancelled, typically by the caller. HTTP
// Mapping: 499 Client Closed Request
// "UNKNOWN" - Unknown error. For example, this error may be returned when a
// `Status` value received from another address space belongs to an error space
// that is not known in this address space. Also errors raised by APIs that do
// not return enough error information may be converted to this error. HTTP
// Mapping: 500 Internal Server Error
// "INVALID_ARGUMENT" - The client specified an invalid argument. Note that
// this differs from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates
// arguments that are problematic regardless of the state of the system (e.g.,
// a malformed file name). HTTP Mapping: 400 Bad Request
// "DEADLINE_EXCEEDED" - The deadline expired before the operation could
// complete. For operations that change the state of the system, this error may
// be returned even if the operation has completed successfully. For example, a
// successful response from a server could have been delayed long enough for
// the deadline to expire. HTTP Mapping: 504 Gateway Timeout
// "NOT_FOUND" - Some requested entity (e.g., file or directory) was not
// found. Note to server developers: if a request is denied for an entire class
// of users, such as gradual feature rollout or undocumented allowlist,
// `NOT_FOUND` may be used. If a request is denied for some users within a
// class of users, such as user-based access control, `PERMISSION_DENIED` must
// be used. HTTP Mapping: 404 Not Found
// "ALREADY_EXISTS" - The entity that a client attempted to create (e.g.,
// file or directory) already exists. HTTP Mapping: 409 Conflict
// "PERMISSION_DENIED" - The caller does not have permission to execute the
// specified operation. `PERMISSION_DENIED` must not be used for rejections
// caused by exhausting some resource (use `RESOURCE_EXHAUSTED` instead for
// those errors). `PERMISSION_DENIED` must not be used if the caller can not be
// identified (use `UNAUTHENTICATED` instead for those errors). This error code
// does not imply the request is valid or the requested entity exists or
// satisfies other pre-conditions. HTTP Mapping: 403 Forbidden
// "UNAUTHENTICATED" - The request does not have valid authentication
// credentials for the operation. HTTP Mapping: 401 Unauthorized
// "RESOURCE_EXHAUSTED" - Some resource has been exhausted, perhaps a
// per-user quota, or perhaps the entire file system is out of space. HTTP
// Mapping: 429 Too Many Requests
// "FAILED_PRECONDITION" - The operation was rejected because the system is
// not in a state required for the operation's execution. For example, the
// directory to be deleted is non-empty, an rmdir operation is applied to a
// non-directory, etc. Service implementors can use the following guidelines to
// decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use
// `UNAVAILABLE` if the client can retry just the failing call. (b) Use
// `ABORTED` if the client should retry at a higher level. For example, when a
// client-specified test-and-set fails, indicating the client should restart a
// read-modify-write sequence. (c) Use `FAILED_PRECONDITION` if the client
// should not retry until the system state has been explicitly fixed. For
// example, if an "rmdir" fails because the directory is non-empty,
// `FAILED_PRECONDITION` should be returned since the client should not retry
// unless the files are deleted from the directory. HTTP Mapping: 400 Bad
// Request
// "ABORTED" - The operation was aborted, typically due to a concurrency
// issue such as a sequencer check failure or transaction abort. See the
// guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and
// `UNAVAILABLE`. HTTP Mapping: 409 Conflict
// "OUT_OF_RANGE" - The operation was attempted past the valid range. E.g.,
// seeking or reading past end-of-file. Unlike `INVALID_ARGUMENT`, this error
// indicates a problem that may be fixed if the system state changes. For
// example, a 32-bit file system will generate `INVALID_ARGUMENT` if asked to
// read at an offset that is not in the range [0,2^32-1], but it will generate
// `OUT_OF_RANGE` if asked to read from an offset past the current file size.
// There is a fair bit of overlap between `FAILED_PRECONDITION` and
// `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific error)
// when it applies so that callers who are iterating through a space can easily
// look for an `OUT_OF_RANGE` error to detect when they are done. HTTP Mapping:
// 400 Bad Request
// "UNIMPLEMENTED" - The operation is not implemented or is not
// supported/enabled in this service. HTTP Mapping: 501 Not Implemented
// "INTERNAL" - Internal errors. This means that some invariants expected by
// the underlying system have been broken. This error code is reserved for
// serious errors. HTTP Mapping: 500 Internal Server Error
// "UNAVAILABLE" - The service is currently unavailable. This is most likely
// a transient condition, which can be corrected by retrying with a backoff.
// Note that it is not always safe to retry non-idempotent operations. See the
// guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and
// `UNAVAILABLE`. HTTP Mapping: 503 Service Unavailable
// "DATA_LOSS" - Unrecoverable data loss or corruption. HTTP Mapping: 500
// Internal Server Error
ErrorCode string `json:"errorCode,omitempty"`
// ErrorCount: Required. Number of errors encountered per `error_code`.
ErrorCount int64 `json:"errorCount,omitempty,string"`
// ErrorLogEntries: Required. Sample error logs.
ErrorLogEntries []*ErrorLogEntry `json:"errorLogEntries,omitempty"`
// ForceSendFields is a list of field names (e.g. "ErrorCode") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ErrorCode") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ErrorSummary) MarshalJSON() ([]byte, error) {
type NoMethod ErrorSummary
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Expr: Represents a textual expression in the Common Expression Language
// (CEL) syntax. CEL is a C-like expression language. The syntax and semantics
// of CEL are documented at https://github.com/google/cel-spec. Example
// (Comparison): title: "Summary size limit" description: "Determines if a
// summary is less than 100 chars" expression: "document.summary.size() < 100"
// Example (Equality): title: "Requestor is owner" description: "Determines if
// requestor is the document owner" expression: "document.owner ==
// request.auth.claims.email" Example (Logic): title: "Public documents"
// description: "Determine whether the document should be publicly visible"
// expression: "document.type != 'private' && document.type != 'internal'"
// Example (Data Manipulation): title: "Notification string" description:
// "Create a notification string with a timestamp." expression: "'New message
// received at ' + string(document.create_time)" The exact variables and
// functions that may be referenced within an expression are determined by the
// service that evaluates it. See the service documentation for additional
// information.
type Expr struct {
// Description: Optional. Description of the expression. This is a longer text
// which describes the expression, e.g. when hovered over it in a UI.
Description string `json:"description,omitempty"`
// Expression: Textual representation of an expression in Common Expression
// Language syntax.
Expression string `json:"expression,omitempty"`
// Location: Optional. String indicating the location of the expression for
// error reporting, e.g. a file name and a position in the file.
Location string `json:"location,omitempty"`
// Title: Optional. Title for the expression, i.e. a short string describing
// its purpose. This can be used e.g. in UIs which allow to enter the
// expression.
Title string `json:"title,omitempty"`
// ForceSendFields is a list of field names (e.g. "Description") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Description") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Expr) MarshalJSON() ([]byte, error) {
type NoMethod Expr
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Job: The storage batch operations job description.
type Job struct {
// BucketList: Specifies a list of buckets and their objects to be transformed.
BucketList *BucketList `json:"bucketList,omitempty"`
// CompleteTime: Output only. The time that the job was completed.
CompleteTime string `json:"completeTime,omitempty"`
// Counters: Output only. Information about the progress of the job.
Counters *Counters `json:"counters,omitempty"`
// CreateTime: Output only. The time that the job was created.
CreateTime string `json:"createTime,omitempty"`
// DeleteObject: Delete objects.
DeleteObject *DeleteObject `json:"deleteObject,omitempty"`
// Description: Optional. A user-provided description for the job. Maximum
// length: 1024 bytes when unicode-encoded.
Description string `json:"description,omitempty"`
// DryRun: Optional. If true, the job runs in dry run mode, returning the total
// object count and, if the object configuration is a prefix list, the bytes
// found from source. No transformations are performed.
DryRun bool `json:"dryRun,omitempty"`
// ErrorSummaries: Output only. Summarizes errors encountered with sample error
// log entries.
ErrorSummaries []*ErrorSummary `json:"errorSummaries,omitempty"`
// IsMultiBucketJob: Output only. If true, this job operates on multiple
// buckets. Multi-bucket jobs are subject to different quota limits than
// single-bucket jobs.
IsMultiBucketJob bool `json:"isMultiBucketJob,omitempty"`
// LoggingConfig: Optional. Logging configuration.
LoggingConfig *LoggingConfig `json:"loggingConfig,omitempty"`
// Name: Identifier. The resource name of the job. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}`. For example:
// `projects/123456/locations/global/jobs/job01`. `job_id` is unique in a given
// project.
Name string `json:"name,omitempty"`
// ProjectSource: Specifies a project source and filters to identify objects to
// be transformed.
ProjectSource *ProjectSource `json:"projectSource,omitempty"`
// PutMetadata: Updates object metadata. Allows updating fixed-key and custom
// metadata. For example, `Cache-Control`, `Content-Disposition`,
// `Content-Encoding`, `Content-Language`, `Content-Type`, `Custom-Time`, and
// `Retention configuration`.
PutMetadata *PutMetadata `json:"putMetadata,omitempty"`
// PutObjectHold: Changes object hold status.
PutObjectHold *PutObjectHold `json:"putObjectHold,omitempty"`
// RewriteObject: Rewrite the object and updates metadata like KMS key.
RewriteObject *RewriteObject `json:"rewriteObject,omitempty"`
// ScheduleTime: Output only. The time that the job was scheduled.
ScheduleTime string `json:"scheduleTime,omitempty"`
// SetObjectAcls: Updates object ACLs.
SetObjectAcls *SetObjectAcls `json:"setObjectAcls,omitempty"`
// State: Output only. State of the job.
//
// Possible values:
// "STATE_UNSPECIFIED" - Default value. This value is unused.
// "RUNNING" - In progress.
// "SUCCEEDED" - Completed successfully.
// "CANCELED" - Cancelled by the user.
// "FAILED" - Terminated due to an unrecoverable failure.
// "QUEUED" - Queued but not yet started.
State string `json:"state,omitempty"`
// UpdateObjectCustomContext: Update object custom context.
UpdateObjectCustomContext *UpdateObjectCustomContext `json:"updateObjectCustomContext,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "BucketList") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BucketList") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Job) MarshalJSON() ([]byte, error) {
type NoMethod Job
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ListBucketOperationsResponse: Message for response to listing
// BucketOperations
type ListBucketOperationsResponse struct {
// BucketOperations: A list of storage batch bucket operations.
BucketOperations []*BucketOperation `json:"bucketOperations,omitempty"`
// NextPageToken: A token identifying a page of results.
NextPageToken string `json:"nextPageToken,omitempty"`
// Unreachable: Locations that could not be reached.
Unreachable []string `json:"unreachable,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "BucketOperations") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BucketOperations") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ListBucketOperationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListBucketOperationsResponse
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ListJobsResponse: Message for response to listing Jobs
type ListJobsResponse struct {
// Jobs: A list of storage batch jobs.
Jobs []*Job `json:"jobs,omitempty"`
// NextPageToken: A token identifying a page of results.
NextPageToken string `json:"nextPageToken,omitempty"`
// Unreachable: Locations that could not be reached.
Unreachable []string `json:"unreachable,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Jobs") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Jobs") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ListJobsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListJobsResponse
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ListLocationsResponse: The response message for Locations.ListLocations.
type ListLocationsResponse struct {
// Locations: A list of locations that matches the specified filter in the
// request.
Locations []*Location `json:"locations,omitempty"`
// NextPageToken: The standard List next-page token.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Locations") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Locations") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ListLocationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListLocationsResponse
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ListOperationsResponse: The response message for Operations.ListOperations.
type ListOperationsResponse struct {
// NextPageToken: The standard List next-page token.
NextPageToken string `json:"nextPageToken,omitempty"`
// Operations: A list of operations that matches the specified filter in the
// request.
Operations []*Operation `json:"operations,omitempty"`
// Unreachable: Unordered list. Unreachable resources. Populated when the
// request sets `ListOperationsRequest.return_partial_success` and reads across
// collections. For example, when attempting to list all resources across all
// supported locations.
Unreachable []string `json:"unreachable,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "NextPageToken") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "NextPageToken") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ListOperationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListOperationsResponse
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Location: A resource that represents a Google Cloud location.
type Location struct {
// DisplayName: The friendly name for this location, typically a nearby city
// name. For example, "Tokyo".
DisplayName string `json:"displayName,omitempty"`
// Labels: Cross-service attributes for the location. For example
// {"cloud.googleapis.com/region": "us-east1"}
Labels map[string]string `json:"labels,omitempty"`
// LocationId: The canonical id for this location. For example: "us-east1".
LocationId string `json:"locationId,omitempty"`
// Metadata: Service-specific metadata. For example the available capacity at
// the given location.
Metadata googleapi.RawMessage `json:"metadata,omitempty"`
// Name: Resource name for the location, which may vary between
// implementations. For example:
// "projects/example-project/locations/us-east1"
Name string `json:"name,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "DisplayName") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DisplayName") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Location) MarshalJSON() ([]byte, error) {
type NoMethod Location
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// LoggingConfig: Specifies the Cloud Logging behavior.
type LoggingConfig struct {
// LogActionStates: Required. States in which Action are logged.If empty, no
// logs are generated.
//
// Possible values:
// "LOGGABLE_ACTION_STATE_UNSPECIFIED" - Illegal value, to avoid allowing a
// default.
// "SUCCEEDED" - `LoggableAction` completed successfully. `SUCCEEDED` actions
// are logged as INFO.
// "FAILED" - `LoggableAction` terminated in an error state. `FAILED` actions
// are logged as ERROR.
LogActionStates []string `json:"logActionStates,omitempty"`
// LogActions: Required. Specifies the actions to be logged.
//
// Possible values:
// "LOGGABLE_ACTION_UNSPECIFIED" - Illegal value, to avoid allowing a
// default.
// "TRANSFORM" - The corresponding transform action in this job.
LogActions []string `json:"logActions,omitempty"`
// ForceSendFields is a list of field names (e.g. "LogActionStates") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LogActionStates") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s LoggingConfig) MarshalJSON() ([]byte, error) {
type NoMethod LoggingConfig
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Manifest: Describes list of objects to be transformed.
type Manifest struct {
// ManifestLocation: Required. Specify the manifest file location. The format
// of manifest location can be an absolute path to the object in the format of
// `gs://bucket_name/path/object_name`. For example,
// `gs://bucket_name/path/object_name.csv`. Alternatively, you can specify an
// absolute path with a single wildcard character in the file name, for example
// `gs://bucket_name/path/file_name*.csv`. If the manifest location is
// specified with a wildcard, objects in all manifest files matching the
// pattern will be acted upon. The manifest is a CSV file, uploaded to Cloud
// Storage, that contains one object or a list of objects that you want to
// process. Each row in the manifest must include the `bucket` and `name` of
// the object. You can optionally specify the `generation` of the object. If
// you don't specify the `generation`, the current version of the object is
// used. You can optionally include a header row with the following format:
// `bucket,name,generation`. For example, bucket,name,generation
// bucket_1,object_1,generation_1 bucket_1,object_2,generation_2
// bucket_1,object_3,generation_3 Note: The manifest file must specify only
// objects within the bucket provided to the job. Rows referencing objects in
// other buckets are ignored.
ManifestLocation string `json:"manifestLocation,omitempty"`
// ForceSendFields is a list of field names (e.g. "ManifestLocation") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ManifestLocation") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Manifest) MarshalJSON() ([]byte, error) {
type NoMethod Manifest
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectAccessControl: Represents an access control entry on an object.
type ObjectAccessControl struct {
// Entity: Required. The entity holding the permission, in one of the following
// forms: * `allUsers` * `allAuthenticatedUsers`
Entity string `json:"entity,omitempty"`
// Role: Required. The role to grant. Acceptable values are: * `READER` - gives
// read access to the object. * `OWNER` - gives owner access to the object.
Role string `json:"role,omitempty"`
// ForceSendFields is a list of field names (e.g. "Entity") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Entity") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ObjectAccessControl) MarshalJSON() ([]byte, error) {
type NoMethod ObjectAccessControl
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectCustomContextPayload: Describes the payload of a user-defined object
// custom context.
type ObjectCustomContextPayload struct {
// Value: The value of the object custom context. If set, `value` can't be an
// empty string because it is a required field in custom context. If unset,
// `value` is ignored and no changes are made to the `value` field of the
// custom context payload.
Value string `json:"value,omitempty"`
// ForceSendFields is a list of field names (e.g. "Value") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Value") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ObjectCustomContextPayload) MarshalJSON() ([]byte, error) {
type NoMethod ObjectCustomContextPayload
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectRetention: Describes options for object retention update.
type ObjectRetention struct {
// RetainUntilTime: Required. The object's retention expiration time, during
// which, the object is protected from being deleted or overwritten. The time
// must be specified in RFC 3339 format, for example `YYYY-MM-DD'T'HH:MM:SS'Z'`
// or `YYYY-MM-DD'T'HH:MM:SS.SS'Z'`. To clear an object's retention, both
// `retentionMode` and `retainUntilTime` must be left unset (omitted). Setting
// `retentionMode` to `RETENTION_MODE_UNSPECIFIED` is treated as a no-op.
// Unlike an unset field, it doesn't modify or clear the retention settings.
RetainUntilTime string `json:"retainUntilTime,omitempty"`
// RetentionMode: Required. The retention mode.
//
// Possible values:
// "RETENTION_MODE_UNSPECIFIED" - The retention mode isn't specified.
// "LOCKED" - When the retention mode is `LOCKED`, the `retainUntilTime`
// can't be removed or reduced.
// "UNLOCKED" - When the retention mode is `UNLOCKED`, the `retainUntilTime`
// can be removed or modified.
RetentionMode string `json:"retentionMode,omitempty"`
// ForceSendFields is a list of field names (e.g. "RetainUntilTime") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "RetainUntilTime") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ObjectRetention) MarshalJSON() ([]byte, error) {
type NoMethod ObjectRetention
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Operation: This resource represents a long-running operation that is the
// result of a network API call.
type Operation struct {
// Done: If the value is `false`, it means the operation is still in progress.
// If `true`, the operation is completed, and either `error` or `response` is
// available.
Done bool `json:"done,omitempty"`
// Error: The error result of the operation in case of failure or cancellation.
Error *Status `json:"error,omitempty"`
// Metadata: Service-specific metadata associated with the operation. It
// typically contains progress information and common metadata such as create
// time. Some services might not provide such metadata. Any method that returns
// a long-running operation should document the metadata type, if any.
Metadata googleapi.RawMessage `json:"metadata,omitempty"`
// Name: The server-assigned name, which is only unique within the same service
// that originally returns it. If you use the default HTTP mapping, the `name`
// should be a resource name ending with `operations/{unique_id}`.
Name string `json:"name,omitempty"`
// Response: The normal, successful response of the operation. If the original
// method returns no data on success, such as `Delete`, the response is
// `google.protobuf.Empty`. If the original method is standard
// `Get`/`Create`/`Update`, the response should be the resource. For other
// methods, the response should have the type `XxxResponse`, where `Xxx` is the
// original method name. For example, if the original method name is
// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
Response googleapi.RawMessage `json:"response,omitempty"`
// ServerResponse contains the HTTP response code and headers from the server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Done") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Done") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Operation) MarshalJSON() ([]byte, error) {
type NoMethod Operation
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// OperationMetadata: Represents the metadata of the long-running operation.
type OperationMetadata struct {
// ApiVersion: Output only. API version used to start the operation.
ApiVersion string `json:"apiVersion,omitempty"`
// CreateTime: Output only. The time the operation was created.
CreateTime string `json:"createTime,omitempty"`
// EndTime: Output only. The time the operation finished running.
EndTime string `json:"endTime,omitempty"`
// Job: Output only. The Job associated with the operation.
Job *Job `json:"job,omitempty"`
// Operation: Output only. The unique operation resource name. Format:
// projects/{project_id}/locations/global/operations/{operation}.
Operation string `json:"operation,omitempty"`
// RequestedCancellation: Output only. Identifies whether the user has
// requested cancellation of the operation. Operations that have been cancelled
// successfully have google.longrunning.Operation.error value with a
// google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
RequestedCancellation bool `json:"requestedCancellation,omitempty"`
// ForceSendFields is a list of field names (e.g. "ApiVersion") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ApiVersion") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s OperationMetadata) MarshalJSON() ([]byte, error) {
type NoMethod OperationMetadata
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// PrefixList: Describes prefixes of objects to be transformed.
type PrefixList struct {
// IncludedObjectPrefixes: Optional. Specify one or more object prefixes. For
// example: * To match one object, use a single prefix, `prefix1`. * To match
// multiple objects, use comma-separated prefixes, `prefix1, prefix2`. * To
// match all objects, use an empty prefix, `''`
IncludedObjectPrefixes []string `json:"includedObjectPrefixes,omitempty"`
// ForceSendFields is a list of field names (e.g. "IncludedObjectPrefixes") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "IncludedObjectPrefixes") to
// include in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s PrefixList) MarshalJSON() ([]byte, error) {
type NoMethod PrefixList
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ProjectSource: Describes the project source where the objects satisfying the
// filters will be transformed.
type ProjectSource struct {
// BucketFilters: Optional. Filters expressed in Common Expression Language
// (CEL) to apply to buckets to identify buckets with objects to be
// transformed.
BucketFilters *Expr `json:"bucketFilters,omitempty"`
// DryRunJobId: Optional. The unique identifier of a dry run job to use as the
// baseline for the current job. Specifying this ID ensures the job is executed
// against the same set of objects validated during the dry run. The value
// corresponds to the {job_id} segment of the resource name:
// `projects/{project_id}/locations/{location}/jobs/{job_id}`.
DryRunJobId string `json:"dryRunJobId,omitempty"`
// InsightsDatasetConfig: Required. The resource identifier of the Storage
// Insights dataset configuration. Storage batch operations uses the latest
// snapshot from this dataset as the source to list and filter target objects.
// Format:
// `projects/{project_id}/locations/{location}/datasetConfigs/{dataset_config}`.
InsightsDatasetConfig string `json:"insightsDatasetConfig,omitempty"`
// ObjectFilters: Optional. Filters expressed in Common Expression Language
// (CEL) to apply to objects to identify objects to be transformed.
ObjectFilters *Expr `json:"objectFilters,omitempty"`
// Project: Required. Project name of the objects to be transformed. e.g.
// projects/my-project or projects/123456.
Project string `json:"project,omitempty"`
// SnapshotTime: Output only. The snapshot time used by the job to read the
// Storage Insights dataset for bucket and object discovery. This field is
// populated by the service and reflects the exact timestamp of the dataset
// snapshot used.
SnapshotTime string `json:"snapshotTime,omitempty"`
// TargetLocations: Optional. Specifies the Cloud Storage locations to include
// in the job. If provided, only buckets and objects within these locations
// will be discovered from the Storage Insights dataset as configured in the
// `insights_dataset_config`. If omitted, the job will discover buckets and
// objects from all locations configured in the `insights_dataset_config`.
TargetLocations *TargetLocations `json:"targetLocations,omitempty"`
// ForceSendFields is a list of field names (e.g. "BucketFilters") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BucketFilters") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s ProjectSource) MarshalJSON() ([]byte, error) {
type NoMethod ProjectSource
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// PutMetadata: Describes options for object metadata update.
type PutMetadata struct {
// CacheControl: Optional. Updates the objects `Cache-Control` fixed metadata.
// Unset values in the request are ignored. To clear the metadata, set an empty
// value. Additionally, the value for `Custom-Time` can't decrease. For
// details, see Cache-Control
// (https://cloud.google.com/storage/docs/metadata#caching_data).
CacheControl string `json:"cacheControl,omitempty"`
// ContentDisposition: Optional. Updates objects `Content-Disposition` fixed
// metadata. Unset values in the request are ignored. To clear the metadata,
// set an empty value. For details, see Content-Disposition
// (https://cloud.google.com/storage/docs/metadata#content-disposition).
ContentDisposition string `json:"contentDisposition,omitempty"`
// ContentEncoding: Optional. Updates the objects `Content-Encoding` fixed
// metadata. Unset values in the request are ignored. To clear the metadata,
// set an empty value. For details, see Content-Encoding
// (https://cloud.google.com/storage/docs/metadata#content-encoding).
ContentEncoding string `json:"contentEncoding,omitempty"`
// ContentLanguage: Optional. Updates the objects `Content-Language` fixed
// metadata. Metadata values must use ISO 639-1 language codes. The maximum
// length for metadata values is 100 characters. Unset values in the request
// are ignored. To clear the metadata, set an empty value. For details, see
// Content-Language
// (https://cloud.google.com/storage/docs/metadata#content-language).
ContentLanguage string `json:"contentLanguage,omitempty"`
// ContentType: Optional. Updates objects `Content-Type` fixed metadata. Unset
// values in the request are ignored. To clear the metadata, set an empty
// value. For details, see Content-Type
// (https://cloud.google.com/storage/docs/metadata#content-type).
ContentType string `json:"contentType,omitempty"`
// CustomMetadata: Optional. Updates the object's custom metadata. This
// operation adds or sets individual custom metadata key-value pairs. Keys
// specified with empty values have their values cleared. Existing custom
// metadata keys not included in the request remain unchanged. For details, see
// Custom metadata
// (https://cloud.google.com/storage/docs/metadata#custom-metadata).
CustomMetadata map[string]string `json:"customMetadata,omitempty"`
// CustomTime: Optional. Updates the objects `Custom-Time` fixed metadata.
// Unset values in the request are ignored. To clear the metadata, set an empty
// value. The time must be specified in RFC 3339 format, for example
// `YYYY-MM-DD'T'HH:MM:SS'Z'` or `YYYY-MM-DD'T'HH:MM:SS.SS'Z'`. For details,
// see Custom-Time
// (https://cloud.google.com/storage/docs/metadata#custom-time).
CustomTime string `json:"customTime,omitempty"`
// ObjectRetention: Optional. Updates an object's retention configuration. To
// clear an object's retention, both `retentionMode` and `retainUntilTime` must
// be left unset (omitted). Setting `retentionMode` to
// `RETENTION_MODE_UNSPECIFIED` is treated as a no-op. Unlike an unset field,
// it doesn't modify or clear the retention settings. An object with `LOCKED`
// retention mode can't have its retention cleared or its `retainUntilTime`
// reduced. For more information, see Object retention
// (https://cloud.google.com/storage/docs/batch-operations/create-manage-batch-operation-jobs#retain-until-time).
ObjectRetention *ObjectRetention `json:"objectRetention,omitempty"`
// ForceSendFields is a list of field names (e.g. "CacheControl") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CacheControl") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s PutMetadata) MarshalJSON() ([]byte, error) {
type NoMethod PutMetadata
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// PutObjectHold: Describes options to update object hold.
type PutObjectHold struct {
// EventBasedHold: Required. Updates object event based holds state. When
// object event based hold is set, object can't be deleted or replaced. Resets
// object's time in the bucket for the purposes of the retention period.
//
// Possible values:
// "HOLD_STATUS_UNSPECIFIED" - Default value, Object hold status isn't
// changed.
// "SET" - Places the hold.
// "UNSET" - Releases the hold.
EventBasedHold string `json:"eventBasedHold,omitempty"`
// TemporaryHold: Required. Updates object temporary holds state. When object
// temporary hold is set, object can't be deleted or replaced.
//
// Possible values:
// "HOLD_STATUS_UNSPECIFIED" - Default value, Object hold status isn't
// changed.
// "SET" - Places the hold.
// "UNSET" - Releases the hold.
TemporaryHold string `json:"temporaryHold,omitempty"`
// ForceSendFields is a list of field names (e.g. "EventBasedHold") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "EventBasedHold") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s PutObjectHold) MarshalJSON() ([]byte, error) {
type NoMethod PutObjectHold
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// RewriteObject: Describes options for object rewrite.
type RewriteObject struct {
// KmsKey: Optional. Resource name of the Cloud KMS key that is used to encrypt
// the object. The Cloud KMS key must be located in same location as the
// object. For details, see
// https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key
// Format:
// `projects/{project_id}/locations/{location}/keyRings/{keyring}/cryptoKeys/{ke
// y}` For example:
// `projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key`
// . The object will be rewritten and set with the specified KMS key.
KmsKey string `json:"kmsKey,omitempty"`
// StorageClass: Optional. Rewrites the object to the specified storage class.
// Setting this field will perform a full byte copy of the object if the
// storage class is different from the object's current storage class. If
// Autoclass is enabled on the bucket, storage class changes are ignored by
// Cloud Storage.
//
// Possible values:
// "STORAGE_CLASS_UNSPECIFIED" - The storage class is not specified.
// "STANDARD" - Standard storage class.
// "NEARLINE" - Nearline storage class.
// "COLDLINE" - Coldline storage class.
// "ARCHIVE" - Archive storage class.
StorageClass string `json:"storageClass,omitempty"`
// ForceSendFields is a list of field names (e.g. "KmsKey") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "KmsKey") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s RewriteObject) MarshalJSON() ([]byte, error) {
type NoMethod RewriteObject
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// SetObjectAcls: Describes options for setting object ACLs.
type SetObjectAcls struct {
// AccessControlsUpdates: Required. Add, update, or remove grants from the
// object's existing ACLs.
AccessControlsUpdates *AccessControlsUpdates `json:"accessControlsUpdates,omitempty"`
// ForceSendFields is a list of field names (e.g. "AccessControlsUpdates") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AccessControlsUpdates") to
// include in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s SetObjectAcls) MarshalJSON() ([]byte, error) {
type NoMethod SetObjectAcls
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Status: The `Status` type defines a logical error model that is suitable for
// different programming environments, including REST APIs and RPC APIs. It is
// used by gRPC (https://github.com/grpc). Each `Status` message contains three
// pieces of data: error code, error message, and error details. You can find
// out more about this error model and how to work with it in the API Design
// Guide (https://cloud.google.com/apis/design/errors).
type Status struct {
// Code: The status code, which should be an enum value of google.rpc.Code.
Code int64 `json:"code,omitempty"`
// Details: A list of messages that carry the error details. There is a common
// set of message types for APIs to use.
Details []googleapi.RawMessage `json:"details,omitempty"`
// Message: A developer-facing error message, which should be in English. Any
// user-facing error message should be localized and sent in the
// google.rpc.Status.details field, or localized by the client.
Message string `json:"message,omitempty"`
// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Code") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s Status) MarshalJSON() ([]byte, error) {
type NoMethod Status
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// TargetLocations: Describes the Cloud Storage locations to include in a
// ProjectSource job.
type TargetLocations struct {
// Locations: Required. REQUIRED. A list of Cloud Storage locations (e.g.,
// `us-central1`) to include in the job. If `snapshot_time` is omitted, the job
// automatically defaults to the most recent snapshot timestamp that is
// successfully populated in BOTH the `object_attributes_view` and
// `bucket_attributes_view` across ALL specified locations. For details on
// Storage Insights dataset snapshots and views, see:
// https://docs.cloud.google.com/storage/docs/insights/dataset-tables-and-schemas#schema
Locations []string `json:"locations,omitempty"`
// SnapshotTime: Optional. OPTIONAL. The exact Storage Insights snapshot
// timestamp to use for the job compatible with the RFC 3339 format (e.g.,
// `2024-01-02T03:04:05Z`). If specified, this exact snapshot must exist in
// BOTH the `object_attributes_view` and `bucket_attributes_view` for every
// location listed in `locations`. If the snapshot is missing from either view
// in any of the locations, the job fails.
SnapshotTime string `json:"snapshotTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "Locations") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Locations") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s TargetLocations) MarshalJSON() ([]byte, error) {
type NoMethod TargetLocations
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// UpdateObjectCustomContext: Describes options to update object custom
// contexts.
type UpdateObjectCustomContext struct {
// ClearAll: If set, must be set to true and all existing object custom
// contexts are deleted.
ClearAll bool `json:"clearAll,omitempty"`
// CustomContextUpdates: A collection of updates to apply to specific custom
// contexts. Use this to add, update or delete individual contexts by key.
CustomContextUpdates *CustomContextUpdates `json:"customContextUpdates,omitempty"`
// ForceSendFields is a list of field names (e.g. "ClearAll") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ClearAll") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s UpdateObjectCustomContext) MarshalJSON() ([]byte, error) {
type NoMethod UpdateObjectCustomContext
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type ProjectsLocationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets information about a location.
//
// - name: Resource name for the location.
func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.get", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.get" call.
// Any non-2xx status code is an error. Response headers are in either
// *Location.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Location{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.get", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsListCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists information about the supported locations for this service. This
// method lists locations based on the resource scope provided in the
// ListLocationsRequest.name field: * **Global locations**: If `name` is empty,
// the method lists the public locations available to all projects. *
// **Project-specific locations**: If `name` follows the format
// `projects/{project}`, the method lists locations visible to that specific
// project. This includes public, private, or other project-specific locations
// enabled for the project. For gRPC and client library implementations, the
// resource name is passed as the `name` field. For direct service calls, the
// resource name is incorporated into the request path based on the specific
// service implementation and version.
//
// - name: The resource that owns the locations collection, if applicable.
func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// ExtraLocationTypes sets the optional parameter "extraLocationTypes": Do not
// use this field unless explicitly documented otherwise. This is primarily for
// internal usage.
func (c *ProjectsLocationsListCall) ExtraLocationTypes(extraLocationTypes ...string) *ProjectsLocationsListCall {
c.urlParams_.SetMulti("extraLocationTypes", append([]string{}, extraLocationTypes...))
return c
}
// Filter sets the optional parameter "filter": A filter to narrow down results
// to a preferred subset. The filtering language accepts strings like
// "displayName=tokyo", and is documented in more detail in AIP-160
// (https://google.aip.dev/160).
func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number of
// results to return. If not set, the service selects a default.
func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": A page token received
// from the `next_page_token` field in the response. Send that page token to
// receive the subsequent page.
func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.list", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListLocationsResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListLocationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.list", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken"))
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
type ProjectsLocationsJobsCancelCall struct {
s *Service
name string
canceljobrequest *CancelJobRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Cancel: Cancels a batch job.
//
// - name: The `name` of the job to cancel. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}`.
func (r *ProjectsLocationsJobsService) Cancel(name string, canceljobrequest *CancelJobRequest) *ProjectsLocationsJobsCancelCall {
c := &ProjectsLocationsJobsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.canceljobrequest = canceljobrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsCancelCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsCancelCall) Context(ctx context.Context) *ProjectsLocationsJobsCancelCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsCancelCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsCancelCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.canceljobrequest)
if err != nil {
return nil, err
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.cancel", "request", internallog.HTTPRequest(req, body.Bytes()))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.cancel" call.
// Any non-2xx status code is an error. Response headers are in either
// *CancelJobResponse.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *ProjectsLocationsJobsCancelCall) Do(opts ...googleapi.CallOption) (*CancelJobResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &CancelJobResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.cancel", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsJobsCreateCall struct {
s *Service
parent string
job *Job
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a batch job.
//
// - parent: The value for parent.
func (r *ProjectsLocationsJobsService) Create(parent string, job *Job) *ProjectsLocationsJobsCreateCall {
c := &ProjectsLocationsJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
c.job = job
return c
}
// JobId sets the optional parameter "jobId": Required. A unique identifier for
// the job. `job_id` must be up to 128 characters and must include only
// characters available in DNS names, as defined by RFC-1123.
func (c *ProjectsLocationsJobsCreateCall) JobId(jobId string) *ProjectsLocationsJobsCreateCall {
c.urlParams_.Set("jobId", jobId)
return c
}
// RequestId sets the optional parameter "requestId": An optional request ID to
// identify requests. Specify a unique request ID in case you need to retry
// your request. Requests with same `request_id` are ignored for at least 60
// minutes since the first request. The request ID must be a valid UUID with
// the exception that zero UUID isn't supported
// (00000000-0000-0000-0000-000000000000).
func (c *ProjectsLocationsJobsCreateCall) RequestId(requestId string) *ProjectsLocationsJobsCreateCall {
c.urlParams_.Set("requestId", requestId)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsCreateCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsCreateCall) Context(ctx context.Context) *ProjectsLocationsJobsCreateCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.job)
if err != nil {
return nil, err
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/jobs")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.create", "request", internallog.HTTPRequest(req, body.Bytes()))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.create" call.
// Any non-2xx status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsJobsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.create", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsJobsDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a batch job.
//
// - name: The `name` of the job to delete. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}`.
func (r *ProjectsLocationsJobsService) Delete(name string) *ProjectsLocationsJobsDeleteCall {
c := &ProjectsLocationsJobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Force sets the optional parameter "force": If set to true, any child bucket
// operations of the job are deleted. We recommend setting this to `true`. You
// can't mutate bucket operations directly, so only the `jobs.delete`
// permission is required to delete a job (and its child bucket operations).
func (c *ProjectsLocationsJobsDeleteCall) Force(force bool) *ProjectsLocationsJobsDeleteCall {
c.urlParams_.Set("force", fmt.Sprint(force))
return c
}
// RequestId sets the optional parameter "requestId": An optional request ID to
// identify requests. Specify a unique request ID in case you need to retry
// your request. Requests with same `request_id` are ignored for at least 60
// minutes since the first request. The request ID must be a valid UUID with
// the exception that zero UUID isn't supported
// (00000000-0000-0000-0000-000000000000).
func (c *ProjectsLocationsJobsDeleteCall) RequestId(requestId string) *ProjectsLocationsJobsDeleteCall {
c.urlParams_.Set("requestId", requestId)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsDeleteCall) Context(ctx context.Context) *ProjectsLocationsJobsDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.delete", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.delete" call.
// Any non-2xx status code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsJobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.delete", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsJobsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets a batch job.
//
// - name: The `name` of the job to retrieve. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}`.
func (r *ProjectsLocationsJobsService) Get(name string) *ProjectsLocationsJobsGetCall {
c := &ProjectsLocationsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsJobsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsGetCall) Context(ctx context.Context) *ProjectsLocationsJobsGetCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.get", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.get" call.
// Any non-2xx status code is an error. Response headers are in either
// *Job.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsJobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Job{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.get", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsJobsListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists Jobs in a given project.
//
// - parent: Format: projects/{project_id}/locations/global.
func (r *ProjectsLocationsJobsService) List(parent string) *ProjectsLocationsJobsListCall {
c := &ProjectsLocationsJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Filter sets the optional parameter "filter": Filters results as defined by
// https://google.aip.dev/160.
func (c *ProjectsLocationsJobsListCall) Filter(filter string) *ProjectsLocationsJobsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Field to sort by. Supported
// fields are `name` and `create_time`.
func (c *ProjectsLocationsJobsListCall) OrderBy(orderBy string) *ProjectsLocationsJobsListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The list page size. The
// default page size is 100.
func (c *ProjectsLocationsJobsListCall) PageSize(pageSize int64) *ProjectsLocationsJobsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The list page token.
func (c *ProjectsLocationsJobsListCall) PageToken(pageToken string) *ProjectsLocationsJobsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsJobsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsListCall) Context(ctx context.Context) *ProjectsLocationsJobsListCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/jobs")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.list", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListJobsResponse.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *ProjectsLocationsJobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListJobsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.list", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsJobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken"))
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
type ProjectsLocationsJobsBucketOperationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets a BucketOperation.
//
// - name: The `name` of the bucket operation to retrieve. Format:
// `projects/{project_id}/locations/global/jobs/{job_id}/bucketOperations/{buc
// ket_operation_id}`.
func (r *ProjectsLocationsJobsBucketOperationsService) Get(name string) *ProjectsLocationsJobsBucketOperationsGetCall {
c := &ProjectsLocationsJobsBucketOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsBucketOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsBucketOperationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsJobsBucketOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsBucketOperationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsBucketOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsJobsBucketOperationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsBucketOperationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsBucketOperationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.bucketOperations.get", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.bucketOperations.get" call.
// Any non-2xx status code is an error. Response headers are in either
// *BucketOperation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *ProjectsLocationsJobsBucketOperationsGetCall) Do(opts ...googleapi.CallOption) (*BucketOperation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &BucketOperation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.bucketOperations.get", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsJobsBucketOperationsListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists BucketOperations in a given project and job.
//
// - parent: Format: `projects/{project_id}/locations/global/jobs/{job_id}`.
func (r *ProjectsLocationsJobsBucketOperationsService) List(parent string) *ProjectsLocationsJobsBucketOperationsListCall {
c := &ProjectsLocationsJobsBucketOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Filter sets the optional parameter "filter": Filters results as defined by
// https://google.aip.dev/160.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Filter(filter string) *ProjectsLocationsJobsBucketOperationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Field to sort by. Supported
// fields are `name` and `create_time`.
func (c *ProjectsLocationsJobsBucketOperationsListCall) OrderBy(orderBy string) *ProjectsLocationsJobsBucketOperationsListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The list page size. Default
// page size is 100.
func (c *ProjectsLocationsJobsBucketOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsJobsBucketOperationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The list page token.
func (c *ProjectsLocationsJobsBucketOperationsListCall) PageToken(pageToken string) *ProjectsLocationsJobsBucketOperationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsJobsBucketOperationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsJobsBucketOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsJobsBucketOperationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Context(ctx context.Context) *ProjectsLocationsJobsBucketOperationsListCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsJobsBucketOperationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/bucketOperations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.bucketOperations.list", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.jobs.bucketOperations.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListBucketOperationsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Do(opts ...googleapi.CallOption) (*ListBucketOperationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListBucketOperationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.jobs.bucketOperations.list", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsJobsBucketOperationsListCall) Pages(ctx context.Context, f func(*ListBucketOperationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken"))
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
type ProjectsLocationsOperationsCancelCall struct {
s *Service
name string
canceloperationrequest *CancelOperationRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Cancel: Starts asynchronous cancellation on a long-running operation. The
// server makes a best effort to cancel the operation, but success is not
// guaranteed. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
// other methods to check whether the cancellation succeeded or whether the
// operation completed despite cancellation. On successful cancellation, the
// operation is not deleted; instead, it becomes an operation with an
// Operation.error value with a google.rpc.Status.code of `1`, corresponding to
// `Code.CANCELLED`.
//
// - name: The name of the operation resource to be cancelled.
func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.canceloperationrequest = canceloperationrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.canceloperationrequest)
if err != nil {
return nil, err
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.cancel", "request", internallog.HTTPRequest(req, body.Bytes()))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.operations.cancel" call.
// Any non-2xx status code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.cancel", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsOperationsDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a long-running operation. This method indicates that the
// client is no longer interested in the operation result. It does not cancel
// the operation. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`.
//
// - name: The name of the operation resource to be deleted.
func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.delete", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.operations.delete" call.
// Any non-2xx status code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.delete", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsOperationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets the latest state of a long-running operation. Clients can use this
// method to poll the operation result at intervals as recommended by the API
// service.
//
// - name: The name of the operation resource.
func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.get", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.operations.get" call.
// Any non-2xx status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was returned.
func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.get", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
type ProjectsLocationsOperationsListCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists operations that match the specified filter in the request. If
// the server doesn't support this method, it returns `UNIMPLEMENTED`.
//
// - name: The name of the operation's parent resource.
func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Filter sets the optional parameter "filter": The standard list filter.
func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// PageSize sets the optional parameter "pageSize": The standard list page
// size.
func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The standard list page
// token.
func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// ReturnPartialSuccess sets the optional parameter "returnPartialSuccess":
// When set to `true`, operations that are reachable are returned as normal,
// and those that are unreachable are returned in the
// ListOperationsResponse.unreachable field. This can only be `true` when
// reading across collections. For example, when `parent` is set to
// "projects/example/locations/-". This field is not supported by default and
// will result in an `UNIMPLEMENTED` error if set unless explicitly documented
// otherwise in service or product specific documentation.
func (c *ProjectsLocationsOperationsListCall) ReturnPartialSuccess(returnPartialSuccess bool) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("returnPartialSuccess", fmt.Sprint(returnPartialSuccess))
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method.
func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
c.ctx_ = ctx
return c
}
// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, nil)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.list", "request", internallog.HTTPRequest(req, nil))
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "storagebatchoperations.projects.locations.operations.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListOperationsResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListOperationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
b, err := gensupport.DecodeResponseBytes(target, res)
if err != nil {
return nil, err
}
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "storagebatchoperations.projects.locations.operations.list", "response", internallog.HTTPResponse(res, b))
return ret, nil
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken"))
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}