|
| 1 | +package confluent |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/1Password/shell-plugins/sdk" |
| 5 | + "github.com/1Password/shell-plugins/sdk/importer" |
| 6 | + "github.com/1Password/shell-plugins/sdk/provision" |
| 7 | + "github.com/1Password/shell-plugins/sdk/schema" |
| 8 | + "github.com/1Password/shell-plugins/sdk/schema/credname" |
| 9 | + "github.com/1Password/shell-plugins/sdk/schema/fieldname" |
| 10 | +) |
| 11 | + |
| 12 | +func CloudCredentials() schema.CredentialType { |
| 13 | + return schema.CredentialType{ |
| 14 | + Name: credname.UserLogin, |
| 15 | + DocsURL: sdk.URL("https://docs.confluent.io/cloud/current/access-management/identity/user-accounts.html#local-user-username-password"), |
| 16 | + ManagementURL: sdk.URL("https://confluent.cloud"), |
| 17 | + Fields: []schema.CredentialField{ |
| 18 | + { |
| 19 | + Name: fieldname.Username, |
| 20 | + MarkdownDescription: "Email used to authenticate to Confluent Cloud.", |
| 21 | + Secret: false, |
| 22 | + Optional: false, |
| 23 | + }, |
| 24 | + { |
| 25 | + Name: fieldname.Password, |
| 26 | + MarkdownDescription: "Password used to authenticate to Confluent Cloud.", |
| 27 | + Secret: true, |
| 28 | + Optional: false, |
| 29 | + }, |
| 30 | + { |
| 31 | + Name: fieldname.Organization, |
| 32 | + MarkdownDescription: "Organization to use with Confluent Cloud.", |
| 33 | + Secret: false, |
| 34 | + Optional: true, |
| 35 | + }, |
| 36 | + }, |
| 37 | + DefaultProvisioner: provision.EnvVars(defaultCloudEnvVarMapping), |
| 38 | + Importer: importer.TryAll( |
| 39 | + importer.TryEnvVarPair(defaultCloudEnvVarMapping), |
| 40 | + )} |
| 41 | +} |
| 42 | + |
| 43 | +var defaultCloudEnvVarMapping = map[string]sdk.FieldName{ |
| 44 | + "CONFLUENT_CLOUD_EMAIL": fieldname.Username, |
| 45 | + "CONFLUENT_CLOUD_PASSWORD": fieldname.Password, |
| 46 | + "CONFLUENT_CLOUD_ORGANIZATION_ID": fieldname.Organization, |
| 47 | +} |
| 48 | + |
| 49 | +//TODO: Revist once the Shell Plugins ecosystem adds support for multiple credential types per plugin |
| 50 | +// func PlatformCredentials() schema.CredentialType { |
| 51 | +// return schema.CredentialType{ |
| 52 | +// Name: credname.Credentials, |
| 53 | +// DocsURL: sdk.URL("https://docs.confluent.io/confluent-cli/current/command-reference/confluent_login.html"), |
| 54 | +// Fields: []schema.CredentialField{ |
| 55 | +// { |
| 56 | +// Name: fieldname.Username, |
| 57 | +// MarkdownDescription: "Username used to authenticate to Confluent Platform.", |
| 58 | +// Secret: false, |
| 59 | +// Optional: false, |
| 60 | +// }, |
| 61 | +// { |
| 62 | +// Name: fieldname.Password, |
| 63 | +// MarkdownDescription: "Password used to authenticate to Confluent Platform.", |
| 64 | +// Secret: true, |
| 65 | +// Optional: false, |
| 66 | +// }, |
| 67 | +// { |
| 68 | +// Name: fieldname.URL, |
| 69 | +// MarkdownDescription: "Metadata Service (MDS) URL used to authenticate to Confluent Platform.", |
| 70 | +// Secret: false, |
| 71 | +// Optional: false, |
| 72 | +// }, |
| 73 | +// { |
| 74 | +// Name: fieldname.Certificate, |
| 75 | +// MarkdownDescription: "Self-signed certificate chain in PEM format.", |
| 76 | +// Secret: true, |
| 77 | +// Optional: false, |
| 78 | +// }, |
| 79 | +// }, |
| 80 | +// DefaultProvisioner: provision.EnvVars(defaultPlatformEnvVarMapping), |
| 81 | +// Importer: importer.TryAll( |
| 82 | +// importer.TryEnvVarPair(defaultPlatformEnvVarMapping), |
| 83 | +// )} |
| 84 | +// } |
| 85 | + |
| 86 | +// var defaultPlatformEnvVarMapping = map[string]sdk.FieldName{ |
| 87 | +// "CONFLUENT_PLATFORM_USERNAME": fieldname.Username, |
| 88 | +// "CONFLUENT_PLATFORM_PASSWORD": fieldname.Password, |
| 89 | +// "CONFLUENT_PLATFORM_MDS_URL": fieldname.URL, |
| 90 | +// "CONFLUENT_PLATFORM_CA_CERT_PATH": fieldname.Certificate, |
| 91 | +// } |
0 commit comments