(storagePoolName)
| 17 | 'use strict'; |
| 18 | |
| 19 | async function main(storagePoolName) { |
| 20 | // [START compute_hyperdisk_pool_create] |
| 21 | // Import the Compute library |
| 22 | const computeLib = require('@google-cloud/compute'); |
| 23 | const compute = computeLib.protos.google.cloud.compute.v1; |
| 24 | |
| 25 | // Instantiate a storagePoolClient |
| 26 | const storagePoolClient = new computeLib.StoragePoolsClient(); |
| 27 | // Instantiate a zoneOperationsClient |
| 28 | const zoneOperationsClient = new computeLib.ZoneOperationsClient(); |
| 29 | |
| 30 | /** |
| 31 | * TODO(developer): Update/uncomment these variables before running the sample. |
| 32 | */ |
| 33 | // Project ID or project number of the Google Cloud project you want to use. |
| 34 | const projectId = await storagePoolClient.getProjectId(); |
| 35 | // Name of the zone in which you want to create the storagePool. |
| 36 | const zone = 'us-central1-a'; |
| 37 | // Name of the storagePool you want to create. |
| 38 | // storagePoolName = 'storage-pool-name'; |
| 39 | // The type of disk you want to create. This value uses the following format: |
| 40 | // "projects/{projectId}/zones/{zone}/storagePoolTypes/(hyperdisk-throughput|hyperdisk-balanced)" |
| 41 | const storagePoolType = `projects/${projectId}/zones/${zone}/storagePoolTypes/hyperdisk-balanced`; |
| 42 | // Optional: The capacity provisioning type of the storage pool. |
| 43 | // The allowed values are advanced and standard. If not specified, the value advanced is used. |
| 44 | const capacityProvisioningType = 'advanced'; |
| 45 | // The total capacity to provision for the new storage pool, specified in GiB by default. |
| 46 | const provisionedCapacity = 10240; |
| 47 | // The IOPS to provision for the storage pool. |
| 48 | // You can use this flag only with Hyperdisk Balanced Storage Pools. |
| 49 | const provisionedIops = 10000; |
| 50 | // The throughput in MBps to provision for the storage pool. |
| 51 | const provisionedThroughput = 1024; |
| 52 | // Optional: The performance provisioning type of the storage pool. |
| 53 | // The allowed values are advanced and standard. If not specified, the value advanced is used. |
| 54 | const performanceProvisioningType = 'advanced'; |
| 55 | |
| 56 | async function callCreateComputeHyperdiskPool() { |
| 57 | // Create a storagePool. |
| 58 | const storagePool = new compute.StoragePool({ |
| 59 | name: storagePoolName, |
| 60 | poolProvisionedCapacityGb: provisionedCapacity, |
| 61 | poolProvisionedIops: provisionedIops, |
| 62 | poolProvisionedThroughput: provisionedThroughput, |
| 63 | storagePoolType, |
| 64 | performanceProvisioningType, |
| 65 | capacityProvisioningType, |
| 66 | zone, |
| 67 | }); |
| 68 | |
| 69 | const [response] = await storagePoolClient.insert({ |
| 70 | project: projectId, |
| 71 | storagePoolResource: storagePool, |
| 72 | zone, |
| 73 | }); |
| 74 | |
| 75 | let operation = response.latestResponse; |
| 76 |
no test coverage detected