google-iam-v1 0.2.0 → 0.3.beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,236 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/iam/v1/iam_policy_pb"
20
+
21
+ module Google
22
+ module Iam
23
+ module V1
24
+ module IAMPolicy
25
+ module Rest
26
+ ##
27
+ # REST service stub for the IAMPolicy service.
28
+ # Service stub contains baseline method implementations
29
+ # including transcoding, making the REST call, and deserialing the response.
30
+ #
31
+ class ServiceStub
32
+ def initialize endpoint:, credentials:
33
+ # These require statements are intentionally placed here to initialize
34
+ # the REST modules only when it's required.
35
+ require "gapic/rest"
36
+
37
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials, numeric_enums: false
38
+ end
39
+
40
+ ##
41
+ # Baseline implementation for the set_iam_policy REST call
42
+ #
43
+ # @param request_pb [::Google::Iam::V1::SetIamPolicyRequest]
44
+ # A request object representing the call parameters. Required.
45
+ # @param options [::Gapic::CallOptions]
46
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
47
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
48
+ # Binding overrides for the transcoding. Only used internally.
49
+ #
50
+ # @yield [result, response] Access the result along with the Faraday response object
51
+ # @yieldparam result [::Google::Iam::V1::Policy]
52
+ # @yieldparam response [::Faraday::Response]
53
+ #
54
+ # @return [::Google::Iam::V1::Policy]
55
+ # A result object deserialized from the server's reply
56
+ def set_iam_policy request_pb, options = nil, bindings_override: nil
57
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
58
+
59
+ verb, uri, query_string_params, body = ServiceStub.transcode_set_iam_policy_request request_pb, bindings_override: bindings_override
60
+ query_string_params = if query_string_params.any?
61
+ query_string_params.to_h { |p| p.split("=", 2) }
62
+ else
63
+ {}
64
+ end
65
+
66
+ response = @client_stub.make_http_request(
67
+ verb,
68
+ uri: uri,
69
+ body: body || "",
70
+ params: query_string_params,
71
+ options: options
72
+ )
73
+ result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
74
+
75
+ yield result, response if block_given?
76
+ result
77
+ end
78
+
79
+ ##
80
+ # Baseline implementation for the get_iam_policy REST call
81
+ #
82
+ # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest]
83
+ # A request object representing the call parameters. Required.
84
+ # @param options [::Gapic::CallOptions]
85
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
86
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
87
+ # Binding overrides for the transcoding. Only used internally.
88
+ #
89
+ # @yield [result, response] Access the result along with the Faraday response object
90
+ # @yieldparam result [::Google::Iam::V1::Policy]
91
+ # @yieldparam response [::Faraday::Response]
92
+ #
93
+ # @return [::Google::Iam::V1::Policy]
94
+ # A result object deserialized from the server's reply
95
+ def get_iam_policy request_pb, options = nil, bindings_override: nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_iam_policy_request request_pb, bindings_override: bindings_override
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
113
+
114
+ yield result, response if block_given?
115
+ result
116
+ end
117
+
118
+ ##
119
+ # Baseline implementation for the test_iam_permissions REST call
120
+ #
121
+ # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest]
122
+ # A request object representing the call parameters. Required.
123
+ # @param options [::Gapic::CallOptions]
124
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
125
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
126
+ # Binding overrides for the transcoding. Only used internally.
127
+ #
128
+ # @yield [result, response] Access the result along with the Faraday response object
129
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
130
+ # @yieldparam response [::Faraday::Response]
131
+ #
132
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
133
+ # A result object deserialized from the server's reply
134
+ def test_iam_permissions request_pb, options = nil, bindings_override: nil
135
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
136
+
137
+ verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb, bindings_override: bindings_override
138
+ query_string_params = if query_string_params.any?
139
+ query_string_params.to_h { |p| p.split("=", 2) }
140
+ else
141
+ {}
142
+ end
143
+
144
+ response = @client_stub.make_http_request(
145
+ verb,
146
+ uri: uri,
147
+ body: body || "",
148
+ params: query_string_params,
149
+ options: options
150
+ )
151
+ result = ::Google::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
152
+
153
+ yield result, response if block_given?
154
+ result
155
+ end
156
+
157
+ ##
158
+ # @private
159
+ #
160
+ # GRPC transcoding helper method for the set_iam_policy REST call
161
+ #
162
+ # @param request_pb [::Google::Iam::V1::SetIamPolicyRequest]
163
+ # A request object representing the call parameters. Required.
164
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
165
+ # Binding overrides for the transcoding.
166
+ # @return [Array(String, [String, nil], Hash{String => String})]
167
+ # Uri, Body, Query string parameters
168
+ def self.transcode_set_iam_policy_request request_pb, bindings_override: nil
169
+ transcoder = Gapic::Rest::GrpcTranscoder.new(bindings_override) if bindings_override
170
+ transcoder ||= Gapic::Rest::GrpcTranscoder.new
171
+ .with_bindings(
172
+ uri_method: :post,
173
+ uri_template: "/v1/{resource}:setIamPolicy",
174
+ body: "*",
175
+ matches: [
176
+ ["resource", %r{^.*$}, true]
177
+ ]
178
+ )
179
+ transcoder.transcode request_pb
180
+ end
181
+
182
+ ##
183
+ # @private
184
+ #
185
+ # GRPC transcoding helper method for the get_iam_policy REST call
186
+ #
187
+ # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest]
188
+ # A request object representing the call parameters. Required.
189
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
190
+ # Binding overrides for the transcoding.
191
+ # @return [Array(String, [String, nil], Hash{String => String})]
192
+ # Uri, Body, Query string parameters
193
+ def self.transcode_get_iam_policy_request request_pb, bindings_override: nil
194
+ transcoder = Gapic::Rest::GrpcTranscoder.new(bindings_override) if bindings_override
195
+ transcoder ||= Gapic::Rest::GrpcTranscoder.new
196
+ .with_bindings(
197
+ uri_method: :post,
198
+ uri_template: "/v1/{resource}:getIamPolicy",
199
+ body: "*",
200
+ matches: [
201
+ ["resource", %r{^.*$}, true]
202
+ ]
203
+ )
204
+ transcoder.transcode request_pb
205
+ end
206
+
207
+ ##
208
+ # @private
209
+ #
210
+ # GRPC transcoding helper method for the test_iam_permissions REST call
211
+ #
212
+ # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest]
213
+ # A request object representing the call parameters. Required.
214
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
215
+ # Binding overrides for the transcoding.
216
+ # @return [Array(String, [String, nil], Hash{String => String})]
217
+ # Uri, Body, Query string parameters
218
+ def self.transcode_test_iam_permissions_request request_pb, bindings_override: nil
219
+ transcoder = Gapic::Rest::GrpcTranscoder.new(bindings_override) if bindings_override
220
+ transcoder ||= Gapic::Rest::GrpcTranscoder.new
221
+ .with_bindings(
222
+ uri_method: :post,
223
+ uri_template: "/v1/{resource}:testIamPermissions",
224
+ body: "*",
225
+ matches: [
226
+ ["resource", %r{^.*$}, true]
227
+ ]
228
+ )
229
+ transcoder.transcode request_pb
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
236
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/iam/v1/version"
24
+
25
+ require "google/iam/v1/iam_policy/credentials"
26
+ require "google/iam/v1/iam_policy/rest/client"
27
+
28
+ module Google
29
+ module Iam
30
+ module V1
31
+ ##
32
+ # API Overview
33
+ #
34
+ #
35
+ # Manages Identity and Access Management (IAM) policies.
36
+ #
37
+ # Any implementation of an API that offers access control features
38
+ # implements the google.iam.v1.IAMPolicy interface.
39
+ #
40
+ # ## Data model
41
+ #
42
+ # Access control is applied when a principal (user or service account), takes
43
+ # some action on a resource exposed by a service. Resources, identified by
44
+ # URI-like names, are the unit of access control specification. Service
45
+ # implementations can choose the granularity of access control and the
46
+ # supported permissions for their resources.
47
+ # For example one database service may allow access control to be
48
+ # specified only at the Table level, whereas another might allow access control
49
+ # to also be specified at the Column level.
50
+ #
51
+ # ## Policy Structure
52
+ #
53
+ # See google.iam.v1.Policy
54
+ #
55
+ # This is intentionally not a CRUD style API because access control policies
56
+ # are created and deleted implicitly with the resources to which they are
57
+ # attached.
58
+ #
59
+ # To load this service and instantiate a REST client:
60
+ #
61
+ # require "google/iam/v1/iam_policy/rest"
62
+ # client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new
63
+ #
64
+ module IAMPolicy
65
+ # Client for the REST transport
66
+ module Rest
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
74
+ require "google/iam/v1/iam_policy/rest/helpers" if ::File.file? helper_path
@@ -24,6 +24,7 @@ require "google/iam/v1/version"
24
24
 
25
25
  require "google/iam/v1/iam_policy/credentials"
26
26
  require "google/iam/v1/iam_policy/client"
27
+ require "google/iam/v1/iam_policy/rest"
27
28
 
28
29
  module Google
29
30
  module Iam
@@ -56,11 +57,16 @@ module Google
56
57
  # are created and deleted implicitly with the resources to which they are
57
58
  # attached.
58
59
  #
59
- # To load this service and instantiate a client:
60
+ # To load this service and instantiate a GRPC client:
60
61
  #
61
62
  # require "google/iam/v1/iam_policy"
62
63
  # client = ::Google::Iam::V1::IAMPolicy::Client.new
63
64
  #
65
+ # To load this service and instantiate a REST client:
66
+ #
67
+ # require "google/iam/v1/iam_policy/rest"
68
+ # client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new
69
+ #
64
70
  module IAMPolicy
65
71
  end
66
72
  end
@@ -3,7 +3,6 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
- require 'google/api/annotations_pb'
7
6
  require 'google/iam/v1/policy_pb'
8
7
 
9
8
  Google::Protobuf::DescriptorPool.generated_pool.build do
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/iam/v1/iam_policy/rest"
20
+ require "google/iam/v1/version"
21
+
22
+ module Google
23
+ module Iam
24
+ ##
25
+ # To load just the REST part of this package, including all its services, and instantiate a REST client:
26
+ #
27
+ # @example
28
+ #
29
+ # require "google/iam/v1/rest"
30
+ # client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new
31
+ #
32
+ module V1
33
+ end
34
+ end
35
+ end
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Iam
22
22
  module V1
23
- VERSION = "0.2.0"
23
+ VERSION = "0.3.beta.2"
24
24
  end
25
25
  end
26
26
  end
data/lib/google/iam/v1.rb CHANGED
@@ -22,13 +22,21 @@ require "google/iam/v1/version"
22
22
  module Google
23
23
  module Iam
24
24
  ##
25
- # To load this package, including all its services, and instantiate a client:
25
+ # To load this package, including all its services, and instantiate a GRPC client:
26
26
  #
27
27
  # @example
28
28
  #
29
29
  # require "google/iam/v1"
30
30
  # client = ::Google::Iam::V1::IAMPolicy::Client.new
31
31
  #
32
+ ##
33
+ # To load this package, including all its services, and instantiate a REST client:
34
+ #
35
+ # @example
36
+ #
37
+ # require "google/iam/v1"
38
+ # client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new
39
+ #
32
40
  module V1
33
41
  end
34
42
  end