Skip to content

Commit 46a90f6

Browse files
committed
Implement todos
1 parent a806116 commit 46a90f6

File tree

4 files changed

+8
-52
lines changed

4 files changed

+8
-52
lines changed

plugins/localstack/api_key.go

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package localstack
22

33
import (
4-
"context"
5-
64
"github.com/1Password/shell-plugins/sdk"
75
"github.com/1Password/shell-plugins/sdk/importer"
86
"github.com/1Password/shell-plugins/sdk/provision"
@@ -14,8 +12,8 @@ import (
1412
func APIKey() schema.CredentialType {
1513
return schema.CredentialType{
1614
Name: credname.APIKey,
17-
DocsURL: sdk.URL("https://localstack.com/docs/api_key"), // TODO: Replace with actual URL
18-
ManagementURL: sdk.URL("https://console.localstack.com/user/security/tokens"), // TODO: Replace with actual URL
15+
DocsURL: sdk.URL("https://docs.localstack.cloud/getting-started/api-key/"),
16+
ManagementURL: sdk.URL("https://app.localstack.cloud/account/apikeys"),
1917
Fields: []schema.CredentialField{
2018
{
2119
Name: fieldname.APIKey,
@@ -34,37 +32,9 @@ func APIKey() schema.CredentialType {
3432
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
3533
Importer: importer.TryAll(
3634
importer.TryEnvVarPair(defaultEnvVarMapping),
37-
TryLocalStackConfigFile(),
3835
)}
3936
}
4037

4138
var defaultEnvVarMapping = map[string]sdk.FieldName{
42-
"LOCALSTACK_API_KEY": fieldname.APIKey, // TODO: Check if this is correct
43-
}
44-
45-
// TODO: Check if the platform stores the API Key in a local config file, and if so,
46-
// implement the function below to add support for importing it.
47-
func TryLocalStackConfigFile() sdk.Importer {
48-
return importer.TryFile("~/path/to/config/file.yml", func(ctx context.Context, contents importer.FileContents, in sdk.ImportInput, out *sdk.ImportAttempt) {
49-
// var config Config
50-
// if err := contents.ToYAML(&config); err != nil {
51-
// out.AddError(err)
52-
// return
53-
// }
54-
55-
// if config.APIKey == "" {
56-
// return
57-
// }
58-
59-
// out.AddCandidate(sdk.ImportCandidate{
60-
// Fields: map[sdk.FieldName]string{
61-
// fieldname.APIKey: config.APIKey,
62-
// },
63-
// })
64-
})
39+
"LOCALSTACK_API_KEY": fieldname.APIKey,
6540
}
66-
67-
// TODO: Implement the config file schema
68-
// type Config struct {
69-
// APIKey string
70-
// }

plugins/localstack/api_key_test.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
func TestAPIKeyProvisioner(t *testing.T) {
1212
plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{
1313
"default": {
14-
ItemFields: map[sdk.FieldName]string{ // TODO: Check if this is correct
14+
ItemFields: map[sdk.FieldName]string{
1515
fieldname.APIKey: "SzCEXAMPLE",
1616
},
1717
ExpectedOutput: sdk.ProvisionOutput{
@@ -26,7 +26,7 @@ func TestAPIKeyProvisioner(t *testing.T) {
2626
func TestAPIKeyImporter(t *testing.T) {
2727
plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{
2828
"environment": {
29-
Environment: map[string]string{ // TODO: Check if this is correct
29+
Environment: map[string]string{
3030
"LOCALSTACK_API_KEY": "SzCEXAMPLE",
3131
},
3232
ExpectedCandidates: []sdk.ImportCandidate{
@@ -37,19 +37,5 @@ func TestAPIKeyImporter(t *testing.T) {
3737
},
3838
},
3939
},
40-
// TODO: If you implemented a config file importer, add a test file example in localstack/test-fixtures
41-
// and fill the necessary details in the test template below.
42-
"config file": {
43-
Files: map[string]string{
44-
// "~/path/to/config.yml": plugintest.LoadFixture(t, "config.yml"),
45-
},
46-
ExpectedCandidates: []sdk.ImportCandidate{
47-
// {
48-
// Fields: map[sdk.FieldName]string{
49-
// fieldname.Token: "SzCEXAMPLE",
50-
// },
51-
// },
52-
},
53-
},
5440
})
5541
}

plugins/localstack/localstack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
func LocalStackCLI() schema.Executable {
1111
return schema.Executable{
12-
Name: "LocalStack CLI", // TODO: Check if this is correct
12+
Name: "LocalStack CLI",
1313
Runs: []string{"localstack"},
14-
DocsURL: sdk.URL("https://localstack.com/docs/cli"), // TODO: Replace with actual URL
14+
DocsURL: sdk.URL("https://docs.localstack.cloud/getting-started/installation/#localstack-cli"),
1515
NeedsAuth: needsauth.IfAll(
1616
needsauth.NotForHelpOrVersion(),
1717
needsauth.NotWithoutArgs(),

plugins/localstack/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func New() schema.Plugin {
1010
Name: "localstack",
1111
Platform: schema.PlatformInfo{
1212
Name: "LocalStack",
13-
Homepage: sdk.URL("https://localstack.com"), // TODO: Check if this is correct
13+
Homepage: sdk.URL("https://localstack.cloud"),
1414
},
1515
Credentials: []schema.CredentialType{
1616
APIKey(),

0 commit comments

Comments
 (0)