project_id(String) — Identifier for a DNS project. If not present,
the default project for the credentials is 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. (SeeDns::Credentials)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud DNS API - Module Google::Cloud (v1.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.0 (latest)](/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud)\n- [1.0.0](/ruby/docs/reference/google-cloud-dns/1.0.0/Google-Cloud)\n- [0.37.0](/ruby/docs/reference/google-cloud-dns/0.37.0/Google-Cloud)\n- [0.36.1](/ruby/docs/reference/google-cloud-dns/0.36.1/Google-Cloud)\n- [0.35.1](/ruby/docs/reference/google-cloud-dns/0.35.1/Google-Cloud) \nReference documentation and code samples for the Cloud DNS API module Google::Cloud.\n\nMethods\n-------\n\n### .dns\n\n def self.dns(project_id = nil, credentials = nil, scope: nil, retries: nil, timeout: nil) -\u003e Google::Cloud::Dns::Project\n\nCreates a new `Project` instance connected to the DNS service.\nEach call creates a new connection.\n\n\n\u003cbr /\u003e\n\nFor more information on connecting to Google Cloud see the\n[Authentication Guide](./AUTHENTICATION \"Authentication Guide\"). \n**Parameters**\n\n- **project_id** (String) --- Identifier for a DNS project. If not present, the default project for the credentials is used.\n- **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 [Dns::Credentials](/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud-Dns-Credentials \"Google::Cloud::Dns::Credentials (class)\"))\n- **scope** (String, Array\\\u003cString\\\u003e) *(defaults to: nil)* ---\n\n The OAuth 2.0 scopes controlling the\n set of resources and operations that the connection can access. See\n [Using OAuth 2.0 to Access Google\n APIs](https://developers.google.com/identity/protocols/OAuth2).\n\n The default scope is:\n - `https://www.googleapis.com/auth/ndev.clouddns.readwrite`\n- **retries** (Integer) *(defaults to: nil)* --- Number of times to retry requests on server error. The default value is `3`. Optional.\n- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional. \n**Returns**\n\n- ([Google::Cloud::Dns::Project](./Google-Cloud-Dns-Project))\n**Example** \n\n```ruby\nrequire \"google/cloud\"\n\ndns = Google::Cloud.dns \"my-project\", \"/path/to/keyfile.json\"\n\nzone = dns.zone \"example-com\"\n```\n\n### #dns\n\n def dns(scope: nil, retries: nil, timeout: nil) -\u003e Google::Cloud::Dns::Project\n\nCreates a new object for connecting to the DNS service.\nEach call creates a new connection.\n\n\n\u003cbr /\u003e\n\nFor more information on connecting to Google Cloud see the\n[Authentication Guide](./AUTHENTICATION \"Authentication Guide\"). \n**Parameters**\n\n- **scope** (String, Array\\\u003cString\\\u003e) *(defaults to: nil)* ---\n\n The OAuth 2.0 scopes controlling the\n set of resources and operations that the connection can access. See\n [Using OAuth 2.0 to Access Google\n APIs](https://developers.google.com/identity/protocols/OAuth2).\n\n The default scope is:\n - `https://www.googleapis.com/auth/ndev.clouddns.readwrite`\n- **retries** (Integer) *(defaults to: nil)* --- Number of times to retry requests on server error. The default value is `3`. Optional.\n- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional. \n**Returns**\n\n- ([Google::Cloud::Dns::Project](./Google-Cloud-Dns-Project))\n**Examples** \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\ndns = gcloud.dns\nzone = dns.zone \"example-com\"\nzone.records.each do |record|\n puts record.name\nend\n```\n\nThe default scope can be overridden with the `scope` option: \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\ndns_readonly = \"https://www.googleapis.com/auth/ndev.clouddns.readonly\"\ndns = gcloud.dns scope: dns_readonly\n```"]]