Created
November 13, 2019 03:23
-
-
Save sinmetal/3482088f9ab73c22aa9415ab3eec7eeb to your computer and use it in GitHub Desktop.
cloud.google.com/go/spanner/admin sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"google.golang.org/genproto/protobuf/field_mask" | |
instance "cloud.google.com/go/spanner/admin/instance/apiv1" | |
instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" | |
) | |
func main() { | |
ctx := context.Background() | |
UpdateInstance(ctx) | |
} | |
func UpdateInstance(ctx context.Context) { | |
c, err := instance.NewInstanceAdminClient(ctx) | |
if err != nil { | |
fmt.Printf("failed new admin client. err=%+v\n", err) | |
} | |
req := &instancepb.UpdateInstanceRequest{ | |
Instance: &instancepb.Instance{ | |
Name: fmt.Sprintf("projects/%s/instances/%s", "gcpug-public-spanner", "merpay-sponsored-instance"), | |
NodeCount: 3, | |
}, | |
FieldMask: &field_mask.FieldMask{ | |
Paths: []string{"node_count"}, | |
}, | |
} | |
op, err := c.UpdateInstance(ctx, req) | |
if err != nil { | |
fmt.Printf("failed new admin client. err=%+v\n", err) | |
} | |
resp, err := op.Wait(ctx) | |
if err != nil { | |
fmt.Printf("failed new admin client. err=%+v\n", err) | |
} | |
fmt.Printf("resp is %+v\n", resp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment