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

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.
@@ -0,0 +1,221 @@
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
+ #
48
+ # @yield [result, response] Access the result along with the Faraday response object
49
+ # @yieldparam result [::Google::Iam::V1::Policy]
50
+ # @yieldparam response [::Faraday::Response]
51
+ #
52
+ # @return [::Google::Iam::V1::Policy]
53
+ # A result object deserialized from the server's reply
54
+ def set_iam_policy request_pb, options = nil
55
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
56
+
57
+ verb, uri, query_string_params, body = ServiceStub.transcode_set_iam_policy_request request_pb
58
+ query_string_params = if query_string_params.any?
59
+ query_string_params.to_h { |p| p.split("=", 2) }
60
+ else
61
+ {}
62
+ end
63
+
64
+ response = @client_stub.make_http_request(
65
+ verb,
66
+ uri: uri,
67
+ body: body || "",
68
+ params: query_string_params,
69
+ options: options
70
+ )
71
+ result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
72
+
73
+ yield result, response if block_given?
74
+ result
75
+ end
76
+
77
+ ##
78
+ # Baseline implementation for the get_iam_policy REST call
79
+ #
80
+ # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest]
81
+ # A request object representing the call parameters. Required.
82
+ # @param options [::Gapic::CallOptions]
83
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
84
+ #
85
+ # @yield [result, response] Access the result along with the Faraday response object
86
+ # @yieldparam result [::Google::Iam::V1::Policy]
87
+ # @yieldparam response [::Faraday::Response]
88
+ #
89
+ # @return [::Google::Iam::V1::Policy]
90
+ # A result object deserialized from the server's reply
91
+ def get_iam_policy request_pb, options = nil
92
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
93
+
94
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_iam_policy_request request_pb
95
+ query_string_params = if query_string_params.any?
96
+ query_string_params.to_h { |p| p.split("=", 2) }
97
+ else
98
+ {}
99
+ end
100
+
101
+ response = @client_stub.make_http_request(
102
+ verb,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ options: options
107
+ )
108
+ result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
109
+
110
+ yield result, response if block_given?
111
+ result
112
+ end
113
+
114
+ ##
115
+ # Baseline implementation for the test_iam_permissions REST call
116
+ #
117
+ # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest]
118
+ # A request object representing the call parameters. Required.
119
+ # @param options [::Gapic::CallOptions]
120
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
121
+ #
122
+ # @yield [result, response] Access the result along with the Faraday response object
123
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
124
+ # @yieldparam response [::Faraday::Response]
125
+ #
126
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
127
+ # A result object deserialized from the server's reply
128
+ def test_iam_permissions request_pb, options = nil
129
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
130
+
131
+ verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb
132
+ query_string_params = if query_string_params.any?
133
+ query_string_params.to_h { |p| p.split("=", 2) }
134
+ else
135
+ {}
136
+ end
137
+
138
+ response = @client_stub.make_http_request(
139
+ verb,
140
+ uri: uri,
141
+ body: body || "",
142
+ params: query_string_params,
143
+ options: options
144
+ )
145
+ result = ::Google::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
146
+
147
+ yield result, response if block_given?
148
+ result
149
+ end
150
+
151
+ ##
152
+ # @private
153
+ #
154
+ # GRPC transcoding helper method for the set_iam_policy REST call
155
+ #
156
+ # @param request_pb [::Google::Iam::V1::SetIamPolicyRequest]
157
+ # A request object representing the call parameters. Required.
158
+ # @return [Array(String, [String, nil], Hash{String => String})]
159
+ # Uri, Body, Query string parameters
160
+ def self.transcode_set_iam_policy_request request_pb
161
+ transcoder = Gapic::Rest::GrpcTranscoder.new
162
+ .with_bindings(
163
+ uri_method: :post,
164
+ uri_template: "/v1/{resource}:setIamPolicy",
165
+ body: "*",
166
+ matches: [
167
+ ["resource", %r{^.*$}, true]
168
+ ]
169
+ )
170
+ transcoder.transcode request_pb
171
+ end
172
+
173
+ ##
174
+ # @private
175
+ #
176
+ # GRPC transcoding helper method for the get_iam_policy REST call
177
+ #
178
+ # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest]
179
+ # A request object representing the call parameters. Required.
180
+ # @return [Array(String, [String, nil], Hash{String => String})]
181
+ # Uri, Body, Query string parameters
182
+ def self.transcode_get_iam_policy_request request_pb
183
+ transcoder = Gapic::Rest::GrpcTranscoder.new
184
+ .with_bindings(
185
+ uri_method: :post,
186
+ uri_template: "/v1/{resource}:getIamPolicy",
187
+ body: "*",
188
+ matches: [
189
+ ["resource", %r{^.*$}, true]
190
+ ]
191
+ )
192
+ transcoder.transcode request_pb
193
+ end
194
+
195
+ ##
196
+ # @private
197
+ #
198
+ # GRPC transcoding helper method for the test_iam_permissions REST call
199
+ #
200
+ # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest]
201
+ # A request object representing the call parameters. Required.
202
+ # @return [Array(String, [String, nil], Hash{String => String})]
203
+ # Uri, Body, Query string parameters
204
+ def self.transcode_test_iam_permissions_request request_pb
205
+ transcoder = Gapic::Rest::GrpcTranscoder.new
206
+ .with_bindings(
207
+ uri_method: :post,
208
+ uri_template: "/v1/{resource}:testIamPermissions",
209
+ body: "*",
210
+ matches: [
211
+ ["resource", %r{^.*$}, true]
212
+ ]
213
+ )
214
+ transcoder.transcode request_pb
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
221
+ 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.1"
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