google-cloud-binary_authorization-v1 0.1.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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/client.rb +897 -0
- data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/credentials.rb +51 -0
- data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/paths.rb +97 -0
- data/lib/google/cloud/binary_authorization/v1/binauthz_management_service.rb +55 -0
- data/lib/google/cloud/binary_authorization/v1/system_policy/client.rb +371 -0
- data/lib/google/cloud/binary_authorization/v1/system_policy/credentials.rb +51 -0
- data/lib/google/cloud/binary_authorization/v1/system_policy/paths.rb +66 -0
- data/lib/google/cloud/binary_authorization/v1/system_policy.rb +49 -0
- data/lib/google/cloud/binary_authorization/v1/validation_helper/client.rb +382 -0
- data/lib/google/cloud/binary_authorization/v1/validation_helper/credentials.rb +51 -0
- data/lib/google/cloud/binary_authorization/v1/validation_helper.rb +48 -0
- data/lib/google/cloud/binary_authorization/v1/version.rb +28 -0
- data/lib/google/cloud/binary_authorization/v1.rb +40 -0
- data/lib/google/cloud/binaryauthorization/v1/resources_pb.rb +111 -0
- data/lib/google/cloud/binaryauthorization/v1/service_pb.rb +84 -0
- data/lib/google/cloud/binaryauthorization/v1/service_services_pb.rb +115 -0
- data/lib/google-cloud-binary_authorization-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +71 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/binaryauthorization/v1/resources.rb +370 -0
- data/proto_docs/google/cloud/binaryauthorization/v1/service.rb +189 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- data/proto_docs/grafeas/v1/attestation.rb +77 -0
- data/proto_docs/grafeas/v1/common.rb +118 -0
- metadata +242 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module BinaryAuthorization
|
24
|
+
module V1
|
25
|
+
module BinauthzManagementService
|
26
|
+
# Credentials for the BinauthzManagementService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"BINARY_AUTHORIZATION_CREDENTIALS",
|
33
|
+
"BINARY_AUTHORIZATION_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"BINARY_AUTHORIZATION_CREDENTIALS_JSON",
|
38
|
+
"BINARY_AUTHORIZATION_KEYFILE_JSON",
|
39
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
40
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
41
|
+
"GCLOUD_KEYFILE_JSON"
|
42
|
+
]
|
43
|
+
self.paths = [
|
44
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
45
|
+
]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module BinaryAuthorization
|
23
|
+
module V1
|
24
|
+
module BinauthzManagementService
|
25
|
+
# Path helper methods for the BinauthzManagementService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Attestor resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/attestors/{attestor}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param attestor [String]
|
36
|
+
#
|
37
|
+
# @return [::String]
|
38
|
+
def attestor_path project:, attestor:
|
39
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
40
|
+
|
41
|
+
"projects/#{project}/attestors/#{attestor}"
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Create a fully-qualified Policy resource string.
|
46
|
+
#
|
47
|
+
# @overload policy_path(project:)
|
48
|
+
# The resource will be in the following format:
|
49
|
+
#
|
50
|
+
# `projects/{project}/policy`
|
51
|
+
#
|
52
|
+
# @param project [String]
|
53
|
+
#
|
54
|
+
# @overload policy_path(location:)
|
55
|
+
# The resource will be in the following format:
|
56
|
+
#
|
57
|
+
# `locations/{location}/policy`
|
58
|
+
#
|
59
|
+
# @param location [String]
|
60
|
+
#
|
61
|
+
# @return [::String]
|
62
|
+
def policy_path **args
|
63
|
+
resources = {
|
64
|
+
"project" => (proc do |project:|
|
65
|
+
"projects/#{project}/policy"
|
66
|
+
end),
|
67
|
+
"location" => (proc do |location:|
|
68
|
+
"locations/#{location}/policy"
|
69
|
+
end)
|
70
|
+
}
|
71
|
+
|
72
|
+
resource = resources[args.keys.sort.join(":")]
|
73
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
74
|
+
resource.call(**args)
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Create a fully-qualified Project resource string.
|
79
|
+
#
|
80
|
+
# The resource will be in the following format:
|
81
|
+
#
|
82
|
+
# `projects/{project}`
|
83
|
+
#
|
84
|
+
# @param project [String]
|
85
|
+
#
|
86
|
+
# @return [::String]
|
87
|
+
def project_path project:
|
88
|
+
"projects/#{project}"
|
89
|
+
end
|
90
|
+
|
91
|
+
extend self
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/binary_authorization/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/binary_authorization/v1/binauthz_management_service/credentials"
|
26
|
+
require "google/cloud/binary_authorization/v1/binauthz_management_service/paths"
|
27
|
+
require "google/cloud/binary_authorization/v1/binauthz_management_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module BinaryAuthorization
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# Google Cloud Management Service for Binary Authorization admission policies
|
35
|
+
# and attestation authorities.
|
36
|
+
#
|
37
|
+
# This API implements a REST model with the following objects:
|
38
|
+
#
|
39
|
+
# * {::Google::Cloud::BinaryAuthorization::V1::Policy Policy}
|
40
|
+
# * {::Google::Cloud::BinaryAuthorization::V1::Attestor Attestor}
|
41
|
+
#
|
42
|
+
# To load this service and instantiate a client:
|
43
|
+
#
|
44
|
+
# require "google/cloud/binary_authorization/v1/binauthz_management_service"
|
45
|
+
# client = ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Client.new
|
46
|
+
#
|
47
|
+
module BinauthzManagementService
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
helper_path = ::File.join __dir__, "binauthz_management_service", "helpers.rb"
|
55
|
+
require "google/cloud/binary_authorization/v1/binauthz_management_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,371 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/binaryauthorization/v1/service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module BinaryAuthorization
|
25
|
+
module V1
|
26
|
+
module SystemPolicy
|
27
|
+
##
|
28
|
+
# Client for the SystemPolicy service.
|
29
|
+
#
|
30
|
+
# API for working with the system policy.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :system_policy_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the SystemPolicy Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all SystemPolicy clients
|
47
|
+
# ::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @yield [config] Configure the Client client.
|
52
|
+
# @yieldparam config [Client::Configuration]
|
53
|
+
#
|
54
|
+
# @return [Client::Configuration]
|
55
|
+
#
|
56
|
+
def self.configure
|
57
|
+
@configure ||= begin
|
58
|
+
namespace = ["Google", "Cloud", "BinaryAuthorization", "V1"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config
|
68
|
+
end
|
69
|
+
yield @configure if block_given?
|
70
|
+
@configure
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Configure the SystemPolicy Client instance.
|
75
|
+
#
|
76
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
77
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
78
|
+
# should be made on {Client.configure}.
|
79
|
+
#
|
80
|
+
# See {::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client::Configuration}
|
81
|
+
# for a description of the configuration fields.
|
82
|
+
#
|
83
|
+
# @yield [config] Configure the Client client.
|
84
|
+
# @yieldparam config [Client::Configuration]
|
85
|
+
#
|
86
|
+
# @return [Client::Configuration]
|
87
|
+
#
|
88
|
+
def configure
|
89
|
+
yield @config if block_given?
|
90
|
+
@config
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create a new SystemPolicy client object.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
#
|
98
|
+
# # Create a client using the default configuration
|
99
|
+
# client = ::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client.new
|
100
|
+
#
|
101
|
+
# # Create a client using a custom configuration
|
102
|
+
# client = ::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client.new do |config|
|
103
|
+
# config.timeout = 10.0
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the SystemPolicy client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
def initialize
|
110
|
+
# These require statements are intentionally placed here to initialize
|
111
|
+
# the gRPC module only when it's required.
|
112
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
113
|
+
require "gapic/grpc"
|
114
|
+
require "google/cloud/binaryauthorization/v1/service_services_pb"
|
115
|
+
|
116
|
+
# Create the configuration object
|
117
|
+
@config = Configuration.new Client.configure
|
118
|
+
|
119
|
+
# Yield the configuration if needed
|
120
|
+
yield @config if block_given?
|
121
|
+
|
122
|
+
# Create credentials
|
123
|
+
credentials = @config.credentials
|
124
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
125
|
+
# but only if the default endpoint does not have a region prefix.
|
126
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
127
|
+
!@config.endpoint.split(".").first.include?("-")
|
128
|
+
credentials ||= Credentials.default scope: @config.scope,
|
129
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
130
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
131
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
132
|
+
end
|
133
|
+
@quota_project_id = @config.quota_project
|
134
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
135
|
+
|
136
|
+
@system_policy_stub = ::Gapic::ServiceStub.new(
|
137
|
+
::Google::Cloud::BinaryAuthorization::V1::SystemPolicyV1::Stub,
|
138
|
+
credentials: credentials,
|
139
|
+
endpoint: @config.endpoint,
|
140
|
+
channel_args: @config.channel_args,
|
141
|
+
interceptors: @config.interceptors
|
142
|
+
)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Service calls
|
146
|
+
|
147
|
+
##
|
148
|
+
# Gets the current system policy in the specified location.
|
149
|
+
#
|
150
|
+
# @overload get_system_policy(request, options = nil)
|
151
|
+
# Pass arguments to `get_system_policy` via a request object, either of type
|
152
|
+
# {::Google::Cloud::BinaryAuthorization::V1::GetSystemPolicyRequest} or an equivalent Hash.
|
153
|
+
#
|
154
|
+
# @param request [::Google::Cloud::BinaryAuthorization::V1::GetSystemPolicyRequest, ::Hash]
|
155
|
+
# A request object representing the call parameters. Required. To specify no
|
156
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
157
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
158
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
159
|
+
#
|
160
|
+
# @overload get_system_policy(name: nil)
|
161
|
+
# Pass arguments to `get_system_policy` via keyword arguments. Note that at
|
162
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
163
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
164
|
+
#
|
165
|
+
# @param name [::String]
|
166
|
+
# Required. The resource name, in the format `locations/*/policy`.
|
167
|
+
# Note that the system policy is not associated with a project.
|
168
|
+
#
|
169
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
170
|
+
# @yieldparam response [::Google::Cloud::BinaryAuthorization::V1::Policy]
|
171
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
172
|
+
#
|
173
|
+
# @return [::Google::Cloud::BinaryAuthorization::V1::Policy]
|
174
|
+
#
|
175
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
176
|
+
#
|
177
|
+
def get_system_policy request, options = nil
|
178
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
179
|
+
|
180
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::GetSystemPolicyRequest
|
181
|
+
|
182
|
+
# Converts hash and nil to an options object
|
183
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
184
|
+
|
185
|
+
# Customize the options with defaults
|
186
|
+
metadata = @config.rpcs.get_system_policy.metadata.to_h
|
187
|
+
|
188
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
189
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
190
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
191
|
+
gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION
|
192
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
193
|
+
|
194
|
+
header_params = {
|
195
|
+
"name" => request.name
|
196
|
+
}
|
197
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
198
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
199
|
+
|
200
|
+
options.apply_defaults timeout: @config.rpcs.get_system_policy.timeout,
|
201
|
+
metadata: metadata,
|
202
|
+
retry_policy: @config.rpcs.get_system_policy.retry_policy
|
203
|
+
|
204
|
+
options.apply_defaults timeout: @config.timeout,
|
205
|
+
metadata: @config.metadata,
|
206
|
+
retry_policy: @config.retry_policy
|
207
|
+
|
208
|
+
@system_policy_stub.call_rpc :get_system_policy, request, options: options do |response, operation|
|
209
|
+
yield response, operation if block_given?
|
210
|
+
return response
|
211
|
+
end
|
212
|
+
rescue ::GRPC::BadStatus => e
|
213
|
+
raise ::Google::Cloud::Error.from_error(e)
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Configuration class for the SystemPolicy API.
|
218
|
+
#
|
219
|
+
# This class represents the configuration for SystemPolicy,
|
220
|
+
# providing control over timeouts, retry behavior, logging, transport
|
221
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
222
|
+
# applied individually to specific RPCs. See
|
223
|
+
# {::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client::Configuration::Rpcs}
|
224
|
+
# for a list of RPCs that can be configured independently.
|
225
|
+
#
|
226
|
+
# Configuration can be applied globally to all clients, or to a single client
|
227
|
+
# on construction.
|
228
|
+
#
|
229
|
+
# @example
|
230
|
+
#
|
231
|
+
# # Modify the global config, setting the timeout for
|
232
|
+
# # get_system_policy to 20 seconds,
|
233
|
+
# # and all remaining timeouts to 10 seconds.
|
234
|
+
# ::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client.configure do |config|
|
235
|
+
# config.timeout = 10.0
|
236
|
+
# config.rpcs.get_system_policy.timeout = 20.0
|
237
|
+
# end
|
238
|
+
#
|
239
|
+
# # Apply the above configuration only to a new client.
|
240
|
+
# client = ::Google::Cloud::BinaryAuthorization::V1::SystemPolicy::Client.new do |config|
|
241
|
+
# config.timeout = 10.0
|
242
|
+
# config.rpcs.get_system_policy.timeout = 20.0
|
243
|
+
# end
|
244
|
+
#
|
245
|
+
# @!attribute [rw] endpoint
|
246
|
+
# The hostname or hostname:port of the service endpoint.
|
247
|
+
# Defaults to `"binaryauthorization.googleapis.com"`.
|
248
|
+
# @return [::String]
|
249
|
+
# @!attribute [rw] credentials
|
250
|
+
# Credentials to send with calls. You may provide any of the following types:
|
251
|
+
# * (`String`) The path to a service account key file in JSON format
|
252
|
+
# * (`Hash`) A service account key as a Hash
|
253
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
254
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
255
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
256
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
257
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
258
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
259
|
+
# * (`nil`) indicating no credentials
|
260
|
+
# @return [::Object]
|
261
|
+
# @!attribute [rw] scope
|
262
|
+
# The OAuth scopes
|
263
|
+
# @return [::Array<::String>]
|
264
|
+
# @!attribute [rw] lib_name
|
265
|
+
# The library name as recorded in instrumentation and logging
|
266
|
+
# @return [::String]
|
267
|
+
# @!attribute [rw] lib_version
|
268
|
+
# The library version as recorded in instrumentation and logging
|
269
|
+
# @return [::String]
|
270
|
+
# @!attribute [rw] channel_args
|
271
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
272
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
273
|
+
# @return [::Hash]
|
274
|
+
# @!attribute [rw] interceptors
|
275
|
+
# An array of interceptors that are run before calls are executed.
|
276
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
277
|
+
# @!attribute [rw] timeout
|
278
|
+
# The call timeout in seconds.
|
279
|
+
# @return [::Numeric]
|
280
|
+
# @!attribute [rw] metadata
|
281
|
+
# Additional gRPC headers to be sent with the call.
|
282
|
+
# @return [::Hash{::Symbol=>::String}]
|
283
|
+
# @!attribute [rw] retry_policy
|
284
|
+
# The retry policy. The value is a hash with the following keys:
|
285
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
286
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
287
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
288
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
289
|
+
# trigger a retry.
|
290
|
+
# @return [::Hash]
|
291
|
+
# @!attribute [rw] quota_project
|
292
|
+
# A separate project against which to charge quota.
|
293
|
+
# @return [::String]
|
294
|
+
#
|
295
|
+
class Configuration
|
296
|
+
extend ::Gapic::Config
|
297
|
+
|
298
|
+
config_attr :endpoint, "binaryauthorization.googleapis.com", ::String
|
299
|
+
config_attr :credentials, nil do |value|
|
300
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
301
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
302
|
+
allowed.any? { |klass| klass === value }
|
303
|
+
end
|
304
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
305
|
+
config_attr :lib_name, nil, ::String, nil
|
306
|
+
config_attr :lib_version, nil, ::String, nil
|
307
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
308
|
+
config_attr :interceptors, nil, ::Array, nil
|
309
|
+
config_attr :timeout, nil, ::Numeric, nil
|
310
|
+
config_attr :metadata, nil, ::Hash, nil
|
311
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
312
|
+
config_attr :quota_project, nil, ::String, nil
|
313
|
+
|
314
|
+
# @private
|
315
|
+
def initialize parent_config = nil
|
316
|
+
@parent_config = parent_config unless parent_config.nil?
|
317
|
+
|
318
|
+
yield self if block_given?
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# Configurations for individual RPCs
|
323
|
+
# @return [Rpcs]
|
324
|
+
#
|
325
|
+
def rpcs
|
326
|
+
@rpcs ||= begin
|
327
|
+
parent_rpcs = nil
|
328
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
329
|
+
Rpcs.new parent_rpcs
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Configuration RPC class for the SystemPolicy API.
|
335
|
+
#
|
336
|
+
# Includes fields providing the configuration for each RPC in this service.
|
337
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
338
|
+
# the following configuration fields:
|
339
|
+
#
|
340
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
341
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
342
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
343
|
+
# include the following keys:
|
344
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
345
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
346
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
347
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
348
|
+
# trigger a retry.
|
349
|
+
#
|
350
|
+
class Rpcs
|
351
|
+
##
|
352
|
+
# RPC-specific configuration for `get_system_policy`
|
353
|
+
# @return [::Gapic::Config::Method]
|
354
|
+
#
|
355
|
+
attr_reader :get_system_policy
|
356
|
+
|
357
|
+
# @private
|
358
|
+
def initialize parent_rpcs = nil
|
359
|
+
get_system_policy_config = parent_rpcs.get_system_policy if parent_rpcs.respond_to? :get_system_policy
|
360
|
+
@get_system_policy = ::Gapic::Config::Method.new get_system_policy_config
|
361
|
+
|
362
|
+
yield self if block_given?
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module BinaryAuthorization
|
24
|
+
module V1
|
25
|
+
module SystemPolicy
|
26
|
+
# Credentials for the SystemPolicy API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"BINARY_AUTHORIZATION_CREDENTIALS",
|
33
|
+
"BINARY_AUTHORIZATION_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"BINARY_AUTHORIZATION_CREDENTIALS_JSON",
|
38
|
+
"BINARY_AUTHORIZATION_KEYFILE_JSON",
|
39
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
40
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
41
|
+
"GCLOUD_KEYFILE_JSON"
|
42
|
+
]
|
43
|
+
self.paths = [
|
44
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
45
|
+
]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|