Skip to content

Commit 67df3d8

Browse files
authored
fix(deps): update dependency google/cloud-compute to v2 (GoogleCloudPlatform#2160)
1 parent cf2005f commit 67df3d8

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

compute/firewall/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"google/cloud-compute": "^1.14"
3+
"google/cloud-compute": "^2.0"
44
}
55
}

compute/firewall/src/create_firewall_rule.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@
2626
# [START compute_firewall_create]
2727
use Google\Cloud\Compute\V1\Allowed;
2828
use Google\Cloud\Compute\V1\Client\FirewallsClient;
29-
use Google\Cloud\Compute\V1\Enums\Firewall\Direction;
30-
31-
/**
32-
* To correctly handle string enums in Cloud Compute library
33-
* use constants defined in the Enums subfolder.
34-
*/
3529
use Google\Cloud\Compute\V1\Firewall;
30+
use Google\Cloud\Compute\V1\Firewall\Direction;
3631
use Google\Cloud\Compute\V1\InsertFirewallRequest;
3732

3833
/**
@@ -57,7 +52,7 @@ function create_firewall_rule(string $projectId, string $firewallRuleName, strin
5752
->setPorts(['80', '443']);
5853
$firewallResource = (new Firewall())
5954
->setName($firewallRuleName)
60-
->setDirection(Direction::INGRESS)
55+
->setDirection(Direction::name(Direction::INGRESS))
6156
->setAllowed([$allowedPorts])
6257
->setSourceRanges(['0.0.0.0/0'])
6358
->setTargetTags(['web'])

0 commit comments

Comments
 (0)