From 5af548bee4ffde279727b2e1ad9b072925106a74 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 18 Feb 2022 09:18:04 -0800 Subject: [PATCH] chore(all): auto-regenerate gapics (#5671) 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/763 Changes: build(pubsub): add flag to distinguish autogenerated libs with a handwritten layer PiperOrigin-RevId: 429391240 Source-Link: https://github.com/googleapis/googleapis/commit/f1529c0002b2df10f6858aafbacf6fd3b6d29e08 fix(bigquery/storage): remove bigquery.readonly auth scope PiperOrigin-RevId: 429331987 Source-Link: https://github.com/googleapis/googleapis/commit/4b2bd2637d6df992933b7437cf64f1c7d7b6ed9b feat(logging): Update Logging API with latest changes PiperOrigin-RevId: 429289471 Source-Link: https://github.com/googleapis/googleapis/commit/acd5f89b8addd2ff54f41a7d43ff9b122bb43337 --- aiplatform/go.sum | 2 - appengine/go.sum | 2 - automl/go.sum | 2 - bigquery/go.mod | 2 +- bigquery/go.sum | 4 +- bigquery/storage/apiv1/doc.go | 3 +- bigquery/storage/apiv1beta1/doc.go | 3 +- bigquery/storage/apiv1beta2/doc.go | 3 +- dataplex/go.sum | 2 - dataproc/go.sum | 2 - go.mod | 2 +- go.sum | 4 +- internal/generated/snippets/go.mod | 2 +- internal/generated/snippets/go.sum | 4 +- .../apiv2/ConfigClient/CopyLogEntries/main.go | 53 ++++ .../apiv2/ConfigClient/GetSettings/main.go | 48 +++ .../apiv2/ConfigClient/UpdateSettings/main.go | 48 +++ internal/godocfx/go.sum | 4 +- logging/apiv2/config_client.go | 282 +++++++++++++++--- logging/apiv2/config_client_example_test.go | 65 ++++ logging/apiv2/doc.go | 2 +- logging/apiv2/gapic_metadata.json | 15 + logging/apiv2/logging_client.go | 8 +- logging/go.mod | 2 +- logging/go.sum | 4 +- osconfig/go.sum | 2 - pubsub/apiv1/doc.go | 2 +- pubsub/go.mod | 2 +- pubsub/go.sum | 4 +- securitycenter/go.sum | 2 - spanner/go.sum | 2 - 31 files changed, 500 insertions(+), 82 deletions(-) create mode 100644 internal/generated/snippets/logging/apiv2/ConfigClient/CopyLogEntries/main.go create mode 100644 internal/generated/snippets/logging/apiv2/ConfigClient/GetSettings/main.go create mode 100644 internal/generated/snippets/logging/apiv2/ConfigClient/UpdateSettings/main.go diff --git a/aiplatform/go.sum b/aiplatform/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/aiplatform/go.sum +++ b/aiplatform/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/appengine/go.sum b/appengine/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/appengine/go.sum +++ b/appengine/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/automl/go.sum b/automl/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/automl/go.sum +++ b/automl/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/bigquery/go.mod b/bigquery/go.mod index f1e29e73926a..feebc1ff9088 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -14,7 +14,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.69.0 - google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 + google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 3520027fc93d..bc3f8bcbe899 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -543,8 +543,8 @@ google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 29a75bc05c01..5eb19ff5d12c 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -82,7 +82,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20220216" +const versionClient = "20220218" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) @@ -110,7 +110,6 @@ func DefaultAuthScopes() []string { return []string{ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/bigquery.insertdata", - "https://www.googleapis.com/auth/bigquery.readonly", "https://www.googleapis.com/auth/cloud-platform", } } diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index 8c2edcdedc57..7b60ea4671a2 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20220216" +const versionClient = "20220218" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) @@ -111,7 +111,6 @@ func checkDisableDeadlines() (bool, error) { func DefaultAuthScopes() []string { return []string{ "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/bigquery.readonly", "https://www.googleapis.com/auth/cloud-platform", } } diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index 0dd727964272..32ef9246fbb7 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20220216" +const versionClient = "20220218" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) @@ -112,7 +112,6 @@ func DefaultAuthScopes() []string { return []string{ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/bigquery.insertdata", - "https://www.googleapis.com/auth/bigquery.readonly", "https://www.googleapis.com/auth/cloud-platform", } } diff --git a/dataplex/go.sum b/dataplex/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/dataplex/go.sum +++ b/dataplex/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/dataproc/go.sum b/dataproc/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/dataproc/go.sum +++ b/dataproc/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/go.mod b/go.mod index 513a520bcc01..e5499fdd8d41 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.69.0 - google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 + google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index c2a70ba3098e..daeb8b180076 100644 --- a/go.sum +++ b/go.sum @@ -526,8 +526,8 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/go.mod b/internal/generated/snippets/go.mod index dee232fe225a..09f2d06397b7 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -111,7 +111,7 @@ require ( cloud.google.com/go/workflows v1.1.0 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect google.golang.org/api v0.69.0 - google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 + google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index 03107179db72..2ce0a1e00353 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -166,8 +166,10 @@ 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-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/logging/apiv2/ConfigClient/CopyLogEntries/main.go b/internal/generated/snippets/logging/apiv2/ConfigClient/CopyLogEntries/main.go new file mode 100644 index 000000000000..b03cf0aeaa23 --- /dev/null +++ b/internal/generated/snippets/logging/apiv2/ConfigClient/CopyLogEntries/main.go @@ -0,0 +1,53 @@ +// Copyright 2022 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 logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] + +package main + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func main() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.CopyLogEntriesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#CopyLogEntriesRequest. + } + op, err := c.CopyLogEntries(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] diff --git a/internal/generated/snippets/logging/apiv2/ConfigClient/GetSettings/main.go b/internal/generated/snippets/logging/apiv2/ConfigClient/GetSettings/main.go new file mode 100644 index 000000000000..8576074f758a --- /dev/null +++ b/internal/generated/snippets/logging/apiv2/ConfigClient/GetSettings/main.go @@ -0,0 +1,48 @@ +// Copyright 2022 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 logging_v2_generated_ConfigServiceV2_GetSettings_sync] + +package main + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func main() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.GetSettingsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#GetSettingsRequest. + } + resp, err := c.GetSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END logging_v2_generated_ConfigServiceV2_GetSettings_sync] diff --git a/internal/generated/snippets/logging/apiv2/ConfigClient/UpdateSettings/main.go b/internal/generated/snippets/logging/apiv2/ConfigClient/UpdateSettings/main.go new file mode 100644 index 000000000000..674f44998a99 --- /dev/null +++ b/internal/generated/snippets/logging/apiv2/ConfigClient/UpdateSettings/main.go @@ -0,0 +1,48 @@ +// Copyright 2022 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 logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] + +package main + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func main() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.UpdateSettingsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#UpdateSettingsRequest. + } + resp, err := c.UpdateSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 8103ca52f109..42ef8cf3739d 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -204,8 +204,8 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/logging/apiv2/config_client.go b/logging/apiv2/config_client.go index 70a8b2472049..95ae03a71834 100644 --- a/logging/apiv2/config_client.go +++ b/logging/apiv2/config_client.go @@ -23,12 +23,15 @@ import ( "net/url" "time" + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" loggingpb "google.golang.org/genproto/googleapis/logging/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -62,6 +65,9 @@ type ConfigCallOptions struct { DeleteExclusion []gax.CallOption GetCmekSettings []gax.CallOption UpdateCmekSettings []gax.CallOption + GetSettings []gax.CallOption + UpdateSettings []gax.CallOption + CopyLogEntries []gax.CallOption } func defaultConfigGRPCClientOptions() []option.ClientOption { @@ -185,6 +191,9 @@ func defaultConfigCallOptions() *ConfigCallOptions { }, GetCmekSettings: []gax.CallOption{}, UpdateCmekSettings: []gax.CallOption{}, + GetSettings: []gax.CallOption{}, + UpdateSettings: []gax.CallOption{}, + CopyLogEntries: []gax.CallOption{}, } } @@ -216,6 +225,10 @@ type internalConfigClient interface { DeleteExclusion(context.Context, *loggingpb.DeleteExclusionRequest, ...gax.CallOption) error GetCmekSettings(context.Context, *loggingpb.GetCmekSettingsRequest, ...gax.CallOption) (*loggingpb.CmekSettings, error) UpdateCmekSettings(context.Context, *loggingpb.UpdateCmekSettingsRequest, ...gax.CallOption) (*loggingpb.CmekSettings, error) + GetSettings(context.Context, *loggingpb.GetSettingsRequest, ...gax.CallOption) (*loggingpb.Settings, error) + UpdateSettings(context.Context, *loggingpb.UpdateSettingsRequest, ...gax.CallOption) (*loggingpb.Settings, error) + CopyLogEntries(context.Context, *loggingpb.CopyLogEntriesRequest, ...gax.CallOption) (*CopyLogEntriesOperation, error) + CopyLogEntriesOperation(name string) *CopyLogEntriesOperation } // ConfigClient is a client for interacting with Cloud Logging API. @@ -228,6 +241,11 @@ type ConfigClient struct { // The call options for this service. CallOptions *ConfigCallOptions + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient } // Wrapper methods routed to the internal client. @@ -252,73 +270,80 @@ func (c *ConfigClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// ListBuckets lists buckets. +// ListBuckets lists log buckets. func (c *ConfigClient) ListBuckets(ctx context.Context, req *loggingpb.ListBucketsRequest, opts ...gax.CallOption) *LogBucketIterator { return c.internalClient.ListBuckets(ctx, req, opts...) } -// GetBucket gets a bucket. +// GetBucket gets a log bucket. func (c *ConfigClient) GetBucket(ctx context.Context, req *loggingpb.GetBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { return c.internalClient.GetBucket(ctx, req, opts...) } -// CreateBucket creates a bucket that can be used to store log entries. Once a bucket has -// been created, the region cannot be changed. +// CreateBucket creates a log bucket that can be used to store log entries. After a bucket +// has been created, the bucket’s location cannot be changed. func (c *ConfigClient) CreateBucket(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { return c.internalClient.CreateBucket(ctx, req, opts...) } -// UpdateBucket updates a bucket. This method replaces the following fields in the +// UpdateBucket updates a log bucket. This method replaces the following fields in the // existing bucket with values from the new bucket: retention_period // // If the retention period is decreased and the bucket is locked, // FAILED_PRECONDITION will be returned. // -// If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION -// will be returned. +// If the bucket has a lifecycle_state of DELETE_REQUESTED, then +// FAILED_PRECONDITION will be returned. // -// A buckets region may not be modified after it is created. +// After a bucket has been created, the bucket’s location cannot be changed. func (c *ConfigClient) UpdateBucket(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) { return c.internalClient.UpdateBucket(ctx, req, opts...) } -// DeleteBucket deletes a bucket. -// Moves the bucket to the DELETE_REQUESTED state. After 7 days, the -// bucket will be purged and all logs in the bucket will be permanently -// deleted. +// DeleteBucket deletes a log bucket. +// +// Changes the bucket’s lifecycle_state to the DELETE_REQUESTED state. +// After 7 days, the bucket will be purged and all log entries in the bucket +// will be permanently deleted. func (c *ConfigClient) DeleteBucket(ctx context.Context, req *loggingpb.DeleteBucketRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteBucket(ctx, req, opts...) } -// UndeleteBucket undeletes a bucket. A bucket that has been deleted may be undeleted within -// the grace period of 7 days. +// UndeleteBucket undeletes a log bucket. A bucket that has been deleted can be undeleted +// within the grace period of 7 days. func (c *ConfigClient) UndeleteBucket(ctx context.Context, req *loggingpb.UndeleteBucketRequest, opts ...gax.CallOption) error { return c.internalClient.UndeleteBucket(ctx, req, opts...) } -// ListViews lists views on a bucket. +// ListViews lists views on a log bucket. func (c *ConfigClient) ListViews(ctx context.Context, req *loggingpb.ListViewsRequest, opts ...gax.CallOption) *LogViewIterator { return c.internalClient.ListViews(ctx, req, opts...) } -// GetView gets a view. +// GetView gets a view on a log bucket… func (c *ConfigClient) GetView(ctx context.Context, req *loggingpb.GetViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) { return c.internalClient.GetView(ctx, req, opts...) } -// CreateView creates a view over logs in a bucket. A bucket may contain a maximum of -// 50 views. +// CreateView creates a view over log entries in a log bucket. A bucket may contain a +// maximum of 30 views. func (c *ConfigClient) CreateView(ctx context.Context, req *loggingpb.CreateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) { return c.internalClient.CreateView(ctx, req, opts...) } -// UpdateView updates a view. This method replaces the following fields in the existing -// view with values from the new view: filter. +// UpdateView updates a view on a log bucket. This method replaces the following fields +// in the existing view with values from the new view: filter. +// If an UNAVAILABLE error is returned, this indicates that system is not in +// a state where it can update the view. If this occurs, please try again in a +// few minutes. func (c *ConfigClient) UpdateView(ctx context.Context, req *loggingpb.UpdateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) { return c.internalClient.UpdateView(ctx, req, opts...) } -// DeleteView deletes a view from a bucket. +// DeleteView deletes a view on a log bucket. +// If an UNAVAILABLE error is returned, this indicates that system is not in +// a state where it can delete the view. If this occurs, please try again in a +// few minutes. func (c *ConfigClient) DeleteView(ctx context.Context, req *loggingpb.DeleteViewRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteView(ctx, req, opts...) } @@ -356,51 +381,53 @@ func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSink return c.internalClient.DeleteSink(ctx, req, opts...) } -// ListExclusions lists all the exclusions in a parent resource. +// ListExclusions lists all the exclusions on the _Default sink in a parent resource. func (c *ConfigClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator { return c.internalClient.ListExclusions(ctx, req, opts...) } -// GetExclusion gets the description of an exclusion. +// GetExclusion gets the description of an exclusion in the _Default sink. func (c *ConfigClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { return c.internalClient.GetExclusion(ctx, req, opts...) } -// CreateExclusion creates a new exclusion in a specified parent resource. -// Only log entries belonging to that resource can be excluded. -// You can have up to 10 exclusions in a resource. +// CreateExclusion creates a new exclusion in the _Default sink in a specified parent +// resource. Only log entries belonging to that resource can be excluded. You +// can have up to 10 exclusions in a resource. func (c *ConfigClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { return c.internalClient.CreateExclusion(ctx, req, opts...) } -// UpdateExclusion changes one or more properties of an existing exclusion. +// UpdateExclusion changes one or more properties of an existing exclusion in the _Default +// sink. func (c *ConfigClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { return c.internalClient.UpdateExclusion(ctx, req, opts...) } -// DeleteExclusion deletes an exclusion. +// DeleteExclusion deletes an exclusion in the _Default sink. func (c *ConfigClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteExclusion(ctx, req, opts...) } -// GetCmekSettings gets the Logs Router CMEK settings for the given resource. +// GetCmekSettings gets the Logging CMEK settings for the given resource. // -// Note: CMEK for the Logs Router can currently only be configured for GCP -// organizations. Once configured, it applies to all projects and folders in -// the GCP organization. +// Note: CMEK for the Log Router can be configured for Google Cloud projects, +// folders, organizations and billing accounts. Once configured for an +// organization, it applies to all projects and folders in the Google Cloud +// organization. // -// See Enabling CMEK for Logs +// See Enabling CMEK for Log // Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) // for more information. func (c *ConfigClient) GetCmekSettings(ctx context.Context, req *loggingpb.GetCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) { return c.internalClient.GetCmekSettings(ctx, req, opts...) } -// UpdateCmekSettings updates the Logs Router CMEK settings for the given resource. +// UpdateCmekSettings updates the Log Router CMEK settings for the given resource. // -// Note: CMEK for the Logs Router can currently only be configured for GCP -// organizations. Once configured, it applies to all projects and folders in -// the GCP organization. +// Note: CMEK for the Log Router can currently only be configured for Google +// Cloud organizations. Once configured, it applies to all projects and +// folders in the Google Cloud organization. // // UpdateCmekSettings // will fail if 1) kms_key_name is invalid, or 2) the associated service @@ -408,13 +435,58 @@ func (c *ConfigClient) GetCmekSettings(ctx context.Context, req *loggingpb.GetCm // roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or // 3) access to the key is disabled. // -// See Enabling CMEK for Logs +// See Enabling CMEK for Log // Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) // for more information. func (c *ConfigClient) UpdateCmekSettings(ctx context.Context, req *loggingpb.UpdateCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) { return c.internalClient.UpdateCmekSettings(ctx, req, opts...) } +// GetSettings gets the Log Router settings for the given resource. +// +// Note: Settings for the Log Router can be get for Google Cloud projects, +// folders, organizations and billing accounts. Currently it can only be +// configured for organizations. Once configured for an organization, it +// applies to all projects and folders in the Google Cloud organization. +// +// See Enabling CMEK for Log +// Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) +// for more information. +func (c *ConfigClient) GetSettings(ctx context.Context, req *loggingpb.GetSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) { + return c.internalClient.GetSettings(ctx, req, opts...) +} + +// UpdateSettings updates the Log Router settings for the given resource. +// +// Note: Settings for the Log Router can currently only be configured for +// Google Cloud organizations. Once configured, it applies to all projects and +// folders in the Google Cloud organization. +// +// UpdateSettings +// will fail if 1) kms_key_name is invalid, or 2) the associated service +// account does not have the required +// roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or +// 3) access to the key is disabled. 4) location_id is not supported by +// Logging. 5) location_id violate OrgPolicy. +// +// See Enabling CMEK for Log +// Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) +// for more information. +func (c *ConfigClient) UpdateSettings(ctx context.Context, req *loggingpb.UpdateSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) { + return c.internalClient.UpdateSettings(ctx, req, opts...) +} + +// CopyLogEntries copies a set of log entries from a log bucket to a Cloud Storage bucket. +func (c *ConfigClient) CopyLogEntries(ctx context.Context, req *loggingpb.CopyLogEntriesRequest, opts ...gax.CallOption) (*CopyLogEntriesOperation, error) { + return c.internalClient.CopyLogEntries(ctx, req, opts...) +} + +// CopyLogEntriesOperation returns a new CopyLogEntriesOperation from a given name. +// The name must be that of a previously created CopyLogEntriesOperation, possibly from a different process. +func (c *ConfigClient) CopyLogEntriesOperation(name string) *CopyLogEntriesOperation { + return c.internalClient.CopyLogEntriesOperation(name) +} + // configGRPCClient is a client for interacting with Cloud Logging API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -431,6 +503,11 @@ type configGRPCClient struct { // The gRPC API client. configClient loggingpb.ConfigServiceV2Client + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient **lroauto.OperationsClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -470,6 +547,17 @@ func NewConfigClient(ctx context.Context, opts ...option.ClientOption) (*ConfigC client.internalClient = c + client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + c.LROClient = &client.LROClient return &client, nil } @@ -995,6 +1083,124 @@ func (c *configGRPCClient) UpdateCmekSettings(ctx context.Context, req *loggingp return resp, nil } +func (c *configGRPCClient) GetSettings(ctx context.Context, req *loggingpb.GetSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) { + 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).GetSettings[0:len((*c.CallOptions).GetSettings):len((*c.CallOptions).GetSettings)], opts...) + var resp *loggingpb.Settings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.GetSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *configGRPCClient) UpdateSettings(ctx context.Context, req *loggingpb.UpdateSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) { + 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).UpdateSettings[0:len((*c.CallOptions).UpdateSettings):len((*c.CallOptions).UpdateSettings)], opts...) + var resp *loggingpb.Settings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.UpdateSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *configGRPCClient) CopyLogEntries(ctx context.Context, req *loggingpb.CopyLogEntriesRequest, opts ...gax.CallOption) (*CopyLogEntriesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).CopyLogEntries[0:len((*c.CallOptions).CopyLogEntries):len((*c.CallOptions).CopyLogEntries)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.CopyLogEntries(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CopyLogEntriesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +// CopyLogEntriesOperation manages a long-running operation from CopyLogEntries. +type CopyLogEntriesOperation struct { + lro *longrunning.Operation +} + +// CopyLogEntriesOperation returns a new CopyLogEntriesOperation from a given name. +// The name must be that of a previously created CopyLogEntriesOperation, possibly from a different process. +func (c *configGRPCClient) CopyLogEntriesOperation(name string) *CopyLogEntriesOperation { + return &CopyLogEntriesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CopyLogEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, error) { + var resp loggingpb.CopyLogEntriesResponse + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CopyLogEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, error) { + var resp loggingpb.CopyLogEntriesResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CopyLogEntriesOperation) Metadata() (*loggingpb.CopyLogEntriesMetadata, error) { + var meta loggingpb.CopyLogEntriesMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CopyLogEntriesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CopyLogEntriesOperation) Name() string { + return op.lro.Name() +} + // LogBucketIterator manages a stream of *loggingpb.LogBucket. type LogBucketIterator struct { items []*loggingpb.LogBucket diff --git a/logging/apiv2/config_client_example_test.go b/logging/apiv2/config_client_example_test.go index 26d88882193a..6cd1295c5e24 100644 --- a/logging/apiv2/config_client_example_test.go +++ b/logging/apiv2/config_client_example_test.go @@ -509,3 +509,68 @@ func ExampleConfigClient_UpdateCmekSettings() { // TODO: Use resp. _ = resp } + +func ExampleConfigClient_GetSettings() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.GetSettingsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#GetSettingsRequest. + } + resp, err := c.GetSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_UpdateSettings() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.UpdateSettingsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#UpdateSettingsRequest. + } + resp, err := c.UpdateSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_CopyLogEntries() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &loggingpb.CopyLogEntriesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#CopyLogEntriesRequest. + } + op, err := c.CopyLogEntries(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index 2b9e6ac679d8..de1fe32e54ef 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -94,7 +94,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20220216" +const versionClient = "20220218" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/apiv2/gapic_metadata.json b/logging/apiv2/gapic_metadata.json index 9636e5a0ceda..b125a4fa1dc2 100644 --- a/logging/apiv2/gapic_metadata.json +++ b/logging/apiv2/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "ConfigClient", "rpcs": { + "CopyLogEntries": { + "methods": [ + "CopyLogEntries" + ] + }, "CreateBucket": { "methods": [ "CreateBucket" @@ -65,6 +70,11 @@ "GetExclusion" ] }, + "GetSettings": { + "methods": [ + "GetSettings" + ] + }, "GetSink": { "methods": [ "GetSink" @@ -115,6 +125,11 @@ "UpdateExclusion" ] }, + "UpdateSettings": { + "methods": [ + "UpdateSettings" + ] + }, "UpdateSink": { "methods": [ "UpdateSink" diff --git a/logging/apiv2/logging_client.go b/logging/apiv2/logging_client.go index 1c3815bc6372..fdd73abf0d4c 100644 --- a/logging/apiv2/logging_client.go +++ b/logging/apiv2/logging_client.go @@ -190,10 +190,10 @@ func (c *Client) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// DeleteLog deletes all the log entries in a log. The log reappears if it receives new -// entries. Log entries written shortly before the delete operation might not -// be deleted. Entries received after the delete operation with a timestamp -// before the operation will be deleted. +// DeleteLog deletes all the log entries in a log for the _Default Log Bucket. The log +// reappears if it receives new entries. Log entries written shortly before +// the delete operation might not be deleted. Entries received after the +// delete operation with a timestamp before the operation will be deleted. func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteLog(ctx, req, opts...) } diff --git a/logging/go.mod b/logging/go.mod index 26d0065f7da2..40c916af1cff 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -13,7 +13,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 google.golang.org/api v0.69.0 - google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 + google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/logging/go.sum b/logging/go.sum index c0f6ebed4442..9369b0580482 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -538,8 +538,8 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/osconfig/go.sum b/osconfig/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/osconfig/go.sum +++ b/osconfig/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index 3cb7f9c4e318..ebde1a546ead 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -85,7 +85,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20220216" +const versionClient = "20220218" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/go.mod b/pubsub/go.mod index 22d2672ee032..c91f4fdcde33 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -14,7 +14,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 google.golang.org/api v0.69.0 - google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 + google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index 347697acf700..b18a3a3de048 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -536,8 +536,8 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c h1:TU4rFa5APdKTq0s6B7WTsH6Xmx0Knj86s6Biz56mErE= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 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/securitycenter/go.sum b/securitycenter/go.sum index 52e62c67b989..e4ab3c66c700 100644 --- a/securitycenter/go.sum +++ b/securitycenter/go.sum @@ -524,8 +524,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/spanner/go.sum b/spanner/go.sum index ab8798f16375..4883dfe7c63b 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -538,8 +538,6 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8 h1:divpuJZKgX3Qt7MFDE5v62yu0yQcQbTCD9VJp9leX58= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 h1:8QEZX8dJDqdCxQVLRWzEKGOkOzuDx0AU4+bQX6LwmU4= google.golang.org/genproto v0.0.0-20220217155828-d576998c0009/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=