diff --git a/google/import_storage_bucket_test.go b/google/import_storage_bucket_test.go deleted file mode 100644 index 88507f23680..00000000000 --- a/google/import_storage_bucket_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package google - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccStorageBucket_import(t *testing.T) { - t.Parallel() - - bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccStorageBucketDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccStorageBucket_basic(bucketName), - }, - resource.TestStep{ - ResourceName: "google_storage_bucket.bucket", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, - }, - }, - }) -} diff --git a/google/resource_storage_bucket.go b/google/resource_storage_bucket.go index 46780f97298..064388176a7 100644 --- a/google/resource_storage_bucket.go +++ b/google/resource_storage_bucket.go @@ -389,6 +389,7 @@ func resourceStorageBucketRead(d *schema.ResourceData, meta interface{}) error { d.Set("location", res.Location) d.Set("cors", flattenCors(res.Cors)) d.Set("versioning", flattenBucketVersioning(res.Versioning)) + d.Set("lifecycle_rule", flattenBucketLifecycle(res.Lifecycle)) d.Set("labels", res.Labels) d.Set("project", project) d.SetId(res.Id) @@ -514,6 +515,40 @@ func flattenBucketVersioning(bucketVersioning *storage.BucketVersioning) []map[s return versionings } +func flattenBucketLifecycle(lifecycle *storage.BucketLifecycle) []map[string]interface{} { + if lifecycle == nil || lifecycle.Rule == nil { + return []map[string]interface{}{} + } + + rules := make([]map[string]interface{}, 0, len(lifecycle.Rule)) + + for _, rule := range lifecycle.Rule { + rules = append(rules, map[string]interface{}{ + "action": schema.NewSet(resourceGCSBucketLifecycleRuleActionHash, []interface{}{flattenBucketLifecycleRuleAction(rule.Action)}), + "condition": schema.NewSet(resourceGCSBucketLifecycleRuleConditionHash, []interface{}{flattenBucketLifecycleRuleCondition(rule.Condition)}), + }) + } + + return rules +} + +func flattenBucketLifecycleRuleAction(action *storage.BucketLifecycleRuleAction) map[string]interface{} { + return map[string]interface{}{ + "type": action.Type, + "storage_class": action.StorageClass, + } +} + +func flattenBucketLifecycleRuleCondition(condition *storage.BucketLifecycleRuleCondition) map[string]interface{} { + return map[string]interface{}{ + "age": int(condition.Age), + "created_before": condition.CreatedBefore, + "is_live": *condition.IsLive, + "matches_storage_class": convertStringArrToInterface(condition.MatchesStorageClass), + "num_newer_versions": int(condition.NumNewerVersions), + } +} + func resourceGCSBucketLifecycleCreateOrUpdate(d *schema.ResourceData, sb *storage.Bucket) error { if v, ok := d.GetOk("lifecycle_rule"); ok { lifecycle_rules := v.([]interface{}) @@ -584,6 +619,10 @@ func resourceGCSBucketLifecycleCreateOrUpdate(d *schema.ResourceData, sb *storag sb.Lifecycle.Rule = append(sb.Lifecycle.Rule, target_lifecycle_rule) } + } else { + sb.Lifecycle = &storage.BucketLifecycle{ + ForceSendFields: []string{"Rule"}, + } } return nil diff --git a/google/resource_storage_bucket_test.go b/google/resource_storage_bucket_test.go index 14eae4d96c8..7fc0e8fc5d8 100644 --- a/google/resource_storage_bucket_test.go +++ b/google/resource_storage_bucket_test.go @@ -36,6 +36,12 @@ func TestAccStorageBucket_basic(t *testing.T) { "google_storage_bucket.bucket", "force_destroy", "false"), ), }, + resource.TestStep{ + ResourceName: "google_storage_bucket.bucket", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"force_destroy"}, + }, }, }) } @@ -132,6 +138,12 @@ func TestAccStorageBucket_lifecycleRules(t *testing.T) { "google_storage_bucket.bucket", fmt.Sprintf("lifecycle_rule.1.condition.%d.age", hash_step0_lc1_condition), "10"), ), }, + resource.TestStep{ + ResourceName: "google_storage_bucket.bucket", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"force_destroy"}, + }, }, }) } @@ -176,6 +188,12 @@ func TestAccStorageBucket_storageClass(t *testing.T) { "google_storage_bucket.bucket", "location", "US-CENTRAL1"), ), }, + { + ResourceName: "google_storage_bucket.bucket", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"force_destroy"}, + }, }, }) } @@ -209,8 +227,6 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", "location", "US"), resource.TestCheckResourceAttr( "google_storage_bucket.bucket", "force_destroy", "false"), - resource.TestCheckNoResourceAttr( - "google_storage_bucket.bucket", "lifecycle_rule.#"), ), }, resource.TestStep{ @@ -222,8 +238,6 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", "location", "EU"), resource.TestCheckResourceAttr( "google_storage_bucket.bucket", "force_destroy", "true"), - resource.TestCheckNoResourceAttr( - "google_storage_bucket.bucket", "lifecycle_rule.#"), ), }, resource.TestStep{ @@ -353,6 +367,12 @@ func TestAccStorageBucket_versioning(t *testing.T) { "google_storage_bucket.bucket", "versioning.0.enabled", "true"), ), }, + resource.TestStep{ + ResourceName: "google_storage_bucket.bucket", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"force_destroy"}, + }, }, }) } 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 f49c93f7857..599f742f76a 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": "\"YWOzh2SDasdU84ArJnpYek-OMdg/akxawO6Ey81E_n6KZZ_RFctOG6Q\"", + "etag": "\"YWOzh2SDasdU84ArJnpYek-OMdg/INmkTh2mO0thq3Agrhx1mHd0DoE\"", "discoveryVersion": "v1", "id": "storage:v1", "name": "storage", "version": "v1", - "revision": "20171011", + "revision": "20171018", "title": "Cloud Storage JSON API", "description": "Stores and retrieves potentially large, immutable data objects.", "ownerDomain": "google.com", @@ -2583,9 +2583,7 @@ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" - ], - "supportsMediaDownload": true, - "useMediaDownloadService": true + ] }, "copy": { "id": "storage.objects.copy", @@ -2727,9 +2725,7 @@ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" - ], - "supportsMediaDownload": true, - "useMediaDownloadService": true + ] }, "delete": { "id": "storage.objects.delete", @@ -3029,8 +3025,6 @@ "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ], - "supportsMediaDownload": true, - "useMediaDownloadService": true, "supportsMediaUpload": true, "mediaUpload": { "accept": [ @@ -3126,7 +3120,7 @@ "id": "storage.objects.patch", "path": "b/{bucket}/o/{object}", "httpMethod": "PATCH", - "description": "Updates an object's metadata. This method supports patch semantics.", + "description": "Patches an object's metadata.", "parameters": { "bucket": { "type": "string", @@ -3206,7 +3200,7 @@ }, "userProject": { "type": "string", - "description": "The project to be billed for this request. Required for Requester Pays buckets.", + "description": "The project to be billed for this request, for Requester Pays buckets.", "location": "query" } }, @@ -3583,9 +3577,7 @@ "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" - ], - "supportsMediaDownload": true, - "useMediaDownloadService": true + ] }, "watchAll": { "id": "storage.objects.watchAll", 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 62a627594c2..bdba5f3021a 100644 --- a/vendor/google.golang.org/api/storage/v1/storage-gen.go +++ b/vendor/google.golang.org/api/storage/v1/storage-gen.go @@ -302,8 +302,8 @@ type Bucket struct { } func (s *Bucket) MarshalJSON() ([]byte, error) { - type noMethod Bucket - raw := noMethod(*s) + type NoMethod Bucket + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -330,8 +330,8 @@ type BucketBilling struct { } func (s *BucketBilling) MarshalJSON() ([]byte, error) { - type noMethod BucketBilling - raw := noMethod(*s) + type NoMethod BucketBilling + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -373,8 +373,8 @@ type BucketCors struct { } func (s *BucketCors) MarshalJSON() ([]byte, error) { - type noMethod BucketCors - raw := noMethod(*s) + type NoMethod BucketCors + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -402,8 +402,8 @@ type BucketEncryption struct { } func (s *BucketEncryption) MarshalJSON() ([]byte, error) { - type noMethod BucketEncryption - raw := noMethod(*s) + type NoMethod BucketEncryption + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -432,8 +432,8 @@ type BucketLifecycle struct { } func (s *BucketLifecycle) MarshalJSON() ([]byte, error) { - type noMethod BucketLifecycle - raw := noMethod(*s) + type NoMethod BucketLifecycle + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -462,8 +462,8 @@ type BucketLifecycleRule struct { } func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) { - type noMethod BucketLifecycleRule - raw := noMethod(*s) + type NoMethod BucketLifecycleRule + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -495,8 +495,8 @@ type BucketLifecycleRuleAction struct { } func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) { - type noMethod BucketLifecycleRuleAction - raw := noMethod(*s) + type NoMethod BucketLifecycleRuleAction + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -546,8 +546,8 @@ type BucketLifecycleRuleCondition struct { } func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) { - type noMethod BucketLifecycleRuleCondition - raw := noMethod(*s) + type NoMethod BucketLifecycleRuleCondition + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -580,8 +580,8 @@ type BucketLogging struct { } func (s *BucketLogging) MarshalJSON() ([]byte, error) { - type noMethod BucketLogging - raw := noMethod(*s) + type NoMethod BucketLogging + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -612,8 +612,8 @@ type BucketOwner struct { } func (s *BucketOwner) MarshalJSON() ([]byte, error) { - type noMethod BucketOwner - raw := noMethod(*s) + type NoMethod BucketOwner + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -641,8 +641,8 @@ type BucketVersioning struct { } func (s *BucketVersioning) MarshalJSON() ([]byte, error) { - type noMethod BucketVersioning - raw := noMethod(*s) + type NoMethod BucketVersioning + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -681,8 +681,8 @@ type BucketWebsite struct { } func (s *BucketWebsite) MarshalJSON() ([]byte, error) { - type noMethod BucketWebsite - raw := noMethod(*s) + type NoMethod BucketWebsite + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -758,8 +758,8 @@ type BucketAccessControl struct { } func (s *BucketAccessControl) MarshalJSON() ([]byte, error) { - type noMethod BucketAccessControl - raw := noMethod(*s) + type NoMethod BucketAccessControl + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -790,8 +790,8 @@ type BucketAccessControlProjectTeam struct { } func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) { - type noMethod BucketAccessControlProjectTeam - raw := noMethod(*s) + type NoMethod BucketAccessControlProjectTeam + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -826,8 +826,8 @@ type BucketAccessControls struct { } func (s *BucketAccessControls) MarshalJSON() ([]byte, error) { - type noMethod BucketAccessControls - raw := noMethod(*s) + type NoMethod BucketAccessControls + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -867,8 +867,8 @@ type Buckets struct { } func (s *Buckets) MarshalJSON() ([]byte, error) { - type noMethod Buckets - raw := noMethod(*s) + type NoMethod Buckets + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -933,8 +933,8 @@ type Channel struct { } func (s *Channel) MarshalJSON() ([]byte, error) { - type noMethod Channel - raw := noMethod(*s) + type NoMethod Channel + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -968,8 +968,8 @@ type ComposeRequest struct { } func (s *ComposeRequest) MarshalJSON() ([]byte, error) { - type noMethod ComposeRequest - raw := noMethod(*s) + type NoMethod ComposeRequest + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1003,8 +1003,8 @@ type ComposeRequestSourceObjects struct { } func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) { - type noMethod ComposeRequestSourceObjects - raw := noMethod(*s) + type NoMethod ComposeRequestSourceObjects + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1036,8 +1036,8 @@ type ComposeRequestSourceObjectsObjectPreconditions struct { } func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) { - type noMethod ComposeRequestSourceObjectsObjectPreconditions - raw := noMethod(*s) + type NoMethod ComposeRequestSourceObjectsObjectPreconditions + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1101,8 +1101,8 @@ type Notification struct { } func (s *Notification) MarshalJSON() ([]byte, error) { - type noMethod Notification - raw := noMethod(*s) + type NoMethod Notification + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1137,8 +1137,8 @@ type Notifications struct { } func (s *Notifications) MarshalJSON() ([]byte, error) { - type noMethod Notifications - raw := noMethod(*s) + type NoMethod Notifications + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1274,8 +1274,8 @@ type Object struct { } func (s *Object) MarshalJSON() ([]byte, error) { - type noMethod Object - raw := noMethod(*s) + type NoMethod Object + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1307,8 +1307,8 @@ type ObjectCustomerEncryption struct { } func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) { - type noMethod ObjectCustomerEncryption - raw := noMethod(*s) + type NoMethod ObjectCustomerEncryption + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1339,8 +1339,8 @@ type ObjectOwner struct { } func (s *ObjectOwner) MarshalJSON() ([]byte, error) { - type noMethod ObjectOwner - raw := noMethod(*s) + type NoMethod ObjectOwner + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1423,8 +1423,8 @@ type ObjectAccessControl struct { } func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) { - type noMethod ObjectAccessControl - raw := noMethod(*s) + type NoMethod ObjectAccessControl + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1455,8 +1455,8 @@ type ObjectAccessControlProjectTeam struct { } func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) { - type noMethod ObjectAccessControlProjectTeam - raw := noMethod(*s) + type NoMethod ObjectAccessControlProjectTeam + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1491,8 +1491,8 @@ type ObjectAccessControls struct { } func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) { - type noMethod ObjectAccessControls - raw := noMethod(*s) + type NoMethod ObjectAccessControls + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1536,8 +1536,8 @@ type Objects struct { } func (s *Objects) MarshalJSON() ([]byte, error) { - type noMethod Objects - raw := noMethod(*s) + type NoMethod Objects + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1585,8 +1585,8 @@ type Policy struct { } func (s *Policy) MarshalJSON() ([]byte, error) { - type noMethod Policy - raw := noMethod(*s) + type NoMethod Policy + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1668,8 +1668,8 @@ type PolicyBindings struct { } func (s *PolicyBindings) MarshalJSON() ([]byte, error) { - type noMethod PolicyBindings - raw := noMethod(*s) + type NoMethod PolicyBindings + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1723,8 +1723,8 @@ type RewriteResponse struct { } func (s *RewriteResponse) MarshalJSON() ([]byte, error) { - type noMethod RewriteResponse - raw := noMethod(*s) + type NoMethod RewriteResponse + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1760,8 +1760,8 @@ type ServiceAccount struct { } func (s *ServiceAccount) MarshalJSON() ([]byte, error) { - type noMethod ServiceAccount - raw := noMethod(*s) + type NoMethod ServiceAccount + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -1813,8 +1813,8 @@ type TestIamPermissionsResponse struct { } func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { - type noMethod TestIamPermissionsResponse - raw := noMethod(*s) + type NoMethod TestIamPermissionsResponse + raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } @@ -2055,7 +2055,7 @@ func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketA }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -2205,7 +2205,7 @@ func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*Buck }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -2358,7 +2358,7 @@ func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*Bucket }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -2505,7 +2505,7 @@ func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*Bucke }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -2661,7 +2661,7 @@ func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*Buck }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -2987,7 +2987,7 @@ func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -3165,7 +3165,7 @@ func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -3359,7 +3359,7 @@ func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -3596,7 +3596,7 @@ func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -3864,7 +3864,7 @@ func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -4075,7 +4075,7 @@ func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -4231,7 +4231,7 @@ func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestI }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -4455,7 +4455,7 @@ func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -4890,7 +4890,7 @@ func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (* }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5041,7 +5041,7 @@ func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5211,7 +5211,7 @@ func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) ( }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5370,7 +5370,7 @@ func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5526,7 +5526,7 @@ func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5808,7 +5808,7 @@ func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -5961,7 +5961,7 @@ func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notificatio }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -6116,7 +6116,7 @@ func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -6427,7 +6427,7 @@ func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectA }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -6601,7 +6601,7 @@ func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*Obje }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -6778,7 +6778,7 @@ func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*Object }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -6949,7 +6949,7 @@ func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*Objec }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -7129,7 +7129,7 @@ func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*Obje }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -7273,9 +7273,9 @@ func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall { return c } -// Context sets the context to be used in this call's Do and Download -// methods. Any pending HTTP request will be aborted if the provided -// context is canceled. +// 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 *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall { c.ctx_ = ctx return c @@ -7314,22 +7314,6 @@ func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) { return gensupport.SendRequest(c.ctx_, c.s.client, req) } -// Download fetches the API endpoint's "media" value, instead of the normal -// API response value. If the returned error is nil, the Response is guaranteed to -// have a 2xx status code. Callers must close the Response.Body as usual. -func (c *ObjectsComposeCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { - gensupport.SetOptions(c.urlParams_, opts...) - res, err := c.doRequest("media") - if err != nil { - return nil, err - } - if err := googleapi.CheckMediaResponse(res); err != nil { - res.Body.Close() - return nil, err - } - return res, nil -} - // Do executes the "storage.objects.compose" call. // Exactly one of *Object or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either @@ -7363,7 +7347,7 @@ func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -7443,9 +7427,7 @@ func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "https://www.googleapis.com/auth/cloud-platform", // "https://www.googleapis.com/auth/devstorage.full_control", // "https://www.googleapis.com/auth/devstorage.read_write" - // ], - // "supportsMediaDownload": true, - // "useMediaDownloadService": true + // ] // } } @@ -7605,9 +7587,9 @@ func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall { return c } -// Context sets the context to be used in this call's Do and Download -// methods. Any pending HTTP request will be aborted if the provided -// context is canceled. +// 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 *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall { c.ctx_ = ctx return c @@ -7648,22 +7630,6 @@ func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) { return gensupport.SendRequest(c.ctx_, c.s.client, req) } -// Download fetches the API endpoint's "media" value, instead of the normal -// API response value. If the returned error is nil, the Response is guaranteed to -// have a 2xx status code. Callers must close the Response.Body as usual. -func (c *ObjectsCopyCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { - gensupport.SetOptions(c.urlParams_, opts...) - res, err := c.doRequest("media") - if err != nil { - return nil, err - } - if err := googleapi.CheckMediaResponse(res); err != nil { - res.Body.Close() - return nil, err - } - return res, nil -} - // Do executes the "storage.objects.copy" call. // Exactly one of *Object or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either @@ -7697,7 +7663,7 @@ func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -7841,9 +7807,7 @@ func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "https://www.googleapis.com/auth/cloud-platform", // "https://www.googleapis.com/auth/devstorage.full_control", // "https://www.googleapis.com/auth/devstorage.read_write" - // ], - // "supportsMediaDownload": true, - // "useMediaDownloadService": true + // ] // } } @@ -8231,7 +8195,7 @@ func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -8447,7 +8411,7 @@ func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -8774,7 +8738,7 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -8898,9 +8862,7 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "https://www.googleapis.com/auth/devstorage.full_control", // "https://www.googleapis.com/auth/devstorage.read_write" // ], - // "supportsMediaDownload": true, - // "supportsMediaUpload": true, - // "useMediaDownloadService": true + // "supportsMediaUpload": true // } } @@ -9074,7 +9036,7 @@ func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -9188,8 +9150,7 @@ type ObjectsPatchCall struct { header_ http.Header } -// Patch: Updates an object's metadata. This method supports patch -// semantics. +// Patch: Patches an object's metadata. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall { c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.bucket = bucket @@ -9274,7 +9235,7 @@ func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall { } // UserProject sets the optional parameter "userProject": The project to -// be billed for this request. Required for Requester Pays buckets. +// be billed for this request, for Requester Pays buckets. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall { c.urlParams_.Set("userProject", userProject) return c @@ -9362,12 +9323,12 @@ func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { - // "description": "Updates an object's metadata. This method supports patch semantics.", + // "description": "Patches an object's metadata.", // "httpMethod": "PATCH", // "id": "storage.objects.patch", // "parameterOrder": [ @@ -9452,7 +9413,7 @@ func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "type": "string" // }, // "userProject": { - // "description": "The project to be billed for this request. Required for Requester Pays buckets.", + // "description": "The project to be billed for this request, for Requester Pays buckets.", // "location": "query", // "type": "string" // } @@ -9738,7 +9699,7 @@ func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -10021,7 +9982,7 @@ func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -10201,7 +10162,7 @@ func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestI }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -10372,9 +10333,9 @@ func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall { return c } -// Context sets the context to be used in this call's Do and Download -// methods. Any pending HTTP request will be aborted if the provided -// context is canceled. +// 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 *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall { c.ctx_ = ctx return c @@ -10413,22 +10374,6 @@ func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) { return gensupport.SendRequest(c.ctx_, c.s.client, req) } -// Download fetches the API endpoint's "media" value, instead of the normal -// API response value. If the returned error is nil, the Response is guaranteed to -// have a 2xx status code. Callers must close the Response.Body as usual. -func (c *ObjectsUpdateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { - gensupport.SetOptions(c.urlParams_, opts...) - res, err := c.doRequest("media") - if err != nil { - return nil, err - } - if err := googleapi.CheckMediaResponse(res); err != nil { - res.Body.Close() - return nil, err - } - return res, nil -} - // Do executes the "storage.objects.update" call. // Exactly one of *Object or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either @@ -10462,7 +10407,7 @@ func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) { }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -10567,9 +10512,7 @@ func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform", // "https://www.googleapis.com/auth/devstorage.full_control" - // ], - // "supportsMediaDownload": true, - // "useMediaDownloadService": true + // ] // } } @@ -10736,7 +10679,7 @@ func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil @@ -10936,7 +10879,7 @@ func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*Servi }, } target := &ret - if err := json.NewDecoder(res.Body).Decode(target); err != nil { + if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil diff --git a/vendor/vendor.json b/vendor/vendor.json index 7ed952f9ab9..c8131ca8338 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1181,10 +1181,10 @@ "revisionTime": "2016-11-27T23:54:21Z" }, { - "checksumSHA1": "Zd7ojgrWPn3j7fLx9HB6/Oub8lE=", + "checksumSHA1": "siiajn/OUThTz+jYlTMXS1ji6MA=", "path": "google.golang.org/api/storage/v1", - "revision": "672d215daf0631fcae4c08c2a4324a763aaaf789", - "revisionTime": "2017-10-29T00:03:09Z" + "revision": "916b9a3f1bca39e28e0bfae24d74a22ab6d6c036", + "revisionTime": "2017-12-12T00:04:04Z" }, { "checksumSHA1": "W24V3U8s386thzZOK6g+EjlKeu0=",