-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial setup with DatabaseCredentials credential and mongosh executable
- Loading branch information
1 parent
d07cd77
commit 0e1ac78
Showing
2 changed files
with
94 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,69 @@ | ||
package atlas | ||
|
||
import ( | ||
"github.com/1Password/shell-plugins/sdk" | ||
"github.com/1Password/shell-plugins/sdk/schema" | ||
"github.com/1Password/shell-plugins/sdk/schema/credname" | ||
"github.com/1Password/shell-plugins/sdk/schema/fieldname" | ||
) | ||
|
||
func DatabaseCredentials() schema.CredentialType { | ||
return schema.CredentialType{ | ||
Name: credname.DatabaseCredentials, | ||
DocsURL: sdk.URL("https://www.mongodb.com/docs/mongodb-shell/connect/"), | ||
Fields: []schema.CredentialField{ | ||
{ | ||
Name: fieldname.Host, | ||
MarkdownDescription: "Host address for the MongoDB database.", | ||
Secret: false, | ||
Optional: true, | ||
Composition: &schema.ValueComposition{ | ||
Charset: schema.Charset{ | ||
Lowercase: true, | ||
Digits: true, | ||
Specific: []rune{'.', '-'}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Name: fieldname.Port, | ||
MarkdownDescription: "Port for the MongoDB database.", | ||
Secret: false, | ||
Optional: true, | ||
Composition: &schema.ValueComposition{ | ||
Charset: schema.Charset{ | ||
Digits: true, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Name: fieldname.Username, | ||
MarkdownDescription: "Username for authenticating to the MongoDB database.", | ||
Secret: false, | ||
Optional: true, | ||
Composition: &schema.ValueComposition{ | ||
Charset: schema.Charset{ | ||
Lowercase: true, | ||
Digits: true, | ||
Specific: []rune{'-', '_'}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Name: fieldname.Password, | ||
MarkdownDescription: "Password for authenticating to the MongoDB database.", | ||
Secret: true, | ||
Optional: true, | ||
Composition: &schema.ValueComposition{ | ||
Charset: schema.Charset{ | ||
Lowercase: true, | ||
Uppercase: true, | ||
Digits: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
DefaultProvisioner: nil, | ||
Importer: nil, | ||
} | ||
} |
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 @@ | ||
package atlas | ||
|
||
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 MongoshCLI() schema.Executable { | ||
return schema.Executable{ | ||
Name: "MongoDB Shell", | ||
Runs: []string{"mongosh"}, | ||
DocsURL: sdk.URL("https://www.mongodb.com/docs/mongodb-shell/"), | ||
NeedsAuth: needsauth.IfAll( | ||
needsauth.NotForHelpOrVersion(), | ||
needsauth.NotWithoutArgs(), | ||
), | ||
Uses: []schema.CredentialUsage{ | ||
{ | ||
Name: credname.DatabaseCredentials, | ||
}, | ||
}, | ||
} | ||
} |