codespace-manager
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/BCIT-LTC/daggerverse/codespace-manager@4c74069e52c4cf17fbc380fb3a228f6c227dba10
Entrypoint
Return Type
CodespaceManager !
Example
dagger -m github.com/BCIT-LTC/daggerverse/codespace-manager@4c74069e52c4cf17fbc380fb3a228f6c227dba10 call \
func (m *MyModule) Example() *dagger.CodespaceManager {
return dag.
CodespaceManager()
}
@function
def example() -> dagger.CodespaceManager:
return (
dag.codespace_manager()
)
@func()
example(): CodespaceManager {
return dag
.codespaceManager()
}
Types
CodespaceManager 🔗
createCodespaceByPullRequest() 🔗
Create a Codespace from a pull request. Check if the Codespace already exists, and if not, create a new one. Assumes there can only be one Codespace per pull request.
Return Type
Void !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory | - | Source directory |
token | Secret ! | - | Token for Codespace creation |
organization | String ! | - | Organization Name |
repoName | String ! | - | Repository Name |
branchName | String ! | - | Branch Name |
pullRequestNumber | Integer ! | - | Pull Request Number |
Example
dagger -m github.com/BCIT-LTC/daggerverse/codespace-manager@4c74069e52c4cf17fbc380fb3a228f6c227dba10 call \
create-codespace-by-pull-request --token env:MYSECRET --organization string --repo-name string --branch-name string --pull-request-number integer
func (m *MyModule) Example(ctx context.Context, token *dagger.Secret, organization string, repoName string, branchName string, pullRequestNumber int) {
return dag.
CodespaceManager().
CreateCodespaceByPullRequest(ctxtoken, organization, repoName, branchName, pullRequestNumber)
}
@function
async def example(token: dagger.Secret, organization: str, repo_name: str, branch_name: str, pull_request_number: int) -> None:
return await (
dag.codespace_manager()
.create_codespace_by_pull_request(token, organization, repo_name, branch_name, pull_request_number)
)
@func()
async example(token: Secret, organization: string, repoName: string, branchName: string, pullRequestNumber: number): Promise<void> {
return dag
.codespaceManager()
.createCodespaceByPullRequest(token, organization, repoName, branchName, pullRequestNumber)
}
deleteCodespaceByPullRequest() 🔗
Delete a Codespace when a pull request is closed.
Return Type
Void !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory | - | Source directory |
token | Secret ! | - | Token for Codespace creation |
organization | String ! | - | Organization Name |
repoName | String ! | - | Repository Name |
branchName | String ! | - | Branch Name |
pullRequestNumber | Integer ! | - | Pull Request Number |
Example
dagger -m github.com/BCIT-LTC/daggerverse/codespace-manager@4c74069e52c4cf17fbc380fb3a228f6c227dba10 call \
delete-codespace-by-pull-request --token env:MYSECRET --organization string --repo-name string --branch-name string --pull-request-number integer
func (m *MyModule) Example(ctx context.Context, token *dagger.Secret, organization string, repoName string, branchName string, pullRequestNumber int) {
return dag.
CodespaceManager().
DeleteCodespaceByPullRequest(ctxtoken, organization, repoName, branchName, pullRequestNumber)
}
@function
async def example(token: dagger.Secret, organization: str, repo_name: str, branch_name: str, pull_request_number: int) -> None:
return await (
dag.codespace_manager()
.delete_codespace_by_pull_request(token, organization, repo_name, branch_name, pull_request_number)
)
@func()
async example(token: Secret, organization: string, repoName: string, branchName: string, pullRequestNumber: number): Promise<void> {
return dag
.codespaceManager()
.deleteCodespaceByPullRequest(token, organization, repoName, branchName, pullRequestNumber)
}