Class ManagedZone (0.34.0)

ManagedZone(name, dns_name=None, client=None, description=None)

ManagedZones are containers for DNS resource records.

See https://cloud.google.com/dns/api/v1/managedZones

Parameters

NameDescription
name str

the name of the zone

dns_name str

(Optional) the DNS name of the zone. If not passed, then calls to create will fail.

client Client

A client which holds credentials and project configuration for the zone (which requires a project).

description str

(Optional) the description for the zone. If not passed, defaults to the value of 'dns_name'.

Properties

created

Datetime at which the zone was created.

Returns
TypeDescription
datetime.datetime, or NoneTypethe creation time (None until set from the server).

description

Description of the zone.

Returns
TypeDescription
str, or NoneTypeThe description as set by the user, or None (the default).

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

Returns
TypeDescription
str, or NoneTypeThe name as set by the user, or None (the default).

name_servers

Datetime at which the zone was created.

Returns
TypeDescription
list of strings, or NoneType.the assigned name servers (None until set from the server).

path

URL path for the zone's APIs.

Returns
TypeDescription
strthe path based on project and dataste name.

project

Project bound to the zone.

Returns
TypeDescription
strthe project (derived from the client).

zone_id

ID for the zone resource.

Returns
TypeDescription
str, or NoneTypethe ID (None until set from the server).

Methods

changes

changes()

Construct a change set bound to this zone.

Returns
TypeDescription
Changesa new Changes instance

create

create(client=None)

API call: create the zone via a PUT request

See https://cloud.google.com/dns/api/v1/managedZones/create

Parameter
NameDescription
client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

delete

delete(client=None)

API call: delete the zone via a DELETE request

See https://cloud.google.com/dns/api/v1/managedZones/delete

Parameter
NameDescription
client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

exists

exists(client=None)

API call: test for the existence of the zone via a GET request

See https://cloud.google.com/dns/api/v1/managedZones/get

Parameter
NameDescription
client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

Returns
TypeDescription
boolBoolean indicating existence of the managed zone.

from_api_repr

from_api_repr(resource, client)

Factory: construct a zone given its API representation

Parameters
NameDescription
resource dict

zone resource representation returned from the API

client Client

Client which holds credentials and project configuration for the zone.

Returns
TypeDescription
ManagedZoneZone parsed from resource.

list_changes

list_changes(max_results=None, page_token=None, client=None)
Parameters
NameDescription
max_results int

Optional. The maximum number of change sets to return. Defaults to a sensible value set by the API.

page_token str

Optional. If present, return the next batch of change sets, using the value, which must correspond to the nextPageToken value returned in the previous response. Deprecated: use the pages property of the returned iterator instead of manually passing the token.

client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

Returns
TypeDescription
google.api_core.page_iterator.IteratorIterator of .changes.Changes belonging to this zone.

list_resource_record_sets

list_resource_record_sets(max_results=None, page_token=None, client=None)

List resource record sets for this zone.

See https://cloud.google.com/dns/api/v1/resourceRecordSets/list

Parameters
NameDescription
max_results int

Optional. The maximum number of resource record sets to return. Defaults to a sensible value set by the API.

page_token str

Optional. If present, return the next batch of resource record sets, using the value, which must correspond to the nextPageToken value returned in the previous response. Deprecated: use the pages property of the returned iterator instead of manually passing the token.

client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

Returns
TypeDescription
google.api_core.page_iterator.IteratorIterator of .resource_record_set.ResourceRecordSet belonging to this zone.

reload

reload(client=None)

API call: refresh zone properties via a GET request

See https://cloud.google.com/dns/api/v1/managedZones/get

Parameter
NameDescription
client Client

(Optional) the client to use. If not passed, falls back to the client stored on the current zone.

resource_record_set

resource_record_set(name, record_type, ttl, rrdatas)

Construct a resource record set bound to this zone.

Parameters
NameDescription
name str

Name of the record set.

record_type str

RR type

ttl int

TTL for the RR, in seconds

rrdatas list of string

resource data for the RR

Returns
TypeDescription
ResourceRecordSeta new ResourceRecordSet instance