From 461c08888bc5021645fd896db537db8175e3f009 Mon Sep 17 00:00:00 2001 From: Vishwaraj Anand Date: Mon, 30 Oct 2023 12:26:23 +0530 Subject: [PATCH 1/2] chore(samples): removing iot samples (#1935) --- .kokoro/secrets-example.sh | 3 - .kokoro/secrets.sh.enc | Bin 9188 -> 6867 bytes iot/composer.json | 7 - iot/phpunit.xml.dist.deprecated | 37 --- iot/src/bind_device_to_gateway.php | 53 --- iot/src/create_es_device.php | 71 ---- iot/src/create_gateway.php | 85 ----- iot/src/create_registry.php | 68 ---- iot/src/create_rsa_device.php | 71 ---- iot/src/create_unauth_device.php | 57 ---- iot/src/delete_device.php | 51 --- iot/src/delete_gateway.php | 53 --- iot/src/delete_registry.php | 49 --- iot/src/get_device.php | 72 ---- iot/src/get_device_configs.php | 57 ---- iot/src/get_device_state.php | 56 ---- iot/src/get_iam_policy.php | 51 --- iot/src/get_registry.php | 51 --- iot/src/list_devices.php | 57 ---- iot/src/list_devices_for_gateway.php | 63 ---- iot/src/list_gateways.php | 77 ----- iot/src/list_registries.php | 56 ---- iot/src/patch_es.php | 71 ---- iot/src/patch_rsa.php | 71 ---- iot/src/send_command_to_device.php | 54 --- iot/src/set_device_config.php | 60 ---- iot/src/set_device_state.php | 79 ----- iot/src/set_iam_policy.php | 62 ---- iot/src/unbind_device_from_gateway.php | 53 --- iot/test/data/ec_public.pem | 4 - iot/test/data/rsa_cert.pem | 17 - iot/test/iotTest.php.deprecated | 440 ------------------------- testing/run_staticanalysis_check.sh | 1 - testing/run_test_suite.sh | 2 - 34 files changed, 2059 deletions(-) delete mode 100644 iot/composer.json delete mode 100644 iot/phpunit.xml.dist.deprecated delete mode 100644 iot/src/bind_device_to_gateway.php delete mode 100644 iot/src/create_es_device.php delete mode 100644 iot/src/create_gateway.php delete mode 100644 iot/src/create_registry.php delete mode 100644 iot/src/create_rsa_device.php delete mode 100644 iot/src/create_unauth_device.php delete mode 100644 iot/src/delete_device.php delete mode 100644 iot/src/delete_gateway.php delete mode 100644 iot/src/delete_registry.php delete mode 100644 iot/src/get_device.php delete mode 100644 iot/src/get_device_configs.php delete mode 100644 iot/src/get_device_state.php delete mode 100644 iot/src/get_iam_policy.php delete mode 100644 iot/src/get_registry.php delete mode 100644 iot/src/list_devices.php delete mode 100644 iot/src/list_devices_for_gateway.php delete mode 100644 iot/src/list_gateways.php delete mode 100644 iot/src/list_registries.php delete mode 100644 iot/src/patch_es.php delete mode 100644 iot/src/patch_rsa.php delete mode 100644 iot/src/send_command_to_device.php delete mode 100644 iot/src/set_device_config.php delete mode 100644 iot/src/set_device_state.php delete mode 100644 iot/src/set_iam_policy.php delete mode 100644 iot/src/unbind_device_from_gateway.php delete mode 100644 iot/test/data/ec_public.pem delete mode 100644 iot/test/data/rsa_cert.pem delete mode 100644 iot/test/iotTest.php.deprecated diff --git a/.kokoro/secrets-example.sh b/.kokoro/secrets-example.sh index 173d9aa062..2c5baeb92b 100644 --- a/.kokoro/secrets-example.sh +++ b/.kokoro/secrets-example.sh @@ -89,9 +89,6 @@ export IAP_URL= # IAM export GOOGLE_IAM_USER= -# IOT -export GOOGLE_IOT_DEVICE_CERTIFICATE_B64= - # KMS export GOOGLE_KMS_KEYRING= export GOOGLE_KMS_CRYPTOKEY= diff --git a/.kokoro/secrets.sh.enc b/.kokoro/secrets.sh.enc index 8bb4b60e692bb5dd8b3ca2125304d46924885c8e..674eb36e25a1648609b108f93e051ca8014f50ff 100644 GIT binary patch literal 6867 zcmV;^8Z6}sBmfTBrh3}F>T@biY+sb5GKe~*A`BR0-~LM+sL7nGGjiDgF%qgZ0LMxY zs;jSM!inv8uf+uu-&<`L6nvkwOG64fs7%2QT^kGiwJT4d)+!cEN_W#Ocgw zT0X$wTClu`o(8mg7Q_0C_kMH$bL9r>pDqVMC8LETY?H0HFqxf68U#MJ5Y__GfNbAY2@X+T6VicqA^kjKYkEm$Y^kBE1qfh}2MUFX zrY57q-SPjX@JIDQDH)~JyrNM1s2Y&nOWng&@ReNOC^Z-jU^P@L0^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Fm#5E46&4@g2*MT$JIi$vG&jhk0oucuDdDxq5iwVc`W2TCvun1P9P>A=!jM9 z{{;d718cq|v_)>DISw}|H)7n3bY=l;Bfh1tItGJ)s4u7EMF> z4PyXR`ETOC><<6V2kS|Oe7Yox1`*blmSuWp3heO(>oJI!dF&B&#%&zCQ@niW>ZBoD z_EQ71$MtKkH0V3ag_#LcJM)A^oHpI^1LU7eU|9F-{k=gt`D8vwMF}>IL*((*M&p~| zbi!TB;^Tw#d}CLr5&QVUTc9wYEynf<@j-+OZYl;a+P2>2$SJ%@lSLX~YH#?YKEF{1 zQ2u6MiviSRK&pcLS5}awLOTTs2W-9fKO+D2jEvcKX*)@7&Tn!seIKu25~GzhU-c0R zD<5+vZ_7{oo+B7AHL$eKky{Bn%iu1Pa)Z!oX7%lP1o62i->~7`7Ix>r-aSv_c+amw zxJ5F{elyDmtixQGx6I?hz`q{MmoKG2Rv&$UocTUNT@_0n>sLSF<&g4kb0#t^g319QtmP?Xv-gAiZ^02Fc~Ubz=e$y9L8FLVeHQMU9U}8#@Z=@uI$Yuw(-)7-pvc{F_t;s^62n zw88>lE+&&uS!-mPc??93Zi74JmBg#-vDzTsMmP=> diff --git a/iot/composer.json b/iot/composer.json deleted file mode 100644 index 01dc46a43f..0000000000 --- a/iot/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "google/iot-sample", - "type": "project", - "require": { - "google/cloud-iot": "^1.0.0" - } -} diff --git a/iot/phpunit.xml.dist.deprecated b/iot/phpunit.xml.dist.deprecated deleted file mode 100644 index b4718b587d..0000000000 --- a/iot/phpunit.xml.dist.deprecated +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - test - - - - - - - - ./src - - ./vendor - - - - - - - diff --git a/iot/src/bind_device_to_gateway.php b/iot/src/bind_device_to_gateway.php deleted file mode 100644 index d9fcfbed0e..0000000000 --- a/iot/src/bind_device_to_gateway.php +++ /dev/null @@ -1,53 +0,0 @@ -registryName($projectId, $location, $registryId); - - $result = $deviceManager->bindDeviceToGateway($registryName, $gatewayId, $deviceId); - - print('Device bound'); -} -# [END iot_bind_device_to_gateway] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/create_es_device.php b/iot/src/create_es_device.php deleted file mode 100644 index e35829b52d..0000000000 --- a/iot/src/create_es_device.php +++ /dev/null @@ -1,71 +0,0 @@ -registryName($projectId, $location, $registryId); - - $publicKey = (new PublicKeyCredential()) - ->setFormat(PublicKeyFormat::ES256_PEM) - ->setKey(file_get_contents($publicKeyFile)); - - $credential = (new DeviceCredential()) - ->setPublicKey($publicKey); - - $device = (new Device()) - ->setId($deviceId) - ->setCredentials([$credential]); - - $device = $deviceManager->createDevice($registryName, $device); - - printf('Device: %s : %s' . PHP_EOL, - $device->getNumId(), - $device->getId()); -} -# [END iot_create_es_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/create_gateway.php b/iot/src/create_gateway.php deleted file mode 100644 index 4779be53a7..0000000000 --- a/iot/src/create_gateway.php +++ /dev/null @@ -1,85 +0,0 @@ -registryName($projectId, $location, $registryId); - - $publicKeyFormat = PublicKeyFormat::ES256_PEM; - if ($algorithm == 'RS256') { - $publicKeyFormat = PublicKeyFormat::RSA_X509_PEM; - } - - $gatewayConfig = (new GatewayConfig()) - ->setGatewayType(GatewayType::GATEWAY) - ->setGatewayAuthMethod(GatewayAuthMethod::ASSOCIATION_ONLY); - - $publicKey = (new PublicKeyCredential()) - ->setFormat($publicKeyFormat) - ->setKey(file_get_contents($certificateFile)); - - $credential = (new DeviceCredential()) - ->setPublicKey($publicKey); - - $device = (new Device()) - ->setId($gatewayId) - ->setGatewayConfig($gatewayConfig) - ->setCredentials([$credential]); - - $gateway = $deviceManager->createDevice($registryName, $device); - - printf('Gateway: %s : %s' . PHP_EOL, - $gateway->getNumId(), - $gateway->getId()); -} -# [END iot_create_gateway] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/create_registry.php b/iot/src/create_registry.php deleted file mode 100644 index 0e022b5bc2..0000000000 --- a/iot/src/create_registry.php +++ /dev/null @@ -1,68 +0,0 @@ -locationName($projectId, $location); - - $pubsubTopicPath = sprintf('projects/%s/topics/%s', $projectId, $pubsubTopic); - $eventNotificationConfig = (new EventNotificationConfig) - ->setPubsubTopicName($pubsubTopicPath); - - $registry = (new DeviceRegistry) - ->setId($registryId) - ->setEventNotificationConfigs([$eventNotificationConfig]); - - $registry = $deviceManager->createDeviceRegistry($locationName, $registry); - - printf('Id: %s, Name: %s' . PHP_EOL, - $registry->getId(), - $registry->getName()); -} -# [END iot_create_registry] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/create_rsa_device.php b/iot/src/create_rsa_device.php deleted file mode 100644 index 47bd109155..0000000000 --- a/iot/src/create_rsa_device.php +++ /dev/null @@ -1,71 +0,0 @@ -registryName($projectId, $location, $registryId); - - $publicKey = (new PublicKeyCredential()) - ->setFormat(PublicKeyFormat::RSA_X509_PEM) - ->setKey(file_get_contents($certificateFile)); - - $credential = (new DeviceCredential()) - ->setPublicKey($publicKey); - - $device = (new Device()) - ->setId($deviceId) - ->setCredentials([$credential]); - - $device = $deviceManager->createDevice($registryName, $device); - - printf('Device: %s : %s' . PHP_EOL, - $device->getNumId(), - $device->getId()); -} -# [END iot_create_rsa_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/create_unauth_device.php b/iot/src/create_unauth_device.php deleted file mode 100644 index 2347a67814..0000000000 --- a/iot/src/create_unauth_device.php +++ /dev/null @@ -1,57 +0,0 @@ -registryName($projectId, $location, $registryId); - - $device = (new Device()) - ->setId($deviceId); - - $device = $deviceManager->createDevice($registryName, $device); - - printf('Device: %s : %s' . PHP_EOL, - $device->getNumId(), - $device->getId()); -} -# [END iot_create_unauth_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/delete_device.php b/iot/src/delete_device.php deleted file mode 100644 index 8965a7868a..0000000000 --- a/iot/src/delete_device.php +++ /dev/null @@ -1,51 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $response = $deviceManager->deleteDevice($deviceName); - - printf('Deleted %s' . PHP_EOL, $deviceName); -} -# [END iot_delete_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/delete_gateway.php b/iot/src/delete_gateway.php deleted file mode 100644 index b38d6ba862..0000000000 --- a/iot/src/delete_gateway.php +++ /dev/null @@ -1,53 +0,0 @@ -deviceName($projectId, $location, $registryId, $gatewayId); - - // TODO: unbind all bound devices when list_devices_for_gateway - // is working - $response = $deviceManager->deleteDevice($gatewayName); - - printf('Deleted %s' . PHP_EOL, $gatewayName); -} -# [END iot_delete_gateway] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/delete_registry.php b/iot/src/delete_registry.php deleted file mode 100644 index 6e8715f9eb..0000000000 --- a/iot/src/delete_registry.php +++ /dev/null @@ -1,49 +0,0 @@ -registryName($projectId, $location, $registryId); - - $deviceManager->deleteDeviceRegistry($registryName); - - printf('Deleted Registry %s' . PHP_EOL, $registryId); -} -# [END iot_delete_registry] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/get_device.php b/iot/src/get_device.php deleted file mode 100644 index 3818c5048b..0000000000 --- a/iot/src/get_device.php +++ /dev/null @@ -1,72 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $device = $deviceManager->getDevice($deviceName); - - $formats = [ - PublicKeyFormat::UNSPECIFIED_PUBLIC_KEY_FORMAT => 'unspecified', - PublicKeyFormat::RSA_X509_PEM => 'RSA_X509_PEM', - PublicKeyFormat::ES256_PEM => 'ES256_PEM', - PublicKeyFormat::RSA_PEM => 'RSA_PEM', - PublicKeyFormat::ES256_X509_PEM => 'ES256_X509_PEM', - ]; - - printf('ID: %s' . PHP_EOL, $device->getId()); - printf('Name: %s' . PHP_EOL, $device->getName()); - foreach ($device->getCredentials() as $credential) { - print('Certificate:' . PHP_EOL); - printf(' Format: %s' . PHP_EOL, - $formats[$credential->getPublicKey()->getFormat()]); - printf(' Expiration: %s' . PHP_EOL, - $credential->getExpirationTime()->toDateTime()->format('Y-m-d H:i:s')); - } - printf('Data: %s' . PHP_EOL, $device->getConfig()->getBinaryData()); - printf('Version: %s' . PHP_EOL, $device->getConfig()->getVersion()); - printf('Update Time: %s' . PHP_EOL, - $device->getConfig()->getCloudUpdateTime()->toDateTime()->format('Y-m-d H:i:s')); -} -# [END iot_get_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/get_device_configs.php b/iot/src/get_device_configs.php deleted file mode 100644 index 10a63833bc..0000000000 --- a/iot/src/get_device_configs.php +++ /dev/null @@ -1,57 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $configs = $deviceManager->listDeviceConfigVersions($deviceName); - - foreach ($configs->getDeviceConfigs() as $config) { - print('Config:' . PHP_EOL); - printf(' Version: %s' . PHP_EOL, $config->getVersion()); - printf(' Data: %s' . PHP_EOL, $config->getBinaryData()); - printf(' Update Time: %s' . PHP_EOL, - $config->getCloudUpdateTime()->toDateTime()->format('Y-m-d H:i:s')); - } -} -# [END iot_get_device_configs] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/get_device_state.php b/iot/src/get_device_state.php deleted file mode 100644 index 6d502e0dec..0000000000 --- a/iot/src/get_device_state.php +++ /dev/null @@ -1,56 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $response = $deviceManager->listDeviceStates($deviceName); - - foreach ($response->getDeviceStates() as $state) { - print('State:' . PHP_EOL); - printf(' Data: %s' . PHP_EOL, $state->getBinaryData()); - printf(' Update Time: %s' . PHP_EOL, - $state->getUpdateTime()->toDateTime()->format('Y-m-d H:i:s')); - } -} -# [END iot_get_device_state] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/get_iam_policy.php b/iot/src/get_iam_policy.php deleted file mode 100644 index 66437d550c..0000000000 --- a/iot/src/get_iam_policy.php +++ /dev/null @@ -1,51 +0,0 @@ -registryName($projectId, $location, $registryId); - - $policy = $deviceManager->getIamPolicy($registryName); - - print($policy->serializeToJsonString() . PHP_EOL); -} -# [END iot_get_iam_policy] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/get_registry.php b/iot/src/get_registry.php deleted file mode 100644 index 45690a880d..0000000000 --- a/iot/src/get_registry.php +++ /dev/null @@ -1,51 +0,0 @@ -registryName($projectId, $location, $registryId); - - $registry = $deviceManager->getDeviceRegistry($registryName); - - printf('Id: %s, Name: %s' . PHP_EOL, - $registry->getId(), - $registry->getName()); -} -# [END iot_get_registry] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/list_devices.php b/iot/src/list_devices.php deleted file mode 100644 index 8a3cb2e682..0000000000 --- a/iot/src/list_devices.php +++ /dev/null @@ -1,57 +0,0 @@ -registryName($projectId, $location, $registryId); - - // Call the API - $devices = $deviceManager->listDevices($registryName); - - // Print the result - foreach ($devices->iterateAllElements() as $device) { - printf('Device: %s : %s' . PHP_EOL, - $device->getNumId(), - $device->getId()); - } -} -# [END iot_list_devices] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/list_devices_for_gateway.php b/iot/src/list_devices_for_gateway.php deleted file mode 100644 index 7b1abb78c6..0000000000 --- a/iot/src/list_devices_for_gateway.php +++ /dev/null @@ -1,63 +0,0 @@ -registryName($projectId, $location, $registryId); - - // Configure the list options for the gateway - $gatewayListOptions = (new GatewayListOptions())->setAssociationsGatewayId($gatewayId); - - // Call the API - $devices = $deviceManager->listDevices($registryName, - ['gatewayListOptions' => $gatewayListOptions] - ); - - // Print the result - foreach ($devices->iterateAllElements() as $device) { - printf('Bound Device: %s' . PHP_EOL, $device->getId()); - } -} -# [END iot_list_devices_for_gateway] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/list_gateways.php b/iot/src/list_gateways.php deleted file mode 100644 index a773988cb3..0000000000 --- a/iot/src/list_gateways.php +++ /dev/null @@ -1,77 +0,0 @@ -registryName($projectId, $location, $registryId); - - // Pass field mask to retrieve the gateway configuration fields - $fieldMask = (new FieldMask())->setPaths(['config', 'gateway_config']); - - // Call the API - $devices = $deviceManager->listDevices($registryName, [ - 'fieldMask' => $fieldMask - ]); - - // Print the result - $foundGateway = false; - foreach ($devices->iterateAllElements() as $device) { - $gatewayConfig = $device->getGatewayConfig(); - $gatewayType = null; - if ($gatewayConfig != null) { - $gatewayType = $gatewayConfig->getGatewayType(); - } - - if ($gatewayType == GatewayType::GATEWAY) { - $foundGateway = true; - printf('Device: %s : %s' . PHP_EOL, - $device->getNumId(), - $device->getId()); - } - } - if (!$foundGateway) { - printf('Registry %s has no gateways' . PHP_EOL, $registryId); - } -} -# [END iot_list_gateways] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/list_registries.php b/iot/src/list_registries.php deleted file mode 100644 index 7299ee9ce8..0000000000 --- a/iot/src/list_registries.php +++ /dev/null @@ -1,56 +0,0 @@ -locationName($projectId, $location); - - $response = $deviceManager->listDeviceRegistries($locationName); - - foreach ($response->iterateAllElements() as $registry) { - printf(' - Id: %s, Name: %s' . PHP_EOL, - $registry->getId(), - $registry->getName()); - } -} -# [END iot_list_registries] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/patch_es.php b/iot/src/patch_es.php deleted file mode 100644 index 544246cf0a..0000000000 --- a/iot/src/patch_es.php +++ /dev/null @@ -1,71 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $publicKey = (new PublicKeyCredential()) - ->setFormat(PublicKeyFormat::ES256_PEM) - ->setKey(file_get_contents($publicKeyFile)); - - $credential = (new DeviceCredential()) - ->setPublicKey($publicKey); - - $device = (new Device()) - ->setName($deviceName) - ->setCredentials([$credential]); - - $updateMask = (new FieldMask()) - ->setPaths(['credentials']); - - $device = $deviceManager->updateDevice($device, $updateMask); - printf('Updated device %s' . PHP_EOL, $device->getName()); -} -# [END iot_patch_es] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/patch_rsa.php b/iot/src/patch_rsa.php deleted file mode 100644 index 633e3b0d51..0000000000 --- a/iot/src/patch_rsa.php +++ /dev/null @@ -1,71 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $publicKey = (new PublicKeyCredential()) - ->setFormat(PublicKeyFormat::RSA_X509_PEM) - ->setKey(file_get_contents($certificateFile)); - - $credential = (new DeviceCredential()) - ->setPublicKey($publicKey); - - $device = (new Device()) - ->setName($deviceName) - ->setCredentials([$credential]); - - $updateMask = (new FieldMask()) - ->setPaths(['credentials']); - - $device = $deviceManager->updateDevice($device, $updateMask); - printf('Updated device %s' . PHP_EOL, $device->getName()); -} -# [END iot_patch_rsa] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/send_command_to_device.php b/iot/src/send_command_to_device.php deleted file mode 100644 index 3ad6b83fbd..0000000000 --- a/iot/src/send_command_to_device.php +++ /dev/null @@ -1,54 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - // Response empty on success - $deviceManager->sendCommandToDevice($deviceName, $command); - - printf('Command sent' . PHP_EOL); -} -# [END iot_send_command_to_device] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/set_device_config.php b/iot/src/set_device_config.php deleted file mode 100644 index 0ae2d8be85..0000000000 --- a/iot/src/set_device_config.php +++ /dev/null @@ -1,60 +0,0 @@ -deviceName($projectId, $location, $registryId, $deviceId); - - $config = $deviceManager->modifyCloudToDeviceConfig($deviceName, $config, [ - 'versionToUpdate' => $version, - ]); - - printf('Version: %s' . PHP_EOL, $config->getVersion()); - printf('Data: %s' . PHP_EOL, $config->getBinaryData()); - printf('Update Time: %s' . PHP_EOL, - $config->getCloudUpdateTime()->toDateTime()->format('Y-m-d H:i:s')); -} -# [END iot_set_device_config] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/set_device_state.php b/iot/src/set_device_state.php deleted file mode 100644 index aca79d572a..0000000000 --- a/iot/src/set_device_state.php +++ /dev/null @@ -1,79 +0,0 @@ - $projectId, 'iat' => time(), 'exp' => time() + 3600], - file_get_contents($certificateFile), - 'RS256' - ); - - // Format the device's URL - $deviceName = sprintf('projects/%s/locations/%s/registries/%s/devices/%s', - $projectId, $location, $registryId, $deviceId); - - $url = sprintf('https://cloudiotdevice.googleapis.com/v1/%s:setState', $deviceName); - - // Make the HTTP request - $response = $httpClient->post($url, [ - 'json' => [ - 'state' => [ - 'binaryData' => base64_encode($stateData) - ] - ], - 'headers' => [ - 'Authorization' => sprintf('Bearer %s', $jwt) - ] - ]); - - print('Updated device State' . PHP_EOL); -} -# [END iot_set_device_state] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/set_iam_policy.php b/iot/src/set_iam_policy.php deleted file mode 100644 index a83df09aff..0000000000 --- a/iot/src/set_iam_policy.php +++ /dev/null @@ -1,62 +0,0 @@ -registryName($projectId, $location, $registryId); - - $binding = (new Binding()) - ->setMembers([$member]) - ->setRole($role); - - $policy = (new Policy()) - ->setBindings([$binding]); - - $policy = $deviceManager->setIamPolicy($registryName, $policy); - - print($policy->serializeToJsonString() . PHP_EOL); -} -# [END iot_set_iam_policy] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/src/unbind_device_from_gateway.php b/iot/src/unbind_device_from_gateway.php deleted file mode 100644 index fb28a723e4..0000000000 --- a/iot/src/unbind_device_from_gateway.php +++ /dev/null @@ -1,53 +0,0 @@ -registryName($projectId, $location, $registryId); - - $result = $deviceManager->unbindDeviceFromGateway($registryName, $gatewayId, $deviceId); - - print('Device unbound'); -} -# [END iot_unbind_device_from_gateway] - -// The following 2 lines are only needed to run the samples -require_once __DIR__ . '/../../testing/sample_helpers.php'; -\Google\Cloud\Samples\execute_sample(__FILE__, __NAMESPACE__, $argv); diff --git a/iot/test/data/ec_public.pem b/iot/test/data/ec_public.pem deleted file mode 100644 index 3b61697ab7..0000000000 --- a/iot/test/data/ec_public.pem +++ /dev/null @@ -1,4 +0,0 @@ ------BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhbN0N+3JH+3VBR/Xex4b1JzeJZgG -SUeTFIUpg/svqd+B4tYZySSYOccVJFUyL805mSgUMQ84/bYAIVybWZqvAQ== ------END PUBLIC KEY----- diff --git a/iot/test/data/rsa_cert.pem b/iot/test/data/rsa_cert.pem deleted file mode 100644 index aad6a4919e..0000000000 --- a/iot/test/data/rsa_cert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICoDCCAYgCCQDO3ocXJemE7jANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZ1 -bnVzZWQwIBcNMTgwNDI0MTg0NDUwWhgPNDc1NjAzMjExODQ0NTBaMBExDzANBgNV -BAMMBnVudXNlZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK9UwSZa -YwZh6GXkbiHkICmtn8Xf6fpte+nwaG/YNASzt+QP0gzV83DE6b6vBH5Jgz96kOr9 -SlQP4AekGyI4devubUEEkd+GnAkrin2dfUkpRNDgKSY9do9yEHnXo8af0C7xsjOn -BCqYgSJ+oeqvDNPcMp552lmpwOBx+xrpoSi0EwXcgRY51lNiGw37UWmny1QrWMmX -mG/Id0Tu9gPpjf/k5GQjaRtoZrHHMviZCUpoEpqn3Ru69zBXfpDY9oPrG8WdG7mN -YlWWMBQb7tfO75I8F1h90qdw6aw81G6l/wJJO3nW65gbuBVobMrnkYj6LV5bjjkW -slJ5vG0TlVaYZ80CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAWi1aN1sSerlk5Gev -nQFm0bRQVXYD8TIGDPubtKGMTuelAcH/o5frNhxgxj3hf+0h/+/tmJ7Y7B+q2zCw -b4rUc13ffhZFyO0F7oPUXHMvg415MN4YM64T8WZ4vAG4BKGKKBBo9C8PwMd0IhSk -xsevPfYls38LRIWTX1uE8E3MJh4CWfKImp/4ayj3m3vlGWktGHrK2DdQNZZTbiVv -EHjz/m6RPeG/BSlNFs/BvCf5gHLDoDVK3x2WPVVDJ/iNTmpgePj22az46Ed2KH6m -XDkPgJduTygnxgz6LY3D5rhcEf5QTQ7OSNcOpLvarnNi3bm/qOLWVrw+bsPLhnON -2c1PTA== ------END CERTIFICATE----- diff --git a/iot/test/iotTest.php.deprecated b/iot/test/iotTest.php.deprecated deleted file mode 100644 index 3c52639f14..0000000000 --- a/iot/test/iotTest.php.deprecated +++ /dev/null @@ -1,440 +0,0 @@ -requireEnv('GOOGLE_PUBSUB_TOPIC'); - - $registryId = 'test-registry-' . self::$testId; - - $output = $this->runFunctionSnippet('create_registry', [ - $registryId, - $topic, - self::$projectId, - self::LOCATION, - ]); - self::$registryId = $registryId; - $this->assertStringContainsString('Id: ' . $registryId, $output); - } - - /** @depends testCreateRegistry */ - public function testListRegistries() - { - $output = $this->runFunctionSnippet('list_registries', [ - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString(self::$registryId, $output); - } - - /** @depends testCreateRegistry */ - public function testGetRegistry() - { - $output = $this->runFunctionSnippet('get_registry', [ - self::$registryId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString(self::$registryId, $output); - } - - /** @depends testCreateRegistry */ - public function testIamPolicy() - { - $email = 'betterbrent@google.com'; - $output = $this->runFunctionSnippet('set_iam_policy', [ - self::$registryId, - 'roles/viewer', - 'user:' . $email, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString($email, $output); - - $output = $this->runFunctionSnippet('get_iam_policy', [ - self::$registryId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString($email, $output); - } - - /** @depends testCreateRegistry */ - public function testCreateRsaDevice() - { - $deviceId = 'test-rsa_device-' . self::$testId; - - $output = $this->runFunctionSnippet('create_rsa_device', [ - self::$registryId, - $deviceId, - __DIR__ . '/data/rsa_cert.pem', - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - $this->assertStringContainsString($deviceId, $output); - } - - /** @depends testCreateRsaDevice */ - public function testSetDeviceState() - { - $certB64 = $this->requireEnv('GOOGLE_IOT_DEVICE_CERTIFICATE_B64'); - $iotCert = base64_decode($certB64); - $iotCertFile = tempnam(sys_get_temp_dir(), 'iot-cert'); - file_put_contents($iotCertFile, $iotCert); - - $data = '{"data":"example of state data"}'; - $output = $this->runFunctionSnippet('set_device_state', [ - self::$registryId, - self::$devices[0], - $iotCertFile, - $data, - self::$projectId, - self::LOCATION, - ]); - - $output = $this->runFunctionSnippet('get_device_state', [ - self::$registryId, - self::$devices[0], - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString('Data: ' . $data, $output); - } - - /** @depends testCreateRsaDevice */ - public function testListDevices() - { - $output = $this->runFunctionSnippet('list_devices', [ - self::$registryId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString(self::$devices[0], $output); - } - - /** @depends testCreateRsaDevice */ - public function testGetDevice() - { - $output = $this->runFunctionSnippet('get_device', [ - self::$registryId, - self::$devices[0], - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString(self::$devices[0], $output); - } - - /** @depends testCreateRsaDevice */ - public function testSetDeviceConfig() - { - $config = '{"data":"example of config data"}'; - $output = $this->runFunctionSnippet('set_device_config', [ - self::$registryId, - self::$devices[0], - $config, - null, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString('Version: 2', $output); - $this->assertStringContainsString('Data: ' . $config, $output); - } - - /** @depends testCreateRsaDevice */ - public function testSendCommandToDevice() - { - $command = '{"data":"example of command data"}'; - $output = $this->runFunctionSnippet('send_command_to_device', [ - self::$registryId, - self::$devices[0], - $command, - self::$projectId, - self::LOCATION, - ]); - print($output); - $this->assertStringContainsString('Sending command to', $output); - } - - /** @depends testSetDeviceConfig */ - public function testGetDeviceConfigs() - { - $output = $this->runFunctionSnippet('get_device_configs', [ - self::$registryId, - self::$devices[0], - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString('Version: 2', $output); - } - - /** @depends testCreateRegistry */ - public function testCreateEsDevice() - { - $deviceId = 'test-es_device-' . self::$testId; - - $output = $this->runFunctionSnippet('create_es_device', [ - self::$registryId, - $deviceId, - __DIR__ . '/data/ec_public.pem', - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - $this->assertStringContainsString($deviceId, $output); - } - - /** @depends testCreateRegistry */ - public function testCreateUnauthDevice() - { - $deviceId = 'test-unauth_device-' . self::$testId; - - $output = $this->runFunctionSnippet('create_unauth_device', [ - self::$registryId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - $this->assertStringContainsString($deviceId, $output); - } - - /** @depends testCreateUnauthDevice */ - public function testPatchEs() - { - $deviceId = 'test-es_device_to_patch' . self::$testId; - - $this->runFunctionSnippet('create_unauth_device', [ - self::$registryId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - - $output = $this->runFunctionSnippet('patch_es', [ - self::$registryId, - $deviceId, - __DIR__ . '/data/ec_public.pem', - self::$projectId, - self::LOCATION, - ]); - - $this->assertStringContainsString('Updated device', $output); - } - - /** @depends testCreateRegistry */ - public function testPatchRsa() - { - $deviceId = 'test-rsa_device_to_patch' . self::$testId; - - $this->runFunctionSnippet('create_unauth_device', [ - self::$registryId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - - $output = $this->runFunctionSnippet('patch_rsa', [ - self::$registryId, - $deviceId, - __DIR__ . '/data/rsa_cert.pem', - self::$projectId, - self::LOCATION, - ]); - - $this->assertStringContainsString('Updated device', $output); - } - - /** @depends testCreateRegistry */ - public function testCreateGateway() - { - $gatewayId = 'test-rsa-gateway' . self::$testId; - - $output = $this->runFunctionSnippet('create_gateway', [ - self::$registryId, - $gatewayId, - __DIR__ . '/data/rsa_cert.pem', - 'RS256', - self::$projectId, - self::LOCATION, - ]); - self::$gateways[] = $gatewayId; - $this->assertStringContainsString('Gateway: ', $output); - - $output = $this->runFunctionSnippet('list_gateways', [ - self::$registryId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString($gatewayId, $output); - } - - /** - * @depends testCreateGateway - * @retryAttempts 3 - */ - public function testBindUnbindDevice() - { - $deviceId = 'test_device_to_bind' . self::$testId; - $gatewayId = 'test-bindunbind-gateway' . self::$testId; - - $this->runFunctionSnippet('create_gateway', [ - self::$registryId, - $gatewayId, - __DIR__ . '/data/rsa_cert.pem', - 'RS256', - self::$projectId, - self::LOCATION, - ]); - self::$gateways[] = $gatewayId; - - $this->runFunctionSnippet('create_unauth_device', [ - self::$registryId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - - $output = $this->runFunctionSnippet('bind_device_to_gateway', [ - self::$registryId, - $gatewayId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString('Device bound', $output); - - $output = $this->runFunctionSnippet('unbind_device_from_gateway', [ - self::$registryId, - $gatewayId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString('Device unbound', $output); - } - - /** @depends testBindUnbindDevice */ - public function testListDevicesForGateway() - { - $deviceId = 'php-bind-and-list' . self::$testId; - $gatewayId = 'php-bal-gateway' . self::$testId; - - $this->runFunctionSnippet('create_unauth_device', [ - self::$registryId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - self::$devices[] = $deviceId; - - $this->runFunctionSnippet('create_gateway', [ - self::$registryId, - $gatewayId, - __DIR__ . '/data/rsa_cert.pem', - 'RS256', - self::$projectId, - self::LOCATION, - ]); - self::$gateways[] = $gatewayId; - - $this->runFunctionSnippet('bind_device_to_gateway', [ - self::$registryId, - $gatewayId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - - $output = $this->runFunctionSnippet('list_devices_for_gateway', [ - self::$registryId, - $gatewayId, - self::$projectId, - self::LOCATION, - ]); - $this->assertStringContainsString($deviceId, $output); - - $this->runFunctionSnippet('unbind_device_from_gateway', [ - self::$registryId, - $gatewayId, - $deviceId, - self::$projectId, - self::LOCATION, - ]); - } -} diff --git a/testing/run_staticanalysis_check.sh b/testing/run_staticanalysis_check.sh index 0dd02ceaff..4f2d2aae39 100644 --- a/testing/run_staticanalysis_check.sh +++ b/testing/run_staticanalysis_check.sh @@ -19,7 +19,6 @@ fi SKIP_DIRS=( dialogflow - iot ) TMP_REPORT_DIR=$(mktemp -d) diff --git a/testing/run_test_suite.sh b/testing/run_test_suite.sh index 27bef996ab..5134301628 100755 --- a/testing/run_test_suite.sh +++ b/testing/run_test_suite.sh @@ -37,7 +37,6 @@ REST_TESTS=( dialogflow dlp error_reporting - iot monitoring speech video @@ -56,7 +55,6 @@ ALT_PROJECT_TESTS=( dialogflow dlp error_reporting - iot kms logging monitoring From f30c448d5c494b84841726a49ae5f2378ebbe119 Mon Sep 17 00:00:00 2001 From: Yash Sahu <54198301+yash30201@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:36:10 +0530 Subject: [PATCH 2/2] feat(Storage): Update samples to showcase Storage Autoclass V2 usage (#1928) --- storage/src/get_bucket_autoclass.php | 6 ++++++ storage/src/set_bucket_autoclass.php | 22 +++++++++++++++------- storage/test/storageTest.php | 27 ++++++++++++++++++--------- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/storage/src/get_bucket_autoclass.php b/storage/src/get_bucket_autoclass.php index 277653d537..89a869615f 100644 --- a/storage/src/get_bucket_autoclass.php +++ b/storage/src/get_bucket_autoclass.php @@ -47,6 +47,12 @@ function get_bucket_autoclass(string $bucketName): void $bucketName, $info['autoclass']['toggleTime'] ); + printf( + 'Autoclass terminal storage class is set to %s for %s at %s.' . PHP_EOL, + $info['autoclass']['terminalStorageClass'], + $info['name'], + $info['autoclass']['terminalStorageClassUpdateTime'], + ); } } # [END storage_get_autoclass] diff --git a/storage/src/set_bucket_autoclass.php b/storage/src/set_bucket_autoclass.php index 0a57c86c89..912539b055 100644 --- a/storage/src/set_bucket_autoclass.php +++ b/storage/src/set_bucket_autoclass.php @@ -27,30 +27,38 @@ use Google\Cloud\Storage\StorageClient; /** - * Updates an existing bucket with provided autoclass toggle. - * - * Note: Only patch requests that disable autoclass are currently supported. - * To enable autoclass, it must be set at bucket creation time. + * Updates an existing bucket with provided autoclass config. * * @param string $bucketName The name of your Cloud Storage bucket (e.g. 'my-bucket'). * @param bool $autoclassStatus If true, enables Autoclass. Disables otherwise. + * @param string $terminalStorageClass This field is optional and defaults to `NEARLINE`. + * Valid values are `NEARLINE` and `ARCHIVE`. */ -function set_bucket_autoclass(string $bucketName, bool $autoclassStatus): void -{ +function set_bucket_autoclass( + string $bucketName, + bool $autoclassStatus, + string $terminalStorageClass +): void { $storage = new StorageClient(); $bucket = $storage->bucket($bucketName); $bucket->update([ 'autoclass' => [ 'enabled' => $autoclassStatus, + 'terminalStorageClass' => $terminalStorageClass ], ]); + $info = $bucket->info(); printf( 'Updated bucket %s with autoclass set to %s.' . PHP_EOL, - $bucketName, + $info['name'], $autoclassStatus ? 'true' : 'false' ); + printf( + 'Autoclass terminal storage class is %s.' . PHP_EOL, + $info['autoclass']['terminalStorageClass'] + ); } # [END storage_set_autoclass] diff --git a/storage/test/storageTest.php b/storage/test/storageTest.php index 1b5a87f6c1..bbf0df0d33 100644 --- a/storage/test/storageTest.php +++ b/storage/test/storageTest.php @@ -836,6 +836,7 @@ public function testGetBucketWithAutoclass() $bucket = self::$storage->createBucket($bucketName, [ 'autoclass' => [ 'enabled' => true, + 'terminalStorageClass' => 'ARCHIVE', ], 'location' => 'US', ]); @@ -849,30 +850,38 @@ public function testGetBucketWithAutoclass() sprintf('Bucket %s has autoclass enabled: %s', $bucketName, true), $output ); + $this->assertStringContainsString( + sprintf('Autoclass terminal storage class is set to %s', 'ARCHIVE'), + $output + ); } public function testSetBucketWithAutoclass() { $bucket = self::$storage->createBucket(uniqid('samples-set-autoclass-'), [ - 'autoclass' => [ - 'enabled' => true, - ], 'location' => 'US', ]); - $info = $bucket->reload(); - $this->assertArrayHasKey('autoclass', $info); - $this->assertTrue($info['autoclass']['enabled']); + $terminalStorageClass = 'ARCHIVE'; $output = self::runFunctionSnippet('set_bucket_autoclass', [ $bucket->name(), - false + true, + $terminalStorageClass ]); $bucket->delete(); $this->assertStringContainsString( sprintf( - 'Updated bucket %s with autoclass set to false.', - $bucket->name(), + 'Updated bucket %s with autoclass set to true.', + $bucket->name() + ), + $output + ); + + $this->assertStringContainsString( + sprintf( + 'Autoclass terminal storage class is %s.' . PHP_EOL, + $terminalStorageClass ), $output );