gcloud 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/AUTHENTICATION.md +13 -9
- data/CHANGELOG.md +8 -3
- data/OVERVIEW.md +46 -8
- data/lib/gcloud.rb +123 -117
- data/lib/gcloud/backoff.rb +43 -15
- data/lib/gcloud/bigquery.rb +211 -195
- data/lib/gcloud/bigquery/connection.rb +9 -9
- data/lib/gcloud/bigquery/copy_job.rb +15 -16
- data/lib/gcloud/bigquery/credentials.rb +3 -3
- data/lib/gcloud/bigquery/data.rb +12 -11
- data/lib/gcloud/bigquery/dataset.rb +162 -216
- data/lib/gcloud/bigquery/dataset/access.rb +59 -43
- data/lib/gcloud/bigquery/dataset/list.rb +3 -3
- data/lib/gcloud/bigquery/errors.rb +9 -5
- data/lib/gcloud/bigquery/extract_job.rb +18 -18
- data/lib/gcloud/bigquery/insert_response.rb +7 -4
- data/lib/gcloud/bigquery/job.rb +48 -44
- data/lib/gcloud/bigquery/job/list.rb +3 -3
- data/lib/gcloud/bigquery/load_job.rb +24 -25
- data/lib/gcloud/bigquery/project.rb +145 -204
- data/lib/gcloud/bigquery/query_data.rb +10 -9
- data/lib/gcloud/bigquery/query_job.rb +23 -32
- data/lib/gcloud/bigquery/table.rb +238 -280
- data/lib/gcloud/bigquery/table/list.rb +3 -3
- data/lib/gcloud/bigquery/table/schema.rb +79 -87
- data/lib/gcloud/bigquery/view.rb +69 -82
- data/lib/gcloud/credentials.rb +3 -9
- data/lib/gcloud/datastore.rb +194 -170
- data/lib/gcloud/datastore/connection.rb +12 -8
- data/lib/gcloud/datastore/credentials.rb +6 -4
- data/lib/gcloud/datastore/dataset.rb +74 -141
- data/lib/gcloud/datastore/dataset/lookup_results.rb +6 -4
- data/lib/gcloud/datastore/dataset/query_results.rb +6 -4
- data/lib/gcloud/datastore/entity.rb +81 -76
- data/lib/gcloud/datastore/errors.rb +10 -8
- data/lib/gcloud/datastore/key.rb +41 -77
- data/lib/gcloud/datastore/properties.rb +3 -3
- data/lib/gcloud/datastore/proto.rb +7 -4
- data/lib/gcloud/datastore/query.rb +26 -3
- data/lib/gcloud/datastore/transaction.rb +12 -8
- data/lib/gcloud/dns.rb +180 -152
- data/lib/gcloud/dns/change.rb +16 -16
- data/lib/gcloud/dns/change/list.rb +3 -3
- data/lib/gcloud/dns/connection.rb +9 -10
- data/lib/gcloud/dns/credentials.rb +3 -3
- data/lib/gcloud/dns/errors.rb +9 -5
- data/lib/gcloud/dns/importer.rb +17 -23
- data/lib/gcloud/dns/project.rb +42 -64
- data/lib/gcloud/dns/record.rb +58 -46
- data/lib/gcloud/dns/record/list.rb +6 -7
- data/lib/gcloud/dns/zone.rb +198 -289
- data/lib/gcloud/dns/zone/list.rb +3 -3
- data/lib/gcloud/dns/zone/transaction.rb +56 -72
- data/lib/gcloud/errors.rb +174 -3
- data/lib/gcloud/gce.rb +3 -4
- data/lib/gcloud/grpc_utils.rb +76 -0
- data/lib/gcloud/logging.rb +308 -0
- data/lib/gcloud/logging/credentials.rb +29 -0
- data/lib/gcloud/logging/entry.rb +303 -0
- data/lib/gcloud/logging/entry/http_request.rb +141 -0
- data/lib/gcloud/logging/entry/list.rb +111 -0
- data/lib/gcloud/logging/entry/operation.rb +90 -0
- data/lib/gcloud/logging/logger.rb +307 -0
- data/lib/gcloud/logging/metric.rb +175 -0
- data/lib/gcloud/logging/metric/list.rb +98 -0
- data/lib/gcloud/logging/project.rb +650 -0
- data/lib/gcloud/logging/resource.rb +95 -0
- data/lib/gcloud/logging/resource_descriptor.rb +140 -0
- data/lib/gcloud/logging/resource_descriptor/list.rb +78 -0
- data/lib/gcloud/logging/service.rb +258 -0
- data/lib/gcloud/logging/sink.rb +233 -0
- data/lib/gcloud/logging/sink/list.rb +97 -0
- data/lib/gcloud/pubsub.rb +241 -199
- data/lib/gcloud/pubsub/credentials.rb +3 -3
- data/lib/gcloud/pubsub/message.rb +26 -20
- data/lib/gcloud/pubsub/project.rb +166 -233
- data/lib/gcloud/pubsub/received_message.rb +28 -38
- data/lib/gcloud/pubsub/service.rb +323 -0
- data/lib/gcloud/pubsub/subscription.rb +172 -242
- data/lib/gcloud/pubsub/subscription/list.rb +11 -9
- data/lib/gcloud/pubsub/topic.rb +152 -271
- data/lib/gcloud/pubsub/topic/batch.rb +66 -0
- data/lib/gcloud/pubsub/topic/list.rb +9 -7
- data/lib/gcloud/resource_manager.rb +158 -138
- data/lib/gcloud/resource_manager/connection.rb +6 -5
- data/lib/gcloud/resource_manager/credentials.rb +3 -3
- data/lib/gcloud/resource_manager/errors.rb +9 -5
- data/lib/gcloud/resource_manager/manager.rb +54 -86
- data/lib/gcloud/resource_manager/project.rb +69 -88
- data/lib/gcloud/resource_manager/project/list.rb +4 -5
- data/lib/gcloud/resource_manager/project/updater.rb +12 -14
- data/lib/gcloud/search.rb +158 -135
- data/lib/gcloud/search/api_client.rb +7 -7
- data/lib/gcloud/search/connection.rb +8 -8
- data/lib/gcloud/search/credentials.rb +3 -3
- data/lib/gcloud/search/document.rb +64 -87
- data/lib/gcloud/search/document/list.rb +5 -5
- data/lib/gcloud/search/errors.rb +9 -5
- data/lib/gcloud/search/field_value.rb +32 -38
- data/lib/gcloud/search/field_values.rb +50 -80
- data/lib/gcloud/search/fields.rb +44 -65
- data/lib/gcloud/search/index.rb +163 -204
- data/lib/gcloud/search/index/list.rb +5 -5
- data/lib/gcloud/search/project.rb +31 -47
- data/lib/gcloud/search/result.rb +27 -31
- data/lib/gcloud/search/result/list.rb +6 -6
- data/lib/gcloud/storage.rb +224 -190
- data/lib/gcloud/storage/bucket.rb +202 -227
- data/lib/gcloud/storage/bucket/acl.rb +83 -170
- data/lib/gcloud/storage/bucket/cors.rb +31 -34
- data/lib/gcloud/storage/bucket/list.rb +3 -3
- data/lib/gcloud/storage/connection.rb +11 -7
- data/lib/gcloud/storage/credentials.rb +3 -3
- data/lib/gcloud/storage/errors.rb +11 -8
- data/lib/gcloud/storage/file.rb +129 -171
- data/lib/gcloud/storage/file/acl.rb +51 -99
- data/lib/gcloud/storage/file/list.rb +3 -3
- data/lib/gcloud/storage/file/verifier.rb +3 -2
- data/lib/gcloud/storage/project.rb +111 -132
- data/lib/gcloud/upload.rb +4 -7
- data/lib/gcloud/version.rb +2 -4
- data/lib/google/api/annotations.rb +14 -0
- data/lib/google/api/http.rb +30 -0
- data/lib/google/api/label.rb +24 -0
- data/lib/google/api/monitored_resource.rb +25 -0
- data/lib/google/datastore/v1beta3/datastore.rb +115 -0
- data/lib/google/datastore/v1beta3/datastore_services.rb +33 -0
- data/lib/google/datastore/v1beta3/entity.rb +63 -0
- data/lib/google/datastore/v1beta3/query.rb +128 -0
- data/lib/google/devtools/cloudtrace/v1/trace.rb +78 -0
- data/lib/google/devtools/cloudtrace/v1/trace_services.rb +32 -0
- data/lib/google/example/library/v1/library.rb +91 -0
- data/lib/google/example/library/v1/library_services.rb +40 -0
- data/lib/google/iam/v1/iam_policy.rb +33 -0
- data/lib/google/iam/v1/iam_policy_services.rb +30 -0
- data/lib/google/iam/v1/policy.rb +25 -0
- data/lib/google/logging/type/http_request.rb +28 -0
- data/lib/google/logging/type/log_severity.rb +27 -0
- data/lib/google/logging/v2/log_entry.rb +44 -0
- data/lib/google/logging/v2/logging.rb +56 -0
- data/lib/google/logging/v2/logging_config.rb +59 -0
- data/lib/google/logging/v2/logging_config_services.rb +32 -0
- data/lib/google/logging/v2/logging_metrics.rb +51 -0
- data/lib/google/logging/v2/logging_metrics_services.rb +32 -0
- data/lib/google/logging/v2/logging_services.rb +31 -0
- data/lib/google/longrunning/operations.rb +50 -0
- data/lib/google/longrunning/operations_services.rb +29 -0
- data/lib/google/protobuf/any.rb +17 -0
- data/lib/google/protobuf/api.rb +31 -0
- data/lib/google/protobuf/descriptor.rb +0 -0
- data/lib/google/protobuf/duration.rb +17 -0
- data/lib/google/protobuf/empty.rb +15 -0
- data/lib/google/protobuf/field_mask.rb +16 -0
- data/lib/google/protobuf/source_context.rb +16 -0
- data/lib/google/protobuf/struct.rb +35 -0
- data/lib/google/protobuf/timestamp.rb +17 -0
- data/lib/google/protobuf/type.rb +79 -0
- data/lib/google/protobuf/wrappers.rb +48 -0
- data/lib/google/pubsub/v1/pubsub.rb +129 -0
- data/lib/google/pubsub/v1/pubsub_services.rb +56 -0
- data/lib/google/pubsub/v1beta2/pubsub.rb +126 -0
- data/lib/google/pubsub/v1beta2/pubsub_services.rb +56 -0
- data/lib/google/rpc/code.rb +32 -0
- data/lib/google/rpc/error_details.rb +61 -0
- data/lib/google/rpc/status.rb +19 -0
- data/lib/google/type/color.rb +20 -0
- data/lib/google/type/date.rb +18 -0
- data/lib/google/type/dayofweek.rb +23 -0
- data/lib/google/type/latlng.rb +17 -0
- data/lib/google/type/money.rb +18 -0
- data/lib/google/type/timeofday.rb +19 -0
- metadata +101 -4
- data/lib/gcloud/pubsub/connection.rb +0 -295
- data/lib/gcloud/pubsub/errors.rb +0 -93
data/lib/gcloud/dns/change.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,19 +12,21 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "gcloud/dns/change/list"
|
|
17
17
|
require "time"
|
|
18
18
|
|
|
19
19
|
module Gcloud
|
|
20
20
|
module Dns
|
|
21
21
|
##
|
|
22
|
-
#
|
|
22
|
+
# # DNS Change
|
|
23
23
|
#
|
|
24
24
|
# Represents a request containing additions or deletions or records.
|
|
25
25
|
# Additions and deletions can be done in bulk, in a single atomic
|
|
26
26
|
# transaction, and take effect at the same time in each authoritative DNS
|
|
27
27
|
# server.
|
|
28
28
|
#
|
|
29
|
+
# @example
|
|
29
30
|
# require "gcloud"
|
|
30
31
|
#
|
|
31
32
|
# gcloud = Gcloud.new
|
|
@@ -38,16 +39,16 @@ module Gcloud
|
|
|
38
39
|
#
|
|
39
40
|
class Change
|
|
40
41
|
##
|
|
41
|
-
# The Zone object this Change belongs to.
|
|
42
|
-
attr_accessor :zone
|
|
42
|
+
# @private The Zone object this Change belongs to.
|
|
43
|
+
attr_accessor :zone
|
|
43
44
|
|
|
44
45
|
##
|
|
45
|
-
# The Google API Client object.
|
|
46
|
-
attr_accessor :gapi
|
|
46
|
+
# @private The Google API Client object.
|
|
47
|
+
attr_accessor :gapi
|
|
47
48
|
|
|
48
49
|
##
|
|
49
|
-
# Create an empty Change object.
|
|
50
|
-
def initialize
|
|
50
|
+
# @private Create an empty Change object.
|
|
51
|
+
def initialize
|
|
51
52
|
@zone = nil
|
|
52
53
|
@gapi = {}
|
|
53
54
|
end
|
|
@@ -74,21 +75,21 @@ module Gcloud
|
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
##
|
|
77
|
-
# Status of the operation. Values are
|
|
78
|
+
# Status of the operation. Values are `"done"` and `"pending"`.
|
|
78
79
|
#
|
|
79
80
|
def status
|
|
80
81
|
@gapi["status"]
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
##
|
|
84
|
-
# Checks if the status is
|
|
85
|
+
# Checks if the status is `"done"`.
|
|
85
86
|
def done?
|
|
86
87
|
return false if status.nil?
|
|
87
88
|
"done".casecmp(status).zero?
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
##
|
|
91
|
-
# Checks if the status is
|
|
92
|
+
# Checks if the status is `"pending"`.
|
|
92
93
|
def pending?
|
|
93
94
|
return false if status.nil?
|
|
94
95
|
"pending".casecmp(status).zero?
|
|
@@ -117,11 +118,10 @@ module Gcloud
|
|
|
117
118
|
alias_method :refresh!, :reload!
|
|
118
119
|
|
|
119
120
|
##
|
|
120
|
-
# Refreshes the change until the status is
|
|
121
|
+
# Refreshes the change until the status is `done`.
|
|
121
122
|
# The delay between refreshes will incrementally increase.
|
|
122
123
|
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
124
|
+
# @example
|
|
125
125
|
# require "gcloud"
|
|
126
126
|
#
|
|
127
127
|
# gcloud = Gcloud.new
|
|
@@ -143,8 +143,8 @@ module Gcloud
|
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
##
|
|
146
|
-
# New Change from a Google API Client object.
|
|
147
|
-
def self.from_gapi gapi, zone
|
|
146
|
+
# @private New Change from a Google API Client object.
|
|
147
|
+
def self.from_gapi gapi, zone
|
|
148
148
|
new.tap do |f|
|
|
149
149
|
f.gapi = gapi
|
|
150
150
|
f.zone = zone
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,6 +12,7 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "delegate"
|
|
17
17
|
|
|
18
18
|
module Gcloud
|
|
@@ -47,8 +47,8 @@ module Gcloud
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
##
|
|
50
|
-
# New Changes::List from a response object.
|
|
51
|
-
def self.from_response resp, zone
|
|
50
|
+
# @private New Changes::List from a response object.
|
|
51
|
+
def self.from_response resp, zone
|
|
52
52
|
changes = new(Array(resp.data["changes"]).map do |gapi_object|
|
|
53
53
|
Change.from_gapi gapi_object, zone
|
|
54
54
|
end)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,23 +12,23 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "gcloud/version"
|
|
17
17
|
require "google/api_client"
|
|
18
18
|
|
|
19
19
|
module Gcloud
|
|
20
20
|
module Dns
|
|
21
21
|
##
|
|
22
|
-
# Represents the connection to DNS,
|
|
23
|
-
|
|
24
|
-
class Connection #:nodoc:
|
|
22
|
+
# @private Represents the connection to DNS, as well as expose the API calls
|
|
23
|
+
class Connection
|
|
25
24
|
API_VERSION = "v1"
|
|
26
25
|
|
|
27
26
|
attr_accessor :project
|
|
28
|
-
attr_accessor :credentials
|
|
27
|
+
attr_accessor :credentials
|
|
29
28
|
|
|
30
29
|
##
|
|
31
30
|
# Creates a new Connection instance.
|
|
32
|
-
def initialize project, credentials
|
|
31
|
+
def initialize project, credentials
|
|
33
32
|
@project = project
|
|
34
33
|
@credentials = credentials
|
|
35
34
|
@client = Google::APIClient.new application_name: "gcloud-ruby",
|
|
@@ -136,7 +135,7 @@ module Gcloud
|
|
|
136
135
|
|
|
137
136
|
##
|
|
138
137
|
# Fully Qualified Domain Name
|
|
139
|
-
def self.fqdn name, origin_dns
|
|
138
|
+
def self.fqdn name, origin_dns
|
|
140
139
|
name = name.to_s.strip
|
|
141
140
|
return name if self.ip_addr? name
|
|
142
141
|
name = origin_dns if name.empty?
|
|
@@ -148,16 +147,16 @@ module Gcloud
|
|
|
148
147
|
|
|
149
148
|
require "ipaddr"
|
|
150
149
|
# Fix to make ip_addr? work on ruby 1.9
|
|
151
|
-
IPAddr::Error = ArgumentError unless defined? IPAddr::Error
|
|
150
|
+
IPAddr::Error = ArgumentError unless defined? IPAddr::Error
|
|
152
151
|
|
|
153
|
-
def self.ip_addr? name
|
|
152
|
+
def self.ip_addr? name
|
|
154
153
|
IPAddr.new name
|
|
155
154
|
true
|
|
156
155
|
rescue IPAddr::Error
|
|
157
156
|
false
|
|
158
157
|
end
|
|
159
158
|
|
|
160
|
-
def inspect
|
|
159
|
+
def inspect
|
|
161
160
|
"#{self.class}(#{@project})"
|
|
162
161
|
end
|
|
163
162
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,13 +12,14 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "gcloud/credentials"
|
|
17
17
|
|
|
18
18
|
module Gcloud
|
|
19
19
|
module Dns
|
|
20
20
|
##
|
|
21
|
-
# Represents the Oauth2 signing logic for DNS.
|
|
22
|
-
class Credentials < Gcloud::Credentials
|
|
21
|
+
# @private Represents the Oauth2 signing logic for DNS.
|
|
22
|
+
class Credentials < Gcloud::Credentials
|
|
23
23
|
SCOPE = ["https://www.googleapis.com/auth/ndev.clouddns.readwrite"]
|
|
24
24
|
PATH_ENV_VARS = %w(DNS_KEYFILE GCLOUD_KEYFILE GOOGLE_CLOUD_KEYFILE)
|
|
25
25
|
JSON_ENV_VARS = %w(DNS_KEYFILE_JSON GCLOUD_KEYFILE_JSON
|
data/lib/gcloud/dns/errors.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,6 +12,7 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "gcloud/errors"
|
|
17
17
|
|
|
18
18
|
module Gcloud
|
|
@@ -33,13 +33,15 @@ module Gcloud
|
|
|
33
33
|
# The errors encountered.
|
|
34
34
|
attr_reader :errors
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
# @private
|
|
37
|
+
def initialize message, code, errors = []
|
|
37
38
|
super message
|
|
38
39
|
@code = code
|
|
39
40
|
@errors = errors
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
# @private
|
|
44
|
+
def self.from_response resp
|
|
43
45
|
if resp.data? && resp.data["error"]
|
|
44
46
|
from_response_data resp.data["error"]
|
|
45
47
|
else
|
|
@@ -47,11 +49,13 @@ module Gcloud
|
|
|
47
49
|
end
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
# @private
|
|
53
|
+
def self.from_response_data error
|
|
51
54
|
new error["message"], error["code"], error["errors"]
|
|
52
55
|
end
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
# @private
|
|
58
|
+
def self.from_response_status resp
|
|
55
59
|
if resp.status == 404
|
|
56
60
|
new "#{resp.error_message}: #{resp.request.uri.request_uri}",
|
|
57
61
|
resp.status
|
data/lib/gcloud/dns/importer.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,38 +12,37 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "zonefile"
|
|
17
17
|
require "gcloud/dns/record"
|
|
18
18
|
|
|
19
19
|
module Gcloud
|
|
20
20
|
module Dns
|
|
21
21
|
##
|
|
22
|
-
#
|
|
22
|
+
# @private
|
|
23
|
+
# # DNS Importer
|
|
23
24
|
#
|
|
24
|
-
# Reads a
|
|
25
|
-
# file
|
|
25
|
+
# Reads a [DNS zone
|
|
26
|
+
# file](https://en.wikipedia.org/wiki/Zone_file) and parses it, creating a
|
|
26
27
|
# collection of Record instances. The returned records are unsaved,
|
|
27
|
-
# as they are not yet associated with a Zone. Use Zone#import to add zone
|
|
28
|
+
# as they are not yet associated with a Zone. Use {Zone#import} to add zone
|
|
28
29
|
# file records to a Zone.
|
|
29
30
|
#
|
|
30
31
|
# Because the Google Cloud DNS API only accepts a single resource record for
|
|
31
|
-
# each
|
|
32
|
+
# each `name` and `type` combination (with multiple `data` elements), the
|
|
32
33
|
# zone file's records are merged as necessary. During this merge, the lowest
|
|
33
|
-
#
|
|
34
|
-
#
|
|
34
|
+
# `ttl` of the merged records is used. If none of the merged records have a
|
|
35
|
+
# `ttl` value, the zone file's global TTL is used for the record.
|
|
35
36
|
#
|
|
36
37
|
# The following record types are supported: A, AAAA, CNAME, MX, NAPTR, NS,
|
|
37
38
|
# PTR, SOA, SPF, SRV, and TXT.
|
|
38
|
-
class Importer
|
|
39
|
+
class Importer
|
|
39
40
|
##
|
|
40
41
|
# Creates a new Importer that immediately parses the provided zone file
|
|
41
42
|
# data and creates Record instances.
|
|
42
43
|
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
# +path_or_io+::
|
|
46
|
-
# The path to a zone file on the filesystem, or an IO instance from
|
|
47
|
-
# which zone file data can be read. (+String+ or +IO+)
|
|
44
|
+
# @param [String, IO] path_or_io The path to a zone file on the
|
|
45
|
+
# filesystem, or an IO instance from which zone file data can be read.
|
|
48
46
|
#
|
|
49
47
|
def initialize zone, path_or_io
|
|
50
48
|
@zone = zone
|
|
@@ -59,16 +57,12 @@ module Gcloud
|
|
|
59
57
|
##
|
|
60
58
|
# Returns the Record instances created from the zone file.
|
|
61
59
|
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
# +except+::
|
|
67
|
-
# Exclude records of this type or types. (+String+ or +Array+)
|
|
68
|
-
#
|
|
69
|
-
# === Returns
|
|
60
|
+
# @param [String, Array<String>] only Include only records of this type or
|
|
61
|
+
# types.
|
|
62
|
+
# @param [String, Array<String>] except Exclude records of this type or
|
|
63
|
+
# types.
|
|
70
64
|
#
|
|
71
|
-
# An array of unsaved Record instances
|
|
65
|
+
# @return [Array<Record>] An array of unsaved {Record} instances
|
|
72
66
|
#
|
|
73
67
|
def records only: nil, except: nil
|
|
74
68
|
ret = @records
|
data/lib/gcloud/dns/project.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,6 +12,7 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
require "gcloud/gce"
|
|
17
17
|
require "gcloud/dns/connection"
|
|
18
18
|
require "gcloud/dns/credentials"
|
|
@@ -22,12 +22,13 @@ require "gcloud/dns/errors"
|
|
|
22
22
|
module Gcloud
|
|
23
23
|
module Dns
|
|
24
24
|
##
|
|
25
|
-
#
|
|
25
|
+
# # Project
|
|
26
26
|
#
|
|
27
27
|
# The project is a top level container for resources including Cloud DNS
|
|
28
|
-
# ManagedZones. Projects can be created only in the
|
|
29
|
-
# Console
|
|
28
|
+
# ManagedZones. Projects can be created only in the [Google Developers
|
|
29
|
+
# Console](https://console.developers.google.com).
|
|
30
30
|
#
|
|
31
|
+
# @example
|
|
31
32
|
# require "gcloud"
|
|
32
33
|
#
|
|
33
34
|
# gcloud = Gcloud.new
|
|
@@ -37,21 +38,21 @@ module Gcloud
|
|
|
37
38
|
# puts record.name
|
|
38
39
|
# end
|
|
39
40
|
#
|
|
40
|
-
# See Gcloud#dns
|
|
41
|
+
# See {Gcloud#dns}
|
|
41
42
|
class Project
|
|
42
43
|
##
|
|
43
|
-
# The Connection object.
|
|
44
|
-
attr_accessor :connection
|
|
44
|
+
# @private The Connection object.
|
|
45
|
+
attr_accessor :connection
|
|
45
46
|
|
|
46
47
|
##
|
|
47
|
-
# The Google API Client object.
|
|
48
|
-
attr_accessor :gapi
|
|
48
|
+
# @private The Google API Client object.
|
|
49
|
+
attr_accessor :gapi
|
|
49
50
|
|
|
50
51
|
##
|
|
51
|
-
# Creates a new Connection instance.
|
|
52
|
+
# @private Creates a new Connection instance.
|
|
52
53
|
#
|
|
53
|
-
# See Gcloud.dns
|
|
54
|
-
def initialize project, credentials
|
|
54
|
+
# See {Gcloud.dns}
|
|
55
|
+
def initialize project, credentials
|
|
55
56
|
project = project.to_s # Always cast to a string
|
|
56
57
|
fail ArgumentError, "project is missing" if project.empty?
|
|
57
58
|
@connection = Connection.new project, credentials
|
|
@@ -61,8 +62,7 @@ module Gcloud
|
|
|
61
62
|
##
|
|
62
63
|
# The unique ID string for the current project.
|
|
63
64
|
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
65
|
+
# @example
|
|
66
66
|
# require "gcloud"
|
|
67
67
|
#
|
|
68
68
|
# gcloud = Gcloud.new "my-todo-project", "/path/to/keyfile.json"
|
|
@@ -125,8 +125,8 @@ module Gcloud
|
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
##
|
|
128
|
-
# Default project.
|
|
129
|
-
def self.default_project
|
|
128
|
+
# @private Default project.
|
|
129
|
+
def self.default_project
|
|
130
130
|
ENV["DNS_PROJECT"] ||
|
|
131
131
|
ENV["GCLOUD_PROJECT"] ||
|
|
132
132
|
ENV["GOOGLE_CLOUD_PROJECT"] ||
|
|
@@ -136,17 +136,12 @@ module Gcloud
|
|
|
136
136
|
##
|
|
137
137
|
# Retrieves an existing zone by name or id.
|
|
138
138
|
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
# +zone_id+::
|
|
142
|
-
# The name or id of a zone. (+String+ or +Integer+)
|
|
143
|
-
#
|
|
144
|
-
# === Returns
|
|
139
|
+
# @param [String, Integer] zone_id The name or id of a zone.
|
|
145
140
|
#
|
|
146
|
-
# Gcloud::Dns::Zone
|
|
147
|
-
#
|
|
148
|
-
# === Example
|
|
141
|
+
# @return [Gcloud::Dns::Zone, nil] Returns `nil` if the zone does not
|
|
142
|
+
# exist.
|
|
149
143
|
#
|
|
144
|
+
# @example
|
|
150
145
|
# require "gcloud"
|
|
151
146
|
#
|
|
152
147
|
# gcloud = Gcloud.new
|
|
@@ -169,20 +164,13 @@ module Gcloud
|
|
|
169
164
|
##
|
|
170
165
|
# Retrieves the list of zones belonging to the project.
|
|
171
166
|
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
174
|
-
#
|
|
175
|
-
# A previously-returned page token representing part of the larger set
|
|
176
|
-
# of results to view. (+String+)
|
|
177
|
-
# +max+::
|
|
178
|
-
# Maximum number of zones to return. (+Integer+)
|
|
179
|
-
#
|
|
180
|
-
# === Returns
|
|
167
|
+
# @param [String] token A previously-returned page token representing part
|
|
168
|
+
# of the larger set of results to view.
|
|
169
|
+
# @param [Integer] max Maximum number of zones to return.
|
|
181
170
|
#
|
|
182
|
-
# Array
|
|
183
|
-
#
|
|
184
|
-
# === Examples
|
|
171
|
+
# @return [Array<Gcloud::Dns::Zone>] (See {Gcloud::Dns::Zone::List})
|
|
185
172
|
#
|
|
173
|
+
# @example
|
|
186
174
|
# require "gcloud"
|
|
187
175
|
#
|
|
188
176
|
# gcloud = Gcloud.new
|
|
@@ -192,9 +180,7 @@ module Gcloud
|
|
|
192
180
|
# puts zone.name
|
|
193
181
|
# end
|
|
194
182
|
#
|
|
195
|
-
#
|
|
196
|
-
# through them: (See Gcloud::Dns::Zone::List)
|
|
197
|
-
#
|
|
183
|
+
# @example With pagination: (See {Gcloud::Dns::Zone::List})
|
|
198
184
|
# require "gcloud"
|
|
199
185
|
#
|
|
200
186
|
# gcloud = Gcloud.new
|
|
@@ -222,30 +208,22 @@ module Gcloud
|
|
|
222
208
|
##
|
|
223
209
|
# Creates a new zone.
|
|
224
210
|
#
|
|
225
|
-
#
|
|
226
|
-
#
|
|
227
|
-
#
|
|
228
|
-
#
|
|
229
|
-
#
|
|
230
|
-
#
|
|
231
|
-
#
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
235
|
-
#
|
|
236
|
-
#
|
|
237
|
-
#
|
|
238
|
-
#
|
|
239
|
-
#
|
|
240
|
-
#
|
|
241
|
-
# ManagedZones. Most users will leave this field unset. (+String+)
|
|
242
|
-
#
|
|
243
|
-
# === Returns
|
|
244
|
-
#
|
|
245
|
-
# Gcloud::Dns::Zone
|
|
246
|
-
#
|
|
247
|
-
# === Examples
|
|
248
|
-
#
|
|
211
|
+
# @param [String] zone_name User assigned name for this resource. Must be
|
|
212
|
+
# unique within the project. The name must be 1-32 characters long, must
|
|
213
|
+
# begin with a letter, end with a letter or digit, and only contain
|
|
214
|
+
# lowercase letters, digits or dashes.
|
|
215
|
+
# @param [String] zone_dns The DNS name of this managed zone, for instance
|
|
216
|
+
# "example.com.".
|
|
217
|
+
# @param [String] description A string of at most 1024 characters
|
|
218
|
+
# associated with this resource for the user's convenience. Has no
|
|
219
|
+
# effect on the managed zone's function.
|
|
220
|
+
# @param [String] name_server_set A NameServerSet is a set of DNS name
|
|
221
|
+
# servers that all host the same ManagedZones. Most users will leave
|
|
222
|
+
# this field unset.
|
|
223
|
+
#
|
|
224
|
+
# @return [Gcloud::Dns::Zone]
|
|
225
|
+
#
|
|
226
|
+
# @example
|
|
249
227
|
# require "gcloud"
|
|
250
228
|
#
|
|
251
229
|
# gcloud = Gcloud.new
|