google-cloud-dns 0.29.2 → 0.29.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2430409168fd2bee1be6c69ef0de57e35d2c473a8f9d996995dc3952a01ab37e
4
- data.tar.gz: 6d86dc2b9aec7ec841218bf80de1bc7f2b23f2ae0e5fe00f7c3b496b41f4818a
3
+ metadata.gz: be4b25685e3ae6cefb7c36cded81c5a6ae3f71e284add2a9f93d73b4ddeb6457
4
+ data.tar.gz: a6f41e044cbcaecc6f4828e79f0605c69823e3e4fa9bbb3df4f4784450cdc4a3
5
5
  SHA512:
6
- metadata.gz: 3de53cc5f31703f9afc7b38ef31b3bc7252821b374ab4a3554d3379a4ca5d5a385b92e74033c6ed7281dc90727c125b7421666897e38c20753c4e645d6ae1918
7
- data.tar.gz: 11e1ea1862bfb949da948d96480b66ff51eedc0212165b9bf0ffc09fe9d2db74a3ad638deb88fb69ed3c5be83842c266dfc3b6640684c4417040a5aded596697
6
+ metadata.gz: 830b6ed9e1fab0cf7d67df07434495caf2d64b7a4a4e89aa252f6f926da0526f4ccd54d8ed009851ccb0a771f11264ac51c80ca3f039b9b17a8e2e67ff2d8c91
7
+ data.tar.gz: e1f92e514ee988222889c046dd495a47b62459b18ff1e1b31683a131526cc542f844117aaf8e61bcca77cdf9ec1d93cffae5e5e959406e210401b54da976c395
@@ -0,0 +1,180 @@
1
+ # Authentication
2
+
3
+ In general, the google-cloud-dns library uses [Service
4
+ Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
+ credentials to connect to Google Cloud services. When running on Compute Engine
6
+ the credentials will be discovered automatically. When running on other
7
+ environments, the Service Account credentials can be specified by providing the
8
+ path to the [JSON
9
+ keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
10
+ the account (or the JSON itself) in environment variables. Additionally, Cloud
11
+ SDK credentials can also be discovered automatically, but this is only
12
+ recommended during development.
13
+
14
+ ## Project and Credential Lookup
15
+
16
+ The google-cloud-dns library aims to make authentication as simple as
17
+ possible, and provides several mechanisms to configure your system without
18
+ providing **Project ID** and **Service Account Credentials** directly in code.
19
+
20
+ **Project ID** is discovered in the following order:
21
+
22
+ 1. Specify project ID in method arguments
23
+ 2. Specify project ID in configuration
24
+ 3. Discover project ID in environment variables
25
+ 4. Discover GCE project ID
26
+
27
+ **Credentials** are discovered in the following order:
28
+
29
+ 1. Specify credentials in method arguments
30
+ 2. Specify credentials in configuration
31
+ 3. Discover credentials path in environment variables
32
+ 4. Discover credentials JSON in environment variables
33
+ 5. Discover credentials file in the Cloud SDK's path
34
+ 6. Discover GCE credentials
35
+
36
+ ### Google Cloud Platform environments
37
+
38
+ While running on Google Cloud Platform environments such as Google Compute
39
+ Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
40
+ The **Project ID** and **Credentials** and are discovered automatically. Code
41
+ should be written as if already authenticated. Just be sure when you [set up the
42
+ GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
43
+ access. For example:
44
+
45
+ * **All APIs**
46
+ * `https://www.googleapis.com/auth/cloud-platform`
47
+ * `https://www.googleapis.com/auth/cloud-platform.read-only`
48
+ * **BigQuery**
49
+ * `https://www.googleapis.com/auth/bigquery`
50
+ * `https://www.googleapis.com/auth/bigquery.insertdata`
51
+ * **Compute Engine**
52
+ * `https://www.googleapis.com/auth/compute`
53
+ * **Datastore**
54
+ * `https://www.googleapis.com/auth/datastore`
55
+ * `https://www.googleapis.com/auth/userinfo.email`
56
+ * **DNS**
57
+ * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
58
+ * **Pub/Sub**
59
+ * `https://www.googleapis.com/auth/pubsub`
60
+ * **Storage**
61
+ * `https://www.googleapis.com/auth/devstorage.full_control`
62
+ * `https://www.googleapis.com/auth/devstorage.read_only`
63
+ * `https://www.googleapis.com/auth/devstorage.read_write`
64
+
65
+ ### Environment Variables
66
+
67
+ The **Project ID** and **Credentials JSON** can be placed in environment
68
+ variables instead of declaring them directly in code. Each service has its own
69
+ environment variable, allowing for different service accounts to be used for
70
+ different services. (See the READMEs for the individual service gems for
71
+ details.) The path to the **Credentials JSON** file can be stored in the
72
+ environment variable, or the **Credentials JSON** itself can be stored for
73
+ environments such as Docker containers where writing files is difficult or not
74
+ encouraged.
75
+
76
+ The environment variables that DNS checks for project ID are:
77
+
78
+ 1. `DNS_PROJECT`
79
+ 2. `GOOGLE_CLOUD_PROJECT`
80
+
81
+ The environment variables that DNS checks for credentials are configured on
82
+ {Google::Cloud::Dns::Credentials}:
83
+
84
+ 1. `DNS_CREDENTIALS` - Path to JSON file, or JSON contents
85
+ 2. `DNS_KEYFILE` - Path to JSON file, or JSON contents
86
+ 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
87
+ 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
88
+ 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
89
+
90
+ ```ruby
91
+ require "google/cloud/dns"
92
+
93
+ ENV["DNS_PROJECT"] = "my-project-id"
94
+ ENV["DNS_CREDENTIALS"] = "path/to/keyfile.json"
95
+
96
+ dns = Google::Cloud::Dns.new
97
+ ```
98
+
99
+ ### Configuration
100
+
101
+ The **Project ID** and **Credentials JSON** can be configured instead of placing
102
+ them in environment variables or providing them as arguments.
103
+
104
+ ```ruby
105
+ require "google/cloud/dns"
106
+
107
+ Google::Cloud::Dns.configure do |config|
108
+ config.project_id = "my-project-id"
109
+ config.credentials = "path/to/keyfile.json"
110
+ end
111
+
112
+ dns = Google::Cloud::Dns.new
113
+ ```
114
+
115
+ ### Cloud SDK
116
+
117
+ This option allows for an easy way to authenticate during development. If
118
+ credentials are not provided in code or in environment variables, then Cloud SDK
119
+ credentials are discovered.
120
+
121
+ To configure your system for this, simply:
122
+
123
+ 1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
124
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
125
+ 3. Write code as if already authenticated.
126
+
127
+ **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
128
+ *should* only be used during development.
129
+
130
+ [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
131
+ [dev-console]: https://console.cloud.google.com/project
132
+
133
+ [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
134
+
135
+ [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
136
+ [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
137
+ [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
138
+
139
+ ## Creating a Service Account
140
+
141
+ Google Cloud requires a **Project ID** and **Service Account Credentials** to
142
+ connect to the APIs. You will use the **Project ID** and **JSON key file** to
143
+ connect to most services with google-cloud-dns.
144
+
145
+ If you are not running this client on Google Compute Engine, you need a Google
146
+ Developers service account.
147
+
148
+ 1. Visit the [Google Developers Console][dev-console].
149
+ 1. Create a new project or click on an existing project.
150
+ 1. Activate the slide-out navigation tray and select **API Manager**. From
151
+ here, you will enable the APIs that your application requires.
152
+
153
+ ![Enable the APIs that your application requires][enable-apis]
154
+
155
+ *Note: You may need to enable billing in order to use these services.*
156
+
157
+ 1. Select **Credentials** from the side navigation.
158
+
159
+ You should see a screen like one of the following.
160
+
161
+ ![Create a new service account][create-new-service-account]
162
+
163
+ ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
164
+
165
+ Find the "Add credentials" drop down and select "Service account" to be
166
+ guided through downloading a new JSON key file.
167
+
168
+ If you want to re-use an existing service account, you can easily generate a
169
+ new key file. Just select the account you wish to re-use, and click "Generate
170
+ new JSON key":
171
+
172
+ ![Re-use an existing service account][reuse-service-account]
173
+
174
+ The key file you download will be used by this library to authenticate API
175
+ requests and should be stored in a secure location.
176
+
177
+ ## Troubleshooting
178
+
179
+ If you're having trouble authenticating you can ask for help by following the
180
+ {file:TROUBLESHOOTING.md Troubleshooting Guide}.
@@ -0,0 +1,69 @@
1
+ # Release History
2
+
3
+ ### 0.29.3 / 2018-09-12
4
+
5
+ * Add missing documentation files to package.
6
+
7
+ ### 0.29.2 / 2018-09-10
8
+
9
+ * Update documentation.
10
+
11
+ ### 0.29.1 / 2018-08-21
12
+
13
+ * Reduce memory usage.
14
+ * Update documentation.
15
+
16
+ ### 0.29.0 / 2018-06-22
17
+
18
+ * Updated dependencies.
19
+
20
+ ### 0.28.0 / 2018-02-27
21
+
22
+ * Add Shared Configuration.
23
+ * Update Google API Client dependency.
24
+
25
+ ### 0.27.0 / 2017-11-14
26
+
27
+ * Add `Google::Cloud::Dns::Credentials` class.
28
+ * Rename constructor arguments to `project_id` and `credentials`.
29
+ (The previous arguments `project` and `keyfile` are still supported.)
30
+ * Document `Google::Auth::Credentials` as `credentials` value.
31
+ * Updated `google-api-client`, `googleauth` dependencies.
32
+
33
+ ### 0.26.0 / 2017-09-28
34
+
35
+ * Update Google API Client dependency to 0.14.x.
36
+
37
+ ### 0.25.0 / 2017-06-27
38
+
39
+ * Upgrade dependency on Google API Client.
40
+ * Update gem spec homepage links.
41
+ * Update tests.
42
+
43
+ ### 0.24.0 / 2017-04-05
44
+
45
+ * Upgrade dependency on Google API Client
46
+
47
+ ### 0.23.0 / 2017-03-31
48
+
49
+ * Updated documentation
50
+
51
+ ### 0.22.0 / 2017-03-03
52
+
53
+ * Updated documentation and code examples.
54
+ * Dependency on Google API Client has been updated to 0.10.x.
55
+
56
+ ### 0.21.0 / 2016-10-20
57
+
58
+ * New service constructor Google::Cloud::Dns.new
59
+
60
+ ### 0.20.1 / 2016-09-02
61
+
62
+ * Fix for timeout on uploads.
63
+
64
+ ### 0.20.0 / 2016-08-26
65
+
66
+ This gem contains the Google Cloud DNS service implementation for the `google-cloud` gem. The `google-cloud` gem replaces the old `gcloud` gem. Legacy code can continue to use the `gcloud` gem.
67
+
68
+ * Namespace is now `Google::Cloud`
69
+ * The `google-cloud` gem is now an umbrella package for individual gems
@@ -0,0 +1,40 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct.
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or reject
24
+ comments, commits, code, wiki edits, issues, and other contributions that are
25
+ not aligned to this Code of Conduct. By adopting this Code of Conduct, project
26
+ maintainers commit themselves to fairly and consistently applying these
27
+ principles to every aspect of managing this project. Project maintainers who do
28
+ not follow or enforce the Code of Conduct may be permanently removed from the
29
+ project team.
30
+
31
+ This code of conduct applies both within project spaces and in public spaces
32
+ when an individual is representing the project or its community.
33
+
34
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
35
+ reported by opening an issue or contacting one or more of the project
36
+ maintainers.
37
+
38
+ This Code of Conduct is adapted from the [Contributor
39
+ Covenant](http://contributor-covenant.org), version 1.2.0, available at
40
+ [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
@@ -0,0 +1,188 @@
1
+ # Contributing to Google Cloud DNS
2
+
3
+ 1. **Sign one of the contributor license agreements below.**
4
+ 2. Fork the repo, develop and test your code changes.
5
+ 3. Send a pull request.
6
+
7
+ ## Contributor License Agreements
8
+
9
+ Before we can accept your pull requests you'll need to sign a Contributor
10
+ License Agreement (CLA):
11
+
12
+ - **If you are an individual writing original source code** and **you own the
13
+ intellectual property**, then you'll need to sign an [individual
14
+ CLA](https://developers.google.com/open-source/cla/individual).
15
+ - **If you work for a company that wants to allow you to contribute your work**,
16
+ then you'll need to sign a [corporate
17
+ CLA](https://developers.google.com/open-source/cla/corporate).
18
+
19
+ You can sign these electronically (just scroll to the bottom). After that, we'll
20
+ be able to accept your pull requests.
21
+
22
+ ## Setup
23
+
24
+ In order to use the google-cloud-dns console and run the project's tests,
25
+ there is a small amount of setup:
26
+
27
+ 1. Install Ruby. google-cloud-dns requires Ruby 2.3+. You may choose to
28
+ manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
+ [rbenv](https://github.com/rbenv/rbenv), or
30
+ [chruby](https://github.com/postmodern/chruby).
31
+
32
+ 2. Install [Bundler](http://bundler.io/).
33
+
34
+ ```sh
35
+ $ gem install bundler
36
+ ```
37
+
38
+ 3. Install the top-level project dependencies.
39
+
40
+ ```sh
41
+ $ bundle install
42
+ ```
43
+
44
+ 4. Install the DNS dependencies.
45
+
46
+ ```sh
47
+ $ cd google-cloud-dns/
48
+ $ bundle exec rake bundleupdate
49
+ ```
50
+
51
+ ## Console
52
+
53
+ In order to run code interactively, you can automatically load
54
+ google-cloud-dns and its dependencies in IRB. This requires that your
55
+ developer environment has already been configured by following the steps
56
+ described in the {file:AUTHENTICATION.md Authentication Guide}. An IRB console
57
+ can be created with:
58
+
59
+ ```sh
60
+ $ cd google-cloud-dns/
61
+ $ bundle exec rake console
62
+ ```
63
+
64
+ ## DNS Tests
65
+
66
+ Tests are very important part of google-cloud-dns. All contributions
67
+ should include tests that ensure the contributed code behaves as expected.
68
+
69
+ To run the unit tests, documentation tests, and code style checks together for a
70
+ package:
71
+
72
+ ``` sh
73
+ $ cd google-cloud-dns/
74
+ $ bundle exec rake ci
75
+ ```
76
+
77
+ To run the command above, plus all acceptance tests, use `rake ci:acceptance` or
78
+ its handy alias, `rake ci:a`.
79
+
80
+ ### DNS Unit Tests
81
+
82
+
83
+ The project uses the [minitest](https://github.com/seattlerb/minitest) library,
84
+ including [specs](https://github.com/seattlerb/minitest#specs),
85
+ [mocks](https://github.com/seattlerb/minitest#mocks) and
86
+ [minitest-autotest](https://github.com/seattlerb/minitest-autotest).
87
+
88
+ To run the DNS unit tests:
89
+
90
+ ``` sh
91
+ $ cd google-cloud-dns/
92
+ $ bundle exec rake test
93
+ ```
94
+
95
+ ### DNS Documentation Tests
96
+
97
+ The project tests the code examples in the gem's
98
+ [YARD](https://github.com/lsegal/yard)-based documentation.
99
+
100
+ The example testing functions in a way that is very similar to unit testing, and
101
+ in fact the library providing it,
102
+ [yard-doctest](https://github.com/p0deje/yard-doctest), is based on the
103
+ project's unit test library, [minitest](https://github.com/seattlerb/minitest).
104
+
105
+ To run the DNS documentation tests:
106
+
107
+ ``` sh
108
+ $ cd google-cloud-dns/
109
+ $ bundle exec rake doctest
110
+ ```
111
+
112
+ If you add, remove or modify documentation examples when working on a pull
113
+ request, you may need to update the setup for the tests. The stubs and mocks
114
+ required to run the tests are located in `support/doctest_helper.rb`. Please
115
+ note that much of the setup is matched by the title of the
116
+ [`@example`](http://www.rubydoc.info/gems/yard/file/docs/Tags.md#example) tag.
117
+ If you alter an example's title, you may encounter breaking tests.
118
+
119
+ ### DNS Acceptance Tests
120
+
121
+ The DNS acceptance tests interact with the live service API. Follow the
122
+ instructions in the {file:AUTHENTICATION.md Authentication guide} for enabling
123
+ the DNS API. Occasionally, some API features may not yet be generally
124
+ available, making it difficult for some contributors to successfully run the
125
+ entire acceptance test suite. However, please ensure that you do successfully
126
+ run acceptance tests for any code areas covered by your pull request.
127
+
128
+ To run the acceptance tests, first create and configure a project in the Google
129
+ Developers Console, as described in the {file:AUTHENTICATION.md Authentication
130
+ guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
131
+ the KEYFILE location on your system.
132
+
133
+ Before you can run the DNS acceptance tests, you must first create indexes
134
+ used in the tests.
135
+
136
+ #### Running the DNS acceptance tests
137
+
138
+ To run the DNS acceptance tests:
139
+
140
+ ``` sh
141
+ $ cd google-cloud-dns/
142
+ $ bundle exec rake acceptance[\\{my-project-id},\\{/path/to/keyfile.json}]
143
+ ```
144
+
145
+ Or, if you prefer you can store the values in the `GCLOUD_TEST_PROJECT` and
146
+ `GCLOUD_TEST_KEYFILE` environment variables:
147
+
148
+ ``` sh
149
+ $ cd google-cloud-dns/
150
+ $ export GCLOUD_TEST_PROJECT=\\{my-project-id}
151
+ $ export GCLOUD_TEST_KEYFILE=\\{/path/to/keyfile.json}
152
+ $ bundle exec rake acceptance
153
+ ```
154
+
155
+ If you want to use a different project and credentials for acceptance tests, you
156
+ can use the more specific `DNS_TEST_PROJECT` and `DNS_TEST_KEYFILE`
157
+ environment variables:
158
+
159
+ ``` sh
160
+ $ cd google-cloud-dns/
161
+ $ export DNS_TEST_PROJECT=\\{my-project-id}
162
+ $ export DNS_TEST_KEYFILE=\\{/path/to/keyfile.json}
163
+ $ bundle exec rake acceptance
164
+ ```
165
+
166
+ ## Coding Style
167
+
168
+ Please follow the established coding style in the library. The style is is
169
+ largely based on [The Ruby Style
170
+ Guide](https://github.com/bbatsov/ruby-style-guide) with a few exceptions based
171
+ on seattle-style:
172
+
173
+ * Avoid parenthesis when possible, including in method definitions.
174
+ * Always use double quotes strings. ([Option
175
+ B](https://github.com/bbatsov/ruby-style-guide#strings))
176
+
177
+ You can check your code against these rules by running Rubocop like so:
178
+
179
+ ```sh
180
+ $ cd google-cloud-dns/
181
+ $ bundle exec rake rubocop
182
+ ```
183
+
184
+ ## Code of Conduct
185
+
186
+ Please note that this project is released with a Contributor Code of Conduct. By
187
+ participating in this project you agree to abide by its terms. See
188
+ {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
@@ -0,0 +1,27 @@
1
+ # Enabling Logging
2
+
3
+ To enable logging for this library, set the logger for the underlying [Google
4
+ API
5
+ Client](https://github.com/google/google-api-ruby-client/blob/master/README.md#logging)
6
+ library. The logger that you set may be a Ruby stdlib
7
+ [`Logger`](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) as
8
+ shown below, or a
9
+ [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/Google/Cloud/Logging/Logger)
10
+ that will write logs to [Stackdriver
11
+ Logging](https://cloud.google.com/logging/).
12
+
13
+ If you do not set the logger explicitly and your application is running in a
14
+ Rails environment, it will default to `Rails.logger`. Otherwise, if you do not
15
+ set the logger and you are not using Rails, logging is disabled by default.
16
+
17
+ Configuring a Ruby stdlib logger:
18
+
19
+ ```ruby
20
+ require "logger"
21
+
22
+ my_logger = Logger.new $stderr
23
+ my_logger.level = Logger::WARN
24
+
25
+ # Set the Google API Client logger
26
+ Google::Apis.logger = my_logger
27
+ ```
@@ -0,0 +1,254 @@
1
+ # Google Cloud DNS
2
+
3
+ Google Cloud DNS is a high-performance, resilient, global DNS service that
4
+ provides a cost-effective way to make your applications and services
5
+ available to your users. This programmable, authoritative DNS service can
6
+ be used to easily publish and manage DNS records using the same
7
+ infrastructure relied upon by Google. To learn more, read [What is Google
8
+ Cloud DNS?](https://cloud.google.com/dns/what-is-cloud-dns).
9
+
10
+ The goal of google-cloud is to provide an API that is comfortable to
11
+ Rubyists. Your authentication credentials are detected automatically in
12
+ Google Cloud Platform environments such as Google Compute Engine, Google
13
+ App Engine and Google Kubernetes Engine. In other environments you can
14
+ configure authentication easily, either directly in your code or via
15
+ environment variables. Read more about the options for connecting in the
16
+ {file:AUTHENTICATION.md Authentication Guide}.
17
+
18
+ ## Creating Zones
19
+
20
+ To get started with Google Cloud DNS, use your DNS Project to create a new
21
+ Zone. The second argument to {Google::Cloud::Dns::Project#create_zone}
22
+ must be a unique domain name for which you can [verify
23
+ ownership](https://www.google.com/webmasters/verification/home).
24
+ Substitute a domain name of your own (ending with a dot to signify that it
25
+ is [fully
26
+ qualified](https://en.wikipedia.org/wiki/Fully_qualified_domain_name)) as
27
+ you follow along with these examples.
28
+
29
+ ```ruby
30
+ require "google/cloud/dns"
31
+
32
+ dns = Google::Cloud::Dns.new
33
+ zone = dns.create_zone "example-com", "example.com."
34
+ puts zone.id # unique identifier defined by the server
35
+ ```
36
+
37
+ For more information, see [Managing
38
+ Zones](https://cloud.google.com/dns/zones/).
39
+
40
+ ## Listing Zones
41
+
42
+ You can retrieve all the zones in your project.
43
+
44
+ ```ruby
45
+ require "google/cloud/dns"
46
+
47
+ dns = Google::Cloud::Dns.new
48
+ zones = dns.zones
49
+ zones.each do |zone|
50
+ puts "#{zone.name} - #{zone.dns}"
51
+ end
52
+ ```
53
+
54
+ You can also retrieve a single zone by either name or id.
55
+
56
+ ```ruby
57
+ require "google/cloud/dns"
58
+
59
+ dns = Google::Cloud::Dns.new
60
+ zone = dns.zone "example-com"
61
+ ```
62
+
63
+ ## Listing Records
64
+
65
+ When you create a zone, the Cloud DNS service automatically creates two
66
+ Record instances for it, providing configuration for Cloud DNS
67
+ nameservers. Let's take a look at these records.
68
+
69
+ ```ruby
70
+ require "google/cloud/dns"
71
+
72
+ dns = Google::Cloud::Dns.new
73
+ zone = dns.zone "example-com"
74
+ records = zone.records
75
+ records.count #=> 2
76
+ records.map &:type #=> ["NS", "SOA"]
77
+ zone.records.first.data.count #=> 4
78
+ zone.records.first.data #=> ["ns-cloud-d1.googledomains.com.", ...]
79
+ ```
80
+
81
+ Note that {Google::Cloud::Dns::Record#data} returns an array. The Cloud
82
+ DNS service only allows the zone to have one Record instance for each name
83
+ and type combination. It supports multiple "resource records" (in this
84
+ case, the four nameserver addresses) via this `data` collection.
85
+
86
+ ## Managing Records
87
+
88
+ You can easily add your own records to the zone. Each call to
89
+ {Google::Cloud::Dns::Zone#add} results in a new Cloud DNS Change instance.
90
+
91
+ ```ruby
92
+ require "google/cloud/dns"
93
+
94
+ dns = Google::Cloud::Dns.new
95
+ zone = dns.zone "example-com"
96
+ change = zone.add "www", "A", 86400, ["1.2.3.4"]
97
+ change.additions.map &:type #=> ["A", "SOA"]
98
+ change.deletions.map &:type #=> ["SOA"]
99
+ ```
100
+
101
+ Whenever you change the set of records belonging to a zone, the zone's
102
+ start of authority (SOA) record should be updated with a higher serial
103
+ number. The google-cloud library automates this update for you, deleting
104
+ the old SOA record and adding an updated one, as shown in the example
105
+ above. You can disable or modify this behavior, of course. See
106
+ {Google::Cloud::Dns::Zone#update} for details.
107
+
108
+ You can retrieve records by name and type. The name argument can be a
109
+ subdomain (e.g., `www`) fragment for convenience, but notice that the
110
+ retrieved record's domain name is always fully-qualified.
111
+
112
+ ```ruby
113
+ require "google/cloud/dns"
114
+
115
+ dns = Google::Cloud::Dns.new
116
+ zone = dns.zone "example-com"
117
+ records = zone.records "www", "A"
118
+ records.first.name #=> "www.example.com."
119
+ ```
120
+
121
+ You can use {Google::Cloud::Dns::Zone#replace} to update the `ttl` and
122
+ `data` for a record.
123
+
124
+ ```ruby
125
+ require "google/cloud/dns"
126
+
127
+ dns = Google::Cloud::Dns.new
128
+ zone = dns.zone "example-com"
129
+ change = zone.replace "www", "A", 86400, ["5.6.7.8"]
130
+ ```
131
+
132
+ Or, you can use {Google::Cloud::Dns::Zone#modify} to update just the `ttl`
133
+ or `data`, without the risk of inadvertently changing values that you wish
134
+ to leave unchanged.
135
+
136
+ ```ruby
137
+ require "google/cloud/dns"
138
+
139
+ dns = Google::Cloud::Dns.new
140
+ zone = dns.zone "example-com"
141
+ change = zone.modify "www", "A" do |r|
142
+ r.ttl = 3600 # change only the TTL
143
+ end
144
+ ```
145
+
146
+ You can also delete records by name and type.
147
+
148
+ ```ruby
149
+ require "google/cloud/dns"
150
+
151
+ dns = Google::Cloud::Dns.new
152
+ zone = dns.zone "example-com"
153
+ change = zone.remove "www", "A"
154
+ record = change.deletions.first
155
+ ```
156
+
157
+ The best way to add, remove, and update multiple records in a single
158
+ [transaction](https://cloud.google.com/dns/records) is to call
159
+ {Google::Cloud::Dns::Zone#update} with a block. See
160
+ {Google::Cloud::Dns::Zone::Transaction}.
161
+
162
+ ```ruby
163
+ require "google/cloud/dns"
164
+
165
+ dns = Google::Cloud::Dns.new
166
+ zone = dns.zone "example-com"
167
+ change = zone.update do |tx|
168
+ tx.add "www", "A", 86400, "1.2.3.4"
169
+ tx.remove "example.com.", "TXT"
170
+ tx.replace "example.com.", "MX", 86400, ["10 mail1.example.com.",
171
+ "20 mail2.example.com."]
172
+ tx.modify "www.example.com.", "CNAME" do |r|
173
+ r.ttl = 86400 # only change the TTL
174
+ end
175
+ end
176
+ ```
177
+
178
+ Finally, you can add and delete records by reference, using
179
+ {Google::Cloud::Dns::Zone#update}.
180
+
181
+ ```ruby
182
+ require "google/cloud/dns"
183
+
184
+ dns = Google::Cloud::Dns.new
185
+ zone = dns.zone "example-com"
186
+ to_add = zone.record "www", "AAAA", 86400, ["2607:f8b0:400a:801::1005"]
187
+ to_delete = zone.records "www", "A"
188
+ change = zone.update to_add, to_delete
189
+ ```
190
+
191
+ ## Listing Changes
192
+
193
+ Because the transactions you execute against your zone do not always
194
+ complete immediately, you can retrieve and inspect changes.
195
+
196
+ ```ruby
197
+ require "google/cloud/dns"
198
+
199
+ dns = Google::Cloud::Dns.new
200
+ zone = dns.zone "example-com"
201
+ changes = zone.changes
202
+ changes.each do |change|
203
+ puts "#{change.id} - #{change.started_at} - #{change.status}"
204
+ end
205
+ ```
206
+
207
+ ## Importing and exporting zone files
208
+
209
+ You can import from a zone file. Because the Cloud DNS service only allows
210
+ the zone to have one Record instance for each name and type combination,
211
+ lines may be merged as needed into records with multiple `data` values.
212
+
213
+ ```ruby
214
+ require "google/cloud/dns"
215
+
216
+ dns = Google::Cloud::Dns.new
217
+ zone = dns.zone "example-com"
218
+ change = zone.import "path/to/db.example.com"
219
+ ```
220
+
221
+ You can also export to a zone file.
222
+
223
+ ```ruby
224
+ require "google/cloud/dns"
225
+
226
+ dns = Google::Cloud::Dns.new
227
+ zone = dns.zone "example-com"
228
+
229
+ zone.export "path/to/db.example.com"
230
+ ```
231
+
232
+ ## Configuring retries and timeout
233
+
234
+ You can configure how many times API requests may be automatically
235
+ retried. When an API request fails, the response will be inspected to see
236
+ if the request meets criteria indicating that it may succeed on retry,
237
+ such as `500` and `503` status codes or a specific internal error code
238
+ such as `rateLimitExceeded`. If it meets the criteria, the request will be
239
+ retried after a delay. If another error occurs, the delay will be
240
+ increased before a subsequent attempt, until the `retries` limit is
241
+ reached.
242
+
243
+ You can also set the request `timeout` value in seconds.
244
+
245
+ ```ruby
246
+ require "google/cloud/dns"
247
+
248
+ dns = Google::Cloud::Dns.new retries: 10, timeout: 120
249
+ ```
250
+
251
+ ## Additional information
252
+
253
+ Google Cloud DNS can be configured to use logging. To learn more, see the
254
+ {file:LOGGING.md Logging guide}.
@@ -0,0 +1,37 @@
1
+ # Troubleshooting
2
+
3
+ ## Where can I get more help?
4
+
5
+ ### Ask the Community
6
+
7
+ If you have a question about how to use a Google Cloud client library in your
8
+ project or are stuck in the Developer's console and don't know where to turn,
9
+ it's possible your questions have already been addressed by the community.
10
+
11
+ First, check out the appropriate tags on StackOverflow:
12
+ - [`google-cloud-platform+ruby+dns`][so-ruby]
13
+
14
+ Next, try searching through the issues on GitHub:
15
+
16
+ - [`api:dns` issues][gh-search-ruby]
17
+
18
+ Still nothing?
19
+
20
+ ### Ask the Developers
21
+
22
+ If you're experiencing a bug with the code, or have an idea for how it can be
23
+ improved, *please* create a new issue on GitHub so we can talk about it.
24
+
25
+ - [New issue][gh-ruby]
26
+
27
+ Or, you can ask questions on the [Google Cloud Platform Slack][slack-ruby]. You
28
+ can use the "ruby" channel for general Ruby questions, or use the
29
+ "google-cloud-ruby" channel if you have questions about this gem in particular.
30
+
31
+ [so-ruby]: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby+dns
32
+
33
+ [gh-search-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues?q=label%3A%22api%3A+dns%22
34
+
35
+ [gh-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues/new
36
+
37
+ [slack-ruby]: https://gcp-slack.appspot.com/
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Dns
19
- VERSION = "0.29.2".freeze
19
+ VERSION = "0.29.3".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.2
4
+ version: 0.29.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-10 00:00:00.000000000 Z
12
+ date: 2018-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -216,8 +216,14 @@ extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
218
  - ".yardopts"
219
+ - AUTHENTICATION.md
220
+ - CHANGELOG.md
221
+ - CODE_OF_CONDUCT.md
222
+ - CONTRIBUTING.md
219
223
  - LICENSE
220
- - README.md
224
+ - LOGGING.md
225
+ - OVERVIEW.md
226
+ - TROUBLESHOOTING.md
221
227
  - lib/google-cloud-dns.rb
222
228
  - lib/google/cloud/dns.rb
223
229
  - lib/google/cloud/dns/change.rb
data/README.md DELETED
@@ -1,103 +0,0 @@
1
- # google-cloud-dns
2
-
3
- [Google Cloud DNS](https://cloud.google.com/dns/) ([docs](https://cloud.google.com/dns/docs)) 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 [What is Google Cloud DNS?](https://cloud.google.com/dns/what-is-cloud-dns).
4
-
5
- - [google-cloud-dns API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-dns/latest)
6
- - [google-cloud-dns on RubyGems](https://rubygems.org/gems/google-cloud-dns)
7
- - [Google Cloud DNS documentation](https://cloud.google.com/dns/docs)
8
-
9
- ## Quick Start
10
-
11
- ```sh
12
- $ gem install google-cloud-dns
13
- ```
14
-
15
- ## Authentication
16
-
17
- This library uses Service Account credentials to connect to Google Cloud services. When running on Compute Engine the credentials will be discovered automatically. When running on other environments the Service Account credentials can be specified by providing the path to the JSON file, or the JSON itself, in environment variables.
18
-
19
- Instructions and configuration options are covered in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-dns/latest/file.AUTHENTICATION).
20
-
21
- ## Example
22
-
23
- ```ruby
24
- require "google/cloud/dns"
25
-
26
- dns = Google::Cloud::Dns.new
27
-
28
- # Retrieve a zone
29
- zone = dns.zone "example-com"
30
-
31
- # Update records in the zone
32
- change = zone.update do |tx|
33
- tx.add "www", "A", 86400, "1.2.3.4"
34
- tx.remove "example.com.", "TXT"
35
- tx.replace "example.com.", "MX", 86400, ["10 mail1.example.com.",
36
- "20 mail2.example.com."]
37
- tx.modify "www.example.com.", "CNAME" do |r|
38
- r.ttl = 86400 # only change the TTL
39
- end
40
- end
41
- ```
42
-
43
- ## Enabling Logging
44
-
45
- To enable logging for this library, set the logger for the underlying [Google API Client](https://github.com/google/google-api-ruby-client/blob/master/README.md#logging) library. The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) as shown below, or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/Google/Cloud/Logging/Logger) that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/).
46
-
47
- If you do not set the logger explicitly and your application is running in a Rails environment, it will default to `Rails.logger`. Otherwise, if you do not set the logger and you are not using Rails, logging is disabled by default.
48
-
49
- Configuring a Ruby stdlib logger:
50
-
51
- ```ruby
52
- require "logger"
53
-
54
- my_logger = Logger.new $stderr
55
- my_logger.level = Logger::WARN
56
-
57
- # Set the Google API Client logger
58
- Google::Apis.logger = my_logger
59
- ```
60
-
61
- ## Supported Ruby Versions
62
-
63
- This library is supported on Ruby 2.3+.
64
-
65
- Google provides official support for Ruby versions that are actively supported
66
- by Ruby Core—that is, Ruby versions that are either in normal maintenance or in
67
- security maintenance, and not end of life. Currently, this means Ruby 2.3 and
68
- later. Older versions of Ruby _may_ still work, but are unsupported and not
69
- recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
70
- about the Ruby support schedule.
71
-
72
- ## Versioning
73
-
74
- This library follows [Semantic Versioning](http://semver.org/).
75
-
76
- It is currently in major version zero (0.y.z), which means that anything may
77
- change at any time and the public API should not be considered stable.
78
-
79
- ## Contributing
80
-
81
- Contributions to this library are always welcome and highly encouraged.
82
-
83
- See the [Contributing
84
- Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-dns/latest/file.CONTRIBUTING)
85
- for more information on how to get started.
86
-
87
- Please note that this project is released with a Contributor Code of Conduct. By
88
- participating in this project you agree to abide by its terms. See [Code of
89
- Conduct](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-dns/latest/file.CODE_OF_CONDUCT)
90
- for more information.
91
-
92
- ## License
93
-
94
- This library is licensed under Apache 2.0. Full license text is available in
95
- [LICENSE](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-dns/latest/file.LICENSE).
96
-
97
- ## Support
98
-
99
- Please [report bugs at the project on
100
- Github](https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues). Don't
101
- hesitate to [ask
102
- questions](http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby)
103
- about the client or APIs on [StackOverflow](http://stackoverflow.com).