Skip to content

Commit 80fd37c

Browse files
author
LalitTurbot
committed
add labels column to table
1 parent 6719b9d commit 80fd37c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

gcp/table_gcp_bigtable_instance.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func tableGcpBigtableInstance(ctx context.Context) *plugin.Table {
2929
Name: "name",
3030
Description: "A friendly name that identifies the resource.",
3131
Type: proto.ColumnType_STRING,
32-
Transform: transform.FromField("Name").Transform(lastPathElement),
32+
Transform: transform.FromCamel().Transform(lastPathElement),
3333
},
3434
{
3535
Name: "display_name",
@@ -47,6 +47,11 @@ func tableGcpBigtableInstance(ctx context.Context) *plugin.Table {
4747
Description: "Specifies the current state of the instance.",
4848
Type: proto.ColumnType_STRING,
4949
},
50+
{
51+
Name: "labels",
52+
Description: "Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. They can be used to filter resources and aggregate metrics.",
53+
Type: proto.ColumnType_JSON,
54+
},
5055
{
5156
Name: "iam_policy",
5257
Description: "An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members` to a single `role`. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`.",
@@ -72,7 +77,7 @@ func tableGcpBigtableInstance(ctx context.Context) *plugin.Table {
7277
Name: "akas",
7378
Description: ColumnDescriptionAkas,
7479
Type: proto.ColumnType_JSON,
75-
Transform: transform.FromP(bigtableInstanceToTurbotData, "Akas"),
80+
Transform: transform.FromP(bigtableInstanceTurbotData, "Akas"),
7681
},
7782

7883
// standard gcp columns
@@ -86,7 +91,7 @@ func tableGcpBigtableInstance(ctx context.Context) *plugin.Table {
8691
Name: "project",
8792
Description: ColumnDescriptionProject,
8893
Type: proto.ColumnType_STRING,
89-
Transform: transform.FromP(bigtableInstanceToTurbotData, "Project"),
94+
Transform: transform.FromP(bigtableInstanceTurbotData, "Project"),
9095
},
9196
},
9297
}
@@ -155,7 +160,8 @@ func getBigtableInstance(ctx context.Context, d *plugin.QueryData, h *plugin.Hyd
155160
}
156161

157162
func getBigtableInstanceIamPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
158-
service, err := bigtableadmin.NewService(ctx)
163+
// Create Service Connection
164+
service, err := BigtableAdminService(ctx, d)
159165
if err != nil {
160166
return nil, err
161167
}
@@ -178,7 +184,7 @@ func getBigtableInstanceIamPolicy(ctx context.Context, d *plugin.QueryData, h *p
178184

179185
//// TRANSFORM FUNCTIONS
180186

181-
func bigtableInstanceToTurbotData(_ context.Context, d *transform.TransformData) (interface{}, error) {
187+
func bigtableInstanceTurbotData(_ context.Context, d *transform.TransformData) (interface{}, error) {
182188
instance := d.HydrateItem.(*bigtableadmin.Instance)
183189
param := d.Param.(string)
184190

0 commit comments

Comments
 (0)