gcp-platforms-auto 0.7.6__tar.gz → 0.7.8__tar.gz
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.
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/PKG-INFO +2 -1
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto/iam.py +3 -3
- gcp_platforms_auto-0.7.8/gcp_platforms_auto/models.py +35 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/PKG-INFO +2 -1
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/SOURCES.txt +1 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/requires.txt +1 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/pyproject.toml +3 -2
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/README.md +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto/__init__.py +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto/db.py +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto/git.py +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/dependency_links.txt +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/top_level.txt +0 -0
- {gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gcp_platforms_auto
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.8
|
|
4
4
|
Summary: A brief description of your package
|
|
5
5
|
Author-email: ofir4858 <ofirshasha10@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -17,5 +17,6 @@ Requires-Dist: google-cloud-resource-manager
|
|
|
17
17
|
Requires-Dist: gitpython
|
|
18
18
|
Requires-Dist: sqlalchemy
|
|
19
19
|
Requires-Dist: pg8000
|
|
20
|
+
Requires-Dist: pydantic
|
|
20
21
|
|
|
21
22
|
# gcp_sdk
|
|
@@ -53,10 +53,10 @@ def check_user_has_role_in_project(
|
|
|
53
53
|
bool: True if the user/service account has the role in the project, False otherwise
|
|
54
54
|
|
|
55
55
|
Example:
|
|
56
|
-
>>> has_access =
|
|
56
|
+
>>> has_access = check_user_has_role_in_project(
|
|
57
57
|
... user_email='oshasha10@dev.sky320.com',
|
|
58
58
|
... role='roles/owner',
|
|
59
|
-
... project_id='sky-starfi-mam-res-gcpro-1'
|
|
59
|
+
... project_id='sky-starfi-mam-res-gcpro-1',
|
|
60
60
|
... )
|
|
61
61
|
"""
|
|
62
62
|
client = asset_v1.AssetServiceClient()
|
|
@@ -195,7 +195,7 @@ def get_projects_with_role(
|
|
|
195
195
|
|
|
196
196
|
for project_id in all_projects:
|
|
197
197
|
# Check if user has the role in this project
|
|
198
|
-
if
|
|
198
|
+
if check_user_has_role_in_project(
|
|
199
199
|
project_id=project_id,
|
|
200
200
|
user_email=user_email,
|
|
201
201
|
organization_id=organization_id,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pydantic import (
|
|
3
|
+
BaseModel,
|
|
4
|
+
ValueError,
|
|
5
|
+
field_validator,
|
|
6
|
+
)
|
|
7
|
+
from google.cloud import logging as cloud_logging
|
|
8
|
+
import re
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Set up Google Cloud Logging
|
|
12
|
+
gcp_client = cloud_logging.Client()
|
|
13
|
+
gcp_client.setup_logging()
|
|
14
|
+
|
|
15
|
+
# Configure the logger
|
|
16
|
+
logger = logging.getLogger("uvicorn")
|
|
17
|
+
logger.setLevel(logging.INFO)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RequesterModel(BaseModel):
|
|
21
|
+
email: str
|
|
22
|
+
|
|
23
|
+
@field_validator("email")
|
|
24
|
+
@classmethod
|
|
25
|
+
def validate_email(cls, v: str) -> str:
|
|
26
|
+
logger.info("validating requester email")
|
|
27
|
+
|
|
28
|
+
# Basic email validation
|
|
29
|
+
email_pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
|
|
30
|
+
if not re.match(email_pattern, v):
|
|
31
|
+
logger.error("invalid email format")
|
|
32
|
+
raise ValueError("invalid email format")
|
|
33
|
+
|
|
34
|
+
logger.info(f"validated requester email: {v}")
|
|
35
|
+
return v
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gcp_platforms_auto
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.8
|
|
4
4
|
Summary: A brief description of your package
|
|
5
5
|
Author-email: ofir4858 <ofirshasha10@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -17,5 +17,6 @@ Requires-Dist: google-cloud-resource-manager
|
|
|
17
17
|
Requires-Dist: gitpython
|
|
18
18
|
Requires-Dist: sqlalchemy
|
|
19
19
|
Requires-Dist: pg8000
|
|
20
|
+
Requires-Dist: pydantic
|
|
20
21
|
|
|
21
22
|
# gcp_sdk
|
{gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/SOURCES.txt
RENAMED
|
@@ -4,6 +4,7 @@ gcp_platforms_auto/__init__.py
|
|
|
4
4
|
gcp_platforms_auto/db.py
|
|
5
5
|
gcp_platforms_auto/git.py
|
|
6
6
|
gcp_platforms_auto/iam.py
|
|
7
|
+
gcp_platforms_auto/models.py
|
|
7
8
|
gcp_platforms_auto.egg-info/PKG-INFO
|
|
8
9
|
gcp_platforms_auto.egg-info/SOURCES.txt
|
|
9
10
|
gcp_platforms_auto.egg-info/dependency_links.txt
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "gcp_platforms_auto"
|
|
7
|
-
version = "0.7.
|
|
7
|
+
version = "0.7.8"
|
|
8
8
|
description = "A brief description of your package"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -19,7 +19,8 @@ dependencies = [
|
|
|
19
19
|
"google-cloud-resource-manager",
|
|
20
20
|
"gitpython",
|
|
21
21
|
"sqlalchemy",
|
|
22
|
-
"pg8000"
|
|
22
|
+
"pg8000",
|
|
23
|
+
"pydantic"
|
|
23
24
|
]
|
|
24
25
|
classifiers = [
|
|
25
26
|
"Programming Language :: Python :: 3",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gcp_platforms_auto-0.7.6 → gcp_platforms_auto-0.7.8}/gcp_platforms_auto.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|