Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Large overhaul adding a more complete view of all the different entities in Pulumi Cloud #185

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6aa29db
Split streams into orgs/stacks
sicarul Aug 12, 2024
9b0dba4
Merge pull request #1 from pulumi/branch-pablo
sicarul Aug 12, 2024
3a0f156
Add stack details and resources
sicarul Aug 12, 2024
4688cae
Merge pull request #2 from pulumi/update-stacks
sicarul Aug 12, 2024
62350d8
Add stack policy groups and policy packs
sicarul Aug 12, 2024
8e7b490
Merge pull request #3 from pulumi/add-stack-policies
sicarul Aug 12, 2024
d402558
add policy group streams
lucascrespo88 Aug 12, 2024
c798a46
rename policy group streams to remove organization prefix
lucascrespo88 Aug 12, 2024
d36ced2
Merge pull request #4 from pulumi/add_policy_pack_streams
lucascrespo88 Aug 12, 2024
3903044
Add stack previews and change updates to service format
sicarul Aug 13, 2024
9033232
add policy pack and enviroment streams
lucascrespo88 Aug 13, 2024
5db6bfe
Merge pull request #5 from pulumi/add-stack-updates-previews
sicarul Aug 13, 2024
2116f7b
fix environments description
lucascrespo88 Aug 13, 2024
08a1387
Merge pull request #6 from pulumi/add_policy_pack_streams
lucascrespo88 Aug 13, 2024
6fc7770
Add deployments and set default items per page to 100
sicarul Aug 13, 2024
82c19a8
Merge pull request #7 from pulumi/add-deployments
sicarul Aug 13, 2024
1a729f7
Add team details
sicarul Aug 13, 2024
a542b2b
Add team access tokens
sicarul Aug 13, 2024
e3d53dd
Merge pull request #8 from pulumi/add-team-details
sicarul Aug 13, 2024
815e406
Add webhooks
sicarul Aug 13, 2024
16feaff
added org name to envs and OIDC Issuers and RUM usage streams added
lucascrespo88 Aug 13, 2024
8147b48
fix commenting
lucascrespo88 Aug 13, 2024
91f5a68
fix space
lucascrespo88 Aug 13, 2024
c078a14
Merge pull request #9 from pulumi/add-webhooks
sicarul Aug 13, 2024
71409e1
Merge branch 'main' into add_issuers_streams
lucascrespo88 Aug 13, 2024
1252510
Merge pull request #10 from pulumi/add_issuers_streams
lucascrespo88 Aug 13, 2024
2407fd1
Add audit logs
sicarul Aug 13, 2024
e7a213e
Agent Pool Stream Added
lucascrespo88 Aug 13, 2024
6cd0126
Merge pull request #11 from pulumi/add-audit-logs
sicarul Aug 13, 2024
60a95e0
Merge pull request #12 from pulumi/add_agent_pool_stream
lucascrespo88 Aug 13, 2024
924c78b
Integrity fixes needed to target-duckdb to work
sicarul Aug 13, 2024
a5dad6a
Merge pull request #13 from pulumi/fixes-for-integrity
sicarul Aug 13, 2024
e02ca2d
Handle 504 gateway timeout error for stack previews endpoint
sicarul Aug 13, 2024
9b5c86e
Merge pull request #14 from pulumi/handle-504-on-stack-previews
sicarul Aug 13, 2024
7b61b21
add Stack Schedules and Stack Schedules deployment history Streams
lucascrespo88 Aug 14, 2024
e3e6627
Merge pull request #15 from pulumi/add_schedule_streams
lucascrespo88 Aug 14, 2024
b3d7845
Merge branch 'main' into main
sicarul Aug 14, 2024
4a003e8
Fix linting
sicarul Aug 14, 2024
e12f1c0
Merge pull request #16 from pulumi/fix-linting
sicarul Aug 14, 2024
4c3bbc4
Start date is now required
sicarul Aug 14, 2024
afa2a83
Let tests run
edgarrmondragon Aug 14, 2024
f5d43f7
Merge pull request #17 from MeltanoLabs/pr-185-suggestions
sicarul Aug 15, 2024
857d88a
fix resource hours field name
lucascrespo88 Aug 15, 2024
3109ef0
Merge pull request #19 from pulumi/fix_resource_hours_field
sicarul Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add team details
  • Loading branch information
sicarul committed Aug 13, 2024
commit 1a729f7b93d86702daf0c4aee568aa12884a5e82
182 changes: 182 additions & 0 deletions tap_pulumi_cloud/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,185 @@ class OrganizationTeams(_OrgPartitionedStream):
th.StringType,
),
).to_dict()


def get_child_context(
self,
record: dict,
context: dict | None, # noqa: ARG002
) -> dict | None:
"""Return a context object for child streams.

Args:
record: A record from this stream.
context: The stream sync context.

Returns:
A context object for child streams.
"""
return {
"org_name": record["org_name"],
"team_name": record["name"]
}


class OrganizationTeamsMembers(_OrgPartitionedStream):
"""Organization team members stream."""

name = "organization_team_members"
path = "/api/orgs/{org_name}/teams/{team_name}"
primary_keys = ["org_name", "team_name"]
records_jsonpath = "$.members[*]"

parent_stream_type = OrganizationTeams

schema = th.PropertiesList(
th.Property(
"org_name",
th.StringType,
description="The name of the organization that owns the team.",
),
th.Property(
"team_name",
th.StringType,
description="The name of the team.",
),
th.Property(
"role",
th.StringType,
description="The role of the user in the team.",
),
th.Property(
"name",
th.StringType,
description="The name of the user.",
),
th.Property(
"github_login",
th.StringType,
description="The GitHub login of the user.",
),
th.Property(
"avatar_url",
th.StringType,
description="The URL of the user's avatar.",
),
).to_dict()

class OrganizationTeamsStacks(_OrgPartitionedStream):
"""Organization team stacks stream."""

name = "organization_team_stacks"
path = "/api/orgs/{org_name}/teams/{team_name}"
primary_keys = ["org_name", "team_name"]
records_jsonpath = "$.stacks[*]"

parent_stream_type = OrganizationTeams

schema = th.PropertiesList(
th.Property(
"org_name",
th.StringType,
description="The name of the organization that owns the team.",
),
th.Property(
"team_name",
th.StringType,
description="The name of the team.",
),
th.Property(
"project_name",
th.StringType,
description="The name of the project.",
),
th.Property(
"stack_name",
th.StringType,
description="The name of the stack.",
),
th.Property(
"permissions",
th.IntegerType,
description="Permissions for the stack: None = 0, Read = 101, Write = 102, Admin = 103.",
),
).to_dict()

class OrganizationTeamsEnvironments(_OrgPartitionedStream):
"""Organization team environments stream."""

name = "organization_team_environments"
path = "/api/orgs/{org_name}/teams/{team_name}"
primary_keys = ["org_name", "team_name"]
records_jsonpath = "$.environments[*]"

parent_stream_type = OrganizationTeams

schema = th.PropertiesList(
th.Property(
"org_name",
th.StringType,
description="The name of the organization that owns the team.",
),
th.Property(
"team_name",
th.StringType,
description="The name of the team.",
),
th.Property(
"project_name",
th.StringType,
description="The name of the project.",
),
th.Property(
"env_name",
th.StringType,
description="The name of the environment.",
),
th.Property(
"permission",
th.StringType,
description="Permissions for the environment.",
),
).to_dict()

class OrganizationAccessTokens(_OrgPartitionedStream):
"""Organization access tokens stream."""

name = "organization_access_tokens"
path = "/api/orgs/{org_name}/tokens"
primary_keys = ["org_name", "id"]
records_jsonpath = "$.tokens[*]"

schema = th.PropertiesList(
th.Property(
"org_name",
th.StringType,
description="The name of the organization that owns the token.",
),
th.Property(
"id",
th.StringType,
description="The ID of the token.",
),
th.Property(
"description",
th.StringType,
description="The description of the token.",
),
th.Property(
"expires",
th.IntegerType,
description="The expiration time of the token.",
),
th.Property(
"last_used",
th.IntegerType,
description="The time the token was last used.",
),
th.Property(
"name",
th.StringType,
description="The name of the token"
),
).to_dict()

4 changes: 4 additions & 0 deletions tap_pulumi_cloud/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def discover_streams(self) -> list[Stream]:
stacks.StackDeployments(tap=self),
organizations.OrganizationMembers(tap=self),
organizations.OrganizationTeams(tap=self),
organizations.OrganizationAccessTokens(tap=self),
organizations.OrganizationTeamsMembers(tap=self),
organizations.OrganizationTeamsStacks(tap=self),
organizations.OrganizationTeamsEnvironments(tap=self),
policies.PolicyGroupsList(tap=self),
policies.PolicyGroups(tap=self),
policies.PolicyPacks(tap=self),
Expand Down