Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions plugins/doppler/doppler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package doppler

import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/needsauth"
"github.com/1Password/shell-plugins/sdk/schema"
"github.com/1Password/shell-plugins/sdk/schema/credname"
)

func DopplerCLI() schema.Executable {
return schema.Executable{
Name: "Doppler CLI",
Runs: []string{"doppler"},
DocsURL: sdk.URL("https://docs.doppler.com/docs/cli"),
NeedsAuth: needsauth.IfAll(
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
),
Uses: []schema.CredentialUsage{
{
Name: credname.PersonalAccessToken,
},
},
}
}
22 changes: 22 additions & 0 deletions plugins/doppler/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package doppler

import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/schema"
)

func New() schema.Plugin {
return schema.Plugin{
Name: "doppler",
Platform: schema.PlatformInfo{
Name: "Doppler",
Homepage: sdk.URL("https://doppler.com"),
},
Credentials: []schema.CredentialType{
ServiceToken(),
},
Executables: []schema.Executable{
DopplerCLI(),
},
}
}
42 changes: 42 additions & 0 deletions plugins/doppler/service_token.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package doppler

import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/importer"
"github.com/1Password/shell-plugins/sdk/provision"
"github.com/1Password/shell-plugins/sdk/schema"
"github.com/1Password/shell-plugins/sdk/schema/credname"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)

func ServiceToken() schema.CredentialType {
return schema.CredentialType{
Name: credname.PersonalAccessToken,
DocsURL: sdk.URL("https://docs.doppler.com/docs/cli"),
ManagementURL: sdk.URL("https://dashboard.doppler.com/workplace/<workplace-id>/tokens/personal"),
Fields: []schema.CredentialField{
{
Name: fieldname.Token,
MarkdownDescription: "Personal Token used to authenticate to Doppler.",
Secret: true,
Composition: &schema.ValueComposition{
Prefix: "dp.pt.",
Charset: schema.Charset{
Uppercase: true,
Lowercase: true,
Digits: true,
},
},
},
},
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryAll(
importer.TryEnvVarPair(defaultEnvVarMapping),
importer.TryAllEnvVars(fieldname.Token, "DOPPLER_TOKEN"),
),
}
}

var defaultEnvVarMapping = map[string]sdk.FieldName{
"DOPPLER_TOKEN": fieldname.Token,
}
46 changes: 46 additions & 0 deletions plugins/doppler/service_token_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package doppler

import (
"testing"

"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/plugintest"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)

func TestServiceTokenImporter(t *testing.T) {
plugintest.TestImporter(t, ServiceToken().Importer, map[string]plugintest.ImportCase{
"DOPPLER_TOKEN environment variable": {
Environment: map[string]string{
"DOPPLER_TOKEN": "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE",
},
ExpectedCandidates: []sdk.ImportCandidate{
{
Fields: map[sdk.FieldName]string{
fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE",
},
},
{
Fields: map[sdk.FieldName]string{
fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE",
},
},
},
},
})
}

func TestServiceTokenProvisioner(t *testing.T) {
plugintest.TestProvisioner(t, ServiceToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{
"default": {
ItemFields: map[sdk.FieldName]string{
fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE",
},
ExpectedOutput: sdk.ProvisionOutput{
Environment: map[string]string{
"DOPPLER_TOKEN": "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE",
},
},
},
})
}
133 changes: 133 additions & 0 deletions plugins/plugins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package plugins

// This file gets auto-generated by the "make registry" command, so should not be edited by hand.

import (
"github.com/1Password/shell-plugins/plugins/akamai"
"github.com/1Password/shell-plugins/plugins/argocd"
"github.com/1Password/shell-plugins/plugins/atlas"
"github.com/1Password/shell-plugins/plugins/aws"
"github.com/1Password/shell-plugins/plugins/axiom"
"github.com/1Password/shell-plugins/plugins/binance"
"github.com/1Password/shell-plugins/plugins/cachix"
"github.com/1Password/shell-plugins/plugins/cargo"
"github.com/1Password/shell-plugins/plugins/circleci"
"github.com/1Password/shell-plugins/plugins/civo"
"github.com/1Password/shell-plugins/plugins/confluent"
"github.com/1Password/shell-plugins/plugins/crowdin"
"github.com/1Password/shell-plugins/plugins/databricks"
"github.com/1Password/shell-plugins/plugins/datadog"
"github.com/1Password/shell-plugins/plugins/digitalocean"
"github.com/1Password/shell-plugins/plugins/doppler"
"github.com/1Password/shell-plugins/plugins/fastly"
"github.com/1Password/shell-plugins/plugins/flyctl"
"github.com/1Password/shell-plugins/plugins/fossa"
"github.com/1Password/shell-plugins/plugins/gitea"
"github.com/1Password/shell-plugins/plugins/github"
"github.com/1Password/shell-plugins/plugins/gitlab"
"github.com/1Password/shell-plugins/plugins/hcloud"
"github.com/1Password/shell-plugins/plugins/heroku"
"github.com/1Password/shell-plugins/plugins/homebrew"
"github.com/1Password/shell-plugins/plugins/huggingface"
"github.com/1Password/shell-plugins/plugins/influxdb"
"github.com/1Password/shell-plugins/plugins/kaggle"
"github.com/1Password/shell-plugins/plugins/lacework"
"github.com/1Password/shell-plugins/plugins/laravelforge"
"github.com/1Password/shell-plugins/plugins/laravelvapor"
"github.com/1Password/shell-plugins/plugins/linode"
"github.com/1Password/shell-plugins/plugins/localstack"
"github.com/1Password/shell-plugins/plugins/mysql"
"github.com/1Password/shell-plugins/plugins/ngrok"
"github.com/1Password/shell-plugins/plugins/ohdear"
"github.com/1Password/shell-plugins/plugins/okta"
"github.com/1Password/shell-plugins/plugins/openai"
"github.com/1Password/shell-plugins/plugins/pipedream"
"github.com/1Password/shell-plugins/plugins/postgresql"
"github.com/1Password/shell-plugins/plugins/pulumi"
"github.com/1Password/shell-plugins/plugins/readme"
"github.com/1Password/shell-plugins/plugins/scaleway"
"github.com/1Password/shell-plugins/plugins/sentry"
"github.com/1Password/shell-plugins/plugins/snowflake"
"github.com/1Password/shell-plugins/plugins/snyk"
"github.com/1Password/shell-plugins/plugins/sourcegraph"
"github.com/1Password/shell-plugins/plugins/stripe"
"github.com/1Password/shell-plugins/plugins/terraform"
"github.com/1Password/shell-plugins/plugins/todoist"
"github.com/1Password/shell-plugins/plugins/treasuredata"
"github.com/1Password/shell-plugins/plugins/tugboat"
"github.com/1Password/shell-plugins/plugins/twilio"
"github.com/1Password/shell-plugins/plugins/upstash"
"github.com/1Password/shell-plugins/plugins/vault"
"github.com/1Password/shell-plugins/plugins/vercel"
"github.com/1Password/shell-plugins/plugins/vertica"
"github.com/1Password/shell-plugins/plugins/vultr"
"github.com/1Password/shell-plugins/plugins/wrangler"
"github.com/1Password/shell-plugins/plugins/yugabytedb"
"github.com/1Password/shell-plugins/plugins/zapier"
"github.com/1Password/shell-plugins/plugins/zendesk"
)

func init() {
Register(akamai.New())
Register(argocd.New())
Register(atlas.New())
Register(aws.New())
Register(axiom.New())
Register(binance.New())
Register(cachix.New())
Register(cargo.New())
Register(circleci.New())
Register(civo.New())
Register(confluent.New())
Register(crowdin.New())
Register(databricks.New())
Register(datadog.New())
Register(digitalocean.New())
Register(doppler.New())
Register(fastly.New())
Register(flyctl.New())
Register(fossa.New())
Register(gitea.New())
Register(github.New())
Register(gitlab.New())
Register(hcloud.New())
Register(heroku.New())
Register(homebrew.New())
Register(huggingface.New())
Register(influxdb.New())
Register(kaggle.New())
Register(lacework.New())
Register(laravelforge.New())
Register(laravelvapor.New())
Register(linode.New())
Register(localstack.New())
Register(mysql.New())
Register(ngrok.New())
Register(ohdear.New())
Register(okta.New())
Register(openai.New())
Register(pipedream.New())
Register(postgresql.New())
Register(pulumi.New())
Register(readme.New())
Register(scaleway.New())
Register(sentry.New())
Register(snowflake.New())
Register(snyk.New())
Register(sourcegraph.New())
Register(stripe.New())
Register(terraform.New())
Register(todoist.New())
Register(treasuredata.New())
Register(tugboat.New())
Register(twilio.New())
Register(upstash.New())
Register(vault.New())
Register(vercel.New())
Register(vertica.New())
Register(vultr.New())
Register(wrangler.New())
Register(yugabytedb.New())
Register(zapier.New())
Register(zendesk.New())
}