קיבוץ נכסים לפי סטטוס

הדגמה של קיבוץ נכסים לפי שינוי סטטוס

דוגמת קוד

Python

כדי לבצע אימות ב-Security Command Center, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

from datetime import timedelta

from google.cloud import securitycenter

client = securitycenter.SecurityCenterClient()

duration = timedelta(days=5)

# 'parent' must be in one of the following formats:
#   "organizations/{organization_id}"
#   "projects/{project_id}"
#   "folders/{folder_id}"
parent = f"organizations/{organization_id}"
result_iterator = client.group_assets(
    request={
        "parent": parent,
        "group_by": "state_change",
        "compare_duration": duration,
    }
)
for i, result in enumerate(result_iterator):
    print((i + 1), result)

המאמרים הבאים

כדי לחפש ולסנן דוגמאות קוד למוצרים אחרים של Google Cloud , אפשר להיעזר בGoogle Cloud דפדפן לדוגמה.