diff --git a/storagecontrol/composer.json b/storagecontrol/composer.json index 01218016b..182f667f4 100644 --- a/storagecontrol/composer.json +++ b/storagecontrol/composer.json @@ -3,6 +3,6 @@ "google/cloud-storage-control": "1.3.0" }, "require-dev": { - "google/cloud-storage": "^1.41.3" + "google/cloud-storage": "^1.48.1" } } diff --git a/storagecontrol/src/create_anywhere_cache.php b/storagecontrol/src/create_anywhere_cache.php new file mode 100644 index 000000000..e3a749558 --- /dev/null +++ b/storagecontrol/src/create_anywhere_cache.php @@ -0,0 +1,67 @@ +bucketName('_', $bucketName); + + $anywhereCache = new AnywhereCache([ + 'zone' => $zone, + ]); + + $request = new CreateAnywhereCacheRequest([ + 'parent' => $formattedName, + 'anywhere_cache' => $anywhereCache, + ]); + + // Start a create operation and block until it completes. Real applications + // may want to setup a callback, wait on a coroutine, or poll until it + // completes. + $response = $storageControlClient->createAnywhereCache($request); + + printf('Created anywhere cache: %s', $response->getName()); +} +# [END storage_control_create_anywhere_cache] + +// 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/storagecontrol/src/disable_anywhere_cache.php b/storagecontrol/src/disable_anywhere_cache.php new file mode 100644 index 000000000..dbddf3c76 --- /dev/null +++ b/storagecontrol/src/disable_anywhere_cache.php @@ -0,0 +1,58 @@ +anywhereCacheName('_', $bucketName, $anywhereCacheId); + + $request = new DisableAnywhereCacheRequest([ + 'name' => $formattedName + ]); + + $response = $storageControlClient->disableAnywhereCache($request); + + printf('Disabled anywhere cache: %s', $response->getName()); +} +# [END storage_control_disable_anywhere_cache] + +// 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/storagecontrol/src/get_anywhere_cache.php b/storagecontrol/src/get_anywhere_cache.php new file mode 100644 index 000000000..7687cf6ca --- /dev/null +++ b/storagecontrol/src/get_anywhere_cache.php @@ -0,0 +1,58 @@ +anywhereCacheName('_', $bucketName, $anywhereCacheId); + + $request = new GetAnywhereCacheRequest([ + 'name' => $formattedName, + ]); + + $response = $storageControlClient->getAnywhereCache($request); + + printf('Got anywhere cache: %s', $response->getName()); +} +# [END storage_control_get_anywhere_cache] + +// 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/storagecontrol/src/list_anywhere_caches.php b/storagecontrol/src/list_anywhere_caches.php new file mode 100644 index 000000000..91ed6e29b --- /dev/null +++ b/storagecontrol/src/list_anywhere_caches.php @@ -0,0 +1,58 @@ +bucketName('_', $bucketName); + + $request = new ListAnywhereCachesRequest([ + 'parent' => $formattedName, + ]); + + $response = $storageControlClient->listAnywhereCaches($request); + + foreach ($response as $anywhereCache) { + printf('Anywhere cache name: %s' . PHP_EOL, $anywhereCache->getName()); + } +} +# [END storage_control_list_anywhere_caches] + +// 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/storagecontrol/src/pause_anywhere_cache.php b/storagecontrol/src/pause_anywhere_cache.php new file mode 100644 index 000000000..260e7bb37 --- /dev/null +++ b/storagecontrol/src/pause_anywhere_cache.php @@ -0,0 +1,58 @@ +anywhereCacheName('_', $bucketName, $anywhereCacheId); + + $request = new PauseAnywhereCacheRequest([ + 'name' => $formattedName, + ]); + + $response = $storageControlClient->pauseAnywhereCache($request); + + printf('Paused anywhere cache: %s', $response->getName()); +} +# [END storage_control_pause_anywhere_cache] + +// 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/storagecontrol/src/resume_anywhere_cache.php b/storagecontrol/src/resume_anywhere_cache.php new file mode 100644 index 000000000..a95dd6f92 --- /dev/null +++ b/storagecontrol/src/resume_anywhere_cache.php @@ -0,0 +1,58 @@ +anywhereCacheName('_', $bucketName, $anywhereCacheId); + + $request = new ResumeAnywhereCacheRequest([ + 'name' => $formattedName + ]); + + $response = $storageControlClient->resumeAnywhereCache($request); + + printf('Resumed anywhere cache: %s', $response->getName()); +} +# [END storage_control_resume_anywhere_cache] + +// 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/storagecontrol/src/update_anywhere_cache.php b/storagecontrol/src/update_anywhere_cache.php new file mode 100644 index 000000000..4d2fba02a --- /dev/null +++ b/storagecontrol/src/update_anywhere_cache.php @@ -0,0 +1,74 @@ +anywhereCacheName('_', $bucketName, $anywhereCacheId); + + $anywhereCache = new AnywhereCache([ + 'name' => $formattedName, + 'admission_policy' => $admission_policy, + ]); + + $updateMask = new FieldMask([ + 'paths' => ['admission_policy'], + ]); + + // Start an update operation and block until it completes. Real applications + // may want to setup a callback, wait on a coroutine, or poll until it + // completes. + $request = new UpdateAnywhereCacheRequest([ + 'anywhere_cache' => $anywhereCache, + 'update_mask' => $updateMask, + ]); + + $response = $storageControlClient->updateAnywhereCache($request); + + printf('Updated anywhere cache: %s', $response->getName()); +} +# [END storage_control_update_anywhere_cache] + +// 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);