gapic-generator 0.7.0 → 0.8.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 +4 -4
- data/CHANGELOG.md +41 -0
- data/lib/gapic/generator/version.rb +1 -1
- data/lib/gapic/generators/default_generator.rb +18 -5
- data/lib/gapic/generators/default_generator_parameters.rb +8 -4
- data/lib/gapic/presenters.rb +3 -0
- data/lib/gapic/presenters/field_presenter.rb +44 -0
- data/lib/gapic/presenters/gem_presenter.rb +47 -10
- data/lib/gapic/presenters/method_presenter.rb +36 -16
- data/lib/gapic/presenters/method_rest_presenter.rb +194 -0
- data/lib/gapic/presenters/package_presenter.rb +18 -0
- data/lib/gapic/presenters/service_presenter.rb +42 -4
- data/lib/gapic/presenters/service_rest_presenter.rb +139 -0
- data/lib/gapic/presenters/snippet_presenter.rb +103 -0
- data/lib/gapic/runner.rb +2 -1
- data/lib/gapic/schema/api.rb +58 -16
- data/lib/gapic/schema/request_param_parser.rb +46 -12
- data/lib/google/protobuf/any.pb.rb +1 -1
- data/lib/google/protobuf/compiler/plugin.pb.rb +9 -6
- data/lib/google/protobuf/descriptor.pb.rb +2 -2
- data/lib/google/protobuf/empty.pb.rb +1 -1
- data/templates/default/gem/readme.erb +2 -2
- data/templates/default/lib/_package.erb +11 -1
- data/templates/default/lib/_service.erb +31 -1
- data/templates/default/lib/rest/_rest.erb +11 -0
- data/templates/default/service/rest.erb +6 -0
- data/templates/default/service/rest/client.erb +6 -0
- data/templates/default/service/rest/client/_client.erb +115 -0
- data/templates/default/service/rest/client/_config.erb +74 -0
- data/templates/default/service/rest/client/_requires.erb +1 -0
- data/templates/default/service/rest/client/method/_def.erb +18 -0
- data/templates/default/service/rest/client/method/def/_options_defaults.erb +15 -0
- data/templates/default/service/rest/client/method/def/_rescue.erb +3 -0
- data/templates/default/service/rest/client/method/def/_response_normal.erb +17 -0
- data/templates/default/service/rest/client/method/docs/_error.erb +2 -0
- data/templates/default/service/rest/client/method/docs/_request.erb +27 -0
- data/templates/default/service/rest/client/method/docs/_result.erb +6 -0
- data/templates/default/service/rest/grpc_transcoding.erb +6 -0
- data/templates/default/service/rest/grpc_transcoding/_grpc_transcoding.erb +9 -0
- data/templates/default/service/rest/grpc_transcoding/method/_def.erb +21 -0
- data/templates/default/service/rest/grpc_transcoding/method/def/_query_string_param.erb +8 -0
- data/templates/default/service/rest/test/client.erb +18 -0
- data/templates/default/service/rest/test/method/_assert_response.erb +2 -0
- data/templates/default/service/rest/test/method/_configure.erb +19 -0
- data/templates/default/service/rest/test/method/_normal.erb +71 -0
- data/templates/default/service/rest/test/method/_setup.erb +38 -0
- data/templates/default/snippets/gemfile.erb +17 -0
- data/templates/default/snippets/snippet/_structure.erb +71 -0
- data/templates/default/snippets/standalone.erb +6 -0
- metadata +31 -3
@@ -67,16 +67,15 @@ module Gapic
|
|
67
67
|
param_name_input = unescape param_name_input_esc
|
68
68
|
param_type, param_config_name = param_schema.schema_name_type_for param_name_input
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
param_value = parse_param_value param_type, value_str
|
70
|
+
param_value = parse_validate_param_value(
|
71
|
+
param_type,
|
72
|
+
param_name_input,
|
73
|
+
param_config_name,
|
74
|
+
value_str,
|
75
|
+
error_output
|
76
|
+
)
|
78
77
|
|
79
|
-
|
78
|
+
unless param_value.nil?
|
80
79
|
RequestParameter.new param_val_input_str, param_name_input_esc, value_str, param_config_name, param_value
|
81
80
|
end
|
82
81
|
end.compact # known bool parameters with invalid values will not be added so we have to compact
|
@@ -92,13 +91,48 @@ module Gapic
|
|
92
91
|
|
93
92
|
private
|
94
93
|
|
94
|
+
# Parses and validates param value depending on type and name
|
95
|
+
# @param param_type [Symbol] type of the parameter
|
96
|
+
# @param param_name_input [String] name of the parameter as given in the config
|
97
|
+
# @param param_config_name [String] canonical configuration name of the parameter
|
98
|
+
# @param value_str [String] string representation of parameter's value
|
99
|
+
# @param error_output [IO] Stream to write outputs to.
|
100
|
+
# @return [String,Array<String>,Hash{String => String}]
|
101
|
+
def parse_validate_param_value param_type, param_name_input, param_config_name, value_str, error_output
|
102
|
+
if param_type == :bool && !["true", "false"].include?(unescape(value_str))
|
103
|
+
error_str = "WARNING: parameter #{param_name_input} (recognised as bool " \
|
104
|
+
"#{param_config_name}) will be discarded because of " \
|
105
|
+
"invalid value. Value should be either 'true' or 'false'."
|
106
|
+
error_output&.puts error_str
|
107
|
+
end
|
108
|
+
|
109
|
+
param_value = parse_param_value param_type, value_str
|
110
|
+
|
111
|
+
if param_config_name == ":transports"
|
112
|
+
allowed_transports = ["grpc", "rest"]
|
113
|
+
noncompliant_values = param_value.reject { |pv| allowed_transports.include? pv }
|
114
|
+
if noncompliant_values.any?
|
115
|
+
noncompliant_values_list = noncompliant_values.join ", "
|
116
|
+
error_str = "WARNING: parameter #{param_name_input} (recognised as string array " \
|
117
|
+
"#{param_config_name}) will be discarded because "\
|
118
|
+
"it contains invalid values: #{noncompliant_values_list}. "\
|
119
|
+
"#{param_config_name} can only contain 'grpc' and/or 'rest' or be empty."
|
120
|
+
error_output&.puts error_str
|
121
|
+
param_value = nil
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
param_value
|
126
|
+
end
|
127
|
+
|
95
128
|
# Parses param value depending on type
|
96
|
-
# @param param_type [Symbol]
|
97
|
-
# @param value_str [String]
|
129
|
+
# @param param_type [Symbol] type of the parameter
|
130
|
+
# @param value_str [String] string representation of parameter's value
|
98
131
|
# @return [String,Array<String>,Hash{String => String}]
|
99
132
|
def parse_param_value param_type, value_str
|
100
133
|
case param_type
|
101
134
|
when :array
|
135
|
+
return [] if value_str.empty?
|
102
136
|
# elements in the arrays are concatenated by `;`
|
103
137
|
# e.g. foo;bar;baz
|
104
138
|
array_value_strings = split_by_unescaped value_str, ";"
|
@@ -114,7 +148,7 @@ module Gapic
|
|
114
148
|
when :bool
|
115
149
|
# bools should be either `true` or `false`
|
116
150
|
unesc_val = unescape value_str
|
117
|
-
unesc_val if ["true", "false"].include? unesc_val
|
151
|
+
(unesc_val == "true") if ["true", "false"].include? unesc_val
|
118
152
|
else
|
119
153
|
# if it's an unknown type, just escape it without attempting to parse anything
|
120
154
|
unescape value_str
|
@@ -21,7 +21,7 @@ module Google
|
|
21
21
|
set_option :java_package, "com.google.protobuf"
|
22
22
|
set_option :java_outer_classname, "AnyProto"
|
23
23
|
set_option :java_multiple_files, true
|
24
|
-
set_option :go_package, "
|
24
|
+
set_option :go_package, "google.golang.org/protobuf/types/known/anypb"
|
25
25
|
set_option :objc_class_prefix, "GPB"
|
26
26
|
set_option :csharp_namespace, "Google.Protobuf.WellKnownTypes"
|
27
27
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
##
|
4
|
-
# This file
|
5
|
-
# for response features and proto3_optional
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
6
5
|
#
|
7
6
|
require 'protobuf'
|
8
7
|
|
@@ -23,6 +22,11 @@ module Google
|
|
23
22
|
class Version < ::Protobuf::Message; end
|
24
23
|
class CodeGeneratorRequest < ::Protobuf::Message; end
|
25
24
|
class CodeGeneratorResponse < ::Protobuf::Message
|
25
|
+
class Feature < ::Protobuf::Enum
|
26
|
+
define :FEATURE_NONE, 0
|
27
|
+
define :FEATURE_PROTO3_OPTIONAL, 1
|
28
|
+
end
|
29
|
+
|
26
30
|
class File < ::Protobuf::Message; end
|
27
31
|
|
28
32
|
end
|
@@ -34,7 +38,7 @@ module Google
|
|
34
38
|
#
|
35
39
|
set_option :java_package, "com.google.protobuf.compiler"
|
36
40
|
set_option :java_outer_classname, "PluginProtos"
|
37
|
-
set_option :go_package, "
|
41
|
+
set_option :go_package, "google.golang.org/protobuf/types/pluginpb"
|
38
42
|
|
39
43
|
|
40
44
|
##
|
@@ -55,16 +59,15 @@ module Google
|
|
55
59
|
end
|
56
60
|
|
57
61
|
class CodeGeneratorResponse
|
58
|
-
FEATURE_PROTO3_OPTIONAL = 1
|
59
|
-
|
60
62
|
class File
|
61
63
|
optional :string, :name, 1
|
62
64
|
optional :string, :insertion_point, 2
|
63
65
|
optional :string, :content, 15
|
66
|
+
optional ::Google::Protobuf::GeneratedCodeInfo, :generated_code_info, 16
|
64
67
|
end
|
65
68
|
|
66
69
|
optional :string, :error, 1
|
67
|
-
optional :
|
70
|
+
optional :uint64, :supported_features, 2
|
68
71
|
repeated ::Google::Protobuf::Compiler::CodeGeneratorResponse::File, :file, 15
|
69
72
|
end
|
70
73
|
|
@@ -121,7 +121,7 @@ module Google
|
|
121
121
|
set_option :java_package, "com.google.protobuf"
|
122
122
|
set_option :java_outer_classname, "DescriptorProtos"
|
123
123
|
set_option :optimize_for, ::Google::Protobuf::FileOptions::OptimizeMode::SPEED
|
124
|
-
set_option :go_package, "
|
124
|
+
set_option :go_package, "google.golang.org/protobuf/types/descriptorpb"
|
125
125
|
set_option :cc_enable_arenas, true
|
126
126
|
set_option :objc_class_prefix, "GPB"
|
127
127
|
set_option :csharp_namespace, "Google.Protobuf.Reflection"
|
@@ -245,7 +245,7 @@ module Google
|
|
245
245
|
optional :bool, :py_generic_services, 18, :default => false
|
246
246
|
optional :bool, :php_generic_services, 42, :default => false
|
247
247
|
optional :bool, :deprecated, 23, :default => false
|
248
|
-
optional :bool, :cc_enable_arenas, 31, :default =>
|
248
|
+
optional :bool, :cc_enable_arenas, 31, :default => true
|
249
249
|
optional :string, :objc_class_prefix, 36
|
250
250
|
optional :string, :csharp_namespace, 37
|
251
251
|
optional :string, :swift_prefix, 39
|
@@ -21,7 +21,7 @@ module Google
|
|
21
21
|
set_option :java_package, "com.google.protobuf"
|
22
22
|
set_option :java_outer_classname, "EmptyProto"
|
23
23
|
set_option :java_multiple_files, true
|
24
|
-
set_option :go_package, "
|
24
|
+
set_option :go_package, "google.golang.org/protobuf/types/known/emptypb"
|
25
25
|
set_option :cc_enable_arenas, true
|
26
26
|
set_option :objc_class_prefix, "GPB"
|
27
27
|
set_option :csharp_namespace, "Google.Protobuf.WellKnownTypes"
|
@@ -28,11 +28,11 @@ response = client.<%= method.name %> request
|
|
28
28
|
|
29
29
|
## Supported Ruby Versions
|
30
30
|
|
31
|
-
This library is supported on Ruby 2.
|
31
|
+
This library is supported on Ruby 2.5+.
|
32
32
|
|
33
33
|
Google provides official support for Ruby versions that are actively supported
|
34
34
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
35
|
-
in security maintenance, and not end of life. Currently, this means Ruby 2.
|
35
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.5
|
36
36
|
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
37
37
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
38
38
|
about the Ruby support schedule.
|
@@ -6,13 +6,23 @@ require "<%= service.service_require %>"
|
|
6
6
|
require "<%= package.gem.version_require %>"
|
7
7
|
<% end %>
|
8
8
|
<%- unless package.empty? -%>
|
9
|
+
<%- if package.services.first.generate_grpc_clients? -%>
|
9
10
|
##
|
10
|
-
# To load this package, including all its services, and instantiate a
|
11
|
+
# To load this package, including all its services, and instantiate a <%= package.grpc_client_designation %>:
|
11
12
|
#
|
12
13
|
# require "<%= package.package_require %>"
|
13
14
|
# client = <%= package.services.first.create_client_call %>
|
14
15
|
#
|
15
16
|
<%- end -%>
|
17
|
+
<%- if package.services.first.generate_rest_clients? -%>
|
18
|
+
##
|
19
|
+
# To load this package, including all its services, and instantiate a REST client:
|
20
|
+
#
|
21
|
+
# require "<%= package.package_require %>"
|
22
|
+
# client = <%= package.services.first.rest.create_client_call %>
|
23
|
+
#
|
24
|
+
<%- end -%>
|
25
|
+
<%- end -%>
|
16
26
|
module <%= package.module_name %>
|
17
27
|
end
|
18
28
|
<% @footer = capture do %>
|
@@ -1,4 +1,21 @@
|
|
1
1
|
<%- assert_locals service -%>
|
2
|
+
|
3
|
+
<%- if service.generate_rest_clients? -%>
|
4
|
+
<% @requires = capture do %>
|
5
|
+
require "gapic/config"
|
6
|
+
require "gapic/config/method"
|
7
|
+
|
8
|
+
require "<%= service.gem.version_require %>"
|
9
|
+
|
10
|
+
<%- unless service.generic_endpoint? -%>
|
11
|
+
require "<%= service.credentials_require %>"
|
12
|
+
<%- end -%>
|
13
|
+
<%- if service.paths? -%>
|
14
|
+
require "<%= service.paths_require %>"
|
15
|
+
<%- end -%>
|
16
|
+
require "<%= service.rest.service_rest_require %>"
|
17
|
+
<% end %>
|
18
|
+
<%- else -%>
|
2
19
|
<% @requires = capture do %>
|
3
20
|
require "gapic/common"
|
4
21
|
require "gapic/config"
|
@@ -22,13 +39,26 @@ require "<%= service.client_require %>"
|
|
22
39
|
<%= indent service.doc_description, "# " %>
|
23
40
|
#
|
24
41
|
<%- end -%>
|
25
|
-
|
42
|
+
<%- end -%>
|
43
|
+
<%- if service.generate_grpc_clients? -%>
|
44
|
+
# To load this service and instantiate a <%= service.grpc_client_designation %>:
|
26
45
|
#
|
27
46
|
# require "<%= service.service_require %>"
|
28
47
|
# client = <%= service.create_client_call %>
|
29
48
|
#
|
49
|
+
<%- end -%>
|
50
|
+
<%- if service.generate_rest_clients? -%>
|
51
|
+
# To load this service and instantiate a REST client:
|
52
|
+
#
|
53
|
+
# require "<%= service.service_require %>"
|
54
|
+
# client = <%= service.rest.create_client_call %>
|
55
|
+
#
|
56
|
+
<%- end -%>
|
30
57
|
module <%= service.module_name %>
|
31
58
|
end
|
59
|
+
|
60
|
+
|
61
|
+
|
32
62
|
<% @footer = capture do %>
|
33
63
|
<%= render partial: "service/helpers", locals: { service: service} -%>
|
34
64
|
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%- assert_locals service -%>
|
2
|
+
<% @requires = capture do %>
|
3
|
+
require "gapic/rest"
|
4
|
+
require "<%= service.rest.transcoding_helper_require %>"
|
5
|
+
require "<%= service.rest.client_require %>"
|
6
|
+
<% end %>
|
7
|
+
module <%= service.module_name %>
|
8
|
+
# Client for the REST transport
|
9
|
+
module Rest
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<%- assert_locals service -%>
|
2
|
+
<% @requires = capture do %>
|
3
|
+
<%= render partial: "service/client/requires", locals: { service: service} -%>
|
4
|
+
require "<%= service.proto_service_require %>"
|
5
|
+
<% end %>
|
6
|
+
##
|
7
|
+
# REST client for the <%= service.name %> service.
|
8
|
+
#
|
9
|
+
<%- if service.doc_description -%>
|
10
|
+
<%= indent service.doc_description, "# " %>
|
11
|
+
#
|
12
|
+
<%- end -%>
|
13
|
+
class <%= service.rest.client_name %>
|
14
|
+
include <%= service.rest.transcoding_helper_name %>
|
15
|
+
<%- if service.paths? -%>
|
16
|
+
include <%= service.paths_name %>
|
17
|
+
<%- end -%>
|
18
|
+
|
19
|
+
# @private
|
20
|
+
attr_reader :<%= service.stub_name %>
|
21
|
+
|
22
|
+
##
|
23
|
+
# Configure the <%= service.name %> <%= service.rest.client_name %> class.
|
24
|
+
#
|
25
|
+
# See {<%= service.rest.client_name_full %>::Configuration}
|
26
|
+
# for a description of the configuration fields.
|
27
|
+
#
|
28
|
+
# ## Example
|
29
|
+
#
|
30
|
+
# To modify the configuration for all <%= service.name %> clients:
|
31
|
+
#
|
32
|
+
# <%= service.rest.client_name_full %>.configure do |config|
|
33
|
+
# config.timeout = 10.0
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# @yield [config] Configure the <%= service.rest.client_name %> client.
|
37
|
+
# @yieldparam config [<%= service.rest.client_name %>::Configuration]
|
38
|
+
#
|
39
|
+
# @return [<%= service.rest.client_name %>::Configuration]
|
40
|
+
#
|
41
|
+
def self.configure
|
42
|
+
<%= indent render(partial: "service/client/self_configure", locals: { service: service }), 4 %>
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the <%= service.name %> <%= service.rest.client_name %> instance.
|
47
|
+
#
|
48
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
49
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
50
|
+
# should be made on {<%= service.rest.client_name %>.configure}.
|
51
|
+
#
|
52
|
+
# See {<%= service.rest.client_name_full %>::Configuration}
|
53
|
+
# for a description of the configuration fields.
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the <%= service.rest.client_name %> client.
|
56
|
+
# @yieldparam config [<%= service.rest.client_name %>::Configuration]
|
57
|
+
#
|
58
|
+
# @return [<%= service.rest.client_name %>::Configuration]
|
59
|
+
#
|
60
|
+
def configure
|
61
|
+
yield @config if block_given?
|
62
|
+
@config
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Create a new <%= service.name %> REST client object.
|
67
|
+
#
|
68
|
+
# ## Examples
|
69
|
+
#
|
70
|
+
# To create a new <%= service.name %> REST client with the default
|
71
|
+
# configuration:
|
72
|
+
#
|
73
|
+
# client = <%= service.rest.client_name_full %>.new
|
74
|
+
#
|
75
|
+
# To create a new <%= service.name %> REST client with a custom
|
76
|
+
# configuration:
|
77
|
+
#
|
78
|
+
# client = <%= service.rest.client_name_full %>.new do |config|
|
79
|
+
# config.timeout = 10.0
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# @yield [config] Configure the <%= service.name %> client.
|
83
|
+
# @yieldparam config [<%= service.rest.client_name %>::Configuration]
|
84
|
+
#
|
85
|
+
def initialize
|
86
|
+
# These require statements are intentionally placed here to initialize
|
87
|
+
# the REST modules only when it's required.
|
88
|
+
require "gapic/rest"
|
89
|
+
|
90
|
+
# Create the configuration object
|
91
|
+
@config = Configuration.new <%= service.rest.client_name %>.configure
|
92
|
+
|
93
|
+
# Yield the configuration if needed
|
94
|
+
yield @config if block_given?
|
95
|
+
|
96
|
+
# Create credentials
|
97
|
+
credentials = @config.credentials
|
98
|
+
<%- unless service.generic_endpoint? -%>
|
99
|
+
credentials ||= Credentials.default scope: @config.scope
|
100
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
101
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
102
|
+
end
|
103
|
+
<%- end -%>
|
104
|
+
|
105
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: @config.endpoint, credentials: credentials
|
106
|
+
end
|
107
|
+
|
108
|
+
# Service calls
|
109
|
+
<%- service.methods.each do |method| -%>
|
110
|
+
|
111
|
+
<%= indent_tail render(partial: "service/rest/client/method/def", locals: { method: method }), 2 %>
|
112
|
+
<%- end %>
|
113
|
+
|
114
|
+
<%= indent_tail render(partial: "service/rest/client/config", locals: { service: service }), 2 %>
|
115
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<%- assert_locals service -%>
|
2
|
+
<%- method_service ||= service -%>
|
3
|
+
##
|
4
|
+
# Configuration class for the <%= service.name %> REST API.
|
5
|
+
#
|
6
|
+
# This class represents the configuration for <%= service.name %> REST,
|
7
|
+
# providing control over credentials, timeouts, retry behavior, logging.
|
8
|
+
#
|
9
|
+
# Configuration can be applied globally to all clients, or to a single client
|
10
|
+
# on construction.
|
11
|
+
#
|
12
|
+
<%- unless method_service.methods.empty? -%>
|
13
|
+
# # Examples
|
14
|
+
#
|
15
|
+
# To modify the global config, setting the timeout for all calls to 10 seconds:
|
16
|
+
#
|
17
|
+
# <%= service.client_name_full %>.configure do |config|
|
18
|
+
# config.timeout = 10.0
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# To apply the above configuration only to a new client:
|
22
|
+
#
|
23
|
+
# client = <%= service.client_name_full %>.new do |config|
|
24
|
+
# config.timeout = 10.0
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
<%- end -%>
|
28
|
+
# @!attribute [rw] endpoint
|
29
|
+
# The hostname or hostname:port of the service endpoint.
|
30
|
+
# Defaults to `<%= service.client_endpoint.inspect %>`.
|
31
|
+
# @return [::String]
|
32
|
+
# @!attribute [rw] credentials
|
33
|
+
# Credentials to send with calls. You may provide any of the following types:
|
34
|
+
# * (`String`) The path to a service account key file in JSON format
|
35
|
+
# * (`Hash`) A service account key as a Hash
|
36
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
37
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
38
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
39
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
40
|
+
# * (`nil`) indicating no credentials
|
41
|
+
# @return [::Object]
|
42
|
+
# @!attribute [rw] scope
|
43
|
+
# The OAuth scopes
|
44
|
+
# @return [::Array<::String>]
|
45
|
+
# @!attribute [rw] lib_name
|
46
|
+
# The library name as recorded in instrumentation and logging
|
47
|
+
# @return [::String]
|
48
|
+
# @!attribute [rw] lib_version
|
49
|
+
# The library version as recorded in instrumentation and logging
|
50
|
+
# @return [::String]
|
51
|
+
# @!attribute [rw] timeout
|
52
|
+
# The call timeout in seconds.
|
53
|
+
# @return [::Numeric]
|
54
|
+
#
|
55
|
+
class Configuration
|
56
|
+
extend ::Gapic::Config
|
57
|
+
|
58
|
+
config_attr :endpoint, <%= service.client_endpoint.inspect %>, ::String
|
59
|
+
config_attr :credentials, nil do |value|
|
60
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
61
|
+
allowed.any? { |klass| klass === value }
|
62
|
+
end
|
63
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
64
|
+
config_attr :lib_name, nil, ::String, nil
|
65
|
+
config_attr :lib_version, nil, ::String, nil
|
66
|
+
config_attr :timeout, nil, ::Numeric, nil
|
67
|
+
|
68
|
+
# @private
|
69
|
+
def initialize parent_config = nil
|
70
|
+
@parent_config = parent_config unless parent_config.nil?
|
71
|
+
|
72
|
+
yield self if block_given?
|
73
|
+
end
|
74
|
+
end
|