# Cloud DNS API - Module Google::Cloud::Dns (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 module Google::Cloud::Dns.

## Google Cloud DNS

Google Cloud DNS is a high-performance, resilient, global DNS service that
provides a cost-effective way to make your applications and services
available to your users. This programmable, authoritative DNS service can
be used to easily publish and manage DNS records using the same
infrastructure relied upon by Google. To learn more, read [Cloud
DNS Overview](https://cloud.google.com/dns/docs/overview).

See [Google Cloud DNS Overview](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/index.html "Google Cloud DNS Overview").

## Methods

### .configure

    def self.configure() -> Google::Cloud::Config

Configure the Google Cloud DNS library.

The following DNS configuration parameters are supported:

- `project_id` - (String) Identifier for a DNS project. (The parameter `project` is considered deprecated, but may also be used.)
- `credentials` - (String, Hash, Google::Auth::Credentials) The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See [Credentials](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Credentials "Google::Cloud::Dns::Credentials (class)")) (The parameter `keyfile` is considered deprecated, but may also be used.)
- `scope` - (String, Array
- `retries` - (Integer) Number of times to retry requests on server error.
- `timeout` - (Integer) Default timeout to use in requests.
- `endpoint` - (String) Override of the endpoint host name, or `nil` to use the default endpoint.
**Yields**

- (Google::Cloud.configure.dns)
**Returns**

- (Google::Cloud::Config) --- The configuration object the Google::Cloud::Dns library uses.

### .new

    def self.new(project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil) -> Google::Cloud::Dns::Project

Creates a new `Project` instance connected to the DNS service.
Each call creates a new connection.


<br />

For more information on connecting to Google Cloud see the
[Authentication Guide](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/AUTHENTICATION "Authentication Guide").
**Parameters**

- **project_id** (String) *(defaults to: nil)* --- Identifier for a DNS project. If not present, the default project for the credentials is used.
- **credentials** (Google::Auth::Credentials) *(defaults to: nil)* --- A Google::Auth::Credentials object. (See [Credentials](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Credentials "Google::Cloud::Dns::Credentials (class)")) @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials is deprecated. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data.


  @example

  # The recommended way to provide credentials is to use the `make_creds` method
  # on the appropriate credentials class for your environment.

  require "googleauth"

  credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
  json_key_io: ::File.open("/path/to/keyfile.json")
  )

  dns = Google::Cloud::Dns.new(
  project_id: "my-project-id",
  credentials: credentials
  )
- **scope** (String, Array\<String\>) *(defaults to: nil)* ---

  The OAuth 2.0 scopes controlling
  the set of resources and operations that the connection can access.
  See [Using OAuth 2.0 to Access Google
  APIs](https://developers.google.com/identity/protocols/OAuth2).

  The default scope is:
  - `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
- **retries** (Integer) *(defaults to: nil)* --- Number of times to retry requests on server error. The default value is `3`. Optional.
- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional.
- **endpoint** (String) *(defaults to: nil)* --- Override of the endpoint host name. Optional. If the param is nil, uses the default endpoint.
- **project** (String) *(defaults to: nil)* --- Alias for the `project_id` argument. Deprecated.
- **keyfile** (String) *(defaults to: nil)* --- Alias for the `credentials` argument. Deprecated.
**Returns**

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

- (ArgumentError)
**Example**

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

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

zone = dns.zone "example-com"
```

## Constants

### VERSION

**value:**"1.2.0".freeze