Managed Zones#
Define API ManagedZones.
-
class
google.cloud.dns.zone.
ManagedZone
(name, dns_name=None, client=None, description=None)[source]# Bases:
object
ManagedZones are containers for DNS resource records.
See: https://cloud.google.com/dns/api/v1/managedZones
Parameters: - name (string) – the name of the zone
- dns_name (string or
NoneType
) – the DNS name of the zone. If not passed, then calls tocreate()
will fail. - client (
google.cloud.dns.client.Client
) – A client which holds credentials and project configuration for the zone (which requires a project). - description (string or
NoneType
) – the description for the zone. If not passed, defaults to the value of ‘dns_name’.
-
changes
()[source]# Construct a change set bound to this zone.
Return type: google.cloud.dns.changes.Changes
Returns: a new Changes
instance
-
create
(client=None)[source]# API call: create the zone via a PUT request
See: https://cloud.google.com/dns/api/v1/managedZones/create
Parameters: client ( google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.
-
created
# Datetime at which the zone was created.
Return type: datetime.datetime
, orNoneType
Returns: the creation time (None until set from the server).
-
delete
(client=None)[source]# API call: delete the zone via a DELETE request
See: https://cloud.google.com/dns/api/v1/managedZones/delete
Parameters: client ( google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.
-
description
# Description of the zone.
Return type: string, or NoneType
Returns: The description as set by the user, or None (the default).
-
exists
(client=None)[source]# API call: test for the existence of the zone via a GET request
See https://cloud.google.com/dns/api/v1/managedZones/get
Parameters: client ( google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.Return type: bool Returns: Boolean indicating existence of the managed zone.
-
classmethod
from_api_repr
(resource, client)[source]# Factory: construct a zone given its API representation
Parameters: - resource (dict) – zone resource representation returned from the API
- client (
google.cloud.dns.client.Client
) – Client which holds credentials and project configuration for the zone.
Return type: Returns: Zone parsed from
resource
.
-
list_changes
(max_results=None, page_token=None, client=None)[source]# List change sets for this zone.
See: https://cloud.google.com/dns/api/v1/resourceRecordSets/list
Parameters: - max_results (int) – maximum number of zones to return, If not passed, defaults to a value set by the API.
- page_token (string) – opaque marker for the next “page” of zones. If not passed, the API will return the first page of zones.
- client (
google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.
Return type: tuple, (list, str)
Returns: list of
google.cloud.dns.resource_record_set.ResourceRecordSet
, plus a “next page token” string: if the token is not None, indicates that more zones can be retrieved with another call (pass that value aspage_token
).
-
list_resource_record_sets
(max_results=None, page_token=None, client=None)[source]# List resource record sets for this zone.
See: https://cloud.google.com/dns/api/v1/resourceRecordSets/list
Parameters: - max_results (int) – maximum number of zones to return, If not passed, defaults to a value set by the API.
- page_token (string) – opaque marker for the next “page” of zones. If not passed, the API will return the first page of zones.
- client (
google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.
Return type: tuple, (list, str)
Returns: list of
google.cloud.dns.resource_record_set.ResourceRecordSet
, plus a “next page token” string: if the token is not None, indicates that more zones can be retrieved with another call (pass that value aspage_token
).
-
name_server_set
# Named set of DNS name servers that all host the same ManagedZones.
Most users will leave this blank.
See: https://cloud.google.com/dns/api/v1/managedZones#nameServerSet
Return type: string, or NoneType
Returns: The name as set by the user, or None (the default).
-
name_servers
# Datetime at which the zone was created.
Return type: list of strings, or NoneType
.Returns: the assigned name servers (None until set from the server).
-
path
# URL path for the zone’s APIs.
Return type: string Returns: the path based on project and dataste name.
-
project
# Project bound to the zone.
Return type: string Returns: the project (derived from the client).
-
reload
(client=None)[source]# API call: refresh zone properties via a GET request
See https://cloud.google.com/dns/api/v1/managedZones/get
Parameters: client ( google.cloud.dns.client.Client
orNoneType
) – the client to use. If not passed, falls back to theclient
stored on the current zone.
-
resource_record_set
(name, record_type, ttl, rrdatas)[source]# Construct a resource record set bound to this zone.
Parameters: Return type: Returns: a new
ResourceRecordSet
instance
-
zone_id
# ID for the zone resource.
Return type: string, or NoneType
Returns: the ID (None until set from the server).