forked from windmill-labs/windmill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3e7053
commit d354746
Showing
8 changed files
with
19,512 additions
and
53 deletions.
There are no files selected for viewing
Empty file.
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
windmill_api/ | ||
api/ |
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
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
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
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 |
---|---|---|
@@ -1,9 +1,51 @@ | ||
package windmill | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
api "github.com/windmill-labs/windmill-go-client/api" | ||
) | ||
|
||
func hello_world() { | ||
fmt.Println("Windmill") | ||
} | ||
|
||
type ClientWithWorkspace struct { | ||
Client *api.ClientWithResponses | ||
Workspace string | ||
} | ||
|
||
func GetClient() (ClientWithWorkspace, error) { | ||
base_url := os.Getenv("BASE_INTERNAL_URL") | ||
workspace := os.Getenv("WM_WORKSPACE") | ||
client, _ := api.NewClientWithResponses(base_url) | ||
return ClientWithWorkspace{ | ||
Client: client, | ||
Workspace: workspace, | ||
}, nil | ||
} | ||
func newBool(b bool) *bool { | ||
return &b | ||
} | ||
|
||
func GetVariable(path string) string { | ||
client, err := GetClient() | ||
if err != nil { | ||
panic(err) | ||
} | ||
res, _ := client.Client.GetVariableWithResponse(context.Background(), client.Workspace, path, &api.GetVariableParams{ | ||
DecryptSecret: newBool(true), | ||
}) | ||
return *res.JSON200.Value | ||
} | ||
|
||
func GetResource(path string) map[string]interface{} { | ||
client, err := GetClient() | ||
if err != nil { | ||
panic(err) | ||
} | ||
res, _ := client.Client.GetResourceWithResponse(context.Background(), client.Workspace, path) | ||
return *res.JSON200.Value | ||
} |
Oops, something went wrong.