MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

service-directory/snippets/deleteService.js:18–59  ·  view source on GitHub ↗
(
  projectId = 'my-project',
  locationId = 'us-east1',
  namespaceId = 'my-namespace',
  serviceId = 'my-service'
)

Source from the content-addressed store, hash-verified

16'use strict';
17
18async 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
61const args = process.argv.slice(2);
62main(...args).catch(console.error);

Callers 1

deleteService.jsFile · 0.70

Calls 1

deleteServiceFunction · 0.85

Tested by

no test coverage detected