2023-12-20 18:29:23 +00:00
|
|
|
package infisical
|
|
|
|
|
|
|
|
type LoginResponse struct {
|
|
|
|
AccessToken string `json:"accessToken"`
|
|
|
|
ExpiresIn int `json:"expiresIn"`
|
|
|
|
AccessTokenMaxTTL int `json:"accessTokenMaxTTL"`
|
|
|
|
TokenType string `json:"tokenType"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type RetrieveSecretOptions struct {
|
|
|
|
WorkspaceID string
|
|
|
|
Environment string
|
|
|
|
SecretPath string
|
|
|
|
IncludeImports bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultRetrieveSecretOptions() *RetrieveSecretOptions {
|
|
|
|
return &RetrieveSecretOptions{
|
|
|
|
WorkspaceID: "",
|
|
|
|
Environment: "",
|
|
|
|
SecretPath: "/",
|
|
|
|
IncludeImports: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 16:38:38 +00:00
|
|
|
type RetrieveSecretOptionFunc func(*RetrieveSecretOptions)
|
|
|
|
|
|
|
|
func WithWorkspaceID(workspaceId string) RetrieveSecretOptionFunc {
|
|
|
|
return func(rso *RetrieveSecretOptions) {
|
|
|
|
rso.WorkspaceID = workspaceId
|
|
|
|
}
|
2023-12-20 18:29:23 +00:00
|
|
|
}
|
|
|
|
|
2024-01-04 16:38:38 +00:00
|
|
|
func WithEnvironment(environment string) RetrieveSecretOptionFunc {
|
|
|
|
return func(rso *RetrieveSecretOptions) {
|
|
|
|
rso.Environment = environment
|
|
|
|
}
|
2023-12-20 18:29:23 +00:00
|
|
|
}
|
|
|
|
|
2024-01-04 16:38:38 +00:00
|
|
|
func WithSecretPath(secretPath string) RetrieveSecretOptionFunc {
|
|
|
|
return func(rso *RetrieveSecretOptions) {
|
|
|
|
rso.SecretPath = secretPath
|
|
|
|
}
|
2023-12-20 18:29:23 +00:00
|
|
|
}
|
|
|
|
|
2024-01-04 16:38:38 +00:00
|
|
|
func WithImports(rso *RetrieveSecretOptions) {
|
|
|
|
rso.IncludeImports = true
|
2023-12-20 18:29:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Secret struct {
|
|
|
|
ID string `json:"_id"`
|
|
|
|
Environment string `json:"environment,omitempty"`
|
|
|
|
SecretComment string `json:"secretComment,omitempty"`
|
|
|
|
SecretKey string `json:"secretKey,omitempty"`
|
|
|
|
SecretValue string `json:"secretValue,omitempty"`
|
|
|
|
Version int `json:"version,omitempty"`
|
|
|
|
Workspace string `json:"workspace,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SecretsResponse struct {
|
|
|
|
Secrets []Secret `json:"secrets"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SecretResponse struct {
|
|
|
|
Secret Secret `json:"secret"`
|
|
|
|
}
|