# Cloud DNS API - Class Google::Cloud::Dns::Project (v1.2.0)

1.2.0 (latest) 1.1.1 1.0.0 0.37.0 0.36.1 0.35.1 Reference documentation and code samples for the Cloud DNS API class Google::Cloud::Dns::Project.

## Project

The project is a top level container for resources including Cloud DNS
ManagedZones. Projects can be created only in the [Google Developers
Console](https://console.developers.google.com).

See [Google::Cloud#dns](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud#Google__Cloud_dns_instance_ "Google::Cloud#dns (method)")

## Inherits

- Object

## Example

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.zone "example-com"
zone.records.each do |record|
  puts record.name
end
```

## Methods

### #additions_per_change

    def additions_per_change()

Maximum allowed number of records to add per change.

### #create_zone

    def create_zone(zone_name, zone_dns, description: nil, name_server_set: nil) -> Google::Cloud::Dns::Zone

Creates a new zone.
**Parameters**

- **zone_name** (String) --- User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes.
- **zone_dns** (String) --- The DNS name of this managed zone, for instance "example.com.".
- **description** (String) *(defaults to: nil)* --- A string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function.
- **name_server_set** (String) *(defaults to: nil)* --- A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset.
**Returns**

- ([Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone))
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.create_zone "example-com", "example.com."
```

### #data_per_record

    def data_per_record()

Maximum allowed number of data entries per record.

### #deletions_per_change

    def deletions_per_change()

Maximum allowed number of records to delete per change.

### #find_zone

    def find_zone(zone_id) -> Google::Cloud::Dns::Zone, nil

**Alias Of** : [#zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_zone_instance_) Retrieves an existing zone by name or id.
**Parameter**

- **zone_id** (String, Integer) --- The name or id of a zone.
**Returns**

- ([Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone), nil) --- Returns `nil` if the zone does not exist.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.zone "example-com"
puts zone.name
```

### #find_zones

    def find_zones(token: nil, max: nil) -> Array<Google::Cloud::Dns::Zone>

**Alias Of** : [#zones](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_zones_instance_) Retrieves the list of zones belonging to the project.


<br />

[Zone::List](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone-List "Google::Cloud::Dns::Zone::List (class)"))
**Parameters**

- **token** (String) *(defaults to: nil)* --- A previously-returned page token representing part of the larger set of results to view.
- **max** (Integer) *(defaults to: nil)* --- Maximum number of zones to return.
**Returns**

- (Array\<[Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone)\>) --- (See
**Examples**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zones = dns.zones
zones.each do |zone|
  puts zone.name
end
```

Retrieve all zones: (See [Zone::List#all](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone-List#Google__Cloud__Dns__Zone__List_all_instance_ "Google::Cloud::Dns::Zone::List#all (method)"))

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zones = dns.zones
zones.all do |zone|
  puts zone.name
end
```

### #get_zone

    def get_zone(zone_id) -> Google::Cloud::Dns::Zone, nil

**Alias Of** : [#zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_zone_instance_) Retrieves an existing zone by name or id.
**Parameter**

- **zone_id** (String, Integer) --- The name or id of a zone.
**Returns**

- ([Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone), nil) --- Returns `nil` if the zone does not exist.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.zone "example-com"
puts zone.name
```

### #id

    def id()

**Alias Of** : [#project_id](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_project_id_instance_) The unique ID string for the current project.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new(
  project_id: "my-project",
  credentials: "/path/to/keyfile.json"
)

dns.project_id #=> "my-project"
```

### #number

    def number()

The project number.

### #project

    def project()

**Alias Of** : [#project_id](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_project_id_instance_) The unique ID string for the current project.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new(
  project_id: "my-project",
  credentials: "/path/to/keyfile.json"
)

dns.project_id #=> "my-project"
```

### #project_id

    def project_id()

**Aliases**

- [#project](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_project_instance_)
- [#id](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_id_instance_)
The unique ID string for the current project.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new(
  project_id: "my-project",
  credentials: "/path/to/keyfile.json"
)

dns.project_id #=> "my-project"
```

### #records_per_zone

    def records_per_zone()

Maximum allowed number of records per zone in the project.

### #refresh!

    def refresh!()

**Alias Of** : [#reload!](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_reload!_instance_) Reloads the change with updated status from the DNS service.

### #reload!

    def reload!()

**Aliases**

- [#refresh!](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_refresh!_instance_)
Reloads the change with updated status from the DNS service.

### #total_data_per_change

    def total_data_per_change()

Maximum allowed total bytes size for all the data in one change.

### #zone

    def zone(zone_id) -> Google::Cloud::Dns::Zone, nil

**Aliases**

- [#find_zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_find_zone_instance_)
- [#get_zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_get_zone_instance_)
Retrieves an existing zone by name or id.
**Parameter**

- **zone_id** (String, Integer) --- The name or id of a zone.
**Returns**

- ([Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone), nil) --- Returns `nil` if the zone does not exist.
**Example**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.zone "example-com"
puts zone.name
```

### #zones

    def zones(token: nil, max: nil) -> Array<Google::Cloud::Dns::Zone>

**Aliases**

- [#find_zones](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Project#Google__Cloud__Dns__Project_find_zones_instance_)
Retrieves the list of zones belonging to the project.


<br />

[Zone::List](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone-List "Google::Cloud::Dns::Zone::List (class)"))
**Parameters**

- **token** (String) *(defaults to: nil)* --- A previously-returned page token representing part of the larger set of results to view.
- **max** (Integer) *(defaults to: nil)* --- Maximum number of zones to return.
**Returns**

- (Array\<[Google::Cloud::Dns::Zone](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone)\>) --- (See
**Examples**

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zones = dns.zones
zones.each do |zone|
  puts zone.name
end
```

Retrieve all zones: (See [Zone::List#all](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Zone-List#Google__Cloud__Dns__Zone__List_all_instance_ "Google::Cloud::Dns::Zone::List#all (method)"))

```ruby
require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zones = dns.zones
zones.all do |zone|
  puts zone.name
end
```

### #zones_quota

    def zones_quota()

Maximum allowed number of zones in the project.