all: regen gapics
Includes a re-pin of genproto to get the latest protos required for this
CL.
Also bumps the timeout on bigtable integration tests.
Change-Id: I9c77164ddbc10fa3b78b95de78f51dc0ee6519ee
Reviewed-on: https://code-review.googlesource.com/c/38551
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andrew Poydence <poy@google.com>
diff --git a/bigtable/bigtable_test.go b/bigtable/bigtable_test.go
index 4aec698..17e5c8b 100644
--- a/bigtable/bigtable_test.go
+++ b/bigtable/bigtable_test.go
@@ -178,7 +178,7 @@
timeout = 10 * time.Minute
t.Logf("Running test against production")
} else {
- timeout = 1 * time.Minute
+ timeout = 5 * time.Minute
t.Logf("bttest.Server running on %s", testEnv.Config().AdminEndpoint)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
diff --git a/go.mod b/go.mod
index fac3c11..4dad397 100644
--- a/go.mod
+++ b/go.mod
@@ -19,7 +19,7 @@
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b
google.golang.org/api v0.1.0
- google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922
+ google.golang.org/genproto v0.0.0-20190226184841-fc2db5cae922
google.golang.org/grpc v1.17.0
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
)
diff --git a/go.sum b/go.sum
index 25c4a3a..ea620c0 100644
--- a/go.sum
+++ b/go.sum
@@ -143,8 +143,8 @@
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898 h1:yvw+zsSmSM02Z5H3ZdEV7B7Ql7eFrjQTnmByJvK+3J8=
google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
-google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 h1:mBVYJnbrXLA/ZCBTCe7PtEgAUP+1bg92qTaFoPHdz+8=
-google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4=
+google.golang.org/genproto v0.0.0-20190226184841-fc2db5cae922 h1:EqOOG7rjaEsiSBOxSSdQyc6rjCtWNQegwGE06rm6SII=
+google.golang.org/genproto v0.0.0-20190226184841-fc2db5cae922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk=
diff --git a/irm/apiv1alpha2/doc.go b/irm/apiv1alpha2/doc.go
index 2fa8066..983725a 100644
--- a/irm/apiv1alpha2/doc.go
+++ b/irm/apiv1alpha2/doc.go
@@ -85,4 +85,4 @@
return "UNKNOWN"
}
-const versionClient = "20190219"
+const versionClient = "20190225"
diff --git a/irm/apiv1alpha2/incident_client.go b/irm/apiv1alpha2/incident_client.go
index 9cf8cee..9b45de8 100644
--- a/irm/apiv1alpha2/incident_client.go
+++ b/irm/apiv1alpha2/incident_client.go
@@ -41,23 +41,21 @@
SearchSimilarIncidents []gax.CallOption
CreateAnnotation []gax.CallOption
ListAnnotations []gax.CallOption
- UpdateAnnotation []gax.CallOption
CreateTag []gax.CallOption
DeleteTag []gax.CallOption
ListTags []gax.CallOption
CreateSignal []gax.CallOption
- ListSignals []gax.CallOption
+ SearchSignals []gax.CallOption
GetSignal []gax.CallOption
UpdateSignal []gax.CallOption
- AcknowledgeSignal []gax.CallOption
EscalateIncident []gax.CallOption
CreateArtifact []gax.CallOption
ListArtifacts []gax.CallOption
UpdateArtifact []gax.CallOption
DeleteArtifact []gax.CallOption
- GetShiftHandoffPresets []gax.CallOption
SendShiftHandoff []gax.CallOption
CreateSubscription []gax.CallOption
+ UpdateSubscription []gax.CallOption
ListSubscriptions []gax.CallOption
DeleteSubscription []gax.CallOption
CreateIncidentRoleAssignment []gax.CallOption
@@ -99,23 +97,21 @@
SearchSimilarIncidents: retry[[2]string{"default", "idempotent"}],
CreateAnnotation: retry[[2]string{"default", "non_idempotent"}],
ListAnnotations: retry[[2]string{"default", "idempotent"}],
- UpdateAnnotation: retry[[2]string{"default", "non_idempotent"}],
CreateTag: retry[[2]string{"default", "non_idempotent"}],
DeleteTag: retry[[2]string{"default", "idempotent"}],
ListTags: retry[[2]string{"default", "idempotent"}],
CreateSignal: retry[[2]string{"default", "non_idempotent"}],
- ListSignals: retry[[2]string{"default", "idempotent"}],
+ SearchSignals: retry[[2]string{"default", "idempotent"}],
GetSignal: retry[[2]string{"default", "idempotent"}],
UpdateSignal: retry[[2]string{"default", "non_idempotent"}],
- AcknowledgeSignal: retry[[2]string{"default", "non_idempotent"}],
EscalateIncident: retry[[2]string{"default", "non_idempotent"}],
CreateArtifact: retry[[2]string{"default", "non_idempotent"}],
ListArtifacts: retry[[2]string{"default", "idempotent"}],
UpdateArtifact: retry[[2]string{"default", "non_idempotent"}],
DeleteArtifact: retry[[2]string{"default", "idempotent"}],
- GetShiftHandoffPresets: retry[[2]string{"default", "idempotent"}],
SendShiftHandoff: retry[[2]string{"default", "non_idempotent"}],
CreateSubscription: retry[[2]string{"default", "non_idempotent"}],
+ UpdateSubscription: retry[[2]string{"default", "non_idempotent"}],
ListSubscriptions: retry[[2]string{"default", "idempotent"}],
DeleteSubscription: retry[[2]string{"default", "idempotent"}],
CreateIncidentRoleAssignment: retry[[2]string{"default", "non_idempotent"}],
@@ -363,22 +359,6 @@
return it
}
-// UpdateAnnotation updates an annotation on an existing incident.
-func (c *IncidentClient) UpdateAnnotation(ctx context.Context, req *irmpb.UpdateAnnotationRequest, opts ...gax.CallOption) (*irmpb.Annotation, error) {
- ctx = insertMetadata(ctx, c.xGoogMetadata)
- opts = append(c.CallOptions.UpdateAnnotation[0:len(c.CallOptions.UpdateAnnotation):len(c.CallOptions.UpdateAnnotation)], opts...)
- var resp *irmpb.Annotation
- err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
- var err error
- resp, err = c.incidentClient.UpdateAnnotation(ctx, req, settings.GRPC...)
- return err
- }, opts...)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
// CreateTag creates a tag on an existing incident.
func (c *IncidentClient) CreateTag(ctx context.Context, req *irmpb.CreateTagRequest, opts ...gax.CallOption) (*irmpb.Tag, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
@@ -460,15 +440,15 @@
return resp, nil
}
-// ListSignals lists signals that are part of an incident.
+// SearchSignals lists signals that are part of an incident.
// Signals are returned in reverse chronological order.
-func (c *IncidentClient) ListSignals(ctx context.Context, req *irmpb.ListSignalsRequest, opts ...gax.CallOption) *SignalIterator {
+func (c *IncidentClient) SearchSignals(ctx context.Context, req *irmpb.SearchSignalsRequest, opts ...gax.CallOption) *SignalIterator {
ctx = insertMetadata(ctx, c.xGoogMetadata)
- opts = append(c.CallOptions.ListSignals[0:len(c.CallOptions.ListSignals):len(c.CallOptions.ListSignals)], opts...)
+ opts = append(c.CallOptions.SearchSignals[0:len(c.CallOptions.SearchSignals):len(c.CallOptions.SearchSignals)], opts...)
it := &SignalIterator{}
- req = proto.Clone(req).(*irmpb.ListSignalsRequest)
+ req = proto.Clone(req).(*irmpb.SearchSignalsRequest)
it.InternalFetch = func(pageSize int, pageToken string) ([]*irmpb.Signal, string, error) {
- var resp *irmpb.ListSignalsResponse
+ var resp *irmpb.SearchSignalsResponse
req.PageToken = pageToken
if pageSize > math.MaxInt32 {
req.PageSize = math.MaxInt32
@@ -477,7 +457,7 @@
}
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
- resp, err = c.incidentClient.ListSignals(ctx, req, settings.GRPC...)
+ resp, err = c.incidentClient.SearchSignals(ctx, req, settings.GRPC...)
return err
}, opts...)
if err != nil {
@@ -514,7 +494,7 @@
return resp, nil
}
-// UpdateSignal updates an existing signal (e.g. to assign/unassign it to an
+// UpdateSignal updates an existing signal (for example, to assign/unassign it to an
// incident).
func (c *IncidentClient) UpdateSignal(ctx context.Context, req *irmpb.UpdateSignalRequest, opts ...gax.CallOption) (*irmpb.Signal, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
@@ -531,23 +511,6 @@
return resp, nil
}
-// AcknowledgeSignal acks a signal. This acknowledges the signal in the underlying system,
-// indicating that the caller takes responsibility for looking into this.
-func (c *IncidentClient) AcknowledgeSignal(ctx context.Context, req *irmpb.AcknowledgeSignalRequest, opts ...gax.CallOption) (*irmpb.AcknowledgeSignalResponse, error) {
- ctx = insertMetadata(ctx, c.xGoogMetadata)
- opts = append(c.CallOptions.AcknowledgeSignal[0:len(c.CallOptions.AcknowledgeSignal):len(c.CallOptions.AcknowledgeSignal)], opts...)
- var resp *irmpb.AcknowledgeSignalResponse
- err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
- var err error
- resp, err = c.incidentClient.AcknowledgeSignal(ctx, req, settings.GRPC...)
- return err
- }, opts...)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
// EscalateIncident escalates an incident.
func (c *IncidentClient) EscalateIncident(ctx context.Context, req *irmpb.EscalateIncidentRequest, opts ...gax.CallOption) (*irmpb.EscalateIncidentResponse, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
@@ -645,23 +608,6 @@
return err
}
-// GetShiftHandoffPresets returns "presets" specific to shift handoff (see SendShiftHandoff), e.g.
-// default values for handoff message fields.
-func (c *IncidentClient) GetShiftHandoffPresets(ctx context.Context, req *irmpb.GetShiftHandoffPresetsRequest, opts ...gax.CallOption) (*irmpb.ShiftHandoffPresets, error) {
- ctx = insertMetadata(ctx, c.xGoogMetadata)
- opts = append(c.CallOptions.GetShiftHandoffPresets[0:len(c.CallOptions.GetShiftHandoffPresets):len(c.CallOptions.GetShiftHandoffPresets)], opts...)
- var resp *irmpb.ShiftHandoffPresets
- err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
- var err error
- resp, err = c.incidentClient.GetShiftHandoffPresets(ctx, req, settings.GRPC...)
- return err
- }, opts...)
- if err != nil {
- return nil, err
- }
- return resp, nil
-}
-
// SendShiftHandoff sends a summary of the shift for oncall handoff.
func (c *IncidentClient) SendShiftHandoff(ctx context.Context, req *irmpb.SendShiftHandoffRequest, opts ...gax.CallOption) (*irmpb.SendShiftHandoffResponse, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
@@ -697,6 +643,22 @@
return resp, nil
}
+// UpdateSubscription updates a subscription.
+func (c *IncidentClient) UpdateSubscription(ctx context.Context, req *irmpb.UpdateSubscriptionRequest, opts ...gax.CallOption) (*irmpb.Subscription, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.UpdateSubscription[0:len(c.CallOptions.UpdateSubscription):len(c.CallOptions.UpdateSubscription)], opts...)
+ var resp *irmpb.Subscription
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.incidentClient.UpdateSubscription(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
// ListSubscriptions returns a list of subscriptions for an incident.
func (c *IncidentClient) ListSubscriptions(ctx context.Context, req *irmpb.ListSubscriptionsRequest, opts ...gax.CallOption) *SubscriptionIterator {
ctx = insertMetadata(ctx, c.xGoogMetadata)
diff --git a/irm/apiv1alpha2/incident_client_example_test.go b/irm/apiv1alpha2/incident_client_example_test.go
index 522e148..cc6fdcb 100644
--- a/irm/apiv1alpha2/incident_client_example_test.go
+++ b/irm/apiv1alpha2/incident_client_example_test.go
@@ -178,24 +178,6 @@
}
}
-func ExampleIncidentClient_UpdateAnnotation() {
- ctx := context.Background()
- c, err := irm.NewIncidentClient(ctx)
- if err != nil {
- // TODO: Handle error.
- }
-
- req := &irmpb.UpdateAnnotationRequest{
- // TODO: Fill request struct fields.
- }
- resp, err := c.UpdateAnnotation(ctx, req)
- if err != nil {
- // TODO: Handle error.
- }
- // TODO: Use resp.
- _ = resp
-}
-
func ExampleIncidentClient_CreateTag() {
ctx := context.Background()
c, err := irm.NewIncidentClient(ctx)
@@ -272,17 +254,17 @@
_ = resp
}
-func ExampleIncidentClient_ListSignals() {
+func ExampleIncidentClient_SearchSignals() {
ctx := context.Background()
c, err := irm.NewIncidentClient(ctx)
if err != nil {
// TODO: Handle error.
}
- req := &irmpb.ListSignalsRequest{
+ req := &irmpb.SearchSignalsRequest{
// TODO: Fill request struct fields.
}
- it := c.ListSignals(ctx, req)
+ it := c.SearchSignals(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
@@ -332,24 +314,6 @@
_ = resp
}
-func ExampleIncidentClient_AcknowledgeSignal() {
- ctx := context.Background()
- c, err := irm.NewIncidentClient(ctx)
- if err != nil {
- // TODO: Handle error.
- }
-
- req := &irmpb.AcknowledgeSignalRequest{
- // TODO: Fill request struct fields.
- }
- resp, err := c.AcknowledgeSignal(ctx, req)
- if err != nil {
- // TODO: Handle error.
- }
- // TODO: Use resp.
- _ = resp
-}
-
func ExampleIncidentClient_EscalateIncident() {
ctx := context.Background()
c, err := irm.NewIncidentClient(ctx)
@@ -444,24 +408,6 @@
}
}
-func ExampleIncidentClient_GetShiftHandoffPresets() {
- ctx := context.Background()
- c, err := irm.NewIncidentClient(ctx)
- if err != nil {
- // TODO: Handle error.
- }
-
- req := &irmpb.GetShiftHandoffPresetsRequest{
- // TODO: Fill request struct fields.
- }
- resp, err := c.GetShiftHandoffPresets(ctx, req)
- if err != nil {
- // TODO: Handle error.
- }
- // TODO: Use resp.
- _ = resp
-}
-
func ExampleIncidentClient_SendShiftHandoff() {
ctx := context.Background()
c, err := irm.NewIncidentClient(ctx)
@@ -498,6 +444,24 @@
_ = resp
}
+func ExampleIncidentClient_UpdateSubscription() {
+ ctx := context.Background()
+ c, err := irm.NewIncidentClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &irmpb.UpdateSubscriptionRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSubscription(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
func ExampleIncidentClient_ListSubscriptions() {
ctx := context.Background()
c, err := irm.NewIncidentClient(ctx)
diff --git a/irm/apiv1alpha2/mock_test.go b/irm/apiv1alpha2/mock_test.go
index 5997223..f34b4a0 100644
--- a/irm/apiv1alpha2/mock_test.go
+++ b/irm/apiv1alpha2/mock_test.go
@@ -145,18 +145,6 @@
return s.resps[0].(*irmpb.ListAnnotationsResponse), nil
}
-func (s *mockIncidentServer) UpdateAnnotation(ctx context.Context, req *irmpb.UpdateAnnotationRequest) (*irmpb.Annotation, error) {
- md, _ := metadata.FromIncomingContext(ctx)
- if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
- return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
- }
- s.reqs = append(s.reqs, req)
- if s.err != nil {
- return nil, s.err
- }
- return s.resps[0].(*irmpb.Annotation), nil
-}
-
func (s *mockIncidentServer) CreateTag(ctx context.Context, req *irmpb.CreateTagRequest) (*irmpb.Tag, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -205,7 +193,7 @@
return s.resps[0].(*irmpb.Signal), nil
}
-func (s *mockIncidentServer) ListSignals(ctx context.Context, req *irmpb.ListSignalsRequest) (*irmpb.ListSignalsResponse, error) {
+func (s *mockIncidentServer) SearchSignals(ctx context.Context, req *irmpb.SearchSignalsRequest) (*irmpb.SearchSignalsResponse, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
@@ -214,7 +202,7 @@
if s.err != nil {
return nil, s.err
}
- return s.resps[0].(*irmpb.ListSignalsResponse), nil
+ return s.resps[0].(*irmpb.SearchSignalsResponse), nil
}
func (s *mockIncidentServer) GetSignal(ctx context.Context, req *irmpb.GetSignalRequest) (*irmpb.Signal, error) {
@@ -241,18 +229,6 @@
return s.resps[0].(*irmpb.Signal), nil
}
-func (s *mockIncidentServer) AcknowledgeSignal(ctx context.Context, req *irmpb.AcknowledgeSignalRequest) (*irmpb.AcknowledgeSignalResponse, error) {
- md, _ := metadata.FromIncomingContext(ctx)
- if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
- return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
- }
- s.reqs = append(s.reqs, req)
- if s.err != nil {
- return nil, s.err
- }
- return s.resps[0].(*irmpb.AcknowledgeSignalResponse), nil
-}
-
func (s *mockIncidentServer) EscalateIncident(ctx context.Context, req *irmpb.EscalateIncidentRequest) (*irmpb.EscalateIncidentResponse, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -313,18 +289,6 @@
return s.resps[0].(*emptypb.Empty), nil
}
-func (s *mockIncidentServer) GetShiftHandoffPresets(ctx context.Context, req *irmpb.GetShiftHandoffPresetsRequest) (*irmpb.ShiftHandoffPresets, error) {
- md, _ := metadata.FromIncomingContext(ctx)
- if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
- return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
- }
- s.reqs = append(s.reqs, req)
- if s.err != nil {
- return nil, s.err
- }
- return s.resps[0].(*irmpb.ShiftHandoffPresets), nil
-}
-
func (s *mockIncidentServer) SendShiftHandoff(ctx context.Context, req *irmpb.SendShiftHandoffRequest) (*irmpb.SendShiftHandoffResponse, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -349,6 +313,18 @@
return s.resps[0].(*irmpb.Subscription), nil
}
+func (s *mockIncidentServer) UpdateSubscription(ctx context.Context, req *irmpb.UpdateSubscriptionRequest) (*irmpb.Subscription, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*irmpb.Subscription), nil
+}
+
func (s *mockIncidentServer) ListSubscriptions(ctx context.Context, req *irmpb.ListSubscriptionsRequest) (*irmpb.ListSubscriptionsResponse, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -490,10 +466,12 @@
var name string = "name3373707"
var title string = "title110371416"
var etag string = "etag3123477"
+ var duplicateIncident string = "duplicateIncident-316496506"
var expectedResponse = &irmpb.Incident{
- Name: name,
- Title: title,
- Etag: etag,
+ Name: name,
+ Title: title,
+ Etag: etag,
+ DuplicateIncident: duplicateIncident,
}
mockIncident.err = nil
@@ -557,10 +535,12 @@
var name2 string = "name2-1052831874"
var title string = "title110371416"
var etag string = "etag3123477"
+ var duplicateIncident string = "duplicateIncident-316496506"
var expectedResponse = &irmpb.Incident{
- Name: name2,
- Title: title,
- Etag: etag,
+ Name: name2,
+ Title: title,
+ Etag: etag,
+ DuplicateIncident: duplicateIncident,
}
mockIncident.err = nil
@@ -692,10 +672,12 @@
var name string = "name3373707"
var title string = "title110371416"
var etag string = "etag3123477"
+ var duplicateIncident string = "duplicateIncident-316496506"
var expectedResponse = &irmpb.Incident{
- Name: name,
- Title: title,
- Etag: etag,
+ Name: name,
+ Title: title,
+ Etag: etag,
+ DuplicateIncident: duplicateIncident,
}
mockIncident.err = nil
@@ -960,75 +942,12 @@
}
_ = resp
}
-func TestIncidentServiceUpdateAnnotation(t *testing.T) {
- var name string = "name3373707"
- var content string = "content951530617"
- var expectedResponse = &irmpb.Annotation{
- Name: name,
- Content: content,
- }
-
- mockIncident.err = nil
- mockIncident.reqs = nil
-
- mockIncident.resps = append(mockIncident.resps[:0], expectedResponse)
-
- var annotation *irmpb.Annotation = &irmpb.Annotation{}
- var request = &irmpb.UpdateAnnotationRequest{
- Annotation: annotation,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.UpdateAnnotation(context.Background(), request)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if want, got := request, mockIncident.reqs[0]; !proto.Equal(want, got) {
- t.Errorf("wrong request %q, want %q", got, want)
- }
-
- if want, got := expectedResponse, resp; !proto.Equal(want, got) {
- t.Errorf("wrong response %q, want %q)", got, want)
- }
-}
-
-func TestIncidentServiceUpdateAnnotationError(t *testing.T) {
- errCode := codes.PermissionDenied
- mockIncident.err = gstatus.Error(errCode, "test error")
-
- var annotation *irmpb.Annotation = &irmpb.Annotation{}
- var request = &irmpb.UpdateAnnotationRequest{
- Annotation: annotation,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.UpdateAnnotation(context.Background(), request)
-
- if st, ok := gstatus.FromError(err); !ok {
- t.Errorf("got error %v, expected grpc error", err)
- } else if c := st.Code(); c != errCode {
- t.Errorf("got error code %q, want %q", c, errCode)
- }
- _ = resp
-}
func TestIncidentServiceCreateTag(t *testing.T) {
var name string = "name3373707"
var displayName string = "displayName1615086568"
- var url string = "url116079"
var expectedResponse = &irmpb.Tag{
Name: name,
DisplayName: displayName,
- Url: url,
}
mockIncident.err = nil
@@ -1285,11 +1204,11 @@
}
_ = resp
}
-func TestIncidentServiceListSignals(t *testing.T) {
+func TestIncidentServiceSearchSignals(t *testing.T) {
var nextPageToken string = ""
var signalsElement *irmpb.Signal = &irmpb.Signal{}
var signals = []*irmpb.Signal{signalsElement}
- var expectedResponse = &irmpb.ListSignalsResponse{
+ var expectedResponse = &irmpb.SearchSignalsResponse{
NextPageToken: nextPageToken,
Signals: signals,
}
@@ -1300,7 +1219,7 @@
mockIncident.resps = append(mockIncident.resps[:0], expectedResponse)
var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
- var request = &irmpb.ListSignalsRequest{
+ var request = &irmpb.SearchSignalsRequest{
Parent: formattedParent,
}
@@ -1309,7 +1228,7 @@
t.Fatal(err)
}
- resp, err := c.ListSignals(context.Background(), request).Next()
+ resp, err := c.SearchSignals(context.Background(), request).Next()
if err != nil {
t.Fatal(err)
@@ -1334,12 +1253,12 @@
}
}
-func TestIncidentServiceListSignalsError(t *testing.T) {
+func TestIncidentServiceSearchSignalsError(t *testing.T) {
errCode := codes.PermissionDenied
mockIncident.err = gstatus.Error(errCode, "test error")
var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
- var request = &irmpb.ListSignalsRequest{
+ var request = &irmpb.SearchSignalsRequest{
Parent: formattedParent,
}
@@ -1348,7 +1267,7 @@
t.Fatal(err)
}
- resp, err := c.ListSignals(context.Background(), request).Next()
+ resp, err := c.SearchSignals(context.Background(), request).Next()
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
@@ -1495,62 +1414,6 @@
}
_ = resp
}
-func TestIncidentServiceAcknowledgeSignal(t *testing.T) {
- var expectedResponse *irmpb.AcknowledgeSignalResponse = &irmpb.AcknowledgeSignalResponse{}
-
- mockIncident.err = nil
- mockIncident.reqs = nil
-
- mockIncident.resps = append(mockIncident.resps[:0], expectedResponse)
-
- var formattedName string = fmt.Sprintf("projects/%s/signals/%s", "[PROJECT]", "[SIGNAL]")
- var request = &irmpb.AcknowledgeSignalRequest{
- Name: formattedName,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.AcknowledgeSignal(context.Background(), request)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if want, got := request, mockIncident.reqs[0]; !proto.Equal(want, got) {
- t.Errorf("wrong request %q, want %q", got, want)
- }
-
- if want, got := expectedResponse, resp; !proto.Equal(want, got) {
- t.Errorf("wrong response %q, want %q)", got, want)
- }
-}
-
-func TestIncidentServiceAcknowledgeSignalError(t *testing.T) {
- errCode := codes.PermissionDenied
- mockIncident.err = gstatus.Error(errCode, "test error")
-
- var formattedName string = fmt.Sprintf("projects/%s/signals/%s", "[PROJECT]", "[SIGNAL]")
- var request = &irmpb.AcknowledgeSignalRequest{
- Name: formattedName,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.AcknowledgeSignal(context.Background(), request)
-
- if st, ok := gstatus.FromError(err); !ok {
- t.Errorf("got error %v, expected grpc error", err)
- } else if c := st.Code(); c != errCode {
- t.Errorf("got error code %q, want %q", c, errCode)
- }
- _ = resp
-}
func TestIncidentServiceEscalateIncident(t *testing.T) {
var expectedResponse *irmpb.EscalateIncidentResponse = &irmpb.EscalateIncidentResponse{}
@@ -1865,65 +1728,6 @@
t.Errorf("got error code %q, want %q", c, errCode)
}
}
-func TestIncidentServiceGetShiftHandoffPresets(t *testing.T) {
- var subject string = "subject-1867885268"
- var expectedResponse = &irmpb.ShiftHandoffPresets{
- Subject: subject,
- }
-
- mockIncident.err = nil
- mockIncident.reqs = nil
-
- mockIncident.resps = append(mockIncident.resps[:0], expectedResponse)
-
- var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
- var request = &irmpb.GetShiftHandoffPresetsRequest{
- Parent: formattedParent,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.GetShiftHandoffPresets(context.Background(), request)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if want, got := request, mockIncident.reqs[0]; !proto.Equal(want, got) {
- t.Errorf("wrong request %q, want %q", got, want)
- }
-
- if want, got := expectedResponse, resp; !proto.Equal(want, got) {
- t.Errorf("wrong response %q, want %q)", got, want)
- }
-}
-
-func TestIncidentServiceGetShiftHandoffPresetsError(t *testing.T) {
- errCode := codes.PermissionDenied
- mockIncident.err = gstatus.Error(errCode, "test error")
-
- var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
- var request = &irmpb.GetShiftHandoffPresetsRequest{
- Parent: formattedParent,
- }
-
- c, err := NewIncidentClient(context.Background(), clientOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.GetShiftHandoffPresets(context.Background(), request)
-
- if st, ok := gstatus.FromError(err); !ok {
- t.Errorf("got error %v, expected grpc error", err)
- } else if c := st.Code(); c != errCode {
- t.Errorf("got error code %q, want %q", c, errCode)
- }
- _ = resp
-}
func TestIncidentServiceSendShiftHandoff(t *testing.T) {
var contentType string = "contentType831846208"
var content string = "content951530617"
@@ -2058,6 +1862,67 @@
}
_ = resp
}
+func TestIncidentServiceUpdateSubscription(t *testing.T) {
+ var name string = "name3373707"
+ var etag string = "etag3123477"
+ var expectedResponse = &irmpb.Subscription{
+ Name: name,
+ Etag: etag,
+ }
+
+ mockIncident.err = nil
+ mockIncident.reqs = nil
+
+ mockIncident.resps = append(mockIncident.resps[:0], expectedResponse)
+
+ var subscription *irmpb.Subscription = &irmpb.Subscription{}
+ var request = &irmpb.UpdateSubscriptionRequest{
+ Subscription: subscription,
+ }
+
+ c, err := NewIncidentClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateSubscription(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockIncident.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestIncidentServiceUpdateSubscriptionError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockIncident.err = gstatus.Error(errCode, "test error")
+
+ var subscription *irmpb.Subscription = &irmpb.Subscription{}
+ var request = &irmpb.UpdateSubscriptionRequest{
+ Subscription: subscription,
+ }
+
+ c, err := NewIncidentClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateSubscription(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
func TestIncidentServiceListSubscriptions(t *testing.T) {
var nextPageToken string = ""
var subscriptionsElement *irmpb.Subscription = &irmpb.Subscription{}
diff --git a/redis/apiv1/cloud_redis_client.go b/redis/apiv1/cloud_redis_client.go
index 46b97f2..e97c7d7 100644
--- a/redis/apiv1/cloud_redis_client.go
+++ b/redis/apiv1/cloud_redis_client.go
@@ -36,11 +36,14 @@
// CloudRedisCallOptions contains the retry settings for each method of CloudRedisClient.
type CloudRedisCallOptions struct {
- ListInstances []gax.CallOption
- GetInstance []gax.CallOption
- CreateInstance []gax.CallOption
- UpdateInstance []gax.CallOption
- DeleteInstance []gax.CallOption
+ ListInstances []gax.CallOption
+ GetInstance []gax.CallOption
+ CreateInstance []gax.CallOption
+ UpdateInstance []gax.CallOption
+ DeleteInstance []gax.CallOption
+ ImportInstance []gax.CallOption
+ ExportInstance []gax.CallOption
+ FailoverInstance []gax.CallOption
}
func defaultCloudRedisClientOptions() []option.ClientOption {
@@ -53,11 +56,14 @@
func defaultCloudRedisCallOptions() *CloudRedisCallOptions {
retry := map[[2]string][]gax.CallOption{}
return &CloudRedisCallOptions{
- ListInstances: retry[[2]string{"default", "non_idempotent"}],
- GetInstance: retry[[2]string{"default", "non_idempotent"}],
- CreateInstance: retry[[2]string{"default", "non_idempotent"}],
- UpdateInstance: retry[[2]string{"default", "non_idempotent"}],
- DeleteInstance: retry[[2]string{"default", "non_idempotent"}],
+ ListInstances: retry[[2]string{"default", "non_idempotent"}],
+ GetInstance: retry[[2]string{"default", "non_idempotent"}],
+ CreateInstance: retry[[2]string{"default", "non_idempotent"}],
+ UpdateInstance: retry[[2]string{"default", "non_idempotent"}],
+ DeleteInstance: retry[[2]string{"default", "non_idempotent"}],
+ ImportInstance: retry[[2]string{"default", "non_idempotent"}],
+ ExportInstance: retry[[2]string{"default", "non_idempotent"}],
+ FailoverInstance: retry[[2]string{"default", "non_idempotent"}],
}
}
@@ -282,6 +288,73 @@
}, nil
}
+// ImportInstance import a Redis RDB snapshot file from GCS into a Redis instance.
+//
+// Redis may stop serving during this operation. Instance state will be
+// IMPORTING for entire operation. When complete, the instance will contain
+// only data from the imported file.
+//
+// The returned operation is automatically deleted after a few hours, so
+// there is no need to call DeleteOperation.
+func (c *CloudRedisClient) ImportInstance(ctx context.Context, req *redispb.ImportInstanceRequest, opts ...gax.CallOption) (*ImportInstanceOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.ImportInstance[0:len(c.CallOptions.ImportInstance):len(c.CallOptions.ImportInstance)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.cloudRedisClient.ImportInstance(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ImportInstanceOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ExportInstance export Redis instance data into a Redis RDB format file in GCS.
+//
+// Redis will continue serving during this operation.
+//
+// The returned operation is automatically deleted after a few hours, so
+// there is no need to call DeleteOperation.
+func (c *CloudRedisClient) ExportInstance(ctx context.Context, req *redispb.ExportInstanceRequest, opts ...gax.CallOption) (*ExportInstanceOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.ExportInstance[0:len(c.CallOptions.ExportInstance):len(c.CallOptions.ExportInstance)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.cloudRedisClient.ExportInstance(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ExportInstanceOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// FailoverInstance failover the master role to current replica node against a specific
+// STANDARD tier redis instance.
+func (c *CloudRedisClient) FailoverInstance(ctx context.Context, req *redispb.FailoverInstanceRequest, opts ...gax.CallOption) (*FailoverInstanceOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.FailoverInstance[0:len(c.CallOptions.FailoverInstance):len(c.CallOptions.FailoverInstance)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.cloudRedisClient.FailoverInstance(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &FailoverInstanceOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
// InstanceIterator manages a stream of *redispb.Instance.
type InstanceIterator struct {
items []*redispb.Instance
@@ -449,6 +522,213 @@
return op.lro.Name()
}
+// ExportInstanceOperation manages a long-running operation from ExportInstance.
+type ExportInstanceOperation struct {
+ lro *longrunning.Operation
+}
+
+// ExportInstanceOperation returns a new ExportInstanceOperation from a given name.
+// The name must be that of a previously created ExportInstanceOperation, possibly from a different process.
+func (c *CloudRedisClient) ExportInstanceOperation(name string) *ExportInstanceOperation {
+ return &ExportInstanceOperation{
+ 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 *ExportInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, 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 *ExportInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ 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 *ExportInstanceOperation) Metadata() (*redispb.OperationMetadata, error) {
+ var meta redispb.OperationMetadata
+ 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 *ExportInstanceOperation) 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 *ExportInstanceOperation) Name() string {
+ return op.lro.Name()
+}
+
+// FailoverInstanceOperation manages a long-running operation from FailoverInstance.
+type FailoverInstanceOperation struct {
+ lro *longrunning.Operation
+}
+
+// FailoverInstanceOperation returns a new FailoverInstanceOperation from a given name.
+// The name must be that of a previously created FailoverInstanceOperation, possibly from a different process.
+func (c *CloudRedisClient) FailoverInstanceOperation(name string) *FailoverInstanceOperation {
+ return &FailoverInstanceOperation{
+ 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 *FailoverInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, 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 *FailoverInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ 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 *FailoverInstanceOperation) Metadata() (*redispb.OperationMetadata, error) {
+ var meta redispb.OperationMetadata
+ 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 *FailoverInstanceOperation) 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 *FailoverInstanceOperation) Name() string {
+ return op.lro.Name()
+}
+
+// ImportInstanceOperation manages a long-running operation from ImportInstance.
+type ImportInstanceOperation struct {
+ lro *longrunning.Operation
+}
+
+// ImportInstanceOperation returns a new ImportInstanceOperation from a given name.
+// The name must be that of a previously created ImportInstanceOperation, possibly from a different process.
+func (c *CloudRedisClient) ImportInstanceOperation(name string) *ImportInstanceOperation {
+ return &ImportInstanceOperation{
+ 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 *ImportInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, 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 *ImportInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ 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 *ImportInstanceOperation) Metadata() (*redispb.OperationMetadata, error) {
+ var meta redispb.OperationMetadata
+ 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 *ImportInstanceOperation) 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 *ImportInstanceOperation) Name() string {
+ return op.lro.Name()
+}
+
// UpdateInstanceOperation manages a long-running operation from UpdateInstance.
type UpdateInstanceOperation struct {
lro *longrunning.Operation
diff --git a/redis/apiv1/cloud_redis_client_example_test.go b/redis/apiv1/cloud_redis_client_example_test.go
index 0a1215b..39a1cfe 100644
--- a/redis/apiv1/cloud_redis_client_example_test.go
+++ b/redis/apiv1/cloud_redis_client_example_test.go
@@ -140,3 +140,72 @@
err = op.Wait(ctx)
// TODO: Handle error.
}
+
+func ExampleCloudRedisClient_ImportInstance() {
+ ctx := context.Background()
+ c, err := redis.NewCloudRedisClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &redispb.ImportInstanceRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ImportInstance(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleCloudRedisClient_ExportInstance() {
+ ctx := context.Background()
+ c, err := redis.NewCloudRedisClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &redispb.ExportInstanceRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ExportInstance(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleCloudRedisClient_FailoverInstance() {
+ ctx := context.Background()
+ c, err := redis.NewCloudRedisClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &redispb.FailoverInstanceRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.FailoverInstance(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/redis/apiv1/doc.go b/redis/apiv1/doc.go
index 98fc3e7..3a96791 100644
--- a/redis/apiv1/doc.go
+++ b/redis/apiv1/doc.go
@@ -18,9 +18,7 @@
// Google Cloud Memorystore for Redis API.
//
-// The Google Cloud Memorystore for Redis API is used for creating and
-// managing
-// Redis instances on the Google Cloud Platform.
+// Creates and manages Redis instances on the Google Cloud Platform.
package redis // import "cloud.google.com/go/redis/apiv1"
import (
@@ -87,4 +85,4 @@
return "UNKNOWN"
}
-const versionClient = "20190121"
+const versionClient = "20190225"
diff --git a/redis/apiv1/mock_test.go b/redis/apiv1/mock_test.go
index 1f71073..7cd1bcd 100644
--- a/redis/apiv1/mock_test.go
+++ b/redis/apiv1/mock_test.go
@@ -111,6 +111,42 @@
return s.resps[0].(*longrunningpb.Operation), nil
}
+func (s *mockCloudRedisServer) ImportInstance(ctx context.Context, req *redispb.ImportInstanceRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
+func (s *mockCloudRedisServer) ExportInstance(ctx context.Context, req *redispb.ExportInstanceRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
+func (s *mockCloudRedisServer) FailoverInstance(ctx context.Context, req *redispb.FailoverInstanceRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
func (s *mockCloudRedisServer) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest) (*longrunningpb.Operation, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -237,19 +273,21 @@
var statusMessage string = "statusMessage-239442758"
var memorySizeGb int32 = 34199707
var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
var expectedResponse = &redispb.Instance{
- Name: name2,
- DisplayName: displayName,
- LocationId: locationId,
- AlternativeLocationId: alternativeLocationId,
- RedisVersion: redisVersion,
- ReservedIpRange: reservedIpRange,
- Host: host,
- Port: port,
- CurrentLocationId: currentLocationId,
- StatusMessage: statusMessage,
- MemorySizeGb: memorySizeGb,
- AuthorizedNetwork: authorizedNetwork,
+ Name: name2,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
}
mockCloudRedis.err = nil
@@ -318,19 +356,21 @@
var statusMessage string = "statusMessage-239442758"
var memorySizeGb2 int32 = 1493816946
var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
var expectedResponse = &redispb.Instance{
- Name: name,
- DisplayName: displayName,
- LocationId: locationId,
- AlternativeLocationId: alternativeLocationId,
- RedisVersion: redisVersion,
- ReservedIpRange: reservedIpRange,
- Host: host,
- Port: port,
- CurrentLocationId: currentLocationId,
- StatusMessage: statusMessage,
- MemorySizeGb: memorySizeGb2,
- AuthorizedNetwork: authorizedNetwork,
+ Name: name,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb2,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
}
mockCloudRedis.err = nil
@@ -443,19 +483,21 @@
var statusMessage string = "statusMessage-239442758"
var memorySizeGb2 int32 = 1493816946
var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
var expectedResponse = &redispb.Instance{
- Name: name,
- DisplayName: displayName2,
- LocationId: locationId,
- AlternativeLocationId: alternativeLocationId,
- RedisVersion: redisVersion,
- ReservedIpRange: reservedIpRange,
- Host: host,
- Port: port,
- CurrentLocationId: currentLocationId,
- StatusMessage: statusMessage,
- MemorySizeGb: memorySizeGb2,
- AuthorizedNetwork: authorizedNetwork,
+ Name: name,
+ DisplayName: displayName2,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb2,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
}
mockCloudRedis.err = nil
@@ -639,3 +681,342 @@
t.Errorf("got error code %q, want %q", c, errCode)
}
}
+func TestCloudRedisImportInstance(t *testing.T) {
+ var name2 string = "name2-1052831874"
+ var displayName string = "displayName1615086568"
+ var locationId string = "locationId552319461"
+ var alternativeLocationId string = "alternativeLocationId-718920621"
+ var redisVersion string = "redisVersion-685310444"
+ var reservedIpRange string = "reservedIpRange-1082940580"
+ var host string = "host3208616"
+ var port int32 = 3446913
+ var currentLocationId string = "currentLocationId1312712735"
+ var statusMessage string = "statusMessage-239442758"
+ var memorySizeGb int32 = 34199707
+ var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
+ var expectedResponse = &redispb.Instance{
+ Name: name2,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
+ }
+
+ mockCloudRedis.err = nil
+ mockCloudRedis.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var inputConfig *redispb.InputConfig = &redispb.InputConfig{}
+ var request = &redispb.ImportInstanceRequest{
+ Name: formattedName,
+ InputConfig: inputConfig,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ImportInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestCloudRedisImportInstanceError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockCloudRedis.err = nil
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var inputConfig *redispb.InputConfig = &redispb.InputConfig{}
+ var request = &redispb.ImportInstanceRequest{
+ Name: formattedName,
+ InputConfig: inputConfig,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ImportInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestCloudRedisExportInstance(t *testing.T) {
+ var name2 string = "name2-1052831874"
+ var displayName string = "displayName1615086568"
+ var locationId string = "locationId552319461"
+ var alternativeLocationId string = "alternativeLocationId-718920621"
+ var redisVersion string = "redisVersion-685310444"
+ var reservedIpRange string = "reservedIpRange-1082940580"
+ var host string = "host3208616"
+ var port int32 = 3446913
+ var currentLocationId string = "currentLocationId1312712735"
+ var statusMessage string = "statusMessage-239442758"
+ var memorySizeGb int32 = 34199707
+ var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
+ var expectedResponse = &redispb.Instance{
+ Name: name2,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
+ }
+
+ mockCloudRedis.err = nil
+ mockCloudRedis.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var outputConfig *redispb.OutputConfig = &redispb.OutputConfig{}
+ var request = &redispb.ExportInstanceRequest{
+ Name: formattedName,
+ OutputConfig: outputConfig,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ExportInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestCloudRedisExportInstanceError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockCloudRedis.err = nil
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var outputConfig *redispb.OutputConfig = &redispb.OutputConfig{}
+ var request = &redispb.ExportInstanceRequest{
+ Name: formattedName,
+ OutputConfig: outputConfig,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ExportInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestCloudRedisFailoverInstance(t *testing.T) {
+ var name2 string = "name2-1052831874"
+ var displayName string = "displayName1615086568"
+ var locationId string = "locationId552319461"
+ var alternativeLocationId string = "alternativeLocationId-718920621"
+ var redisVersion string = "redisVersion-685310444"
+ var reservedIpRange string = "reservedIpRange-1082940580"
+ var host string = "host3208616"
+ var port int32 = 3446913
+ var currentLocationId string = "currentLocationId1312712735"
+ var statusMessage string = "statusMessage-239442758"
+ var memorySizeGb int32 = 34199707
+ var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var persistenceIamIdentity string = "persistenceIamIdentity1061944584"
+ var expectedResponse = &redispb.Instance{
+ Name: name2,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb,
+ AuthorizedNetwork: authorizedNetwork,
+ PersistenceIamIdentity: persistenceIamIdentity,
+ }
+
+ mockCloudRedis.err = nil
+ mockCloudRedis.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var dataProtectionMode redispb.FailoverInstanceRequest_DataProtectionMode = redispb.FailoverInstanceRequest_DATA_PROTECTION_MODE_UNSPECIFIED
+ var request = &redispb.FailoverInstanceRequest{
+ Name: formattedName,
+ DataProtectionMode: dataProtectionMode,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.FailoverInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestCloudRedisFailoverInstanceError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockCloudRedis.err = nil
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var dataProtectionMode redispb.FailoverInstanceRequest_DataProtectionMode = redispb.FailoverInstanceRequest_DATA_PROTECTION_MODE_UNSPECIFIED
+ var request = &redispb.FailoverInstanceRequest{
+ Name: formattedName,
+ DataProtectionMode: dataProtectionMode,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.FailoverInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go
index df322ef..a3f7951 100644
--- a/redis/apiv1beta1/doc.go
+++ b/redis/apiv1beta1/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20190121"
+const versionClient = "20190225"
diff --git a/regen-gapic.sh b/regen-gapic.sh
index 8c17d45..f98e581 100755
--- a/regen-gapic.sh
+++ b/regen-gapic.sh
@@ -45,7 +45,7 @@
google/cloud/securitycenter/artman_securitycenter_v1beta1.yaml
google/cloud/speech/artman_speech_v1.yaml
google/cloud/speech/artman_speech_v1p1beta1.yaml
-google/cloud/talent/artman_jobs_v4beta1.yaml
+google/cloud/talent/artman_talent_v4beta1.yaml
google/cloud/tasks/artman_cloudtasks_v2beta2.yaml
google/cloud/tasks/artman_cloudtasks_v2beta3.yaml
google/cloud/texttospeech/artman_texttospeech_v1.yaml
diff --git a/talent/apiv4beta1/company_client.go b/talent/apiv4beta1/company_client.go
index 4fb00cc..f35b11e 100644
--- a/talent/apiv4beta1/company_client.go
+++ b/talent/apiv4beta1/company_client.go
@@ -91,7 +91,7 @@
// NewCompanyClient creates a new company service client.
//
-// A service handles company management, including CRUD and job enumeration.
+// A service that handles company management, including CRUD and enumeration.
func NewCompanyClient(ctx context.Context, opts ...option.ClientOption) (*CompanyClient, error) {
conn, err := transport.DialGRPC(ctx, append(defaultCompanyClientOptions(), opts...)...)
if err != nil {
@@ -159,9 +159,7 @@
return resp, nil
}
-// UpdateCompany updates specified company. Company names can't be updated. To update a
-// company name, delete the company and all jobs associated with it, and only
-// then re-create them.
+// UpdateCompany updates specified company.
func (c *CompanyClient) UpdateCompany(ctx context.Context, req *talentpb.UpdateCompanyRequest, opts ...gax.CallOption) (*talentpb.Company, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.UpdateCompany[0:len(c.CallOptions.UpdateCompany):len(c.CallOptions.UpdateCompany)], opts...)
@@ -190,7 +188,7 @@
return err
}
-// ListCompanies lists all companies associated with the service account.
+// ListCompanies lists all companies associated with the project.
func (c *CompanyClient) ListCompanies(ctx context.Context, req *talentpb.ListCompaniesRequest, opts ...gax.CallOption) *CompanyIterator {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.ListCompanies[0:len(c.CallOptions.ListCompanies):len(c.CallOptions.ListCompanies)], opts...)
diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go
index e988eff..5517b59 100644
--- a/talent/apiv4beta1/doc.go
+++ b/talent/apiv4beta1/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20190127"
+const versionClient = "20190225"
diff --git a/talent/apiv4beta1/mock_test.go b/talent/apiv4beta1/mock_test.go
index 467c69f..655e4c0 100644
--- a/talent/apiv4beta1/mock_test.go
+++ b/talent/apiv4beta1/mock_test.go
@@ -400,6 +400,81 @@
return s.resps[0].(*talentpb.ParseResumeResponse), nil
}
+type mockTenantServer struct {
+ // Embed for forward compatibility.
+ // Tests will keep working if more methods are added
+ // in the future.
+ talentpb.TenantServiceServer
+
+ reqs []proto.Message
+
+ // If set, all calls return this error.
+ err error
+
+ // responses to return if err == nil
+ resps []proto.Message
+}
+
+func (s *mockTenantServer) CreateTenant(ctx context.Context, req *talentpb.CreateTenantRequest) (*talentpb.Tenant, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*talentpb.Tenant), nil
+}
+
+func (s *mockTenantServer) GetTenant(ctx context.Context, req *talentpb.GetTenantRequest) (*talentpb.Tenant, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*talentpb.Tenant), nil
+}
+
+func (s *mockTenantServer) UpdateTenant(ctx context.Context, req *talentpb.UpdateTenantRequest) (*talentpb.Tenant, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*talentpb.Tenant), nil
+}
+
+func (s *mockTenantServer) DeleteTenant(ctx context.Context, req *talentpb.DeleteTenantRequest) (*emptypb.Empty, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*emptypb.Empty), nil
+}
+
+func (s *mockTenantServer) ListTenants(ctx context.Context, req *talentpb.ListTenantsRequest) (*talentpb.ListTenantsResponse, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*talentpb.ListTenantsResponse), nil
+}
+
// clientOpt is the option tests should use to connect to the test server.
// It is initialized by TestMain.
var clientOpt option.ClientOption
@@ -411,6 +486,7 @@
mockJob mockJobServer
mockProfile mockProfileServer
mockResume mockResumeServer
+ mockTenant mockTenantServer
)
func TestMain(m *testing.M) {
@@ -423,6 +499,7 @@
talentpb.RegisterJobServiceServer(serv, &mockJob)
talentpb.RegisterProfileServiceServer(serv, &mockProfile)
talentpb.RegisterResumeServiceServer(serv, &mockResume)
+ talentpb.RegisterTenantServiceServer(serv, &mockTenant)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@@ -865,11 +942,9 @@
func TestEventServiceCreateClientEvent(t *testing.T) {
var requestId string = "requestId37109963"
var eventId string = "eventId278118624"
- var parentEventId string = "parentEventId-436467499"
var expectedResponse = &talentpb.ClientEvent{
- RequestId: requestId,
- EventId: eventId,
- ParentEventId: parentEventId,
+ RequestId: requestId,
+ EventId: eventId,
}
mockEvent.err = nil
@@ -1047,7 +1122,7 @@
mockJob.resps = append(mockJob.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOB]")
+ var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOBS]")
var request = &talentpb.GetJobRequest{
Name: formattedName,
}
@@ -1076,7 +1151,7 @@
errCode := codes.PermissionDenied
mockJob.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOB]")
+ var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOBS]")
var request = &talentpb.GetJobRequest{
Name: formattedName,
}
@@ -1184,7 +1259,7 @@
mockJob.resps = append(mockJob.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOB]")
+ var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOBS]")
var request = &talentpb.DeleteJobRequest{
Name: formattedName,
}
@@ -1210,7 +1285,7 @@
errCode := codes.PermissionDenied
mockJob.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOB]")
+ var formattedName string = fmt.Sprintf("projects/%s/jobs/%s", "[PROJECT]", "[JOBS]")
var request = &talentpb.DeleteJobRequest{
Name: formattedName,
}
@@ -1538,7 +1613,7 @@
mockProfile.resps = append(mockProfile.resps[:0], expectedResponse)
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var request = &talentpb.ListProfilesRequest{
Parent: formattedParent,
}
@@ -1577,7 +1652,7 @@
errCode := codes.PermissionDenied
mockProfile.err = gstatus.Error(errCode, "test error")
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var request = &talentpb.ListProfilesRequest{
Parent: formattedParent,
}
@@ -1621,7 +1696,7 @@
mockProfile.resps = append(mockProfile.resps[:0], expectedResponse)
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var profile *talentpb.Profile = &talentpb.Profile{}
var request = &talentpb.CreateProfileRequest{
Parent: formattedParent,
@@ -1652,7 +1727,7 @@
errCode := codes.PermissionDenied
mockProfile.err = gstatus.Error(errCode, "test error")
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var profile *talentpb.Profile = &talentpb.Profile{}
var request = &talentpb.CreateProfileRequest{
Parent: formattedParent,
@@ -1698,7 +1773,7 @@
mockProfile.resps = append(mockProfile.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/companies/%s/profiles/%s", "[PROJECT]", "[COMPANY]", "[PROFILE]")
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s/profiles/%s", "[PROJECT]", "[TENANT]", "[PROFILE]")
var request = &talentpb.GetProfileRequest{
Name: formattedName,
}
@@ -1727,7 +1802,7 @@
errCode := codes.PermissionDenied
mockProfile.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/companies/%s/profiles/%s", "[PROJECT]", "[COMPANY]", "[PROFILE]")
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s/profiles/%s", "[PROJECT]", "[TENANT]", "[PROFILE]")
var request = &talentpb.GetProfileRequest{
Name: formattedName,
}
@@ -1827,7 +1902,7 @@
mockProfile.resps = append(mockProfile.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/companies/%s/profiles/%s", "[PROJECT]", "[COMPANY]", "[PROFILE]")
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s/profiles/%s", "[PROJECT]", "[TENANT]", "[PROFILE]")
var request = &talentpb.DeleteProfileRequest{
Name: formattedName,
}
@@ -1853,7 +1928,7 @@
errCode := codes.PermissionDenied
mockProfile.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/companies/%s/profiles/%s", "[PROJECT]", "[COMPANY]", "[PROFILE]")
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s/profiles/%s", "[PROJECT]", "[TENANT]", "[PROFILE]")
var request = &talentpb.DeleteProfileRequest{
Name: formattedName,
}
@@ -1887,7 +1962,7 @@
mockProfile.resps = append(mockProfile.resps[:0], expectedResponse)
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var requestMetadata *talentpb.RequestMetadata = &talentpb.RequestMetadata{}
var request = &talentpb.SearchProfilesRequest{
Parent: formattedParent,
@@ -1928,7 +2003,7 @@
errCode := codes.PermissionDenied
mockProfile.err = gstatus.Error(errCode, "test error")
- var formattedParent string = fmt.Sprintf("projects/%s/companies/%s", "[PROJECT]", "[COMPANY]")
+ var formattedParent string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
var requestMetadata *talentpb.RequestMetadata = &talentpb.RequestMetadata{}
var request = &talentpb.SearchProfilesRequest{
Parent: formattedParent,
@@ -2012,3 +2087,314 @@
}
_ = resp
}
+func TestTenantServiceCreateTenant(t *testing.T) {
+ var name string = "name3373707"
+ var externalId string = "externalId-1153075697"
+ var expectedResponse = &talentpb.Tenant{
+ Name: name,
+ ExternalId: externalId,
+ }
+
+ mockTenant.err = nil
+ mockTenant.reqs = nil
+
+ mockTenant.resps = append(mockTenant.resps[:0], expectedResponse)
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var tenant *talentpb.Tenant = &talentpb.Tenant{}
+ var request = &talentpb.CreateTenantRequest{
+ Parent: formattedParent,
+ Tenant: tenant,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.CreateTenant(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockTenant.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestTenantServiceCreateTenantError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockTenant.err = gstatus.Error(errCode, "test error")
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var tenant *talentpb.Tenant = &talentpb.Tenant{}
+ var request = &talentpb.CreateTenantRequest{
+ Parent: formattedParent,
+ Tenant: tenant,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.CreateTenant(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestTenantServiceGetTenant(t *testing.T) {
+ var name2 string = "name2-1052831874"
+ var externalId string = "externalId-1153075697"
+ var expectedResponse = &talentpb.Tenant{
+ Name: name2,
+ ExternalId: externalId,
+ }
+
+ mockTenant.err = nil
+ mockTenant.reqs = nil
+
+ mockTenant.resps = append(mockTenant.resps[:0], expectedResponse)
+
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
+ var request = &talentpb.GetTenantRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.GetTenant(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockTenant.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestTenantServiceGetTenantError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockTenant.err = gstatus.Error(errCode, "test error")
+
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
+ var request = &talentpb.GetTenantRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.GetTenant(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestTenantServiceUpdateTenant(t *testing.T) {
+ var name string = "name3373707"
+ var externalId string = "externalId-1153075697"
+ var expectedResponse = &talentpb.Tenant{
+ Name: name,
+ ExternalId: externalId,
+ }
+
+ mockTenant.err = nil
+ mockTenant.reqs = nil
+
+ mockTenant.resps = append(mockTenant.resps[:0], expectedResponse)
+
+ var tenant *talentpb.Tenant = &talentpb.Tenant{}
+ var request = &talentpb.UpdateTenantRequest{
+ Tenant: tenant,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateTenant(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockTenant.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestTenantServiceUpdateTenantError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockTenant.err = gstatus.Error(errCode, "test error")
+
+ var tenant *talentpb.Tenant = &talentpb.Tenant{}
+ var request = &talentpb.UpdateTenantRequest{
+ Tenant: tenant,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateTenant(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestTenantServiceDeleteTenant(t *testing.T) {
+ var expectedResponse *emptypb.Empty = &emptypb.Empty{}
+
+ mockTenant.err = nil
+ mockTenant.reqs = nil
+
+ mockTenant.resps = append(mockTenant.resps[:0], expectedResponse)
+
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
+ var request = &talentpb.DeleteTenantRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = c.DeleteTenant(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockTenant.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+}
+
+func TestTenantServiceDeleteTenantError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockTenant.err = gstatus.Error(errCode, "test error")
+
+ var formattedName string = fmt.Sprintf("projects/%s/tenants/%s", "[PROJECT]", "[TENANT]")
+ var request = &talentpb.DeleteTenantRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = c.DeleteTenant(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+}
+func TestTenantServiceListTenants(t *testing.T) {
+ var nextPageToken string = ""
+ var tenantsElement *talentpb.Tenant = &talentpb.Tenant{}
+ var tenants = []*talentpb.Tenant{tenantsElement}
+ var expectedResponse = &talentpb.ListTenantsResponse{
+ NextPageToken: nextPageToken,
+ Tenants: tenants,
+ }
+
+ mockTenant.err = nil
+ mockTenant.reqs = nil
+
+ mockTenant.resps = append(mockTenant.resps[:0], expectedResponse)
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var request = &talentpb.ListTenantsRequest{
+ Parent: formattedParent,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.ListTenants(context.Background(), request).Next()
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockTenant.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ want := (interface{})(expectedResponse.Tenants[0])
+ got := (interface{})(resp)
+ var ok bool
+
+ switch want := (want).(type) {
+ case proto.Message:
+ ok = proto.Equal(want, got.(proto.Message))
+ default:
+ ok = want == got
+ }
+ if !ok {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestTenantServiceListTenantsError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockTenant.err = gstatus.Error(errCode, "test error")
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var request = &talentpb.ListTenantsRequest{
+ Parent: formattedParent,
+ }
+
+ c, err := NewTenantClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.ListTenants(context.Background(), request).Next()
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
diff --git a/talent/apiv4beta1/profile_client.go b/talent/apiv4beta1/profile_client.go
index 6f42add..2fa605c 100644
--- a/talent/apiv4beta1/profile_client.go
+++ b/talent/apiv4beta1/profile_client.go
@@ -227,7 +227,7 @@
return err
}
-// SearchProfiles searches for profiles within a company.
+// SearchProfiles searches for profiles within a tenant.
//
// For example, search by raw queries "software engineer in Mountain View" or
// search by structured filters (location filter, education filter, etc.).
diff --git a/talent/apiv4beta1/resume_client.go b/talent/apiv4beta1/resume_client.go
index 5396219..7166c54 100644
--- a/talent/apiv4beta1/resume_client.go
+++ b/talent/apiv4beta1/resume_client.go
@@ -127,7 +127,7 @@
// resume, clients need to call the CreateProfile method again with the
// profile returned.
//
-// This API supports the following list of formats:
+// The following list of formats are supported:
//
// PDF
//
@@ -139,7 +139,8 @@
//
// DOCX
//
-// An error is thrown if the input format is not supported.
+// PNG (only when [ParseResumeRequest.enable_ocr][] is set to true,
+// otherwise an error is thrown)
func (c *ResumeClient) ParseResume(ctx context.Context, req *talentpb.ParseResumeRequest, opts ...gax.CallOption) (*talentpb.ParseResumeResponse, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.ParseResume[0:len(c.CallOptions.ParseResume):len(c.CallOptions.ParseResume)], opts...)
diff --git a/talent/apiv4beta1/tenant_client.go b/talent/apiv4beta1/tenant_client.go
new file mode 100644
index 0000000..dc834a2
--- /dev/null
+++ b/talent/apiv4beta1/tenant_client.go
@@ -0,0 +1,267 @@
+// Copyright 2019 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
+//
+// https://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 gapic-generator. DO NOT EDIT.
+
+package talent
+
+import (
+ "context"
+ "math"
+ "time"
+
+ "github.com/golang/protobuf/proto"
+ gax "github.com/googleapis/gax-go/v2"
+ "google.golang.org/api/iterator"
+ "google.golang.org/api/option"
+ "google.golang.org/api/transport"
+ talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+// TenantCallOptions contains the retry settings for each method of TenantClient.
+type TenantCallOptions struct {
+ CreateTenant []gax.CallOption
+ GetTenant []gax.CallOption
+ UpdateTenant []gax.CallOption
+ DeleteTenant []gax.CallOption
+ ListTenants []gax.CallOption
+}
+
+func defaultTenantClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ option.WithEndpoint("jobs.googleapis.com:443"),
+ option.WithScopes(DefaultAuthScopes()...),
+ }
+}
+
+func defaultTenantCallOptions() *TenantCallOptions {
+ retry := map[[2]string][]gax.CallOption{
+ {"default", "idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ }
+ return &TenantCallOptions{
+ CreateTenant: retry[[2]string{"default", "non_idempotent"}],
+ GetTenant: retry[[2]string{"default", "idempotent"}],
+ UpdateTenant: retry[[2]string{"default", "non_idempotent"}],
+ DeleteTenant: retry[[2]string{"default", "idempotent"}],
+ ListTenants: retry[[2]string{"default", "idempotent"}],
+ }
+}
+
+// TenantClient is a client for interacting with Cloud Talent Solution API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type TenantClient struct {
+ // The connection to the service.
+ conn *grpc.ClientConn
+
+ // The gRPC API client.
+ tenantClient talentpb.TenantServiceClient
+
+ // The call options for this service.
+ CallOptions *TenantCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewTenantClient creates a new tenant service client.
+//
+// A service that handles tenant management, including CRUD and enumeration.
+func NewTenantClient(ctx context.Context, opts ...option.ClientOption) (*TenantClient, error) {
+ conn, err := transport.DialGRPC(ctx, append(defaultTenantClientOptions(), opts...)...)
+ if err != nil {
+ return nil, err
+ }
+ c := &TenantClient{
+ conn: conn,
+ CallOptions: defaultTenantCallOptions(),
+
+ tenantClient: talentpb.NewTenantServiceClient(conn),
+ }
+ c.setGoogleClientInfo()
+ return c, nil
+}
+
+// Connection returns the client's connection to the API service.
+func (c *TenantClient) Connection() *grpc.ClientConn {
+ return c.conn
+}
+
+// Close closes the connection to the API service. The user should invoke this when
+// the client is no longer required.
+func (c *TenantClient) Close() error {
+ return c.conn.Close()
+}
+
+// setGoogleClientInfo sets the name and version of the application in
+// the `x-goog-api-client` header passed on each request. Intended for
+// use by Google-written clients.
+func (c *TenantClient) setGoogleClientInfo(keyval ...string) {
+ kv := append([]string{"gl-go", versionGo()}, keyval...)
+ kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
+ c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
+}
+
+// CreateTenant creates a new tenant entity.
+func (c *TenantClient) CreateTenant(ctx context.Context, req *talentpb.CreateTenantRequest, opts ...gax.CallOption) (*talentpb.Tenant, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.CreateTenant[0:len(c.CallOptions.CreateTenant):len(c.CallOptions.CreateTenant)], opts...)
+ var resp *talentpb.Tenant
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.tenantClient.CreateTenant(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetTenant retrieves specified tenant.
+func (c *TenantClient) GetTenant(ctx context.Context, req *talentpb.GetTenantRequest, opts ...gax.CallOption) (*talentpb.Tenant, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.GetTenant[0:len(c.CallOptions.GetTenant):len(c.CallOptions.GetTenant)], opts...)
+ var resp *talentpb.Tenant
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.tenantClient.GetTenant(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateTenant updates specified tenant.
+func (c *TenantClient) UpdateTenant(ctx context.Context, req *talentpb.UpdateTenantRequest, opts ...gax.CallOption) (*talentpb.Tenant, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.UpdateTenant[0:len(c.CallOptions.UpdateTenant):len(c.CallOptions.UpdateTenant)], opts...)
+ var resp *talentpb.Tenant
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.tenantClient.UpdateTenant(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteTenant deletes specified tenant.
+func (c *TenantClient) DeleteTenant(ctx context.Context, req *talentpb.DeleteTenantRequest, opts ...gax.CallOption) error {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.DeleteTenant[0:len(c.CallOptions.DeleteTenant):len(c.CallOptions.DeleteTenant)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.tenantClient.DeleteTenant(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// ListTenants lists all tenants associated with the project.
+func (c *TenantClient) ListTenants(ctx context.Context, req *talentpb.ListTenantsRequest, opts ...gax.CallOption) *TenantIterator {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.ListTenants[0:len(c.CallOptions.ListTenants):len(c.CallOptions.ListTenants)], opts...)
+ it := &TenantIterator{}
+ req = proto.Clone(req).(*talentpb.ListTenantsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*talentpb.Tenant, string, error) {
+ var resp *talentpb.ListTenantsResponse
+ req.PageToken = pageToken
+ if pageSize > math.MaxInt32 {
+ req.PageSize = math.MaxInt32
+ } else {
+ req.PageSize = int32(pageSize)
+ }
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.tenantClient.ListTenants(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+ return resp.Tenants, resp.NextPageToken, 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.PageSize)
+ return it
+}
+
+// TenantIterator manages a stream of *talentpb.Tenant.
+type TenantIterator struct {
+ items []*talentpb.Tenant
+ pageInfo *iterator.PageInfo
+ nextFunc func() error
+
+ // 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 []*talentpb.Tenant, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *TenantIterator) 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 *TenantIterator) Next() (*talentpb.Tenant, error) {
+ var item *talentpb.Tenant
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *TenantIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *TenantIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/talent/apiv4beta1/tenant_client_example_test.go b/talent/apiv4beta1/tenant_client_example_test.go
new file mode 100644
index 0000000..9994f34
--- /dev/null
+++ b/talent/apiv4beta1/tenant_client_example_test.go
@@ -0,0 +1,129 @@
+// Copyright 2019 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
+//
+// https://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 gapic-generator. DO NOT EDIT.
+
+package talent_test
+
+import (
+ "context"
+
+ talent "cloud.google.com/go/talent/apiv4beta1"
+ "google.golang.org/api/iterator"
+ talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
+)
+
+func ExampleNewTenantClient() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleTenantClient_CreateTenant() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &talentpb.CreateTenantRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateTenant(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTenantClient_GetTenant() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &talentpb.GetTenantRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetTenant(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTenantClient_UpdateTenant() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &talentpb.UpdateTenantRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateTenant(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTenantClient_DeleteTenant() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &talentpb.DeleteTenantRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteTenant(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleTenantClient_ListTenants() {
+ ctx := context.Background()
+ c, err := talent.NewTenantClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &talentpb.ListTenantsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListTenants(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}