Skip to content

Commit

Permalink
bigtable: Add InstanceType to CreateInstance
Browse files Browse the repository at this point in the history
Change-Id: I17ec1fecfeba7368ca513ce151d90232e1724318
Reviewed-on: https://code-review.googlesource.com/15070
Reviewed-by: Jonathan Amsterdam <[email protected]>
  • Loading branch information
garye committed Jul 27, 2017
1 parent 0a49544 commit 7a4ba9f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bigtable/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ func (st StorageType) proto() btapb.StorageType {
return btapb.StorageType_SSD
}

// InstanceType is the type of the instance
type InstanceType int32

const (
PRODUCTION InstanceType = InstanceType(btapb.Instance_PRODUCTION)
DEVELOPMENT = InstanceType(btapb.Instance_DEVELOPMENT)
)

// InstanceInfo represents information about an instance
type InstanceInfo struct {
Name string // name of the instance
Expand All @@ -320,8 +328,10 @@ type InstanceInfo struct {
// InstanceConf contains the information necessary to create an Instance
type InstanceConf struct {
InstanceId, DisplayName, ClusterId, Zone string
NumNodes int32
StorageType StorageType
// NumNodes must not be specified for DEVELOPMENT instance types
NumNodes int32
StorageType StorageType
InstanceType InstanceType
}

var instanceNameRegexp = regexp.MustCompile(`^projects/([^/]+)/instances/([a-z][-a-z0-9]*)$`)
Expand All @@ -333,7 +343,7 @@ func (iac *InstanceAdminClient) CreateInstance(ctx context.Context, conf *Instan
req := &btapb.CreateInstanceRequest{
Parent: "projects/" + iac.project,
InstanceId: conf.InstanceId,
Instance: &btapb.Instance{DisplayName: conf.DisplayName},
Instance: &btapb.Instance{DisplayName: conf.DisplayName, Type: btapb.Instance_Type(conf.InstanceType)},
Clusters: map[string]*btapb.Cluster{
conf.ClusterId: {
ServeNodes: conf.NumNodes,
Expand Down

0 comments on commit 7a4ba9f

Please sign in to comment.