This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
/
service.py
462 lines (367 loc) · 15.8 KB
/
service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.iap.v1",
manifest={
"GetIapSettingsRequest",
"UpdateIapSettingsRequest",
"IapSettings",
"AccessSettings",
"GcipSettings",
"CorsSettings",
"OAuthSettings",
"ApplicationSettings",
"CsmSettings",
"AccessDeniedPageSettings",
"ListBrandsRequest",
"ListBrandsResponse",
"CreateBrandRequest",
"GetBrandRequest",
"ListIdentityAwareProxyClientsRequest",
"ListIdentityAwareProxyClientsResponse",
"CreateIdentityAwareProxyClientRequest",
"GetIdentityAwareProxyClientRequest",
"ResetIdentityAwareProxyClientSecretRequest",
"DeleteIdentityAwareProxyClientRequest",
"Brand",
"IdentityAwareProxyClient",
},
)
class GetIapSettingsRequest(proto.Message):
r"""The request sent to GetIapSettings.
Attributes:
name (str):
Required. The resource name for which to retrieve the
settings. Authorization: Requires the ``getSettings``
permission for the associated resource.
"""
name = proto.Field(proto.STRING, number=1,)
class UpdateIapSettingsRequest(proto.Message):
r"""The request sent to UpdateIapSettings.
Attributes:
iap_settings (google.cloud.iap_v1.types.IapSettings):
Required. The new values for the IAP settings to be updated.
Authorization: Requires the ``updateSettings`` permission
for the associated resource.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
The field mask specifying which IAP settings
should be updated. If omitted, the all of the
settings are updated. See
https://developers.google.com/protocol-
buffers/docs/reference/google.protobuf#fieldmask
"""
iap_settings = proto.Field(proto.MESSAGE, number=1, message="IapSettings",)
update_mask = proto.Field(
proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,
)
class IapSettings(proto.Message):
r"""The IAP configurable settings.
Attributes:
name (str):
Required. The resource name of the IAP
protected resource.
access_settings (google.cloud.iap_v1.types.AccessSettings):
Top level wrapper for all access related
setting in IAP
application_settings (google.cloud.iap_v1.types.ApplicationSettings):
Top level wrapper for all application related
settings in IAP
"""
name = proto.Field(proto.STRING, number=1,)
access_settings = proto.Field(proto.MESSAGE, number=5, message="AccessSettings",)
application_settings = proto.Field(
proto.MESSAGE, number=6, message="ApplicationSettings",
)
class AccessSettings(proto.Message):
r"""Access related settings for IAP protected apps.
Attributes:
gcip_settings (google.cloud.iap_v1.types.GcipSettings):
GCIP claims and endpoint configurations for
3p identity providers.
cors_settings (google.cloud.iap_v1.types.CorsSettings):
Configuration to allow cross-origin requests
via IAP.
oauth_settings (google.cloud.iap_v1.types.OAuthSettings):
Settings to configure IAP's OAuth behavior.
"""
gcip_settings = proto.Field(proto.MESSAGE, number=1, message="GcipSettings",)
cors_settings = proto.Field(proto.MESSAGE, number=2, message="CorsSettings",)
oauth_settings = proto.Field(proto.MESSAGE, number=3, message="OAuthSettings",)
class GcipSettings(proto.Message):
r"""Allows customers to configure tenant_id for GCIP instance per-app.
Attributes:
tenant_ids (Sequence[str]):
GCIP tenant ids that are linked to the IAP resource.
tenant_ids could be a string beginning with a number
character to indicate authenticating with GCIP tenant flow,
or in the format of \_ to indicate authenticating with GCIP
agent flow. If agent flow is used, tenant_ids should only
contain one single element, while for tenant flow,
tenant_ids can contain multiple elements.
login_page_uri (google.protobuf.wrappers_pb2.StringValue):
Login page URI associated with the GCIP
tenants. Typically, all resources within the
same project share the same login page, though
it could be overridden at the sub resource
level.
"""
tenant_ids = proto.RepeatedField(proto.STRING, number=1,)
login_page_uri = proto.Field(
proto.MESSAGE, number=2, message=wrappers_pb2.StringValue,
)
class CorsSettings(proto.Message):
r"""Allows customers to configure HTTP request paths that'll
allow HTTP OPTIONS call to bypass authentication and
authorization.
Attributes:
allow_http_options (google.protobuf.wrappers_pb2.BoolValue):
Configuration to allow HTTP OPTIONS calls to
skip authorization. If undefined, IAP will not
apply any special logic to OPTIONS requests.
"""
allow_http_options = proto.Field(
proto.MESSAGE, number=1, message=wrappers_pb2.BoolValue,
)
class OAuthSettings(proto.Message):
r"""Configuration for OAuth login&consent flow behavior as well
as for OAuth Credentials.
Attributes:
login_hint (google.protobuf.wrappers_pb2.StringValue):
Domain hint to send as hd=? parameter in
OAuth request flow. Enables redirect to primary
IDP by skipping Google's login screen.
https://developers.google.com/identity/protocols/OpenIDConnect#hd-
param Note: IAP does not verify that the id
token's hd claim matches this value since access
behavior is managed by IAM policies.
"""
login_hint = proto.Field(proto.MESSAGE, number=2, message=wrappers_pb2.StringValue,)
class ApplicationSettings(proto.Message):
r"""Wrapper over application specific settings for IAP.
Attributes:
csm_settings (google.cloud.iap_v1.types.CsmSettings):
Settings to configure IAP's behavior for a
CSM mesh.
access_denied_page_settings (google.cloud.iap_v1.types.AccessDeniedPageSettings):
Customization for Access Denied page.
cookie_domain (google.protobuf.wrappers_pb2.StringValue):
The Domain value to set for cookies generated
by IAP. This value is not validated by the API,
but will be ignored at runtime if invalid.
"""
csm_settings = proto.Field(proto.MESSAGE, number=1, message="CsmSettings",)
access_denied_page_settings = proto.Field(
proto.MESSAGE, number=2, message="AccessDeniedPageSettings",
)
cookie_domain = proto.Field(
proto.MESSAGE, number=3, message=wrappers_pb2.StringValue,
)
class CsmSettings(proto.Message):
r"""Configuration for RCTokens generated for CSM workloads
protected by IAP. RCTokens are IAP generated JWTs that can be
verified at the application. The RCToken is primarily used for
ISTIO deployments, and can be scoped to a single mesh by
configuring the audience field accordingly
Attributes:
rctoken_aud (google.protobuf.wrappers_pb2.StringValue):
Audience claim set in the generated RCToken.
This value is not validated by IAP.
"""
rctoken_aud = proto.Field(
proto.MESSAGE, number=1, message=wrappers_pb2.StringValue,
)
class AccessDeniedPageSettings(proto.Message):
r"""Custom content configuration for access denied page.
IAP allows customers to define a custom URI to use as the error
page when access is denied to users. If IAP prevents access to
this page, the default IAP error page will be displayed instead.
Attributes:
access_denied_page_uri (google.protobuf.wrappers_pb2.StringValue):
The URI to be redirected to when access is
denied.
generate_troubleshooting_uri (google.protobuf.wrappers_pb2.BoolValue):
Whether to generate a troubleshooting URL on
access denied events to this application.
"""
access_denied_page_uri = proto.Field(
proto.MESSAGE, number=1, message=wrappers_pb2.StringValue,
)
generate_troubleshooting_uri = proto.Field(
proto.MESSAGE, number=2, message=wrappers_pb2.BoolValue,
)
class ListBrandsRequest(proto.Message):
r"""The request sent to ListBrands.
Attributes:
parent (str):
Required. GCP Project number/id. In the following format:
projects/{project_number/id}.
"""
parent = proto.Field(proto.STRING, number=1,)
class ListBrandsResponse(proto.Message):
r"""Response message for ListBrands.
Attributes:
brands (Sequence[google.cloud.iap_v1.types.Brand]):
Brands existing in the project.
"""
brands = proto.RepeatedField(proto.MESSAGE, number=1, message="Brand",)
class CreateBrandRequest(proto.Message):
r"""The request sent to CreateBrand.
Attributes:
parent (str):
Required. GCP Project number/id under which the brand is to
be created. In the following format:
projects/{project_number/id}.
brand (google.cloud.iap_v1.types.Brand):
Required. The brand to be created.
"""
parent = proto.Field(proto.STRING, number=1,)
brand = proto.Field(proto.MESSAGE, number=2, message="Brand",)
class GetBrandRequest(proto.Message):
r"""The request sent to GetBrand.
Attributes:
name (str):
Required. Name of the brand to be fetched. In the following
format: projects/{project_number/id}/brands/{brand}.
"""
name = proto.Field(proto.STRING, number=1,)
class ListIdentityAwareProxyClientsRequest(proto.Message):
r"""The request sent to ListIdentityAwareProxyClients.
Attributes:
parent (str):
Required. Full brand path. In the following format:
projects/{project_number/id}/brands/{brand}.
page_size (int):
The maximum number of clients to return. The
service may return fewer than this value.
If unspecified, at most 100 clients will be
returned. The maximum value is 1000; values
above 1000 will be coerced to 1000.
page_token (str):
A page token, received from a previous
``ListIdentityAwareProxyClients`` call. Provide this to
retrieve the subsequent page.
When paginating, all other parameters provided to
``ListIdentityAwareProxyClients`` must match the call that
provided the page token.
"""
parent = proto.Field(proto.STRING, number=1,)
page_size = proto.Field(proto.INT32, number=2,)
page_token = proto.Field(proto.STRING, number=3,)
class ListIdentityAwareProxyClientsResponse(proto.Message):
r"""Response message for ListIdentityAwareProxyClients.
Attributes:
identity_aware_proxy_clients (Sequence[google.cloud.iap_v1.types.IdentityAwareProxyClient]):
Clients existing in the brand.
next_page_token (str):
A token, which can be send as ``page_token`` to retrieve the
next page. If this field is omitted, there are no subsequent
pages.
"""
@property
def raw_page(self):
return self
identity_aware_proxy_clients = proto.RepeatedField(
proto.MESSAGE, number=1, message="IdentityAwareProxyClient",
)
next_page_token = proto.Field(proto.STRING, number=2,)
class CreateIdentityAwareProxyClientRequest(proto.Message):
r"""The request sent to CreateIdentityAwareProxyClient.
Attributes:
parent (str):
Required. Path to create the client in. In the following
format: projects/{project_number/id}/brands/{brand}. The
project must belong to a G Suite account.
identity_aware_proxy_client (google.cloud.iap_v1.types.IdentityAwareProxyClient):
Required. Identity Aware Proxy Client to be
created.
"""
parent = proto.Field(proto.STRING, number=1,)
identity_aware_proxy_client = proto.Field(
proto.MESSAGE, number=2, message="IdentityAwareProxyClient",
)
class GetIdentityAwareProxyClientRequest(proto.Message):
r"""The request sent to GetIdentityAwareProxyClient.
Attributes:
name (str):
Required. Name of the Identity Aware Proxy client to be
fetched. In the following format:
projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
"""
name = proto.Field(proto.STRING, number=1,)
class ResetIdentityAwareProxyClientSecretRequest(proto.Message):
r"""The request sent to ResetIdentityAwareProxyClientSecret.
Attributes:
name (str):
Required. Name of the Identity Aware Proxy client to that
will have its secret reset. In the following format:
projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
"""
name = proto.Field(proto.STRING, number=1,)
class DeleteIdentityAwareProxyClientRequest(proto.Message):
r"""The request sent to DeleteIdentityAwareProxyClient.
Attributes:
name (str):
Required. Name of the Identity Aware Proxy client to be
deleted. In the following format:
projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
"""
name = proto.Field(proto.STRING, number=1,)
class Brand(proto.Message):
r"""OAuth brand data.
NOTE: Only contains a portion of the data that describes a
brand.
Attributes:
name (str):
Output only. Identifier of the brand.
NOTE: GCP project number achieves the same brand
identification purpose as only one brand per
project can be created.
support_email (str):
Support email displayed on the OAuth consent
screen.
application_title (str):
Application name displayed on OAuth consent
screen.
org_internal_only (bool):
Output only. Whether the brand is only
intended for usage inside the G Suite
organization only.
"""
name = proto.Field(proto.STRING, number=1,)
support_email = proto.Field(proto.STRING, number=2,)
application_title = proto.Field(proto.STRING, number=3,)
org_internal_only = proto.Field(proto.BOOL, number=4,)
class IdentityAwareProxyClient(proto.Message):
r"""Contains the data that describes an Identity Aware Proxy
owned client.
Attributes:
name (str):
Output only. Unique identifier of the OAuth
client.
secret (str):
Output only. Client secret of the OAuth
client.
display_name (str):
Human-friendly name given to the OAuth
client.
"""
name = proto.Field(proto.STRING, number=1,)
secret = proto.Field(proto.STRING, number=2,)
display_name = proto.Field(proto.STRING, number=3,)
__all__ = tuple(sorted(__protobuf__.manifest))