Method: resourceRecordSets.create

Creates a new ResourceRecordSet.

HTTP request

POST https://dns.googleapis.com/dns/v1/projects/{project}/managedZones/{managedZone}/rrsets

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
project

string

Identifies the project addressed by this request.

managedZone

string

Identifies the managed zone addressed by this request. Can be the managed zone name or ID.

Query parameters

Parameters
clientOperationId

string

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 contains an instance of ResourceRecordSet.

Response body

If successful, the response body contains a newly created instance of ResourceRecordSet.

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.

Examples

Python

Uses the Google API Client Library for Python.

"""
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 Python client library for Google APIs by running
   `pip install --upgrade google-api-python-client`
"""

import pprint

from googleapiclient import discovery
from oauth2client.client import GoogleCredentials

credentials
= GoogleCredentials.get_application_default()

service
= discovery.build('dns', 'v1', credentials=credentials)

# Project ID for this request.
project
= 'my-project'  # TODO(developer): Update placeholder value.

# The name of the zone for this request.
managed_zone
= 'my-managed-zone'  # TODO(developer): Update placeholder value.

dns_record_body
= {
   
# TODO(developer): Update kind placeholder value.
   
'kind': 'dns#resourceRecordSet',
   
# TODO(developer): Update name placeholder value.
   
'name': 'my-record.my-zone.my-domain.',
   
# TODO(developer): Update rrdatas placeholder values.
   
'rrdatas': ['my-ip-address01'],
   
# TODO(developer): Update ttl placeholder value.
   
'ttl': 300,
   
# TODO(developer): Update type placeholder value.
   
'type': 'A'
}

request
= service.resourceRecordSets().create(
    project
=project,
    managedZone
=managed_zone,
    body
=dns_record_body
   
)

response
= request.execute()
pprint
.pprint(response)