From 1a0720f2f33bb14617f5c6a524946a93209e1266 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 2 Oct 2021 13:52:28 -0700 Subject: [PATCH] chore(all): auto-regenerate gapics (#4934) This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/690 Changes: feat(security/privateca): add IAMPolicy & Locations mix-in support PiperOrigin-RevId: 400044694 Source-Link: https://github.com/googleapis/googleapis/commit/af7fb72df59a814221b123a4d1acb3f6c3e6cc95 feat(contactcenterinsights): deprecate issue_matches docs: if conversation medium is unspecified, it will default to PHONE_CALL PiperOrigin-RevId: 400004079 Source-Link: https://github.com/googleapis/googleapis/commit/e202ad333102f9daa81f18a2169a926b81f645cd feat(kms): add RPC retry information for MacSign, MacVerify, and GenerateRandomBytes Committer: @bdhess PiperOrigin-RevId: 399925901 Source-Link: https://github.com/googleapis/googleapis/commit/ae7e399135b2bc16e1f1f47edb270db2cdf98bd8 --- contactcenterinsights/apiv1/doc.go | 2 +- contactcenterinsights/go.mod | 2 +- contactcenterinsights/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- .../CreateBackup/main.go | 53 +++++ .../CreateInstance/main.go | 53 +++++ .../DeleteBackup/main.go | 51 +++++ .../DeleteInstance/main.go | 51 +++++ .../GetBackup/main.go | 48 ++++ .../GetInstance/main.go | 48 ++++ .../ListBackups/main.go | 55 +++++ .../ListInstances/main.go | 55 +++++ .../RestoreInstance/main.go | 53 +++++ .../UpdateBackup/main.go | 53 +++++ .../UpdateInstance/main.go | 53 +++++ internal/generated/snippets/go.mod | 7 +- internal/generated/snippets/go.sum | 3 +- .../GetIamPolicy/main.go | 48 ++++ .../GetLocation/main.go | 48 ++++ .../ListLocations/main.go | 55 +++++ .../SetIamPolicy/main.go | 48 ++++ .../TestIamPermissions/main.go | 48 ++++ internal/godocfx/go.sum | 4 +- kms/apiv1/doc.go | 2 +- kms/apiv1/key_management_client.go | 60 ++++- kms/go.mod | 2 +- kms/go.sum | 4 +- security/go.mod | 6 +- security/go.sum | 19 +- .../apiv1/certificate_authority_client.go | 209 ++++++++++++++++++ ...rtificate_authority_client_example_test.go | 108 +++++++++ security/privateca/apiv1/doc.go | 2 +- security/privateca/apiv1/gapic_metadata.json | 25 +++ 34 files changed, 1251 insertions(+), 34 deletions(-) create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateBackup/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateInstance/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteBackup/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteInstance/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetBackup/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetInstance/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListBackups/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListInstances/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/RestoreInstance/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateBackup/main.go create mode 100644 internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateInstance/main.go create mode 100644 internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetLocation/main.go create mode 100644 internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/ListLocations/main.go create mode 100644 internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/TestIamPermissions/main.go diff --git a/contactcenterinsights/apiv1/doc.go b/contactcenterinsights/apiv1/doc.go index cfa273256f0..5ffc47fde48 100644 --- a/contactcenterinsights/apiv1/doc.go +++ b/contactcenterinsights/apiv1/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210929" +const versionClient = "20211001" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/contactcenterinsights/go.mod b/contactcenterinsights/go.mod index 11c17f2c1c7..130389bb2b8 100644 --- a/contactcenterinsights/go.mod +++ b/contactcenterinsights/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.94.1 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 + google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/contactcenterinsights/go.sum b/contactcenterinsights/go.sum index 66dde77ba42..07c24590922 100644 --- a/contactcenterinsights/go.sum +++ b/contactcenterinsights/go.sum @@ -488,8 +488,8 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/go.mod b/go.mod index 02f61d184e8..2d1c2ec3fed 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 + google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 7542c93fbb4..b5dc9194c11 100644 --- a/go.sum +++ b/go.sum @@ -491,8 +491,8 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateBackup/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateBackup/main.go new file mode 100644 index 00000000000..6bcbf6d24e7 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateBackup/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_CreateBackup_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.CreateBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#CreateBackupRequest. + } + op, err := c.CreateBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_CreateBackup_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateInstance/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateInstance/main.go new file mode 100644 index 00000000000..2ec82e79bf9 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/CreateInstance/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_CreateInstance_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.CreateInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#CreateInstanceRequest. + } + op, err := c.CreateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_CreateInstance_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteBackup/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteBackup/main.go new file mode 100644 index 00000000000..20e7f4d51e9 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteBackup/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_DeleteBackup_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.DeleteBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#DeleteBackupRequest. + } + op, err := c.DeleteBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END file_v1_generated_CloudFilestoreManager_DeleteBackup_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteInstance/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteInstance/main.go new file mode 100644 index 00000000000..ee84ee97957 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/DeleteInstance/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_DeleteInstance_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.DeleteInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#DeleteInstanceRequest. + } + op, err := c.DeleteInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END file_v1_generated_CloudFilestoreManager_DeleteInstance_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetBackup/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetBackup/main.go new file mode 100644 index 00000000000..87dbbb9d1d8 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetBackup/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_GetBackup_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.GetBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#GetBackupRequest. + } + resp, err := c.GetBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_GetBackup_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetInstance/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetInstance/main.go new file mode 100644 index 00000000000..ff3042ea6f6 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/GetInstance/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_GetInstance_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.GetInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#GetInstanceRequest. + } + resp, err := c.GetInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_GetInstance_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListBackups/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListBackups/main.go new file mode 100644 index 00000000000..261e04c404c --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListBackups/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_ListBackups_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + "google.golang.org/api/iterator" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.ListBackupsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#ListBackupsRequest. + } + it := c.ListBackups(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END file_v1_generated_CloudFilestoreManager_ListBackups_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListInstances/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListInstances/main.go new file mode 100644 index 00000000000..bedd0c85432 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/ListInstances/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_ListInstances_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + "google.golang.org/api/iterator" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.ListInstancesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#ListInstancesRequest. + } + it := c.ListInstances(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END file_v1_generated_CloudFilestoreManager_ListInstances_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/RestoreInstance/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/RestoreInstance/main.go new file mode 100644 index 00000000000..eff569de0ba --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/RestoreInstance/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_RestoreInstance_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.RestoreInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#RestoreInstanceRequest. + } + op, err := c.RestoreInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_RestoreInstance_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateBackup/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateBackup/main.go new file mode 100644 index 00000000000..69a24ff1383 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateBackup/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_UpdateBackup_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.UpdateBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#UpdateBackupRequest. + } + op, err := c.UpdateBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_UpdateBackup_sync] diff --git a/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateInstance/main.go b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateInstance/main.go new file mode 100644 index 00000000000..3fafdb409b5 --- /dev/null +++ b/internal/generated/snippets/filestore/apiv1/CloudFilestoreManagerClient/UpdateInstance/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START file_v1_generated_CloudFilestoreManager_UpdateInstance_sync] + +package main + +import ( + "context" + + filestore "cloud.google.com/go/filestore/apiv1" + filestorepb "google.golang.org/genproto/googleapis/cloud/filestore/v1" +) + +func main() { + ctx := context.Background() + c, err := filestore.NewCloudFilestoreManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &filestorepb.UpdateInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#UpdateInstanceRequest. + } + op, err := c.UpdateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END file_v1_generated_CloudFilestoreManager_UpdateInstance_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index b256ce4227b..fd7b175c849 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -23,7 +23,7 @@ replace cloud.google.com/go/spanner => ../../../spanner replace cloud.google.com/go/storage => ../../../storage require ( - cloud.google.com/go v0.95.0 + cloud.google.com/go v0.97.0 cloud.google.com/go/accessapproval v0.1.0 cloud.google.com/go/accesscontextmanager v0.0.0-00010101000000-000000000000 cloud.google.com/go/aiplatform v0.1.0 @@ -61,6 +61,7 @@ require ( cloud.google.com/go/errorreporting v0.1.0 cloud.google.com/go/essentialcontacts v0.1.0 cloud.google.com/go/eventarc v0.1.0 + cloud.google.com/go/filestore v0.0.0-00010101000000-000000000000 cloud.google.com/go/firestore v0.90.0 cloud.google.com/go/functions v0.1.0 cloud.google.com/go/gaming v0.1.0 @@ -123,7 +124,7 @@ require ( cloud.google.com/go/websecurityscanner v0.1.0 cloud.google.com/go/workflows v0.1.0 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 + google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer @@ -311,3 +312,5 @@ replace cloud.google.com/go/contactcenterinsights => ../../../contactcenterinsig replace cloud.google.com/go/networksecurity => ../../../networksecurity replace cloud.google.com/go/orchestration => ../../../orchestration + +replace cloud.google.com/go/filestore => ../../../filestore diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index 44bafda0abc..bea8c1b90ac 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -161,8 +161,9 @@ google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20210927142257-433400c27d05/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetIamPolicy/main.go b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetIamPolicy/main.go new file mode 100644 index 00000000000..7fb93abe3fa --- /dev/null +++ b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetIamPolicy/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START privateca_v1_generated_CertificateAuthorityService_GetIamPolicy_sync] + +package main + +import ( + "context" + + privateca "cloud.google.com/go/security/privateca/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#GetIamPolicyRequest. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END privateca_v1_generated_CertificateAuthorityService_GetIamPolicy_sync] diff --git a/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetLocation/main.go b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetLocation/main.go new file mode 100644 index 00000000000..aa5cad1305e --- /dev/null +++ b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/GetLocation/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START privateca_v1_generated_CertificateAuthorityService_GetLocation_sync] + +package main + +import ( + "context" + + privateca "cloud.google.com/go/security/privateca/apiv1" + locationpb "google.golang.org/genproto/googleapis/cloud/location" +) + +func main() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &locationpb.GetLocationRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. + } + resp, err := c.GetLocation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END privateca_v1_generated_CertificateAuthorityService_GetLocation_sync] diff --git a/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/ListLocations/main.go b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/ListLocations/main.go new file mode 100644 index 00000000000..06a6b325812 --- /dev/null +++ b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/ListLocations/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START privateca_v1_generated_CertificateAuthorityService_ListLocations_sync] + +package main + +import ( + "context" + + privateca "cloud.google.com/go/security/privateca/apiv1" + "google.golang.org/api/iterator" + locationpb "google.golang.org/genproto/googleapis/cloud/location" +) + +func main() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &locationpb.ListLocationsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. + } + it := c.ListLocations(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END privateca_v1_generated_CertificateAuthorityService_ListLocations_sync] diff --git a/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/SetIamPolicy/main.go b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/SetIamPolicy/main.go new file mode 100644 index 00000000000..c18adc85357 --- /dev/null +++ b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/SetIamPolicy/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START privateca_v1_generated_CertificateAuthorityService_SetIamPolicy_sync] + +package main + +import ( + "context" + + privateca "cloud.google.com/go/security/privateca/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END privateca_v1_generated_CertificateAuthorityService_SetIamPolicy_sync] diff --git a/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/TestIamPermissions/main.go b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/TestIamPermissions/main.go new file mode 100644 index 00000000000..2d90cffbdb1 --- /dev/null +++ b/internal/generated/snippets/security/privateca/apiv1/CertificateAuthorityClient/TestIamPermissions/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START privateca_v1_generated_CertificateAuthorityService_TestIamPermissions_sync] + +package main + +import ( + "context" + + privateca "cloud.google.com/go/security/privateca/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#TestIamPermissionsRequest. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END privateca_v1_generated_CertificateAuthorityService_TestIamPermissions_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index f9c935f44e7..b412794c980 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -309,8 +309,8 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 640a6dbb29a..43b9b73f57e 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -91,7 +91,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210930" +const versionClient = "20211001" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/key_management_client.go b/kms/apiv1/key_management_client.go index 62fe8c5b402..dfa8f9b1e22 100644 --- a/kms/apiv1/key_management_client.go +++ b/kms/apiv1/key_management_client.go @@ -340,12 +340,45 @@ func defaultKeyManagementCallOptions() *KeyManagementCallOptions { }) }), }, - MacSign: []gax.CallOption{}, - MacVerify: []gax.CallOption{}, - GenerateRandomBytes: []gax.CallOption{}, - GetIamPolicy: []gax.CallOption{}, - SetIamPolicy: []gax.CallOption{}, - TestIamPermissions: []gax.CallOption{}, + MacSign: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + MacVerify: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GenerateRandomBytes: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -1320,6 +1353,11 @@ func (c *keyManagementGRPCClient) AsymmetricDecrypt(ctx context.Context, req *km } func (c *keyManagementGRPCClient) MacSign(ctx context.Context, req *kmspb.MacSignRequest, opts ...gax.CallOption) (*kmspb.MacSignResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).MacSign[0:len((*c.CallOptions).MacSign):len((*c.CallOptions).MacSign)], opts...) @@ -1336,6 +1374,11 @@ func (c *keyManagementGRPCClient) MacSign(ctx context.Context, req *kmspb.MacSig } func (c *keyManagementGRPCClient) MacVerify(ctx context.Context, req *kmspb.MacVerifyRequest, opts ...gax.CallOption) (*kmspb.MacVerifyResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).MacVerify[0:len((*c.CallOptions).MacVerify):len((*c.CallOptions).MacVerify)], opts...) @@ -1352,6 +1395,11 @@ func (c *keyManagementGRPCClient) MacVerify(ctx context.Context, req *kmspb.MacV } func (c *keyManagementGRPCClient) GenerateRandomBytes(ctx context.Context, req *kmspb.GenerateRandomBytesRequest, opts ...gax.CallOption) (*kmspb.GenerateRandomBytesResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).GenerateRandomBytes[0:len((*c.CallOptions).GenerateRandomBytes):len((*c.CallOptions).GenerateRandomBytes)], opts...) diff --git a/kms/go.mod b/kms/go.mod index aa329aaf4be..b97d57592f4 100644 --- a/kms/go.mod +++ b/kms/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 + google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/kms/go.sum b/kms/go.sum index d250dcad66a..07c24590922 100644 --- a/kms/go.sum +++ b/kms/go.sum @@ -488,8 +488,8 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/security/go.mod b/security/go.mod index 7cfecaeabf9..81edbf4530e 100644 --- a/security/go.mod +++ b/security/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( cloud.google.com/go v0.94.1 - github.com/googleapis/gax-go/v2 v2.1.0 - google.golang.org/api v0.57.0 - google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 + github.com/googleapis/gax-go/v2 v2.1.1 + google.golang.org/api v0.58.0 + google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/security/go.sum b/security/go.sum index dbf1877fa8b..07c24590922 100644 --- a/security/go.sum +++ b/security/go.sum @@ -140,8 +140,9 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0 h1:6DWmvNpomjL1+3liNSZbVns3zsYzzCjm6pRBO1tLeso= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -323,8 +324,8 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365 h1:6wSTsvPddg9gc/mVEEyk9oOAoxn+bT4Z9q1zx+4RwA4= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -421,8 +422,9 @@ google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNe google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0 h1:4t9zuDlHLcIx0ZEhmXEeFVCRsiOgpgn2QOH9N0MNjPI= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.58.0 h1:MDkAbYIB1JpSgCTOCYYoIec/coMlKK4oVbpnBLLcyT0= +google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3lv+E= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -484,9 +486,10 @@ google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwy google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 h1:2ncG/LajxmrclaZH+ppVi02rQxz4eXYJzGHdFN4Y9UA= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= +google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/security/privateca/apiv1/certificate_authority_client.go b/security/privateca/apiv1/certificate_authority_client.go index 7cec0e0b276..1308416e3c6 100644 --- a/security/privateca/apiv1/certificate_authority_client.go +++ b/security/privateca/apiv1/certificate_authority_client.go @@ -30,7 +30,9 @@ import ( "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" + locationpb "google.golang.org/genproto/googleapis/cloud/location" privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" longrunningpb "google.golang.org/genproto/googleapis/longrunning" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -71,6 +73,11 @@ type CertificateAuthorityCallOptions struct { GetCertificateTemplate []gax.CallOption ListCertificateTemplates []gax.CallOption UpdateCertificateTemplate []gax.CallOption + GetLocation []gax.CallOption + ListLocations []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption } func defaultCertificateAuthorityGRPCClientOptions() []option.ClientOption { @@ -465,6 +472,11 @@ func defaultCertificateAuthorityCallOptions() *CertificateAuthorityCallOptions { }) }), }, + GetLocation: []gax.CallOption{}, + ListLocations: []gax.CallOption{}, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -516,6 +528,11 @@ type internalCertificateAuthorityClient interface { ListCertificateTemplates(context.Context, *privatecapb.ListCertificateTemplatesRequest, ...gax.CallOption) *CertificateTemplateIterator UpdateCertificateTemplate(context.Context, *privatecapb.UpdateCertificateTemplateRequest, ...gax.CallOption) (*UpdateCertificateTemplateOperation, error) UpdateCertificateTemplateOperation(name string) *UpdateCertificateTemplateOperation + GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) + ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator + GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) } // CertificateAuthorityClient is a client for interacting with Certificate Authority API. @@ -802,6 +819,42 @@ func (c *CertificateAuthorityClient) UpdateCertificateTemplateOperation(name str return c.internalClient.UpdateCertificateTemplateOperation(name) } +// GetLocation gets information about a location. +func (c *CertificateAuthorityClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { + return c.internalClient.GetLocation(ctx, req, opts...) +} + +// ListLocations lists information about the supported locations for this service. +func (c *CertificateAuthorityClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { + return c.internalClient.ListLocations(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. Returns an empty policy +// if the resource exists and does not have a policy set. +func (c *CertificateAuthorityClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces +// any existing policy. +// +// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED +// errors. +func (c *CertificateAuthorityClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. If the +// resource does not exist, this will return an empty set of +// permissions, not a NOT_FOUND error. +// +// Note: This operation is designed to be used for building +// permission-aware UIs and command-line tools, not for authorization +// checking. This operation may “fail open” without warning. +func (c *CertificateAuthorityClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + // certificateAuthorityGRPCClient is a client for interacting with Certificate Authority API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -823,6 +876,10 @@ type certificateAuthorityGRPCClient struct { // Users should not Close this client. LROClient **lroauto.OperationsClient + iamPolicyClient iampb.IAMPolicyClient + + locationsClient locationpb.LocationsClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -858,6 +915,8 @@ func NewCertificateAuthorityClient(ctx context.Context, opts ...option.ClientOpt disableDeadlines: disableDeadlines, certificateAuthorityClient: privatecapb.NewCertificateAuthorityServiceClient(connPool), CallOptions: &client.CallOptions, + iamPolicyClient: iampb.NewIAMPolicyClient(connPool), + locationsClient: locationpb.NewLocationsClient(connPool), } c.setGoogleClientInfo() @@ -1651,6 +1710,109 @@ func (c *certificateAuthorityGRPCClient) UpdateCertificateTemplate(ctx context.C }, nil } +func (c *certificateAuthorityGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) + var resp *locationpb.Location + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.locationsClient.GetLocation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *certificateAuthorityGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) + it := &LocationIterator{} + req = proto.Clone(req).(*locationpb.ListLocationsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { + resp := &locationpb.ListLocationsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.locationsClient.ListLocations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetLocations(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *certificateAuthorityGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *certificateAuthorityGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *certificateAuthorityGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // ActivateCertificateAuthorityOperation manages a long-running operation from ActivateCertificateAuthority. type ActivateCertificateAuthorityOperation struct { lro *longrunning.Operation @@ -2829,3 +2991,50 @@ func (it *CertificateTemplateIterator) takeBuf() interface{} { it.items = nil return b } + +// LocationIterator manages a stream of *locationpb.Location. +type LocationIterator struct { + items []*locationpb.Location + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LocationIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LocationIterator) Next() (*locationpb.Location, error) { + var item *locationpb.Location + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LocationIterator) bufLen() int { + return len(it.items) +} + +func (it *LocationIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/security/privateca/apiv1/certificate_authority_client_example_test.go b/security/privateca/apiv1/certificate_authority_client_example_test.go index d24df188716..739b3b21d51 100644 --- a/security/privateca/apiv1/certificate_authority_client_example_test.go +++ b/security/privateca/apiv1/certificate_authority_client_example_test.go @@ -21,7 +21,9 @@ import ( privateca "cloud.google.com/go/security/privateca/apiv1" "google.golang.org/api/iterator" + locationpb "google.golang.org/genproto/googleapis/cloud/location" privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" ) func ExampleNewCertificateAuthorityClient() { @@ -711,3 +713,109 @@ func ExampleCertificateAuthorityClient_UpdateCertificateTemplate() { // TODO: Use resp. _ = resp } + +func ExampleCertificateAuthorityClient_GetLocation() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &locationpb.GetLocationRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. + } + resp, err := c.GetLocation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCertificateAuthorityClient_ListLocations() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &locationpb.ListLocationsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. + } + it := c.ListLocations(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleCertificateAuthorityClient_GetIamPolicy() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#GetIamPolicyRequest. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCertificateAuthorityClient_SetIamPolicy() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCertificateAuthorityClient_TestIamPermissions() { + ctx := context.Background() + c, err := privateca.NewCertificateAuthorityClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#TestIamPermissionsRequest. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/security/privateca/apiv1/doc.go b/security/privateca/apiv1/doc.go index c78c66ab6b2..19fda40c170 100644 --- a/security/privateca/apiv1/doc.go +++ b/security/privateca/apiv1/doc.go @@ -87,7 +87,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210921" +const versionClient = "20211001" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1/gapic_metadata.json b/security/privateca/apiv1/gapic_metadata.json index c979b6d151b..15981b873fd 100644 --- a/security/privateca/apiv1/gapic_metadata.json +++ b/security/privateca/apiv1/gapic_metadata.json @@ -95,6 +95,16 @@ "GetCertificateTemplate" ] }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "GetLocation": { + "methods": [ + "GetLocation" + ] + }, "ListCaPools": { "methods": [ "ListCaPools" @@ -120,11 +130,26 @@ "ListCertificates" ] }, + "ListLocations": { + "methods": [ + "ListLocations" + ] + }, "RevokeCertificate": { "methods": [ "RevokeCertificate" ] }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, "UndeleteCertificateAuthority": { "methods": [ "UndeleteCertificateAuthority"