Concept | AWS | Azure | GCP |
---|---|---|---|
Hierarchical Grouping | AWS Organizations | Azure Management Groups | GCP Resource Hierarchy |
Root Level | Root (Master Account) | Root Management Group | Organization |
Tenant Concept | Not Applicable | Azure Active Directory (Azure AD) Tenant | Not Applicable |
Grouping Levels | Organizational Units (OUs) | Management Groups | Folders |
Lowest Level | AWS Accounts (Member Accounts) | Subscriptions | Projects |
Policies | Service Control Policies (SCPs) | Azure Policies | Organization Policies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combined_pattern = re.compile(r''' | |
# Image reference | |
^\s* # Start of line, followed by optional whitespace | |
\[image:\s+ # Literal '[image:', followed by at least one whitespace character | |
([^\]]+?) # Capture group 1: Image name - one or more characters that are not ']', non-greedy | |
\s* # Optional whitespace | |
(?: # Start of non-capturing group for optional width | |
(\d+) # Capture group 2: One or more digits for width | |
% # Literal '%' character | |
\s* # Optional whitespace |
Storage Type | AWS | Azure | GCP |
---|---|---|---|
Object Storage | S3 (Simple Storage Service) | Blob Storage (part of Storage Account) | Cloud Storage |
File Storage | EFS (Elastic File System) | File Storage (part of Storage Account) | Filestore |
Block Storage | EBS (Elastic Block Store) | Managed Disks | Persistent Disk |
Queue Storage | SQS (Simple Queue Service) | Queue Storage (part of Storage Account) | Cloud Pub/Sub |
example 1
with data as (
select
suppress_and_count_repeats (
'pipes',
'pipes_organization_member',
'org_handle',
'user_handle, user_id, status',
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION suppress_and_count_repeats( | |
schema_name TEXT, -- Schema name of the target table | |
table_name TEXT, -- Name of the target table | |
partition_by_column TEXT, -- Column to partition by | |
order_by_columns TEXT, -- Columns to order by | |
additional_column_names TEXT[] -- Array of additional column names | |
) RETURNS SETOF JSON AS $$ | |
DECLARE | |
generated_query TEXT; -- Variable to store the generated SQL query | |
additional_selects TEXT; -- Variable to store the dynamically constructed additional select statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH cte AS ( | |
SELECT | |
org_handle, | |
user_handle, | |
status, | |
ROW_NUMBER() OVER (PARTITION BY org_handle ORDER BY user_handle) AS rn, | |
DENSE_RANK() OVER (ORDER BY org_handle) AS org_rank | |
FROM | |
pipes_organization_member | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
import base64 | |
import os | |
from openai import OpenAI | |
# OpenAI API key | |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY") | |
client = OpenAI(api_key=OPENAI_API_KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
import json | |
import os | |
from openai import OpenAI | |
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) | |
# Mock function to simulate fetching weather data from an API | |
def get_weather(location): | |
# In a real scenario, replace this with an actual API call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func listDevices(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { | |
var visitor ListPredicate = func(client *kolide.Client, cursor string, limit int32, searches ...kolide.Search) (interface{}, error) { | |
return client.GetDevices(cursor, limit, searches...) | |
} | |
return listAnything(ctx, d, h, "kolide_device.listDevices", visitor, "Devices") | |
} | |
func listAdminUsers(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func listAnything(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData, callee string, visitor ListPredicate, target string) (interface{}, error) { | |
// Create a slice to hold search queries | |
searches, err := query(ctx, d) | |
if err != nil { | |
plugin.Logger(ctx).Error(callee, "qualifier_operator_error", err) | |
return nil, err | |
} | |
// Establish connection to Kolide client | |
client, err := connect(ctx, d) |
NewerOlder