Skip to content

Commit e61a87f

Browse files
fixes(bigtable): Fixes variable casing in Bigtable samples GoogleCloudPlatform#1385 (GoogleCloudPlatform#1387)
1 parent e848c4e commit e61a87f

27 files changed

+237
-237
lines changed

bigtable/src/create_cluster.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
if (count($argv) < 3 || count($argv) > 5) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID CLUSTER_ID [LOCATION_ID]" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $cluster_id) = $argv;
32-
$location_id = isset($argv[4]) ? $argv[4] : 'us-east1-b';
31+
list($_, $projectId, $instanceId, $clusterId) = $argv;
32+
$locationId = isset($argv[4]) ? $argv[4] : 'us-east1-b';
3333

3434
// [START bigtable_create_cluster]
3535

@@ -39,23 +39,23 @@
3939
use Google\ApiCore\ApiException;
4040

4141
/** Uncomment and populate these variables in your code */
42-
// $project_id = 'The Google project ID';
43-
// $instance_id = 'The Bigtable instance ID';
44-
// $cluster_id = 'The Bigtable cluster ID';
45-
// $location_id = 'The Bigtable region ID';
42+
// $projectId = 'The Google project ID';
43+
// $instanceId = 'The Bigtable instance ID';
44+
// $clusterId = 'The Bigtable cluster ID';
45+
// $locationId = 'The Bigtable region ID';
4646

4747

4848
$instanceAdminClient = new BigtableInstanceAdminClient();
4949

50-
$instanceName = $instanceAdminClient->instanceName($project_id, $instance_id);
51-
$clusterName = $instanceAdminClient->clusterName($project_id, $instance_id, $cluster_id);
50+
$instanceName = $instanceAdminClient->instanceName($projectId, $instanceId);
51+
$clusterName = $instanceAdminClient->clusterName($projectId, $instanceId, $clusterId);
5252

53-
printf("Adding Cluster to Instance %s" . PHP_EOL, $instance_id);
53+
printf("Adding Cluster to Instance %s" . PHP_EOL, $instanceId);
5454
try {
5555
$instanceAdminClient->getInstance($instanceName);
5656
} catch (ApiException $e) {
5757
if ($e->getStatus() === 'NOT_FOUND') {
58-
printf("Instance %s does not exists." . PHP_EOL, $instance_id);
58+
printf("Instance %s does not exists." . PHP_EOL, $instanceId);
5959
return;
6060
} else {
6161
throw $e;
@@ -77,21 +77,21 @@
7777
$cluster->setDefaultStorageType($storage_type);
7878
$cluster->setLocation(
7979
$instanceAdminClient->locationName(
80-
$project_id,
81-
$location_id
80+
$projectId,
81+
$locationId
8282
)
8383
);
8484
try {
8585
$instanceAdminClient->getCluster($clusterName);
86-
printf("Cluster %s already exists, aborting...", $cluster_id);
86+
printf("Cluster %s already exists, aborting...", $clusterId);
8787
} catch (ApiException $e) {
8888
if ($e->getStatus() === 'NOT_FOUND') {
89-
$operationResponse = $instanceAdminClient->createCluster($instanceName, $cluster_id, $cluster);
89+
$operationResponse = $instanceAdminClient->createCluster($instanceName, $clusterId, $cluster);
9090

9191
$operationResponse->pollUntilComplete();
9292
if ($operationResponse->operationSucceeded()) {
9393
$result = $operationResponse->getResult();
94-
printf("Cluster created: %s", $cluster_id);
94+
printf("Cluster created: %s", $clusterId);
9595
} else {
9696
$error = $operationResponse->getError();
9797
printf("Cluster not created: %s", $error);

bigtable/src/create_dev_instance.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
if (count($argv) < 3 || count($argv) > 5) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID CLUSTER_ID [LOCATION_ID]" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $cluster_id) = $argv;
32-
$location_id = isset($argv[4]) ? $argv[4] : 'us-east1-b';
31+
list($_, $projectId, $instanceId, $clusterId) = $argv;
32+
$locationId = isset($argv[4]) ? $argv[4] : 'us-east1-b';
3333

3434
// [START bigtable_create_dev_instance]
3535

@@ -41,62 +41,62 @@
4141
use Google\ApiCore\ApiException;
4242

4343
/** Uncomment and populate these variables in your code */
44-
// $project_id = 'The Google project ID';
45-
// $instance_id = 'The Bigtable instance ID';
46-
// $cluster_id = 'The Bigtable cluster ID';
47-
// $location_id = 'The Bigtable region ID';
44+
// $projectId = 'The Google project ID';
45+
// $instanceId = 'The Bigtable instance ID';
46+
// $clusterId = 'The Bigtable cluster ID';
47+
// $locationId = 'The Bigtable region ID';
4848

4949

5050
$instanceAdminClient = new BigtableInstanceAdminClient();
5151

52-
$projectName = $instanceAdminClient->projectName($project_id);
53-
$instanceName = $instanceAdminClient->instanceName($project_id, $instance_id);
52+
$projectName = $instanceAdminClient->projectName($projectId);
53+
$instanceName = $instanceAdminClient->instanceName($projectId, $instanceId);
5454

5555

5656
printf("Creating a DEVELOPMENT Instance" . PHP_EOL);
5757
// Set options to create an Instance
5858

59-
$storage_type = StorageType::HDD;
59+
$storageType = StorageType::HDD;
6060
$development = InstanceType::DEVELOPMENT;
6161
$labels = ['dev-label' => 'dev-label'];
6262

6363

6464
# Create instance with given options
6565
$instance = new Instance();
66-
$instance->setDisplayName($instance_id);
66+
$instance->setDisplayName($instanceId);
6767
$instance->setLabels($labels);
6868
$instance->setType($development);
6969

7070
// Create cluster with given options
7171
$cluster = new Cluster();
72-
$cluster->setDefaultStorageType($storage_type);
72+
$cluster->setDefaultStorageType($storageType);
7373
$cluster->setLocation(
7474
$instanceAdminClient->locationName(
75-
$project_id,
76-
$location_id
75+
$projectId,
76+
$locationId
7777
)
7878
);
7979
$clusters = [
80-
$cluster_id => $cluster
80+
$clusterId => $cluster
8181
];
8282
// Create development instance with given options
8383
try {
8484
$instanceAdminClient->getInstance($instanceName);
85-
printf("Instance %s already exists." . PHP_EOL, $instance_id);
85+
printf("Instance %s already exists." . PHP_EOL, $instanceId);
8686
} catch (ApiException $e) {
8787
if ($e->getStatus() === 'NOT_FOUND') {
88-
printf("Creating a development Instance: %s" . PHP_EOL, $instance_id);
88+
printf("Creating a development Instance: %s" . PHP_EOL, $instanceId);
8989
$operationResponse = $instanceAdminClient->createInstance(
9090
$projectName,
91-
$instance_id,
91+
$instanceId,
9292
$instance,
9393
$clusters
9494
);
9595
$operationResponse->pollUntilComplete();
9696
if (!$operationResponse->operationSucceeded()) {
9797
print('Error: ' . $operationResponse->getError()->getMessage());
9898
} else {
99-
printf("Instance %s created.", $instance_id);
99+
printf("Instance %s created.", $instanceId);
100100
}
101101
} else {
102102
throw $e;

bigtable/src/create_family_gc_intersection.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (count($argv) != 4) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID TABLE_ID" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $table_id) = $argv;
31+
list($_, $projectId, $instanceId, $tableId) = $argv;
3232

3333
// [START bigtable_create_family_gc_intersection]
3434
use Google\Cloud\Bigtable\Admin\V2\GcRule\Intersection as GcRuleIntersection;
@@ -39,26 +39,26 @@
3939
use Google\Protobuf\Duration;
4040

4141
/** Uncomment and populate these variables in your code */
42-
// $project_id = 'The Google project ID';
43-
// $instance_id = 'The Bigtable instance ID';
44-
// $table_id = 'The Bigtable table ID';
42+
// $projectId = 'The Google project ID';
43+
// $instanceId = 'The Bigtable instance ID';
44+
// $tableId = 'The Bigtable table ID';
4545

4646
$tableAdminClient = new BigtableTableAdminClient();
4747

48-
$tableName = $tableAdminClient->tableName($project_id, $instance_id, $table_id);
48+
$tableName = $tableAdminClient->tableName($projectId, $instanceId, $tableId);
4949

5050
print('Creating column family cf4 with Intersection GC rule...' . PHP_EOL);
5151
$columnFamily4 = new ColumnFamily();
5252

53-
$intersection_rule = new GcRuleIntersection();
54-
$intersection_array = [
53+
$intersectionRule = new GcRuleIntersection();
54+
$intersectionArray = [
5555
(new GcRule)->setMaxAge((new Duration())->setSeconds(3600 * 24 * 5)),
5656
(new GcRule)->setMaxNumVersions(2)
5757
];
58-
$intersection_rule->setRules($intersection_array);
58+
$intersectionRule->setRules($intersectionArray);
5959

6060
$intersection = new GcRule();
61-
$intersection->setIntersection($intersection_rule);
61+
$intersection->setIntersection($intersectionRule);
6262

6363
$columnFamily4->setGCRule($intersection);
6464

bigtable/src/create_family_gc_max_age.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (count($argv) != 4) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID TABLE_ID" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $table_id) = $argv;
31+
list($_, $projectId, $instanceId, $tableId) = $argv;
3232

3333
// [START bigtable_create_family_gc_max_age]
3434
use Google\Cloud\Bigtable\Admin\V2\ModifyColumnFamiliesRequest\Modification;
@@ -38,13 +38,13 @@
3838
use Google\Protobuf\Duration;
3939

4040
/** Uncomment and populate these variables in your code */
41-
// $project_id = 'The Google project ID';
42-
// $instance_id = 'The Bigtable instance ID';
43-
// $table_id = 'The Bigtable table ID';
41+
// $projectId = 'The Google project ID';
42+
// $instanceId = 'The Bigtable instance ID';
43+
// $tableId = 'The Bigtable table ID';
4444

4545
$tableAdminClient = new BigtableTableAdminClient();
4646

47-
$tableName = $tableAdminClient->tableName($project_id, $instance_id, $table_id);
47+
$tableName = $tableAdminClient->tableName($projectId, $instanceId, $tableId);
4848

4949

5050
print('Creating column family cf1 with MaxAge GC Rule...' . PHP_EOL);

bigtable/src/create_family_gc_max_versions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (count($argv) != 4) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID TABLE_ID" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $table_id) = $argv;
31+
list($_, $projectId, $instanceId, $tableId) = $argv;
3232

3333
// [START bigtable_create_family_gc_max_versions]
3434

@@ -38,13 +38,13 @@
3838
use Google\Cloud\Bigtable\Admin\V2\GcRule;
3939

4040
/** Uncomment and populate these variables in your code */
41-
// $project_id = 'The Google project ID';
42-
// $instance_id = 'The Bigtable instance ID';
43-
// $table_id = 'The Bigtable table ID';
41+
// $projectId = 'The Google project ID';
42+
// $instanceId = 'The Bigtable instance ID';
43+
// $tableId = 'The Bigtable table ID';
4444

4545
$tableAdminClient = new BigtableTableAdminClient();
4646

47-
$tableName = $tableAdminClient->tableName($project_id, $instance_id, $table_id);
47+
$tableName = $tableAdminClient->tableName($projectId, $instanceId, $tableId);
4848

4949

5050
print('Creating column family cf2 with max versions GC rule...' . PHP_EOL);

bigtable/src/create_family_gc_nested.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (count($argv) != 4) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID TABLE_ID" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $table_id) = $argv;
31+
list($_, $projectId, $instanceId, $tableId) = $argv;
3232

3333
// [START bigtable_create_family_gc_nested]
3434

@@ -41,13 +41,13 @@
4141
use Google\Protobuf\Duration;
4242

4343
/** Uncomment and populate these variables in your code */
44-
// $project_id = 'The Google project ID';
45-
// $instance_id = 'The Bigtable instance ID';
46-
// $table_id = 'The Bigtable table ID';
44+
// $projectId = 'The Google project ID';
45+
// $instanceId = 'The Bigtable instance ID';
46+
// $tableId = 'The Bigtable table ID';
4747

4848
$tableAdminClient = new BigtableTableAdminClient();
4949

50-
$tableName = $tableAdminClient->tableName($project_id, $instance_id, $table_id);
50+
$tableName = $tableAdminClient->tableName($projectId, $instanceId, $tableId);
5151

5252

5353
print('Creating column family cf5 with a Nested GC rule...' . PHP_EOL);
@@ -71,14 +71,14 @@
7171
$rule2 = new GcRule();
7272
$rule2->setIntersection($rule2Intersection);
7373

74-
$nested_rule = new GcRuleUnion();
75-
$nested_rule->setRules([
74+
$nestedRule = new GcRuleUnion();
75+
$nestedRule->setRules([
7676
$rule1,
7777
$rule2
7878
]);
79-
$nested_rule = (new GcRule())->setUnion($nested_rule);
79+
$nestedRule = (new GcRule())->setUnion($nestedRule);
8080

81-
$columnFamily5->setGCRule($nested_rule);
81+
$columnFamily5->setGCRule($nestedRule);
8282

8383
$columnModification = new Modification();
8484
$columnModification->setId('cf5');

bigtable/src/create_family_gc_union.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (count($argv) != 4) {
2929
return printf("Usage: php %s PROJECT_ID INSTANCE_ID TABLE_ID" . PHP_EOL, __FILE__);
3030
}
31-
list($_, $project_id, $instance_id, $table_id) = $argv;
31+
list($_, $projectId, $instanceId, $tableId) = $argv;
3232

3333
// [START bigtable_create_family_gc_union]
3434

@@ -40,14 +40,14 @@
4040
use Google\Protobuf\Duration;
4141

4242
/** Uncomment and populate these variables in your code */
43-
// $project_id = 'The Google project ID';
44-
// $instance_id = 'The Bigtable instance ID';
45-
// $table_id = 'The Bigtable table ID';
46-
// $location_id = 'The Bigtable region ID';
43+
// $projectId = 'The Google project ID';
44+
// $instanceId = 'The Bigtable instance ID';
45+
// $tableId = 'The Bigtable table ID';
46+
// $locationId = 'The Bigtable region ID';
4747

4848
$tableAdminClient = new BigtableTableAdminClient();
4949

50-
$tableName = $tableAdminClient->tableName($project_id, $instance_id, $table_id);
50+
$tableName = $tableAdminClient->tableName($projectId, $instanceId, $tableId);
5151

5252

5353
print('Creating column family cf3 with union GC rule...' . PHP_EOL);
@@ -59,14 +59,14 @@
5959

6060
$columnFamily3 = new ColumnFamily();
6161

62-
$rule_union = new GcRuleUnion();
63-
$rule_union_array = [
62+
$ruleUnion = new GcRuleUnion();
63+
$ruleUnionArray = [
6464
(new GcRule)->setMaxNumVersions(2),
6565
(new GcRule)->setMaxAge((new Duration())->setSeconds(3600 * 24 * 5))
6666
];
67-
$rule_union->setRules($rule_union_array);
67+
$ruleUnion->setRules($ruleUnionArray);
6868
$union = new GcRule();
69-
$union->setUnion($rule_union);
69+
$union->setUnion($ruleUnion);
7070

7171
$columnFamily3->setGCRule($union);
7272

0 commit comments

Comments
 (0)