( projectId = 'my-project', locationId = 'us-east1', namespaceId = 'my-namespace', serviceId = 'my-service' )
| 16 | 'use strict'; |
| 17 | |
| 18 | async function main( |
| 19 | projectId = 'my-project', |
| 20 | locationId = 'us-east1', |
| 21 | namespaceId = 'my-namespace', |
| 22 | serviceId = 'my-service' |
| 23 | ) { |
| 24 | // [START servicedirectory_delete_service] |
| 25 | // |
| 26 | // TODO(developer): Uncomment these variables before running the sample. |
| 27 | // |
| 28 | // const projectId = 'my-project'; |
| 29 | // const locationId = 'us-central1'; |
| 30 | // const namespaceId = 'my-namespace'; |
| 31 | // const serviceId = 'my-service'; |
| 32 | |
| 33 | // Imports the Google Cloud client library |
| 34 | const { |
| 35 | RegistrationServiceClient, |
| 36 | } = require('@google-cloud/service-directory'); |
| 37 | |
| 38 | // Creates a client |
| 39 | const registrationServiceClient = new RegistrationServiceClient(); |
| 40 | |
| 41 | // Build the service name |
| 42 | const serviceName = registrationServiceClient.servicePath( |
| 43 | projectId, |
| 44 | locationId, |
| 45 | namespaceId, |
| 46 | serviceId |
| 47 | ); |
| 48 | |
| 49 | async function deleteService() { |
| 50 | await registrationServiceClient.deleteService({ |
| 51 | name: serviceName, |
| 52 | }); |
| 53 | |
| 54 | console.log(`Deleted service: ${serviceName}`); |
| 55 | } |
| 56 | |
| 57 | deleteService(); |
| 58 | // [END servicedirectory_delete_service] |
| 59 | } |
| 60 | |
| 61 | const args = process.argv.slice(2); |
| 62 | main(...args).catch(console.error); |
no test coverage detected