-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
add_pipes_org_workspace_invite_members
mod (#30)
- Loading branch information
1 parent
985e82d
commit 18170c1
Showing
6 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Invite members to join organization by email, create pipes workspace, add members to workspace | ||
|
||
- Send email invitation to users to join as member in the organization. | ||
- Create workspace in the organization and add members with role in the workspace. | ||
|
||
## Usage | ||
|
||
- Add following required credentials to `flowpipe.pvars` | ||
|
||
- Pipes API token to access the services. Find more info to generate access token [here].(https://turbot.com/pipes/docs/da-settings#tokens) | ||
|
||
- Start your Flowpipe server | ||
- Send email invitation to users to join as member in the organization. e.g. | ||
|
||
``` | ||
flowpipe pipeline run invite_org_members_by_email --arg org_handle="<YourOrgName>" --arg member_email='["member1@gmail.com", "member1@gmail.com"]' | ||
``` | ||
|
||
- Create workspace in the organization and add members with role in the workspace. | ||
|
||
``` | ||
flowpipe pipeline run add_pipes_org_workspace_and_members --arg org_handle="<YourOrgName>" --arg workspace_handle="<WorkspaceName>" | ||
``` |
72 changes: 72 additions & 0 deletions
72
add_pipes_org_workspace_invite_members/add_pipes_org_workspace_and_members.fp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
pipeline "add_pipes_org_workspace_and_members" { | ||
title = "Add Pipes Workspace Organization and Add Members" | ||
description = "Add workspce to the organization and add organization members to the workspace." | ||
|
||
param "token" { | ||
type = string | ||
description = "API access token." | ||
default = var.token | ||
} | ||
|
||
param "org_handle" { | ||
type = string | ||
description = "The handle of the organization where the workspace has to be created." | ||
} | ||
|
||
param "workspace_handle" { | ||
type = string | ||
description = "The handle name of the workspace to be created." | ||
} | ||
|
||
param "instance_type" { | ||
type = string | ||
description = "The type of the instance to be created." | ||
default = "db1.shared" | ||
} | ||
|
||
param "member_handles" { | ||
type = list(string) | ||
description = "Orgnization member handles to be invited to join workspace." | ||
# ["rk-fbuq", "rkm2023"] | ||
} | ||
|
||
param "role" { | ||
type = string | ||
description = "The workspace role name assigned to the member. It supports reader, operator and owner as role." | ||
default = "reader" | ||
} | ||
|
||
step "pipeline" "add_pipes_org_workspace" { | ||
pipeline = pipes.pipeline.create_org_workspace | ||
args = { | ||
token = param.token | ||
org_handle = param.org_handle | ||
workspace_handle = param.workspace_handle | ||
instance_type = param.instance_type | ||
} | ||
} | ||
|
||
step "pipeline" "add_workspace_member" { | ||
depends_on = [step.pipeline.add_pipes_org_workspace] | ||
for_each = { for handle in param.member_handles : handle => handle } | ||
pipeline = pipes.pipeline.add_org_workspace_member | ||
args = { | ||
token = param.token | ||
org_handle = param.org_handle | ||
workspace_handle = param.workspace_handle | ||
role = param.role | ||
member_handle = each.value | ||
} | ||
} | ||
|
||
output "workspace" { | ||
description = "Workspace details." | ||
value = step.pipeline.add_pipes_org_workspace | ||
} | ||
|
||
output "member" { | ||
description = "Member information." | ||
value = step.pipeline.add_workspace_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
token = "tpt_tokenxxxxx" |
45 changes: 45 additions & 0 deletions
45
add_pipes_org_workspace_invite_members/invite_org_members_by_email.fp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
pipeline "invite_org_members_by_email" { | ||
title = "Invite Members to Organization" | ||
description = "Add members by email invite to the organization in pipe." | ||
|
||
param "token" { | ||
type = string | ||
description = "API access token." | ||
default = var.token | ||
} | ||
|
||
param "org_handle" { | ||
type = string | ||
description = "The handle of the organization where the workspace has to be created." | ||
} | ||
|
||
param "member_email" { | ||
type = list(string) | ||
description = "Email-ids of members to be invited to join organization." | ||
# Example ["test1@gmail.com", "test2@gmail.com"] | ||
} | ||
|
||
param "role" { | ||
type = string | ||
description = "The role assigned to the member." | ||
default = "member" | ||
} | ||
|
||
step "pipeline" "invite_org_members_by_email" { | ||
for_each = { for email in param.member_email : email => email } | ||
pipeline = pipes.pipeline.invite_org_member_by_email | ||
args = { | ||
token = param.token | ||
org_handle = param.org_handle | ||
role = param.role | ||
email = each.value | ||
} | ||
} | ||
|
||
output "invitation_details" { | ||
description = "Invitation details." | ||
value = step.pipeline.invite_org_members_by_email | ||
} | ||
|
||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod "add_pipes_org_workspace_invite_members" { | ||
title = "Add Pipes Organization to Invite Members" | ||
description = "Add organization in pipe and invite members to join by email." | ||
|
||
require { | ||
mod "github.com/turbot/flowpipe-mod-pipes" { | ||
version = "v0.0.1-rc.3" | ||
args = { | ||
token = var.token | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
variable "token" { | ||
type = string | ||
description = "API access token" | ||
# TODO: Add once supported | ||
# sensitive = true | ||
} |