aboutsummaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/api
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2017-10-18 13:15:14 +0100
committerNiall Sheridan <niall@intercom.io>2017-10-18 13:25:46 +0100
commit7b320119ba532fd409ec7dade7ad02011c309599 (patch)
treea39860f35b55e6cc499f8f5bfa969138c5dd6b73 /vendor/google.golang.org/api
parent7c99874c7a3e7a89716f3ee0cdf696532e35ae35 (diff)
Update dependencies
Diffstat (limited to 'vendor/google.golang.org/api')
-rw-r--r--vendor/google.golang.org/api/gensupport/json.go49
-rw-r--r--vendor/google.golang.org/api/gensupport/media.go126
-rw-r--r--vendor/google.golang.org/api/gensupport/send.go6
-rw-r--r--vendor/google.golang.org/api/internal/creds.go104
-rw-r--r--vendor/google.golang.org/api/internal/service-account.json12
-rw-r--r--vendor/google.golang.org/api/internal/settings.go18
-rw-r--r--vendor/google.golang.org/api/oauth2/v2/oauth2-api.json6
-rw-r--r--vendor/google.golang.org/api/option/option.go26
-rw-r--r--vendor/google.golang.org/api/storage/v1/storage-api.json572
-rw-r--r--vendor/google.golang.org/api/storage/v1/storage-gen.go1711
-rw-r--r--vendor/google.golang.org/api/transport/dial.go166
-rw-r--r--vendor/google.golang.org/api/transport/grpc/dial.go86
-rw-r--r--vendor/google.golang.org/api/transport/http/dial.go107
13 files changed, 2658 insertions, 331 deletions
diff --git a/vendor/google.golang.org/api/gensupport/json.go b/vendor/google.golang.org/api/gensupport/json.go
index 53331b7..c01e321 100644
--- a/vendor/google.golang.org/api/gensupport/json.go
+++ b/vendor/google.golang.org/api/gensupport/json.go
@@ -22,23 +22,33 @@ func MarshalJSON(schema interface{}, forceSendFields, nullFields []string) ([]by
return json.Marshal(schema)
}
- mustInclude := make(map[string]struct{})
+ mustInclude := make(map[string]bool)
for _, f := range forceSendFields {
- mustInclude[f] = struct{}{}
+ mustInclude[f] = true
}
- useNull := make(map[string]struct{})
- for _, f := range nullFields {
- useNull[f] = struct{}{}
+ useNull := make(map[string]bool)
+ useNullMaps := make(map[string]map[string]bool)
+ for _, nf := range nullFields {
+ parts := strings.SplitN(nf, ".", 2)
+ field := parts[0]
+ if len(parts) == 1 {
+ useNull[field] = true
+ } else {
+ if useNullMaps[field] == nil {
+ useNullMaps[field] = map[string]bool{}
+ }
+ useNullMaps[field][parts[1]] = true
+ }
}
- dataMap, err := schemaToMap(schema, mustInclude, useNull)
+ dataMap, err := schemaToMap(schema, mustInclude, useNull, useNullMaps)
if err != nil {
return nil, err
}
return json.Marshal(dataMap)
}
-func schemaToMap(schema interface{}, mustInclude, useNull map[string]struct{}) (map[string]interface{}, error) {
+func schemaToMap(schema interface{}, mustInclude, useNull map[string]bool, useNullMaps map[string]map[string]bool) (map[string]interface{}, error) {
m := make(map[string]interface{})
s := reflect.ValueOf(schema)
st := s.Type()
@@ -59,17 +69,35 @@ func schemaToMap(schema interface{}, mustInclude, useNull map[string]struct{}) (
v := s.Field(i)
f := st.Field(i)
- if _, ok := useNull[f.Name]; ok {
+ if useNull[f.Name] {
if !isEmptyValue(v) {
return nil, fmt.Errorf("field %q in NullFields has non-empty value", f.Name)
}
m[tag.apiName] = nil
continue
}
+
if !includeField(v, f, mustInclude) {
continue
}
+ // If map fields are explicitly set to null, use a map[string]interface{}.
+ if f.Type.Kind() == reflect.Map && useNullMaps[f.Name] != nil {
+ ms, ok := v.Interface().(map[string]string)
+ if !ok {
+ return nil, fmt.Errorf("field %q has keys in NullFields but is not a map[string]string", f.Name)
+ }
+ mi := map[string]interface{}{}
+ for k, v := range ms {
+ mi[k] = v
+ }
+ for k := range useNullMaps[f.Name] {
+ mi[k] = nil
+ }
+ m[tag.apiName] = mi
+ continue
+ }
+
// nil maps are treated as empty maps.
if f.Type.Kind() == reflect.Map && v.IsNil() {
m[tag.apiName] = map[string]string{}
@@ -139,7 +167,7 @@ func parseJSONTag(val string) (jsonTag, error) {
}
// Reports whether the struct field "f" with value "v" should be included in JSON output.
-func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]struct{}) bool {
+func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]bool) bool {
// The regular JSON encoding of a nil pointer is "null", which means "delete this field".
// Therefore, we could enable field deletion by honoring pointer fields' presence in the mustInclude set.
// However, many fields are not pointers, so there would be no way to delete these fields.
@@ -156,8 +184,7 @@ func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string
return false
}
- _, ok := mustInclude[f.Name]
- return ok || !isEmptyValue(v)
+ return mustInclude[f.Name] || !isEmptyValue(v)
}
// isEmptyValue reports whether v is the empty value for its type. This
diff --git a/vendor/google.golang.org/api/gensupport/media.go b/vendor/google.golang.org/api/gensupport/media.go
index c6410e8..f3e77fc 100644
--- a/vendor/google.golang.org/api/gensupport/media.go
+++ b/vendor/google.golang.org/api/gensupport/media.go
@@ -174,26 +174,126 @@ func typeHeader(contentType string) textproto.MIMEHeader {
// PrepareUpload determines whether the data in the supplied reader should be
// uploaded in a single request, or in sequential chunks.
// chunkSize is the size of the chunk that media should be split into.
-// If chunkSize is non-zero and the contents of media do not fit in a single
-// chunk (or there is an error reading media), then media will be returned as a
-// MediaBuffer. Otherwise, media will be returned as a Reader.
+//
+// If chunkSize is zero, media is returned as the first value, and the other
+// two return values are nil, true.
+//
+// Otherwise, a MediaBuffer is returned, along with a bool indicating whether the
+// contents of media fit in a single chunk.
//
// After PrepareUpload has been called, media should no longer be used: the
// media content should be accessed via one of the return values.
-func PrepareUpload(media io.Reader, chunkSize int) (io.Reader, *MediaBuffer) {
+func PrepareUpload(media io.Reader, chunkSize int) (r io.Reader, mb *MediaBuffer, singleChunk bool) {
if chunkSize == 0 { // do not chunk
- return media, nil
+ return media, nil, true
+ }
+ mb = NewMediaBuffer(media, chunkSize)
+ _, _, _, err := mb.Chunk()
+ // If err is io.EOF, we can upload this in a single request. Otherwise, err is
+ // either nil or a non-EOF error. If it is the latter, then the next call to
+ // mb.Chunk will return the same error. Returning a MediaBuffer ensures that this
+ // error will be handled at some point.
+ return nil, mb, err == io.EOF
+}
+
+// MediaInfo holds information for media uploads. It is intended for use by generated
+// code only.
+type MediaInfo struct {
+ // At most one of Media and MediaBuffer will be set.
+ media io.Reader
+ buffer *MediaBuffer
+ singleChunk bool
+ mType string
+ size int64 // mediaSize, if known. Used only for calls to progressUpdater_.
+ progressUpdater googleapi.ProgressUpdater
+}
+
+// NewInfoFromMedia should be invoked from the Media method of a call. It returns a
+// MediaInfo populated with chunk size and content type, and a reader or MediaBuffer
+// if needed.
+func NewInfoFromMedia(r io.Reader, options []googleapi.MediaOption) *MediaInfo {
+ mi := &MediaInfo{}
+ opts := googleapi.ProcessMediaOptions(options)
+ if !opts.ForceEmptyContentType {
+ r, mi.mType = DetermineContentType(r, opts.ContentType)
+ }
+ mi.media, mi.buffer, mi.singleChunk = PrepareUpload(r, opts.ChunkSize)
+ return mi
+}
+
+// NewInfoFromResumableMedia should be invoked from the ResumableMedia method of a
+// call. It returns a MediaInfo using the given reader, size and media type.
+func NewInfoFromResumableMedia(r io.ReaderAt, size int64, mediaType string) *MediaInfo {
+ rdr := ReaderAtToReader(r, size)
+ rdr, mType := DetermineContentType(rdr, mediaType)
+ return &MediaInfo{
+ size: size,
+ mType: mType,
+ buffer: NewMediaBuffer(rdr, googleapi.DefaultUploadChunkSize),
+ media: nil,
+ singleChunk: false,
+ }
+}
+
+func (mi *MediaInfo) SetProgressUpdater(pu googleapi.ProgressUpdater) {
+ if mi != nil {
+ mi.progressUpdater = pu
}
+}
- mb := NewMediaBuffer(media, chunkSize)
- rdr, _, _, err := mb.Chunk()
+// UploadType determines the type of upload: a single request, or a resumable
+// series of requests.
+func (mi *MediaInfo) UploadType() string {
+ if mi.singleChunk {
+ return "multipart"
+ }
+ return "resumable"
+}
- if err == io.EOF { // we can upload this in a single request
- return rdr, nil
+// UploadRequest sets up an HTTP request for media upload. It adds headers
+// as necessary, and returns a replacement for the body.
+func (mi *MediaInfo) UploadRequest(reqHeaders http.Header, body io.Reader) (newBody io.Reader, cleanup func()) {
+ cleanup = func() {}
+ if mi == nil {
+ return body, cleanup
+ }
+ var media io.Reader
+ if mi.media != nil {
+ // This only happens when the caller has turned off chunking. In that
+ // case, we write all of media in a single non-retryable request.
+ media = mi.media
+ } else if mi.singleChunk {
+ // The data fits in a single chunk, which has now been read into the MediaBuffer.
+ // We obtain that chunk so we can write it in a single request. The request can
+ // be retried because the data is stored in the MediaBuffer.
+ media, _, _, _ = mi.buffer.Chunk()
+ }
+ if media != nil {
+ combined, ctype := CombineBodyMedia(body, "application/json", media, mi.mType)
+ cleanup = func() { combined.Close() }
+ reqHeaders.Set("Content-Type", ctype)
+ body = combined
}
- // err might be a non-EOF error. If it is, the next call to mb.Chunk will
- // return the same error. Returning a MediaBuffer ensures that this error
- // will be handled at some point.
+ if mi.buffer != nil && mi.mType != "" && !mi.singleChunk {
+ reqHeaders.Set("X-Upload-Content-Type", mi.mType)
+ }
+ return body, cleanup
+}
- return nil, mb
+// ResumableUpload returns an appropriately configured ResumableUpload value if the
+// upload is resumable, or nil otherwise.
+func (mi *MediaInfo) ResumableUpload(locURI string) *ResumableUpload {
+ if mi == nil || mi.singleChunk {
+ return nil
+ }
+ return &ResumableUpload{
+ URI: locURI,
+ Media: mi.buffer,
+ MediaType: mi.mType,
+ Callback: func(curr int64) {
+ if mi.progressUpdater != nil {
+ mi.progressUpdater(curr, mi.size)
+ }
+ },
+ }
}
diff --git a/vendor/google.golang.org/api/gensupport/send.go b/vendor/google.golang.org/api/gensupport/send.go
index 3d22f63..092044f 100644
--- a/vendor/google.golang.org/api/gensupport/send.go
+++ b/vendor/google.golang.org/api/gensupport/send.go
@@ -5,6 +5,7 @@
package gensupport
import (
+ "errors"
"net/http"
"golang.org/x/net/context"
@@ -32,6 +33,11 @@ func RegisterHook(h Hook) {
// If ctx is non-nil, it calls all hooks, then sends the request with
// ctxhttp.Do, then calls any functions returned by the hooks in reverse order.
func SendRequest(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
+ // Disallow Accept-Encoding because it interferes with the automatic gzip handling
+ // done by the default http.Transport. See https://github.com/google/google-api-go-client/issues/219.
+ if _, ok := req.Header["Accept-Encoding"]; ok {
+ return nil, errors.New("google api: custom Accept-Encoding headers not allowed")
+ }
if ctx == nil {
return client.Do(req)
}
diff --git a/vendor/google.golang.org/api/internal/creds.go b/vendor/google.golang.org/api/internal/creds.go
new file mode 100644
index 0000000..b546b63
--- /dev/null
+++ b/vendor/google.golang.org/api/internal/creds.go
@@ -0,0 +1,104 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "time"
+
+ "golang.org/x/net/context"
+ "golang.org/x/oauth2"
+ "golang.org/x/oauth2/google"
+)
+
+// Creds returns credential information obtained from DialSettings, or if none, then
+// it returns default credential information.
+func Creds(ctx context.Context, ds *DialSettings) (*google.DefaultCredentials, error) {
+ if ds.CredentialsFile != "" {
+ return credFileTokenSource(ctx, ds.CredentialsFile, ds.Scopes...)
+ }
+ if ds.TokenSource != nil {
+ return &google.DefaultCredentials{TokenSource: ds.TokenSource}, nil
+ }
+ return google.FindDefaultCredentials(ctx, ds.Scopes...)
+}
+
+// credFileTokenSource reads a refresh token file or a service account and returns
+// a TokenSource constructed from the config.
+func credFileTokenSource(ctx context.Context, filename string, scope ...string) (*google.DefaultCredentials, error) {
+ data, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, fmt.Errorf("cannot read credentials file: %v", err)
+ }
+ // See if it is a refresh token credentials file first.
+ ts, ok, err := refreshTokenTokenSource(ctx, data, scope...)
+ if err != nil {
+ return nil, err
+ }
+ if ok {
+ return &google.DefaultCredentials{
+ TokenSource: ts,
+ JSON: data,
+ }, nil
+ }
+
+ // If not, it should be a service account.
+ cfg, err := google.JWTConfigFromJSON(data, scope...)
+ if err != nil {
+ return nil, fmt.Errorf("google.JWTConfigFromJSON: %v", err)
+ }
+ // jwt.Config does not expose the project ID, so re-unmarshal to get it.
+ var pid struct {
+ ProjectID string `json:"project_id"`
+ }
+ if err := json.Unmarshal(data, &pid); err != nil {
+ return nil, err
+ }
+ return &google.DefaultCredentials{
+ ProjectID: pid.ProjectID,
+ TokenSource: cfg.TokenSource(ctx),
+ JSON: data,
+ }, nil
+}
+
+func refreshTokenTokenSource(ctx context.Context, data []byte, scope ...string) (oauth2.TokenSource, bool, error) {
+ var c cred
+ if err := json.Unmarshal(data, &c); err != nil {
+ return nil, false, fmt.Errorf("cannot unmarshal credentials file: %v", err)
+ }
+ if c.ClientID == "" || c.ClientSecret == "" || c.RefreshToken == "" || c.Type != "authorized_user" {
+ return nil, false, nil
+ }
+ cfg := &oauth2.Config{
+ ClientID: c.ClientID,
+ ClientSecret: c.ClientSecret,
+ Endpoint: google.Endpoint,
+ RedirectURL: "urn:ietf:wg:oauth:2.0:oob",
+ Scopes: scope,
+ }
+ return cfg.TokenSource(ctx, &oauth2.Token{
+ RefreshToken: c.RefreshToken,
+ Expiry: time.Now(),
+ }), true, nil
+}
+
+type cred struct {
+ ClientID string `json:"client_id"`
+ ClientSecret string `json:"client_secret"`
+ RefreshToken string `json:"refresh_token"`
+ Type string `json:"type"`
+}
diff --git a/vendor/google.golang.org/api/internal/service-account.json b/vendor/google.golang.org/api/internal/service-account.json
new file mode 100644
index 0000000..2cb54c2
--- /dev/null
+++ b/vendor/google.golang.org/api/internal/service-account.json
@@ -0,0 +1,12 @@
+{
+ "type": "service_account",
+ "project_id": "project_id",
+ "private_key_id": "private_key_id",
+ "private_key": "private_key",
+ "client_email": "xyz@developer.gserviceaccount.com",
+ "client_id": "123",
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
+ "token_uri": "https://accounts.google.com/o/oauth2/token",
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xyz%40developer.gserviceaccount.com"
+}
diff --git a/vendor/google.golang.org/api/internal/settings.go b/vendor/google.golang.org/api/internal/settings.go
index d7b9f57..5147191 100644
--- a/vendor/google.golang.org/api/internal/settings.go
+++ b/vendor/google.golang.org/api/internal/settings.go
@@ -25,13 +25,13 @@ import (
// DialSettings holds information needed to establish a connection with a
// Google API service.
type DialSettings struct {
- Endpoint string
- Scopes []string
- ServiceAccountJSONFilename string // if set, TokenSource is ignored.
- TokenSource oauth2.TokenSource
- UserAgent string
- APIKey string
- HTTPClient *http.Client
- GRPCDialOpts []grpc.DialOption
- GRPCConn *grpc.ClientConn
+ Endpoint string
+ Scopes []string
+ TokenSource oauth2.TokenSource
+ CredentialsFile string // if set, Token Source is ignored.
+ UserAgent string
+ APIKey string
+ HTTPClient *http.Client
+ GRPCDialOpts []grpc.DialOption
+ GRPCConn *grpc.ClientConn
}
diff --git a/vendor/google.golang.org/api/oauth2/v2/oauth2-api.json b/vendor/google.golang.org/api/oauth2/v2/oauth2-api.json
index f1f8beb..67a0378 100644
--- a/vendor/google.golang.org/api/oauth2/v2/oauth2-api.json
+++ b/vendor/google.golang.org/api/oauth2/v2/oauth2-api.json
@@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
- "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/DLGEtypjIuIXh77Iqrmfcan50ew\"",
+ "etag": "\"YWOzh2SDasdU84ArJnpYek-OMdg/UI_PjeJG3puXfKEXm-20UHWIhYQ\"",
"discoveryVersion": "v1",
"id": "oauth2:v2",
"name": "oauth2",
"version": "v2",
- "revision": "20161103",
+ "revision": "20170807",
"title": "Google OAuth2 API",
"description": "Obtains end-user authorization grants for use with other Google APIs.",
"ownerDomain": "google.com",
@@ -20,7 +20,7 @@
"basePath": "/",
"rootUrl": "https://www.googleapis.com/",
"servicePath": "",
- "batchPath": "batch",
+ "batchPath": "batch/oauth2/v2",
"parameters": {
"alt": {
"type": "string",
diff --git a/vendor/google.golang.org/api/option/option.go b/vendor/google.golang.org/api/option/option.go
index 4b14a2e..e3080e3 100644
--- a/vendor/google.golang.org/api/option/option.go
+++ b/vendor/google.golang.org/api/option/option.go
@@ -40,19 +40,25 @@ func (w withTokenSource) Apply(o *internal.DialSettings) {
o.TokenSource = w.ts
}
-// WithServiceAccountFile returns a ClientOption that uses a Google service
-// account credentials file to authenticate.
-// Use WithTokenSource with a token source created from
-// golang.org/x/oauth2/google.JWTConfigFromJSON
-// if reading the file from disk is not an option.
-func WithServiceAccountFile(filename string) ClientOption {
- return withServiceAccountFile(filename)
+type withCredFile string
+
+func (w withCredFile) Apply(o *internal.DialSettings) {
+ o.CredentialsFile = string(w)
}
-type withServiceAccountFile string
+// WithCredentialsFile returns a ClientOption that authenticates
+// API calls with the given service account or refresh token JSON
+// credentials file.
+func WithCredentialsFile(filename string) ClientOption {
+ return withCredFile(filename)
+}
-func (w withServiceAccountFile) Apply(o *internal.DialSettings) {
- o.ServiceAccountJSONFilename = string(w)
+// WithServiceAccountFile returns a ClientOption that uses a Google service
+// account credentials file to authenticate.
+//
+// Deprecated: Use WithCredentialsFile instead.
+func WithServiceAccountFile(filename string) ClientOption {
+ return WithCredentialsFile(filename)
}
// WithEndpoint returns a ClientOption that overrides the default endpoint
diff --git a/vendor/google.golang.org/api/storage/v1/storage-api.json b/vendor/google.golang.org/api/storage/v1/storage-api.json
index 31a3be1..e30379b 100644
--- a/vendor/google.golang.org/api/storage/v1/storage-api.json
+++ b/vendor/google.golang.org/api/storage/v1/storage-api.json
@@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
- "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/z5yry82uiiVbT8ZegvP6VogRacg\"",
+ "etag": "\"YWOzh2SDasdU84ArJnpYek-OMdg/wG6rmEvDnTlddzJg86OD2al2nik\"",
"discoveryVersion": "v1",
"id": "storage:v1",
"name": "storage",
"version": "v1",
- "revision": "20170224",
+ "revision": "20171004",
"title": "Cloud Storage JSON API",
"description": "Stores and retrieves potentially large, immutable data objects.",
"ownerDomain": "google.com",
@@ -108,6 +108,16 @@
]
}
},
+ "billing": {
+ "type": "object",
+ "description": "The bucket's billing configuration.",
+ "properties": {
+ "requesterPays": {
+ "type": "boolean",
+ "description": "When set to true, bucket is requester pays."
+ }
+ }
+ },
"cors": {
"type": "array",
"description": "The bucket's Cross-Origin Resource Sharing (CORS) configuration.",
@@ -150,6 +160,15 @@
"$ref": "ObjectAccessControl"
}
},
+ "encryption": {
+ "type": "object",
+ "description": "Encryption configuration used by default for newly inserted objects, when no encryption config is specified.",
+ "properties": {
+ "defaultKmsKeyName": {
+ "type": "string"
+ }
+ }
+ },
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the bucket."
@@ -163,6 +182,14 @@
"description": "The kind of item this is. For buckets, this is always storage#bucket.",
"default": "storage#bucket"
},
+ "labels": {
+ "type": "object",
+ "description": "User-provided labels, in key/value pairs.",
+ "additionalProperties": {
+ "type": "string",
+ "description": "An individual label entry."
+ }
+ },
"lifecycle": {
"type": "object",
"description": "The bucket's lifecycle configuration. See lifecycle management for more information.",
@@ -541,6 +568,81 @@
}
}
},
+ "Notification": {
+ "id": "Notification",
+ "type": "object",
+ "description": "A subscription to receive Google PubSub notifications.",
+ "properties": {
+ "custom_attributes": {
+ "type": "object",
+ "description": "An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "etag": {
+ "type": "string",
+ "description": "HTTP 1.1 Entity tag for this subscription notification."
+ },
+ "event_types": {
+ "type": "array",
+ "description": "If present, only send notifications about listed event types. If empty, sent notifications for all event types.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "id": {
+ "type": "string",
+ "description": "The ID of the notification."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The kind of item this is. For notifications, this is always storage#notification.",
+ "default": "storage#notification"
+ },
+ "object_name_prefix": {
+ "type": "string",
+ "description": "If present, only apply this notification configuration to object names that begin with this prefix."
+ },
+ "payload_format": {
+ "type": "string",
+ "description": "The desired content of the Payload.",
+ "default": "JSON_API_V1"
+ },
+ "selfLink": {
+ "type": "string",
+ "description": "The canonical URL of this notification."
+ },
+ "topic": {
+ "type": "string",
+ "description": "The Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'",
+ "annotations": {
+ "required": [
+ "storage.notifications.insert"
+ ]
+ }
+ }
+ }
+ },
+ "Notifications": {
+ "id": "Notifications",
+ "type": "object",
+ "description": "A list of notification subscriptions.",
+ "properties": {
+ "items": {
+ "type": "array",
+ "description": "The list of items.",
+ "items": {
+ "$ref": "Notification"
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "The kind of item this is. For lists of notifications, this is always storage#notifications.",
+ "default": "storage#notifications"
+ }
+ }
+ },
"Object": {
"id": "Object",
"type": "object",
@@ -585,7 +687,7 @@
},
"contentType": {
"type": "string",
- "description": "Content-Type of the object data. If contentType is not specified, object downloads will be served as application/octet-stream."
+ "description": "Content-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream."
},
"crc32c": {
"type": "string",
@@ -623,6 +725,10 @@
"description": "The kind of item this is. For objects, this is always storage#object.",
"default": "storage#object"
},
+ "kmsKeyName": {
+ "type": "string",
+ "description": "Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key."
+ },
"md5Hash": {
"type": "string",
"description": "MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices."
@@ -840,6 +946,9 @@
"items": {
"type": "object",
"properties": {
+ "condition": {
+ "type": "any"
+ },
"members": {
"type": "array",
"description": "A collection of identifiers for members who may assume the provided role. Recognized identifiers are as follows: \n- allUsers — A special identifier that represents anyone on the internet; with or without a Google account. \n- allAuthenticatedUsers — A special identifier that represents anyone who is authenticated with a Google account or a service account. \n- user:emailid — An email address that represents a specific account. For example, user:alice@gmail.com or user:joe@example.com. \n- serviceAccount:emailid — An email address that represents a service account. For example, serviceAccount:my-other-app@appspot.gserviceaccount.com . \n- group:emailid — An email address that represents a Google group. For example, group:admins@example.com. \n- domain:domain — A Google Apps domain name that represents all the users of that domain. For example, domain:google.com or domain:example.com. \n- projectOwner:projectid — Owners of the given project. For example, projectOwner:my-example-project \n- projectEditor:projectid — Editors of the given project. For example, projectEditor:my-example-project \n- projectViewer:projectid — Viewers of the given project. For example, projectViewer:my-example-project",
@@ -884,7 +993,7 @@
},
"resourceId": {
"type": "string",
- "description": "The ID of the resource to which this policy belongs. Will be of the form buckets/bucket for buckets, and buckets/bucket/objects/object for objects. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input."
+ "description": "The ID of the resource to which this policy belongs. Will be of the form projects/_/buckets/bucket for buckets, and projects/_/buckets/bucket/objects/object for objects. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input."
}
}
},
@@ -905,7 +1014,7 @@
"objectSize": {
"type": "string",
"description": "The total size of the object being copied in bytes. This property is always present in the response.",
- "format": "uint64"
+ "format": "int64"
},
"resource": {
"$ref": "Object",
@@ -918,7 +1027,23 @@
"totalBytesRewritten": {
"type": "string",
"description": "The total bytes written so far, which can be used to provide a waiting user with a progress indicator. This property is always present in the response.",
- "format": "uint64"
+ "format": "int64"
+ }
+ }
+ },
+ "ServiceAccount": {
+ "id": "ServiceAccount",
+ "type": "object",
+ "description": "A subscription to receive Google PubSub notifications.",
+ "properties": {
+ "email_address": {
+ "type": "string",
+ "description": "The ID of the notification."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The kind of item this is. For notifications, this is always storage#notification.",
+ "default": "storage#serviceAccount"
}
}
},
@@ -962,6 +1087,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -990,6 +1120,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1015,6 +1150,11 @@
"description": "Name of a bucket.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1042,6 +1182,11 @@
"description": "Name of a bucket.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1072,6 +1217,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1106,6 +1256,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1150,6 +1305,11 @@
"description": "If set, only deletes the bucket if its metageneration does not match this value.",
"format": "int64",
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1197,6 +1357,11 @@
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1224,6 +1389,11 @@
"description": "Name of a bucket.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1304,6 +1474,11 @@
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1363,6 +1538,11 @@
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1455,6 +1635,11 @@
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1482,6 +1667,11 @@
"description": "Name of a bucket.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1517,6 +1707,11 @@
"required": true,
"repeated": true,
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1610,6 +1805,11 @@
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1668,6 +1868,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1696,6 +1901,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1721,6 +1931,11 @@
"description": "Name of a bucket.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1760,6 +1975,11 @@
"description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1790,6 +2010,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1824,6 +2049,11 @@
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1843,6 +2073,148 @@
}
}
},
+ "notifications": {
+ "methods": {
+ "delete": {
+ "id": "storage.notifications.delete",
+ "path": "b/{bucket}/notificationConfigs/{notification}",
+ "httpMethod": "DELETE",
+ "description": "Permanently deletes a notification subscription.",
+ "parameters": {
+ "bucket": {
+ "type": "string",
+ "description": "The parent bucket of the notification.",
+ "required": true,
+ "location": "path"
+ },
+ "notification": {
+ "type": "string",
+ "description": "ID of the notification to delete.",
+ "required": true,
+ "location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "bucket",
+ "notification"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ]
+ },
+ "get": {
+ "id": "storage.notifications.get",
+ "path": "b/{bucket}/notificationConfigs/{notification}",
+ "httpMethod": "GET",
+ "description": "View a notification configuration.",
+ "parameters": {
+ "bucket": {
+ "type": "string",
+ "description": "The parent bucket of the notification.",
+ "required": true,
+ "location": "path"
+ },
+ "notification": {
+ "type": "string",
+ "description": "Notification ID",
+ "required": true,
+ "location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "bucket",
+ "notification"
+ ],
+ "response": {
+ "$ref": "Notification"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_only",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ]
+ },
+ "insert": {
+ "id": "storage.notifications.insert",
+ "path": "b/{bucket}/notificationConfigs",
+ "httpMethod": "POST",
+ "description": "Creates a notification subscription for a given bucket.",
+ "parameters": {
+ "bucket": {
+ "type": "string",
+ "description": "The parent bucket of the notification.",
+ "required": true,
+ "location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "bucket"
+ ],
+ "request": {
+ "$ref": "Notification"
+ },
+ "response": {
+ "$ref": "Notification"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ]
+ },
+ "list": {
+ "id": "storage.notifications.list",
+ "path": "b/{bucket}/notificationConfigs",
+ "httpMethod": "GET",
+ "description": "Retrieves a list of notification subscriptions for a given bucket.",
+ "parameters": {
+ "bucket": {
+ "type": "string",
+ "description": "Name of a Google Cloud Storage bucket.",
+ "required": true,
+ "location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "bucket"
+ ],
+ "response": {
+ "$ref": "Notifications"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_only",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ]
+ }
+ }
+ },
"objectAccessControls": {
"methods": {
"delete": {
@@ -1874,6 +2246,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1915,6 +2292,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1953,6 +2335,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -1993,6 +2380,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2036,6 +2428,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2083,6 +2480,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2146,7 +2548,7 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
@@ -2155,6 +2557,16 @@
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
+ },
+ "kmsKeyName": {
+ "type": "string",
+ "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ "location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2216,13 +2628,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2240,13 +2652,13 @@
},
"ifSourceGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
+ "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
"format": "int64",
"location": "query"
},
@@ -2292,6 +2704,11 @@
"description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2334,13 +2751,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2361,6 +2778,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2393,13 +2815,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2433,6 +2855,11 @@
"Omit the owner, acl property."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2475,6 +2902,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2511,13 +2943,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2533,6 +2965,11 @@
"format": "int64",
"location": "query"
},
+ "kmsKeyName": {
+ "type": "string",
+ "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ "location": "query"
+ },
"name": {
"type": "string",
"description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
@@ -2571,6 +3008,11 @@
"Omit the owner, acl property."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2654,6 +3096,11 @@
],
"location": "query"
},
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ },
"versions": {
"type": "boolean",
"description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
@@ -2695,13 +3142,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2756,6 +3203,11 @@
"Omit the owner, acl property."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2785,6 +3237,11 @@
"required": true,
"location": "path"
},
+ "destinationKmsKeyName": {
+ "type": "string",
+ "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ "location": "query"
+ },
"destinationObject": {
"type": "string",
"description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
@@ -2814,13 +3271,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -2838,13 +3295,13 @@
},
"ifSourceGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
+ "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
"format": "int64",
"location": "query"
},
@@ -2901,6 +3358,11 @@
"description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2944,6 +3406,11 @@
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -2992,6 +3459,11 @@
"required": true,
"repeated": true,
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -3030,13 +3502,13 @@
},
"ifGenerationMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
- "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
@@ -3091,6 +3563,11 @@
"Omit the owner, acl property."
],
"location": "query"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
}
},
"parameterOrder": [
@@ -3158,6 +3635,11 @@
],
"location": "query"
},
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ "location": "query"
+ },
"versions": {
"type": "boolean",
"description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
@@ -3184,6 +3666,46 @@
"supportsSubscription": true
}
}
+ },
+ "projects": {
+ "resources": {
+ "serviceAccount": {
+ "methods": {
+ "get": {
+ "id": "storage.projects.serviceAccount.get",
+ "path": "projects/{projectId}/serviceAccount",
+ "httpMethod": "GET",
+ "description": "Get the email address of this project's Google Cloud Storage service account.",
+ "parameters": {
+ "projectId": {
+ "type": "string",
+ "description": "Project ID",
+ "required": true,
+ "location": "path"
+ },
+ "userProject": {
+ "type": "string",
+ "description": "The project to be billed for this request.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "response": {
+ "$ref": "ServiceAccount"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_only",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ]
+ }
+ }
+ }
+ }
}
}
}
diff --git a/vendor/google.golang.org/api/storage/v1/storage-gen.go b/vendor/google.golang.org/api/storage/v1/storage-gen.go
index b36bff2..e311c29 100644
--- a/vendor/google.golang.org/api/storage/v1/storage-gen.go
+++ b/vendor/google.golang.org/api/storage/v1/storage-gen.go
@@ -72,8 +72,10 @@ func New(client *http.Client) (*Service, error) {
s.Buckets = NewBucketsService(s)
s.Channels = NewChannelsService(s)
s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
+ s.Notifications = NewNotificationsService(s)
s.ObjectAccessControls = NewObjectAccessControlsService(s)
s.Objects = NewObjectsService(s)
+ s.Projects = NewProjectsService(s)
return s, nil
}
@@ -90,9 +92,13 @@ type Service struct {
DefaultObjectAccessControls *DefaultObjectAccessControlsService
+ Notifications *NotificationsService
+
ObjectAccessControls *ObjectAccessControlsService
Objects *ObjectsService
+
+ Projects *ProjectsService
}
func (s *Service) userAgent() string {
@@ -138,6 +144,15 @@ type DefaultObjectAccessControlsService struct {
s *Service
}
+func NewNotificationsService(s *Service) *NotificationsService {
+ rs := &NotificationsService{s: s}
+ return rs
+}
+
+type NotificationsService struct {
+ s *Service
+}
+
func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
rs := &ObjectAccessControlsService{s: s}
return rs
@@ -156,11 +171,35 @@ type ObjectsService struct {
s *Service
}
+func NewProjectsService(s *Service) *ProjectsService {
+ rs := &ProjectsService{s: s}
+ rs.ServiceAccount = NewProjectsServiceAccountService(s)
+ return rs
+}
+
+type ProjectsService struct {
+ s *Service
+
+ ServiceAccount *ProjectsServiceAccountService
+}
+
+func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
+ rs := &ProjectsServiceAccountService{s: s}
+ return rs
+}
+
+type ProjectsServiceAccountService struct {
+ s *Service
+}
+
// Bucket: A bucket.
type Bucket struct {
// Acl: Access controls on the bucket.
Acl []*BucketAccessControl `json:"acl,omitempty"`
+ // Billing: The bucket's billing configuration.
+ Billing *BucketBilling `json:"billing,omitempty"`
+
// Cors: The bucket's Cross-Origin Resource Sharing (CORS)
// configuration.
Cors []*BucketCors `json:"cors,omitempty"`
@@ -169,6 +208,10 @@ type Bucket struct {
// when no ACL is provided.
DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
+ // Encryption: Encryption configuration used by default for newly
+ // inserted objects, when no encryption config is specified.
+ Encryption *BucketEncryption `json:"encryption,omitempty"`
+
// Etag: HTTP 1.1 Entity tag for the bucket.
Etag string `json:"etag,omitempty"`
@@ -180,6 +223,9 @@ type Bucket struct {
// storage#bucket.
Kind string `json:"kind,omitempty"`
+ // Labels: User-provided labels, in key/value pairs.
+ Labels map[string]string `json:"labels,omitempty"`
+
// Lifecycle: The bucket's lifecycle configuration. See lifecycle
// management for more information.
Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
@@ -261,6 +307,34 @@ func (s *Bucket) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
+// BucketBilling: The bucket's billing configuration.
+type BucketBilling struct {
+ // RequesterPays: When set to true, bucket is requester pays.
+ RequesterPays bool `json:"requesterPays,omitempty"`
+
+ // ForceSendFields is a list of field names (e.g. "RequesterPays") to
+ // unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+
+ // NullFields is a list of field names (e.g. "RequesterPays") to include
+ // in API requests with the JSON null value. By default, fields with
+ // empty values are omitted from API requests. However, any field with
+ // an empty value appearing in NullFields will be sent to the server as
+ // null. It is an error if a field in this list has a non-empty value.
+ // This may be used to include null fields in Patch requests.
+ NullFields []string `json:"-"`
+}
+
+func (s *BucketBilling) MarshalJSON() ([]byte, error) {
+ type noMethod BucketBilling
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
+}
+
type BucketCors struct {
// MaxAgeSeconds: The value, in seconds, to return in the
// Access-Control-Max-Age header used in preflight responses.
@@ -304,6 +378,35 @@ func (s *BucketCors) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
+// BucketEncryption: Encryption configuration used by default for newly
+// inserted objects, when no encryption config is specified.
+type BucketEncryption struct {
+ DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
+
+ // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
+ // to unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+
+ // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
+ // include in API requests with the JSON null value. By default, fields
+ // with empty values are omitted from API requests. However, any field
+ // with an empty value appearing in NullFields will be sent to the
+ // server as null. It is an error if a field in this list has a
+ // non-empty value. This may be used to include null fields in Patch
+ // requests.
+ NullFields []string `json:"-"`
+}
+
+func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
+ type noMethod BucketEncryption
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
+}
+
// BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
// management for more information.
type BucketLifecycle struct {
@@ -412,7 +515,7 @@ type BucketLifecycleRuleCondition struct {
// IsLive: Relevant only for versioned objects. If the value is true,
// this condition matches live objects; if the value is false, it
// matches archived objects.
- IsLive bool `json:"isLive,omitempty"`
+ IsLive *bool `json:"isLive,omitempty"`
// MatchesStorageClass: Objects having any of the storage classes
// specified by this condition will be matched. Values include
@@ -938,6 +1041,107 @@ func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte,
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
+// Notification: A subscription to receive Google PubSub notifications.
+type Notification struct {
+ // CustomAttributes: An optional list of additional attributes to attach
+ // to each Cloud PubSub message published for this notification
+ // subscription.
+ CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
+
+ // Etag: HTTP 1.1 Entity tag for this subscription notification.
+ Etag string `json:"etag,omitempty"`
+
+ // EventTypes: If present, only send notifications about listed event
+ // types. If empty, sent notifications for all event types.
+ EventTypes []string `json:"event_types,omitempty"`
+
+ // Id: The ID of the notification.
+ Id string `json:"id,omitempty"`
+
+ // Kind: The kind of item this is. For notifications, this is always
+ // storage#notification.
+ Kind string `json:"kind,omitempty"`
+
+ // ObjectNamePrefix: If present, only apply this notification
+ // configuration to object names that begin with this prefix.
+ ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
+
+ // PayloadFormat: The desired content of the Payload.
+ PayloadFormat string `json:"payload_format,omitempty"`
+
+ // SelfLink: The canonical URL of this notification.
+ SelfLink string `json:"selfLink,omitempty"`
+
+ // Topic: The Cloud PubSub topic to which this subscription publishes.
+ // Formatted as:
+ // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
+ // c}'
+ Topic string `json:"topic,omitempty"`
+
+ // ServerResponse contains the HTTP response code and headers from the
+ // server.
+ googleapi.ServerResponse `json:"-"`
+
+ // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
+ // unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+
+ // NullFields is a list of field names (e.g. "CustomAttributes") to
+ // include in API requests with the JSON null value. By default, fields
+ // with empty values are omitted from API requests. However, any field
+ // with an empty value appearing in NullFields will be sent to the
+ // server as null. It is an error if a field in this list has a
+ // non-empty value. This may be used to include null fields in Patch
+ // requests.
+ NullFields []string `json:"-"`
+}
+
+func (s *Notification) MarshalJSON() ([]byte, error) {
+ type noMethod Notification
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
+}
+
+// Notifications: A list of notification subscriptions.
+type Notifications struct {
+ // Items: The list of items.
+ Items []*Notification `json:"items,omitempty"`
+
+ // Kind: The kind of item this is. For lists of notifications, this is
+ // always storage#notifications.
+ Kind string `json:"kind,omitempty"`
+
+ // ServerResponse contains the HTTP response code and headers from the
+ // server.
+ googleapi.ServerResponse `json:"-"`
+
+ // ForceSendFields is a list of field names (e.g. "Items") to
+ // unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+
+ // NullFields is a list of field names (e.g. "Items") to include in API
+ // requests with the JSON null value. By default, fields with empty
+ // values are omitted from API requests. However, any field with an
+ // empty value appearing in NullFields will be sent to the server as
+ // null. It is an error if a field in this list has a non-empty value.
+ // This may be used to include null fields in Patch requests.
+ NullFields []string `json:"-"`
+}
+
+func (s *Notifications) MarshalJSON() ([]byte, error) {
+ type noMethod Notifications
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
+}
+
// Object: An object.
type Object struct {
// Acl: Access controls on the object.
@@ -964,9 +1168,8 @@ type Object struct {
// ContentLanguage: Content-Language of the object data.
ContentLanguage string `json:"contentLanguage,omitempty"`
- // ContentType: Content-Type of the object data. If contentType is not
- // specified, object downloads will be served as
- // application/octet-stream.
+ // ContentType: Content-Type of the object data. If an object is stored
+ // without a Content-Type, it is served as application/octet-stream.
ContentType string `json:"contentType,omitempty"`
// Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
@@ -994,6 +1197,10 @@ type Object struct {
// storage#object.
Kind string `json:"kind,omitempty"`
+ // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
+ // is encrypted by such a key.
+ KmsKeyName string `json:"kmsKeyName,omitempty"`
+
// Md5Hash: MD5 hash of the data; encoded using base64. For more
// information about using the MD5 hash, see Hashes and ETags: Best
// Practices.
@@ -1348,10 +1555,11 @@ type Policy struct {
Kind string `json:"kind,omitempty"`
// ResourceId: The ID of the resource to which this policy belongs. Will
- // be of the form buckets/bucket for buckets, and
- // buckets/bucket/objects/object for objects. A specific generation may
- // be specified by appending #generationNumber to the end of the object
- // name, e.g. buckets/my-bucket/objects/data.txt#17. The current
+ // be of the form projects/_/buckets/bucket for buckets, and
+ // projects/_/buckets/bucket/objects/object for objects. A specific
+ // generation may be specified by appending #generationNumber to the end
+ // of the object name, e.g.
+ // projects/_/buckets/my-bucket/objects/data.txt#17. The current
// generation can be denoted with #0. This field is ignored on input.
ResourceId string `json:"resourceId,omitempty"`
@@ -1383,6 +1591,8 @@ func (s *Policy) MarshalJSON() ([]byte, error) {
}
type PolicyBindings struct {
+ Condition interface{} `json:"condition,omitempty"`
+
// Members: A collection of identifiers for members who may assume the
// provided role. Recognized identifiers are as follows:
// - allUsers — A special identifier that represents anyone on the
@@ -1440,7 +1650,7 @@ type PolicyBindings struct {
// an ACL entry on a bucket with the OWNER role.
Role string `json:"role,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Members") to
+ // ForceSendFields is a list of field names (e.g. "Condition") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
@@ -1448,7 +1658,7 @@ type PolicyBindings struct {
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
- // NullFields is a list of field names (e.g. "Members") to include in
+ // NullFields is a list of field names (e.g. "Condition") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
@@ -1474,7 +1684,7 @@ type RewriteResponse struct {
// ObjectSize: The total size of the object being copied in bytes. This
// property is always present in the response.
- ObjectSize uint64 `json:"objectSize,omitempty,string"`
+ ObjectSize int64 `json:"objectSize,omitempty,string"`
// Resource: A resource containing the metadata for the copied-to
// object. This property is present in the response only when copying
@@ -1489,7 +1699,7 @@ type RewriteResponse struct {
// TotalBytesRewritten: The total bytes written so far, which can be
// used to provide a waiting user with a progress indicator. This
// property is always present in the response.
- TotalBytesRewritten uint64 `json:"totalBytesRewritten,omitempty,string"`
+ TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
// ServerResponse contains the HTTP response code and headers from the
// server.
@@ -1518,6 +1728,43 @@ func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
+// ServiceAccount: A subscription to receive Google PubSub
+// notifications.
+type ServiceAccount struct {
+ // EmailAddress: The ID of the notification.
+ EmailAddress string `json:"email_address,omitempty"`
+
+ // Kind: The kind of item this is. For notifications, this is always
+ // storage#notification.
+ Kind string `json:"kind,omitempty"`
+
+ // ServerResponse contains the HTTP response code and headers from the
+ // server.
+ googleapi.ServerResponse `json:"-"`
+
+ // ForceSendFields is a list of field names (e.g. "EmailAddress") to
+ // unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+
+ // NullFields is a list of field names (e.g. "EmailAddress") to include
+ // in API requests with the JSON null value. By default, fields with
+ // empty values are omitted from API requests. However, any field with
+ // an empty value appearing in NullFields will be sent to the server as
+ // null. It is an error if a field in this list has a non-empty value.
+ // This may be used to include null fields in Patch requests.
+ NullFields []string `json:"-"`
+}
+
+func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
+ type noMethod ServiceAccount
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
+}
+
// TestIamPermissionsResponse: A
// storage.(buckets|objects).testIamPermissions response.
type TestIamPermissionsResponse struct {
@@ -1591,6 +1838,13 @@ func (r *BucketAccessControlsService) Delete(bucket string, entity string) *Buck
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -1667,6 +1921,11 @@ func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl/{entity}",
@@ -1699,6 +1958,13 @@ func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketA
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -1813,6 +2079,11 @@ func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketA
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl/{entity}",
@@ -1846,6 +2117,13 @@ func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -1944,6 +2222,11 @@ func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*Buck
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl",
@@ -1979,6 +2262,13 @@ func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsL
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2085,6 +2375,11 @@ func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*Bucket
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl",
@@ -2121,6 +2416,13 @@ func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucket
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2227,6 +2529,11 @@ func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*Bucke
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl/{entity}",
@@ -2265,6 +2572,13 @@ func (r *BucketAccessControlsService) Update(bucket string, entity string, bucke
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2371,6 +2685,11 @@ func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*Buck
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/acl/{entity}",
@@ -2421,6 +2740,13 @@ func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch in
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2501,6 +2827,11 @@ func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
// "format": "int64",
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}",
@@ -2560,6 +2891,13 @@ func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2691,6 +3029,11 @@ func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}",
@@ -2726,6 +3069,13 @@ func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -2832,6 +3182,11 @@ func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/iam",
@@ -2919,6 +3274,13 @@ func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request
+func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -3067,6 +3429,11 @@ func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b",
@@ -3136,6 +3503,13 @@ func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request.
+func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -3270,6 +3644,11 @@ func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b",
@@ -3397,6 +3776,13 @@ func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -3560,6 +3946,11 @@ func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}",
@@ -3596,6 +3987,13 @@ func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSet
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -3694,6 +4092,11 @@ func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/iam",
@@ -3732,6 +4135,13 @@ func (r *BucketsService) TestIamPermissions(bucket string, permissions []string)
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -3846,6 +4256,11 @@ func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestI
// "repeated": true,
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/iam/testPermissions",
@@ -3952,6 +4367,13 @@ func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4115,6 +4537,11 @@ func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}",
@@ -4246,6 +4673,13 @@ func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4322,6 +4756,11 @@ func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption)
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl/{entity}",
@@ -4354,6 +4793,13 @@ func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4468,6 +4914,11 @@ func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl/{entity}",
@@ -4502,6 +4953,13 @@ func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccessc
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4600,6 +5058,11 @@ func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption)
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl",
@@ -4652,6 +5115,13 @@ func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagen
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4770,6 +5240,11 @@ func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (
// "format": "int64",
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl",
@@ -4806,6 +5281,13 @@ func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string,
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -4912,6 +5394,11 @@ func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption)
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl/{entity}",
@@ -4950,6 +5437,13 @@ func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5056,6 +5550,11 @@ func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption)
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/defaultObjectAcl/{entity}",
@@ -5073,6 +5572,589 @@ func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption)
}
+// method id "storage.notifications.delete":
+
+type NotificationsDeleteCall struct {
+ s *Service
+ bucket string
+ notification string
+ urlParams_ gensupport.URLParams
+ ctx_ context.Context
+ header_ http.Header
+}
+
+// Delete: Permanently deletes a notification subscription.
+func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
+ c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ c.bucket = bucket
+ c.notification = notification
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
+ c.ctx_ = ctx
+ return c
+}
+
+// Header returns an http.Header that can be modified by the caller to
+// add HTTP headers to the request.
+func (c *NotificationsDeleteCall) Header() http.Header {
+ if c.header_ == nil {
+ c.header_ = make(http.Header)
+ }
+ return c.header_
+}
+
+func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
+ reqHeaders := make(http.Header)
+ for k, v := range c.header_ {
+ reqHeaders[k] = v
+ }
+ reqHeaders.Set("User-Agent", c.s.userAgent())
+ var body io.Reader = nil
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("DELETE", urls, body)
+ req.Header = reqHeaders
+ googleapi.Expand(req.URL, map[string]string{
+ "bucket": c.bucket,
+ "notification": c.notification,
+ })
+ return gensupport.SendRequest(c.ctx_, c.s.client, req)
+}
+
+// Do executes the "storage.notifications.delete" call.
+func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
+ gensupport.SetOptions(c.urlParams_, opts...)
+ res, err := c.doRequest("json")
+ if err != nil {
+ return err
+ }
+ defer googleapi.CloseBody(res)
+ if err := googleapi.CheckResponse(res); err != nil {
+ return err
+ }
+ return nil
+ // {
+ // "description": "Permanently deletes a notification subscription.",
+ // "httpMethod": "DELETE",
+ // "id": "storage.notifications.delete",
+ // "parameterOrder": [
+ // "bucket",
+ // "notification"
+ // ],
+ // "parameters": {
+ // "bucket": {
+ // "description": "The parent bucket of the notification.",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "notification": {
+ // "description": "ID of the notification to delete.",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "b/{bucket}/notificationConfigs/{notification}",
+ // "scopes": [
+ // "https://www.googleapis.com/auth/cloud-platform",
+ // "https://www.googleapis.com/auth/devstorage.full_control",
+ // "https://www.googleapis.com/auth/devstorage.read_write"
+ // ]
+ // }
+
+}
+
+// method id "storage.notifications.get":
+
+type NotificationsGetCall struct {
+ s *Service
+ bucket string
+ notification string
+ urlParams_ gensupport.URLParams
+ ifNoneMatch_ string
+ ctx_ context.Context
+ header_ http.Header
+}
+
+// Get: View a notification configuration.
+func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
+ c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ c.bucket = bucket
+ c.notification = notification
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// IfNoneMatch sets the 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. Use googleapi.IsNotModified to check whether the response
+// error from Do is the result of In-None-Match.
+func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
+ c.ifNoneMatch_ = entityTag
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
+ c.ctx_ = ctx
+ return c
+}
+
+// Header returns an http.Header that can be modified by the caller to
+// add HTTP headers to the request.
+func (c *NotificationsGetCall) Header() http.Header {
+ if c.header_ == nil {
+ c.header_ = make(http.Header)
+ }
+ return c.header_
+}
+
+func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
+ reqHeaders := make(http.Header)
+ for k, v := range c.header_ {
+ reqHeaders[k] = v
+ }
+ reqHeaders.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ var body io.Reader = nil
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("GET", urls, body)
+ req.Header = reqHeaders
+ googleapi.Expand(req.URL, map[string]string{
+ "bucket": c.bucket,
+ "notification": c.notification,
+ })
+ return gensupport.SendRequest(c.ctx_, c.s.client, req)
+}
+
+// Do executes the "storage.notifications.get" call.
+// Exactly one of *Notification or error will be non-nil. Any non-2xx
+// status code is an error. Response headers are in either
+// *Notification.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 *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, 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, &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, err
+ }
+ ret := &Notification{
+ ServerResponse: googleapi.ServerResponse{
+ Header: res.Header,
+ HTTPStatusCode: res.StatusCode,
+ },
+ }
+ target := &ret
+ if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ return nil, err
+ }
+ return ret, nil
+ // {
+ // "description": "View a notification configuration.",
+ // "httpMethod": "GET",
+ // "id": "storage.notifications.get",
+ // "parameterOrder": [
+ // "bucket",
+ // "notification"
+ // ],
+ // "parameters": {
+ // "bucket": {
+ // "description": "The parent bucket of the notification.",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "notification": {
+ // "description": "Notification ID",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "b/{bucket}/notificationConfigs/{notification}",
+ // "response": {
+ // "$ref": "Notification"
+ // },
+ // "scopes": [
+ // "https://www.googleapis.com/auth/cloud-platform",
+ // "https://www.googleapis.com/auth/cloud-platform.read-only",
+ // "https://www.googleapis.com/auth/devstorage.full_control",
+ // "https://www.googleapis.com/auth/devstorage.read_only",
+ // "https://www.googleapis.com/auth/devstorage.read_write"
+ // ]
+ // }
+
+}
+
+// method id "storage.notifications.insert":
+
+type NotificationsInsertCall struct {
+ s *Service
+ bucket string
+ notification *Notification
+ urlParams_ gensupport.URLParams
+ ctx_ context.Context
+ header_ http.Header
+}
+
+// Insert: Creates a notification subscription for a given bucket.
+func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
+ c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ c.bucket = bucket
+ c.notification = notification
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
+ c.ctx_ = ctx
+ return c
+}
+
+// Header returns an http.Header that can be modified by the caller to
+// add HTTP headers to the request.
+func (c *NotificationsInsertCall) Header() http.Header {
+ if c.header_ == nil {
+ c.header_ = make(http.Header)
+ }
+ return c.header_
+}
+
+func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
+ reqHeaders := make(http.Header)
+ for k, v := range c.header_ {
+ reqHeaders[k] = v
+ }
+ reqHeaders.Set("User-Agent", c.s.userAgent())
+ var body io.Reader = nil
+ body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
+ if err != nil {
+ return nil, err
+ }
+ reqHeaders.Set("Content-Type", "application/json")
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("POST", urls, body)
+ req.Header = reqHeaders
+ googleapi.Expand(req.URL, map[string]string{
+ "bucket": c.bucket,
+ })
+ return gensupport.SendRequest(c.ctx_, c.s.client, req)
+}
+
+// Do executes the "storage.notifications.insert" call.
+// Exactly one of *Notification or error will be non-nil. Any non-2xx
+// status code is an error. Response headers are in either
+// *Notification.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 *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, 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, &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, err
+ }
+ ret := &Notification{
+ ServerResponse: googleapi.ServerResponse{
+ Header: res.Header,
+ HTTPStatusCode: res.StatusCode,
+ },
+ }
+ target := &ret
+ if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ return nil, err
+ }
+ return ret, nil
+ // {
+ // "description": "Creates a notification subscription for a given bucket.",
+ // "httpMethod": "POST",
+ // "id": "storage.notifications.insert",
+ // "parameterOrder": [
+ // "bucket"
+ // ],
+ // "parameters": {
+ // "bucket": {
+ // "description": "The parent bucket of the notification.",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "b/{bucket}/notificationConfigs",
+ // "request": {
+ // "$ref": "Notification"
+ // },
+ // "response": {
+ // "$ref": "Notification"
+ // },
+ // "scopes": [
+ // "https://www.googleapis.com/auth/cloud-platform",
+ // "https://www.googleapis.com/auth/devstorage.full_control",
+ // "https://www.googleapis.com/auth/devstorage.read_write"
+ // ]
+ // }
+
+}
+
+// method id "storage.notifications.list":
+
+type NotificationsListCall struct {
+ s *Service
+ bucket string
+ urlParams_ gensupport.URLParams
+ ifNoneMatch_ string
+ ctx_ context.Context
+ header_ http.Header
+}
+
+// List: Retrieves a list of notification subscriptions for a given
+// bucket.
+func (r *NotificationsService) List(bucket string) *NotificationsListCall {
+ c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ c.bucket = bucket
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// IfNoneMatch sets the 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. Use googleapi.IsNotModified to check whether the response
+// error from Do is the result of In-None-Match.
+func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
+ c.ifNoneMatch_ = entityTag
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
+ c.ctx_ = ctx
+ return c
+}
+
+// Header returns an http.Header that can be modified by the caller to
+// add HTTP headers to the request.
+func (c *NotificationsListCall) Header() http.Header {
+ if c.header_ == nil {
+ c.header_ = make(http.Header)
+ }
+ return c.header_
+}
+
+func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
+ reqHeaders := make(http.Header)
+ for k, v := range c.header_ {
+ reqHeaders[k] = v
+ }
+ reqHeaders.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ var body io.Reader = nil
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("GET", urls, body)
+ req.Header = reqHeaders
+ googleapi.Expand(req.URL, map[string]string{
+ "bucket": c.bucket,
+ })
+ return gensupport.SendRequest(c.ctx_, c.s.client, req)
+}
+
+// Do executes the "storage.notifications.list" call.
+// Exactly one of *Notifications or error will be non-nil. Any non-2xx
+// status code is an error. Response headers are in either
+// *Notifications.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 *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, 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, &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, err
+ }
+ ret := &Notifications{
+ ServerResponse: googleapi.ServerResponse{
+ Header: res.Header,
+ HTTPStatusCode: res.StatusCode,
+ },
+ }
+ target := &ret
+ if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ return nil, err
+ }
+ return ret, nil
+ // {
+ // "description": "Retrieves a list of notification subscriptions for a given bucket.",
+ // "httpMethod": "GET",
+ // "id": "storage.notifications.list",
+ // "parameterOrder": [
+ // "bucket"
+ // ],
+ // "parameters": {
+ // "bucket": {
+ // "description": "Name of a Google Cloud Storage bucket.",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "b/{bucket}/notificationConfigs",
+ // "response": {
+ // "$ref": "Notifications"
+ // },
+ // "scopes": [
+ // "https://www.googleapis.com/auth/cloud-platform",
+ // "https://www.googleapis.com/auth/cloud-platform.read-only",
+ // "https://www.googleapis.com/auth/devstorage.full_control",
+ // "https://www.googleapis.com/auth/devstorage.read_only",
+ // "https://www.googleapis.com/auth/devstorage.read_write"
+ // ]
+ // }
+
+}
+
// method id "storage.objectAccessControls.delete":
type ObjectAccessControlsDeleteCall struct {
@@ -5103,6 +6185,13 @@ func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAcc
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5193,6 +6282,11 @@ func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl/{entity}",
@@ -5235,6 +6329,13 @@ func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccess
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5363,6 +6464,11 @@ func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectA
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl/{entity}",
@@ -5406,6 +6512,13 @@ func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAcc
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5518,6 +6631,11 @@ func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*Obje
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl",
@@ -5563,6 +6681,13 @@ func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAcces
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5683,6 +6808,11 @@ func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*Object
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl",
@@ -5729,6 +6859,13 @@ func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAcce
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -5849,6 +6986,11 @@ func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*Objec
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl/{entity}",
@@ -5897,6 +7039,13 @@ func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAcc
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -6017,6 +7166,11 @@ func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*Obje
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/acl/{entity}",
@@ -6079,7 +7233,8 @@ func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl s
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the object's current
-// generation matches the given value.
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -6093,6 +7248,23 @@ func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64)
return c
}
+// KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
+// the Cloud KMS key, of the form
+// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
+// that will be used to encrypt the object. Overrides the object
+// metadata's kms_key_name value, if any.
+func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
+ c.urlParams_.Set("kmsKeyName", kmsKeyName)
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -6238,7 +7410,7 @@ func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -6248,6 +7420,16 @@ func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "format": "int64",
// "location": "query",
// "type": "string"
+ // },
+ // "kmsKeyName": {
+ // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ // "location": "query",
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{destinationBucket}/o/{destinationObject}/compose",
@@ -6317,7 +7499,8 @@ func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl stri
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the destination object's
-// current generation matches the given value.
+// current generation matches the given value. Setting to 0 makes the
+// operation succeed only if there are no live versions of the object.
func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -6326,7 +7509,9 @@ func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCop
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
// the destination object's current generation does not match the given
-// value.
+// value. If no live object exists, the precondition fails. Setting to 0
+// makes the operation succeed only if there is a live version of the
+// object.
func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -6352,7 +7537,7 @@ func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int6
// IfSourceGenerationMatch sets the optional parameter
// "ifSourceGenerationMatch": Makes the operation conditional on whether
-// the source object's generation matches the given value.
+// the source object's current generation matches the given value.
func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
return c
@@ -6360,8 +7545,8 @@ func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64)
// IfSourceGenerationNotMatch sets the optional parameter
// "ifSourceGenerationNotMatch": Makes the operation conditional on
-// whether the source object's generation does not match the given
-// value.
+// whether the source object's current generation does not match the
+// given value.
func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
return c
@@ -6405,6 +7590,13 @@ func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyC
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -6554,13 +7746,13 @@ func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -6578,13 +7770,13 @@ func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifSourceGenerationMatch": {
- // "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifSourceGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -6631,6 +7823,11 @@ func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
@@ -6682,7 +7879,8 @@ func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the object's current
-// generation matches the given value.
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -6690,7 +7888,9 @@ func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsD
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the object's current generation does not match the given value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -6713,6 +7913,13 @@ func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch in
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -6791,13 +7998,13 @@ func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -6819,6 +8026,11 @@ func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}",
@@ -6860,8 +8072,9 @@ func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
}
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
-// Makes the operation conditional on whether the object's generation
-// matches the given value.
+// Makes the operation conditional on whether the object's current
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -6869,7 +8082,9 @@ func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetC
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the object's generation does not match the given value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -6903,6 +8118,13 @@ func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -7035,13 +8257,13 @@ func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the object's generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -7076,6 +8298,11 @@ func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}",
@@ -7123,6 +8350,13 @@ func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPol
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -7243,6 +8477,11 @@ func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/iam",
@@ -7263,17 +8502,13 @@ func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// method id "storage.objects.insert":
type ObjectsInsertCall struct {
- s *Service
- bucket string
- object *Object
- urlParams_ gensupport.URLParams
- media_ io.Reader
- mediaBuffer_ *gensupport.MediaBuffer
- mediaType_ string
- mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
- progressUpdater_ googleapi.ProgressUpdater
- ctx_ context.Context
- header_ http.Header
+ s *Service
+ bucket string
+ object *Object
+ urlParams_ gensupport.URLParams
+ mediaInfo_ *gensupport.MediaInfo
+ ctx_ context.Context
+ header_ http.Header
}
// Insert: Stores a new object and metadata.
@@ -7297,7 +8532,8 @@ func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInse
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the object's current
-// generation matches the given value.
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -7305,7 +8541,9 @@ func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsI
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the object's current generation does not match the given value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -7328,6 +8566,16 @@ func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch in
return c
}
+// KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
+// the Cloud KMS key, of the form
+// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
+// that will be used to encrypt the object. Overrides the object
+// metadata's kms_key_name value, if any.
+func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
+ c.urlParams_.Set("kmsKeyName", kmsKeyName)
+ return c
+}
+
// Name sets the optional parameter "name": Name of the object. Required
// when the object metadata is not otherwise provided. Overrides the
// object metadata's name value, if any. For information about how to
@@ -7369,6 +8617,13 @@ func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Media specifies the media to upload in one or more chunks. The chunk
// size may be controlled by supplying a MediaOption generated by
// googleapi.ChunkSize. The chunk size defaults to
@@ -7381,12 +8636,7 @@ func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption)
if ct := c.object.ContentType; ct != "" {
options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
}
- opts := googleapi.ProcessMediaOptions(options)
- chunkSize := opts.ChunkSize
- if !opts.ForceEmptyContentType {
- r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
- }
- c.media_, c.mediaBuffer_ = gensupport.PrepareUpload(r, chunkSize)
+ c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
return c
}
@@ -7401,11 +8651,7 @@ func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption)
// supersede any context previously provided to the Context method.
func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
c.ctx_ = ctx
- rdr := gensupport.ReaderAtToReader(r, size)
- rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
- c.mediaBuffer_ = gensupport.NewMediaBuffer(rdr, googleapi.DefaultUploadChunkSize)
- c.media_ = nil
- c.mediaSize_ = size
+ c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
return c
}
@@ -7414,7 +8660,7 @@ func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, s
// not slow down the upload operation. This should only be called when
// using ResumableMedia (as opposed to Media).
func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
- c.progressUpdater_ = pu
+ c.mediaInfo_.SetProgressUpdater(pu)
return c
}
@@ -7459,27 +8705,16 @@ func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
- if c.media_ != nil || c.mediaBuffer_ != nil {
+ if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
- protocol := "multipart"
- if c.mediaBuffer_ != nil {
- protocol = "resumable"
- }
- c.urlParams_.Set("uploadType", protocol)
+ c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
body = new(bytes.Buffer)
reqHeaders.Set("Content-Type", "application/json")
}
- if c.media_ != nil {
- combined, ctype := gensupport.CombineBodyMedia(body, "application/json", c.media_, c.mediaType_)
- defer combined.Close()
- reqHeaders.Set("Content-Type", ctype)
- body = combined
- }
- if c.mediaBuffer_ != nil && c.mediaType_ != "" {
- reqHeaders.Set("X-Upload-Content-Type", c.mediaType_)
- }
+ body, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
+ defer cleanup()
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
@@ -7515,20 +8750,10 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
- if c.mediaBuffer_ != nil {
- loc := res.Header.Get("Location")
- rx := &gensupport.ResumableUpload{
- Client: c.s.client,
- UserAgent: c.s.userAgent(),
- URI: loc,
- Media: c.mediaBuffer_,
- MediaType: c.mediaType_,
- Callback: func(curr int64) {
- if c.progressUpdater_ != nil {
- c.progressUpdater_(curr, c.mediaSize_)
- }
- },
- }
+ rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
+ if rx != nil {
+ rx.Client = c.s.client
+ rx.UserAgent = c.s.userAgent()
ctx := c.ctx_
if ctx == nil {
ctx = context.TODO()
@@ -7588,13 +8813,13 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -7611,6 +8836,11 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "location": "query",
// "type": "string"
// },
+ // "kmsKeyName": {
+ // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ // "location": "query",
+ // "type": "string"
+ // },
// "name": {
// "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
// "location": "query",
@@ -7649,6 +8879,11 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o",
@@ -7735,6 +8970,13 @@ func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Versions sets the optional parameter "versions": If true, lists all
// versions of an object as distinct results. The default is false. For
// more information, see Object Versioning.
@@ -7886,6 +9128,11 @@ func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
// "location": "query",
// "type": "string"
// },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // },
// "versions": {
// "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
// "location": "query",
@@ -7961,7 +9208,8 @@ func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the object's current
-// generation matches the given value.
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -7969,7 +9217,9 @@ func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPa
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the object's current generation does not match the given value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -8023,6 +9273,13 @@ func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -8131,13 +9388,13 @@ func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -8193,6 +9450,11 @@ func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}",
@@ -8236,6 +9498,17 @@ func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, desti
return c
}
+// DestinationKmsKeyName sets the optional parameter
+// "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
+// form
+// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
+// that will be used to encrypt the object. Overrides the object
+// metadata's kms_key_name value, if any.
+func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
+ c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
+ return c
+}
+
// DestinationPredefinedAcl sets the optional parameter
// "destinationPredefinedAcl": Apply a predefined set of access controls
// to the destination object.
@@ -8258,8 +9531,9 @@ func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl s
}
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
-// Makes the operation conditional on whether the destination object's
-// current generation matches the given value.
+// Makes the operation conditional on whether the object's current
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -8267,8 +9541,9 @@ func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *Objects
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the destination object's current generation does not match the given
-// value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -8294,7 +9569,7 @@ func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch i
// IfSourceGenerationMatch sets the optional parameter
// "ifSourceGenerationMatch": Makes the operation conditional on whether
-// the source object's generation matches the given value.
+// the source object's current generation matches the given value.
func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
return c
@@ -8302,8 +9577,8 @@ func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int
// IfSourceGenerationNotMatch sets the optional parameter
// "ifSourceGenerationNotMatch": Makes the operation conditional on
-// whether the source object's generation does not match the given
-// value.
+// whether the source object's current generation does not match the
+// given value.
func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
return c
@@ -8372,6 +9647,13 @@ func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRe
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -8477,6 +9759,11 @@ func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse,
// "required": true,
// "type": "string"
// },
+ // "destinationKmsKeyName": {
+ // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
+ // "location": "query",
+ // "type": "string"
+ // },
// "destinationObject": {
// "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
// "location": "path",
@@ -8505,13 +9792,13 @@ func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse,
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -8529,13 +9816,13 @@ func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse,
// "type": "string"
// },
// "ifSourceGenerationMatch": {
- // "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifSourceGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -8593,6 +9880,11 @@ func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse,
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
@@ -8640,6 +9932,13 @@ func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPol
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -8752,6 +10051,11 @@ func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// "location": "path",
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/iam",
@@ -8800,6 +10104,13 @@ func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTes
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -8928,6 +10239,11 @@ func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestI
// "repeated": true,
// "required": true,
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}/iam/testPermissions",
@@ -8976,7 +10292,8 @@ func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
// IfGenerationMatch sets the optional parameter "ifGenerationMatch":
// Makes the operation conditional on whether the object's current
-// generation matches the given value.
+// generation matches the given value. Setting to 0 makes the operation
+// succeed only if there are no live versions of the object.
func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
return c
@@ -8984,7 +10301,9 @@ func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsU
// IfGenerationNotMatch sets the optional parameter
// "ifGenerationNotMatch": Makes the operation conditional on whether
-// the object's current generation does not match the given value.
+// the object's current generation does not match the given value. If no
+// live object exists, the precondition fails. Setting to 0 makes the
+// operation succeed only if there is a live version of the object.
func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
return c
@@ -9038,6 +10357,13 @@ func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
@@ -9162,13 +10488,13 @@ func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "type": "string"
// },
// "ifGenerationMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
// },
// "ifGenerationNotMatch": {
- // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
+ // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
// "format": "int64",
// "location": "query",
// "type": "string"
@@ -9224,6 +10550,11 @@ func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// ],
// "location": "query",
// "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
// }
// },
// "path": "b/{bucket}/o/{object}",
@@ -9309,6 +10640,13 @@ func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall
return c
}
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request. Required for Requester Pays buckets.
+func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
// Versions sets the optional parameter "versions": If true, lists all
// versions of an object as distinct results. The default is false. For
// more information, see Object Versioning.
@@ -9452,6 +10790,11 @@ func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error)
// "location": "query",
// "type": "string"
// },
+ // "userProject": {
+ // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
+ // "location": "query",
+ // "type": "string"
+ // },
// "versions": {
// "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
// "location": "query",
@@ -9477,3 +10820,157 @@ func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error)
// }
}
+
+// method id "storage.projects.serviceAccount.get":
+
+type ProjectsServiceAccountGetCall struct {
+ s *Service
+ projectId string
+ urlParams_ gensupport.URLParams
+ ifNoneMatch_ string
+ ctx_ context.Context
+ header_ http.Header
+}
+
+// Get: Get the email address of this project's Google Cloud Storage
+// service account.
+func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
+ c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ c.projectId = projectId
+ return c
+}
+
+// UserProject sets the optional parameter "userProject": The project to
+// be billed for this request.
+func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
+ c.urlParams_.Set("userProject", userProject)
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// IfNoneMatch sets the 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. Use googleapi.IsNotModified to check whether the response
+// error from Do is the result of In-None-Match.
+func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
+ c.ifNoneMatch_ = entityTag
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
+ c.ctx_ = ctx
+ return c
+}
+
+// Header returns an http.Header that can be modified by the caller to
+// add HTTP headers to the request.
+func (c *ProjectsServiceAccountGetCall) Header() http.Header {
+ if c.header_ == nil {
+ c.header_ = make(http.Header)
+ }
+ return c.header_
+}
+
+func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
+ reqHeaders := make(http.Header)
+ for k, v := range c.header_ {
+ reqHeaders[k] = v
+ }
+ reqHeaders.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ var body io.Reader = nil
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("GET", urls, body)
+ req.Header = reqHeaders
+ googleapi.Expand(req.URL, map[string]string{
+ "projectId": c.projectId,
+ })
+ return gensupport.SendRequest(c.ctx_, c.s.client, req)
+}
+
+// Do executes the "storage.projects.serviceAccount.get" call.
+// Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
+// status code is an error. Response headers are in either
+// *ServiceAccount.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 *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, 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, &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, err
+ }
+ ret := &ServiceAccount{
+ ServerResponse: googleapi.ServerResponse{
+ Header: res.Header,
+ HTTPStatusCode: res.StatusCode,
+ },
+ }
+ target := &ret
+ if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ return nil, err
+ }
+ return ret, nil
+ // {
+ // "description": "Get the email address of this project's Google Cloud Storage service account.",
+ // "httpMethod": "GET",
+ // "id": "storage.projects.serviceAccount.get",
+ // "parameterOrder": [
+ // "projectId"
+ // ],
+ // "parameters": {
+ // "projectId": {
+ // "description": "Project ID",
+ // "location": "path",
+ // "required": true,
+ // "type": "string"
+ // },
+ // "userProject": {
+ // "description": "The project to be billed for this request.",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "projects/{projectId}/serviceAccount",
+ // "response": {
+ // "$ref": "ServiceAccount"
+ // },
+ // "scopes": [
+ // "https://www.googleapis.com/auth/cloud-platform",
+ // "https://www.googleapis.com/auth/cloud-platform.read-only",
+ // "https://www.googleapis.com/auth/devstorage.full_control",
+ // "https://www.googleapis.com/auth/devstorage.read_only",
+ // "https://www.googleapis.com/auth/devstorage.read_write"
+ // ]
+ // }
+
+}
diff --git a/vendor/google.golang.org/api/transport/dial.go b/vendor/google.golang.org/api/transport/dial.go
index e1434ba..91d8325 100644
--- a/vendor/google.golang.org/api/transport/dial.go
+++ b/vendor/google.golang.org/api/transport/dial.go
@@ -18,184 +18,44 @@
package transport
import (
- "errors"
- "fmt"
- "io/ioutil"
"net/http"
"golang.org/x/net/context"
- "golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/grpc"
- "google.golang.org/grpc/credentials"
- "google.golang.org/grpc/credentials/oauth"
- gtransport "google.golang.org/api/googleapi/transport"
"google.golang.org/api/internal"
"google.golang.org/api/option"
+ gtransport "google.golang.org/api/transport/grpc"
+ htransport "google.golang.org/api/transport/http"
)
// NewHTTPClient returns an HTTP client for use communicating with a Google cloud
// service, configured with the given ClientOptions. It also returns the endpoint
// for the service as specified in the options.
func NewHTTPClient(ctx context.Context, opts ...option.ClientOption) (*http.Client, string, error) {
- var o internal.DialSettings
- for _, opt := range opts {
- opt.Apply(&o)
- }
- if o.GRPCConn != nil {
- return nil, "", errors.New("unsupported gRPC connection specified")
- }
- // TODO(cbro): consider injecting the User-Agent even if an explicit HTTP client is provided?
- if o.HTTPClient != nil {
- return o.HTTPClient, o.Endpoint, nil
- }
- if o.APIKey != "" {
- hc := &http.Client{
- Transport: &gtransport.APIKey{
- Key: o.APIKey,
- Transport: userAgentTransport{
- base: baseTransport(ctx),
- userAgent: o.UserAgent,
- },
- },
- }
- return hc, o.Endpoint, nil
- }
- if o.ServiceAccountJSONFilename != "" {
- ts, err := serviceAcctTokenSource(ctx, o.ServiceAccountJSONFilename, o.Scopes...)
- if err != nil {
- return nil, "", err
- }
- o.TokenSource = ts
- }
- if o.TokenSource == nil {
- var err error
- o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
- if err != nil {
- return nil, "", fmt.Errorf("google.DefaultTokenSource: %v", err)
- }
- }
- hc := &http.Client{
- Transport: &oauth2.Transport{
- Source: o.TokenSource,
- Base: userAgentTransport{
- base: baseTransport(ctx),
- userAgent: o.UserAgent,
- },
- },
- }
- return hc, o.Endpoint, nil
-}
-
-type userAgentTransport struct {
- userAgent string
- base http.RoundTripper
-}
-
-func (t userAgentTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- rt := t.base
- if rt == nil {
- return nil, errors.New("transport: no Transport specified")
- }
- if t.userAgent == "" {
- return rt.RoundTrip(req)
- }
- newReq := *req
- newReq.Header = make(http.Header)
- for k, vv := range req.Header {
- newReq.Header[k] = vv
- }
- // TODO(cbro): append to existing User-Agent header?
- newReq.Header["User-Agent"] = []string{t.userAgent}
- return rt.RoundTrip(&newReq)
-}
-
-// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
-var appengineDialerHook func(context.Context) grpc.DialOption
-var appengineUrlfetchHook func(context.Context) http.RoundTripper
-
-// baseTransport returns the base HTTP transport.
-// On App Engine, this is urlfetch.Transport, otherwise it's http.DefaultTransport.
-func baseTransport(ctx context.Context) http.RoundTripper {
- if appengineUrlfetchHook != nil {
- return appengineUrlfetchHook(ctx)
- }
- return http.DefaultTransport
+ return htransport.NewClient(ctx, opts...)
}
// DialGRPC returns a GRPC connection for use communicating with a Google cloud
// service, configured with the given ClientOptions.
func DialGRPC(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
- var o internal.DialSettings
- for _, opt := range opts {
- opt.Apply(&o)
- }
- if o.HTTPClient != nil {
- return nil, errors.New("unsupported HTTP client specified")
- }
- if o.GRPCConn != nil {
- return o.GRPCConn, nil
- }
- if o.ServiceAccountJSONFilename != "" {
- ts, err := serviceAcctTokenSource(ctx, o.ServiceAccountJSONFilename, o.Scopes...)
- if err != nil {
- return nil, err
- }
- o.TokenSource = ts
- }
- if o.TokenSource == nil {
- var err error
- o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
- if err != nil {
- return nil, fmt.Errorf("google.DefaultTokenSource: %v", err)
- }
- }
- grpcOpts := []grpc.DialOption{
- grpc.WithPerRPCCredentials(oauth.TokenSource{o.TokenSource}),
- grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
- }
- if appengineDialerHook != nil {
- // Use the Socket API on App Engine.
- grpcOpts = append(grpcOpts, appengineDialerHook(ctx))
- }
- grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
- if o.UserAgent != "" {
- grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
- }
- return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
-}
-
-func serviceAcctTokenSource(ctx context.Context, filename string, scope ...string) (oauth2.TokenSource, error) {
- data, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, fmt.Errorf("cannot read service account file: %v", err)
- }
- cfg, err := google.JWTConfigFromJSON(data, scope...)
- if err != nil {
- return nil, fmt.Errorf("google.JWTConfigFromJSON: %v", err)
- }
- return cfg.TokenSource(ctx), nil
+ return gtransport.Dial(ctx, opts...)
}
// DialGRPCInsecure returns an insecure GRPC connection for use communicating
// with fake or mock Google cloud service implementations, such as emulators.
// The connection is configured with the given ClientOptions.
func DialGRPCInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
- var o internal.DialSettings
+ return gtransport.DialInsecure(ctx, opts...)
+}
+
+// Creds constructs a google.DefaultCredentials from the information in the options,
+// or obtains the default credentials in the same way as google.FindDefaultCredentials.
+func Creds(ctx context.Context, opts ...option.ClientOption) (*google.DefaultCredentials, error) {
+ var ds internal.DialSettings
for _, opt := range opts {
- opt.Apply(&o)
- }
- if o.HTTPClient != nil {
- return nil, errors.New("unsupported HTTP client specified")
- }
- if o.GRPCConn != nil {
- return o.GRPCConn, nil
- }
- grpcOpts := []grpc.DialOption{grpc.WithInsecure()}
- grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
- if o.UserAgent != "" {
- grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
+ opt.Apply(&ds)
}
- return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
+ return internal.Creds(ctx, &ds)
}
diff --git a/vendor/google.golang.org/api/transport/grpc/dial.go b/vendor/google.golang.org/api/transport/grpc/dial.go
new file mode 100644
index 0000000..8a23bd3
--- /dev/null
+++ b/vendor/google.golang.org/api/transport/grpc/dial.go
@@ -0,0 +1,86 @@
+// Copyright 2015 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package transport/grpc supports network connections to GRPC servers.
+// This package is not intended for use by end developers. Use the
+// google.golang.org/api/option package to configure API clients.
+package grpc
+
+import (
+ "errors"
+
+ "golang.org/x/net/context"
+ "google.golang.org/api/internal"
+ "google.golang.org/api/option"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials"
+ "google.golang.org/grpc/credentials/oauth"
+)
+
+// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
+var appengineDialerHook func(context.Context) grpc.DialOption
+
+// Dial returns a GRPC connection for use communicating with a Google cloud
+// service, configured with the given ClientOptions.
+func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
+ var o internal.DialSettings
+ for _, opt := range opts {
+ opt.Apply(&o)
+ }
+ if o.HTTPClient != nil {
+ return nil, errors.New("unsupported HTTP client specified")
+ }
+ if o.GRPCConn != nil {
+ return o.GRPCConn, nil
+ }
+ creds, err := internal.Creds(ctx, &o)
+ if err != nil {
+ return nil, err
+ }
+ grpcOpts := []grpc.DialOption{
+ grpc.WithPerRPCCredentials(oauth.TokenSource{creds.TokenSource}),
+ grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
+ }
+ if appengineDialerHook != nil {
+ // Use the Socket API on App Engine.
+ grpcOpts = append(grpcOpts, appengineDialerHook(ctx))
+ }
+ grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
+ if o.UserAgent != "" {
+ grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
+ }
+ return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
+}
+
+// DialInsecure returns an insecure GRPC connection for use communicating
+// with fake or mock Google cloud service implementations, such as emulators.
+// The connection is configured with the given ClientOptions.
+func DialInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
+ var o internal.DialSettings
+ for _, opt := range opts {
+ opt.Apply(&o)
+ }
+ if o.HTTPClient != nil {
+ return nil, errors.New("unsupported HTTP client specified")
+ }
+ if o.GRPCConn != nil {
+ return o.GRPCConn, nil
+ }
+ grpcOpts := []grpc.DialOption{grpc.WithInsecure()}
+ grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
+ if o.UserAgent != "" {
+ grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
+ }
+ return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
+}
diff --git a/vendor/google.golang.org/api/transport/http/dial.go b/vendor/google.golang.org/api/transport/http/dial.go
new file mode 100644
index 0000000..a04956d
--- /dev/null
+++ b/vendor/google.golang.org/api/transport/http/dial.go
@@ -0,0 +1,107 @@
+// Copyright 2015 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package transport/http supports network connections to HTTP servers.
+// This package is not intended for use by end developers. Use the
+// google.golang.org/api/option package to configure API clients.
+package http
+
+import (
+ "errors"
+ "net/http"
+
+ "golang.org/x/net/context"
+ "golang.org/x/oauth2"
+ "google.golang.org/api/googleapi/transport"
+ "google.golang.org/api/internal"
+ "google.golang.org/api/option"
+)
+
+// NewClient returns an HTTP client for use communicating with a Google cloud
+// service, configured with the given ClientOptions. It also returns the endpoint
+// for the service as specified in the options.
+func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client, string, error) {
+ var o internal.DialSettings
+ for _, opt := range opts {
+ opt.Apply(&o)
+ }
+ if o.GRPCConn != nil {
+ return nil, "", errors.New("unsupported gRPC connection specified")
+ }
+ // TODO(cbro): consider injecting the User-Agent even if an explicit HTTP client is provided?
+ if o.HTTPClient != nil {
+ return o.HTTPClient, o.Endpoint, nil
+ }
+ if o.APIKey != "" {
+ hc := &http.Client{
+ Transport: &transport.APIKey{
+ Key: o.APIKey,
+ Transport: userAgentTransport{
+ base: baseTransport(ctx),
+ userAgent: o.UserAgent,
+ },
+ },
+ }
+ return hc, o.Endpoint, nil
+ }
+ creds, err := internal.Creds(ctx, &o)
+ if err != nil {
+ return nil, "", err
+ }
+ hc := &http.Client{
+ Transport: &oauth2.Transport{
+ Source: creds.TokenSource,
+ Base: userAgentTransport{
+ base: baseTransport(ctx),
+ userAgent: o.UserAgent,
+ },
+ },
+ }
+ return hc, o.Endpoint, nil
+}
+
+type userAgentTransport struct {
+ userAgent string
+ base http.RoundTripper
+}
+
+func (t userAgentTransport) RoundTrip(req *http.Request) (*http.Response, error) {
+ rt := t.base
+ if rt == nil {
+ return nil, errors.New("transport: no Transport specified")
+ }
+ if t.userAgent == "" {
+ return rt.RoundTrip(req)
+ }
+ newReq := *req
+ newReq.Header = make(http.Header)
+ for k, vv := range req.Header {
+ newReq.Header[k] = vv
+ }
+ // TODO(cbro): append to existing User-Agent header?
+ newReq.Header["User-Agent"] = []string{t.userAgent}
+ return rt.RoundTrip(&newReq)
+}
+
+// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
+var appengineUrlfetchHook func(context.Context) http.RoundTripper
+
+// baseTransport returns the base HTTP transport.
+// On App Engine, this is urlfetch.Transport, otherwise it's http.DefaultTransport.
+func baseTransport(ctx context.Context) http.RoundTripper {
+ if appengineUrlfetchHook != nil {
+ return appengineUrlfetchHook(ctx)
+ }
+ return http.DefaultTransport
+}