google-cloud-dns 0.30.2 → 0.31.0

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: 595489857ccfc57ee754e666f9feac8fb28f93122b3fb07ad065af95a6e7f7aa
4
- data.tar.gz: f00d600df85a0a0fc78c37d153c6e91ba0109749e6e613d9575af3be91756d54
3
+ metadata.gz: 8b9bafa762fcedbd09357499238445ae8824e00be1e5602da94efa1a03d981e6
4
+ data.tar.gz: 6e77eec9ce5e726c19293614f3ead0c9d939225d098bcf25c7ba76b0c360fde9
5
5
  SHA512:
6
- metadata.gz: ddd01191f73978160528a4c239897dca2dbc9419a88d4f563ee9175706b6a808f237442f6a49366ac11666167da9ba0ad85d9568abd8092c57a02b9d825963d8
7
- data.tar.gz: 791d85c38cbc463cca62e2fde0125c41f034b59d54b4a14c6234d31f1e81a25ce10e75e3438752ac4e3fce7809059a3a4ebe417a347c5a5cd6a6e44c5c43a9a6
6
+ metadata.gz: eb1638265de6117fc67de4a15ae2d930c70d26b37d05810e8dadbe97d634b63116e72a67abad0c699628dc547d9b484f0f72148b897a0ed6ceb7af706fb6ec11
7
+ data.tar.gz: e3073bc5c171b4e0f6cea8e1a1a45e9a4f0cfdff0286a034fc046ace99fb41e1b2e0f2e67dd3e70cc95debafbf32ee2b0b579839e205fdef2f4c3591dfa93dcc
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.31.0 / 2019-10-01
4
+
5
+ #### Features
6
+
7
+ * Support overriding of service endpoint
8
+
3
9
  ### 0.30.2 / 2019-08-23
4
10
 
5
11
  #### Documentation
@@ -132,4 +132,5 @@ Google::Cloud.configure.add_config! :dns do |config|
132
132
  config.add_field! :scope, nil, match: [String, Array]
133
133
  config.add_field! :retries, nil, match: Integer
134
134
  config.add_field! :timeout, nil, match: Integer
135
+ config.add_field! :endpoint, nil, match: String
135
136
  end
@@ -56,6 +56,8 @@ module Google
56
56
  # @param [Integer] retries Number of times to retry requests on server
57
57
  # error. The default value is `3`. Optional.
58
58
  # @param [Integer] timeout Default timeout to use in requests. Optional.
59
+ # @param [String] endpoint Override of the endpoint host name. Optional.
60
+ # If the param is nil, uses the default endpoint.
59
61
  # @param [String] project Alias for the `project_id` argument. Deprecated.
60
62
  # @param [String] keyfile Alias for the `credentials` argument.
61
63
  # Deprecated.
@@ -73,26 +75,24 @@ module Google
73
75
  # zone = dns.zone "example-com"
74
76
  #
75
77
  def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
76
- timeout: nil, project: nil, keyfile: nil
77
- project_id ||= (project || default_project_id)
78
+ timeout: nil, endpoint: nil, project: nil, keyfile: nil
78
79
  scope ||= configure.scope
79
80
  retries ||= configure.retries
80
81
  timeout ||= configure.timeout
82
+ endpoint ||= configure.endpoint
81
83
  credentials ||= (keyfile || default_credentials(scope: scope))
82
84
 
83
85
  unless credentials.is_a? Google::Auth::Credentials
84
86
  credentials = Dns::Credentials.new credentials, scope: scope
85
87
  end
86
88
 
87
- if credentials.respond_to? :project_id
88
- project_id ||= credentials.project_id
89
- end
90
- project_id = project_id.to_s # Always cast to a string
89
+ project_id = resolve_project_id(project_id || project, credentials)
91
90
  raise ArgumentError, "project_id is missing" if project_id.empty?
92
91
 
93
92
  Dns::Project.new(
94
93
  Dns::Service.new(
95
- project_id, credentials, retries: retries, timeout: timeout
94
+ project_id, credentials,
95
+ retries: retries, timeout: timeout, host: endpoint
96
96
  )
97
97
  )
98
98
  end
@@ -113,6 +113,8 @@ module Google
113
113
  # * `retries` - (Integer) Number of times to retry requests on server
114
114
  # error.
115
115
  # * `timeout` - (Integer) Default timeout to use in requests.
116
+ # * `endpoint` - (String) Override of the endpoint host name, or `nil`
117
+ # to use the default endpoint.
116
118
  #
117
119
  # @return [Google::Cloud::Config] The configuration object the
118
120
  # Google::Cloud::Dns library uses.
@@ -138,6 +140,16 @@ module Google
138
140
  Google::Cloud.configure.credentials ||
139
141
  Dns::Credentials.default(scope: scope)
140
142
  end
143
+
144
+ ##
145
+ # @private Resolve project.
146
+ def self.resolve_project_id given_project, credentials
147
+ project_id = given_project || default_project_id
148
+ if credentials.respond_to? :project_id
149
+ project_id ||= credentials.project_id
150
+ end
151
+ project_id.to_s # Always cast to a string
152
+ end
141
153
  end
142
154
  end
143
155
  end
@@ -33,7 +33,8 @@ module Google
33
33
 
34
34
  ##
35
35
  # Creates a new Service instance.
36
- def initialize project, credentials, retries: nil, timeout: nil
36
+ def initialize project, credentials,
37
+ retries: nil, timeout: nil, host: nil
37
38
  @project = project
38
39
  @credentials = credentials
39
40
  @service = API::DnsService.new
@@ -48,6 +49,7 @@ module Google
48
49
  @service.request_options.header["x-goog-api-client"] = \
49
50
  "gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Dns::VERSION}"
50
51
  @service.authorization = @credentials.client
52
+ @service.root_url = host if host
51
53
  end
52
54
 
53
55
  def service
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Dns
19
- VERSION = "0.30.2".freeze
19
+ VERSION = "0.31.0".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.30.2
4
+ version: 0.31.0
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: 2019-08-23 00:00:00.000000000 Z
12
+ date: 2019-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core