- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- Examples
- Try it!
Deletes a previously created Policy. Fails if the policy is still being referenced by a network.
HTTP request
DELETE https://dns.googleapis.com/dns/v1/projects/{project}/policies/{policy}
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
project |
Identifies the project addressed by this request. |
policy |
User given friendly name of the policy addressed by this request. |
Query parameters
Parameters | |
---|---|
clientOperationId |
For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. |
Request body
The request body must be empty.
Response body
If successful, the response body is empty.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/ndev.clouddns.readwrite
For more information, see the Authentication Overview.
Uses the Node.js client library.Examples
// BEFORE RUNNING:
// ---------------
// 1. If not already done, enable the Google Cloud DNS API
// and check the quota for your project at
// https://console.developers.google.com/apis/api/dns
// 2. This sample uses Application Default Credentials for authentication.
// If not already done, install the gcloud CLI from
// https://cloud.google.com/sdk and run
// `gcloud beta auth application-default login`.
// For more information, see
// https://developers.google.com/identity/protocols/application-default-credentials
// 3. Install the Node.js client library by running
// `npm install googleapis --save`
const {google} = require('googleapis');
const dns = google.dns('v1');
async function main () {
const authClient = await authorize();
const request = {
// Identifies the project addressed by this request.
project: 'my-project', // TODO: Update placeholder value.
// User given friendly name of the policy addressed by this request.
policy: 'my-policy', // TODO: Update placeholder value.
auth: authClient,
};
try {
await dns.policies.delete(request);
} catch (err) {
console.error(err);
}
}
main();
async function authorize() {
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
return await auth.getClient();
}