diff --git a/go.mod b/go.mod index bcfb9ff1d15c..5d28ac160e6b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f google.golang.org/api v0.86.0 - google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 + google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf google.golang.org/grpc v1.47.0 google.golang.org/protobuf v1.28.0 ) diff --git a/go.sum b/go.sum index edac53d85831..11c3a1d6aee4 100644 --- a/go.sum +++ b/go.sum @@ -600,8 +600,8 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 h1:W70HjnmXFJm+8RNjOpIDYW2nKsSi/af0VvIZUtYkwuU= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf h1:NYsHq6fUluuMrpjNnahu8SSjtoUEhQv95NZCWXurW3I= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 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 62f4ec135fb5..4e425bd5deca 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -118,7 +118,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.86.0 - google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 + google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index a196787b8e36..ab096f760321 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -216,8 +216,9 @@ google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220621134657-43db42f103f7/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220623142657-077d458a5694/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 h1:W70HjnmXFJm+8RNjOpIDYW2nKsSi/af0VvIZUtYkwuU= google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf h1:NYsHq6fUluuMrpjNnahu8SSjtoUEhQv95NZCWXurW3I= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 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/godocfx/go.sum b/internal/godocfx/go.sum index 0d12edf7fd5c..c301aef39b00 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -273,8 +273,8 @@ google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220622131801-db39fadba55f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 h1:W70HjnmXFJm+8RNjOpIDYW2nKsSi/af0VvIZUtYkwuU= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf h1:NYsHq6fUluuMrpjNnahu8SSjtoUEhQv95NZCWXurW3I= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 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/talent/apiv4/gapic_metadata.json b/talent/apiv4/gapic_metadata.json index 78dd2d4a5207..ca0a51cbd36a 100644 --- a/talent/apiv4/gapic_metadata.json +++ b/talent/apiv4/gapic_metadata.json @@ -127,11 +127,6 @@ "ListJobs" ] }, - "PurgeJobs": { - "methods": [ - "PurgeJobs" - ] - }, "SearchJobs": { "methods": [ "SearchJobs" diff --git a/talent/apiv4/job_client.go b/talent/apiv4/job_client.go index 3659ca92b21d..97a83275c424 100644 --- a/talent/apiv4/job_client.go +++ b/talent/apiv4/job_client.go @@ -49,7 +49,6 @@ type JobCallOptions struct { BatchUpdateJobs []gax.CallOption DeleteJob []gax.CallOption BatchDeleteJobs []gax.CallOption - PurgeJobs []gax.CallOption ListJobs []gax.CallOption SearchJobs []gax.CallOption SearchJobsForAlert []gax.CallOption @@ -99,7 +98,6 @@ func defaultJobCallOptions() *JobCallOptions { }), }, BatchDeleteJobs: []gax.CallOption{}, - PurgeJobs: []gax.CallOption{}, ListJobs: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -133,8 +131,6 @@ type internalJobClient interface { DeleteJob(context.Context, *talentpb.DeleteJobRequest, ...gax.CallOption) error BatchDeleteJobs(context.Context, *talentpb.BatchDeleteJobsRequest, ...gax.CallOption) (*BatchDeleteJobsOperation, error) BatchDeleteJobsOperation(name string) *BatchDeleteJobsOperation - PurgeJobs(context.Context, *talentpb.PurgeJobsRequest, ...gax.CallOption) (*PurgeJobsOperation, error) - PurgeJobsOperation(name string) *PurgeJobsOperation ListJobs(context.Context, *talentpb.ListJobsRequest, ...gax.CallOption) *JobIterator SearchJobs(context.Context, *talentpb.SearchJobsRequest, ...gax.CallOption) (*talentpb.SearchJobsResponse, error) SearchJobsForAlert(context.Context, *talentpb.SearchJobsRequest, ...gax.CallOption) (*talentpb.SearchJobsResponse, error) @@ -243,22 +239,6 @@ func (c *JobClient) BatchDeleteJobsOperation(name string) *BatchDeleteJobsOperat return c.internalClient.BatchDeleteJobsOperation(name) } -// PurgeJobs purges all jobs associated with requested target. -// -// Note: Jobs in OPEN status remain searchable until the operation completes. -// -// Note: The operation returned may take hours or longer to complete, -// depending on the number of jobs that need to be deleted. -func (c *JobClient) PurgeJobs(ctx context.Context, req *talentpb.PurgeJobsRequest, opts ...gax.CallOption) (*PurgeJobsOperation, error) { - return c.internalClient.PurgeJobs(ctx, req, opts...) -} - -// PurgeJobsOperation returns a new PurgeJobsOperation from a given name. -// The name must be that of a previously created PurgeJobsOperation, possibly from a different process. -func (c *JobClient) PurgeJobsOperation(name string) *PurgeJobsOperation { - return c.internalClient.PurgeJobsOperation(name) -} - // ListJobs lists jobs by filter. func (c *JobClient) ListJobs(ctx context.Context, req *talentpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { return c.internalClient.ListJobs(ctx, req, opts...) @@ -547,25 +527,6 @@ func (c *jobGRPCClient) BatchDeleteJobs(ctx context.Context, req *talentpb.Batch }, nil } -func (c *jobGRPCClient) PurgeJobs(ctx context.Context, req *talentpb.PurgeJobsRequest, opts ...gax.CallOption) (*PurgeJobsOperation, error) { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).PurgeJobs[0:len((*c.CallOptions).PurgeJobs):len((*c.CallOptions).PurgeJobs)], opts...) - var resp *longrunningpb.Operation - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.jobClient.PurgeJobs(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return &PurgeJobsOperation{ - lro: longrunning.InternalNewOperation(*c.LROClient, resp), - }, nil -} - func (c *jobGRPCClient) ListJobs(ctx context.Context, req *talentpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) @@ -879,75 +840,6 @@ func (op *BatchUpdateJobsOperation) Name() string { return op.lro.Name() } -// PurgeJobsOperation manages a long-running operation from PurgeJobs. -type PurgeJobsOperation struct { - lro *longrunning.Operation -} - -// PurgeJobsOperation returns a new PurgeJobsOperation from a given name. -// The name must be that of a previously created PurgeJobsOperation, possibly from a different process. -func (c *jobGRPCClient) PurgeJobsOperation(name string) *PurgeJobsOperation { - return &PurgeJobsOperation{ - 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 *PurgeJobsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*talentpb.PurgeJobsResponse, error) { - var resp talentpb.PurgeJobsResponse - 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 *PurgeJobsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*talentpb.PurgeJobsResponse, error) { - var resp talentpb.PurgeJobsResponse - 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 *PurgeJobsOperation) Metadata() (*talentpb.BatchOperationMetadata, error) { - var meta talentpb.BatchOperationMetadata - 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 *PurgeJobsOperation) 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 *PurgeJobsOperation) Name() string { - return op.lro.Name() -} - // JobIterator manages a stream of *talentpb.Job. type JobIterator struct { items []*talentpb.Job diff --git a/talent/apiv4/job_client_example_test.go b/talent/apiv4/job_client_example_test.go index 189e8b5a7dfe..5314eaf6d474 100644 --- a/talent/apiv4/job_client_example_test.go +++ b/talent/apiv4/job_client_example_test.go @@ -190,31 +190,6 @@ func ExampleJobClient_BatchDeleteJobs() { _ = resp } -func ExampleJobClient_PurgeJobs() { - ctx := context.Background() - c, err := talent.NewJobClient(ctx) - if err != nil { - // TODO: Handle error. - } - defer c.Close() - - req := &talentpb.PurgeJobsRequest{ - // TODO: Fill request struct fields. - // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/talent/v4#PurgeJobsRequest. - } - op, err := c.PurgeJobs(ctx, req) - if err != nil { - // TODO: Handle error. - } - - resp, err := op.Wait(ctx) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - func ExampleJobClient_ListJobs() { ctx := context.Background() c, err := talent.NewJobClient(ctx) diff --git a/talent/go.mod b/talent/go.mod index 672d3ad3a03e..dabf536f92e2 100644 --- a/talent/go.mod +++ b/talent/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.102.1 github.com/googleapis/gax-go/v2 v2.4.0 google.golang.org/api v0.86.0 - google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 + google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf google.golang.org/grpc v1.47.0 google.golang.org/protobuf v1.28.0 ) diff --git a/talent/go.sum b/talent/go.sum index 408193417c73..12eefeebdba8 100644 --- a/talent/go.sum +++ b/talent/go.sum @@ -589,8 +589,8 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 h1:W70HjnmXFJm+8RNjOpIDYW2nKsSi/af0VvIZUtYkwuU= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf h1:NYsHq6fUluuMrpjNnahu8SSjtoUEhQv95NZCWXurW3I= +google.golang.org/genproto v0.0.0-20220630135532-f4acab7bd6cf/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 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=