Documentation
¶
Overview ¶
Package boundary provides methods for commonly used boundary actions that are used in end-to-end tests.
Index ¶
- func AddCredentialSourceToTargetCli(t testing.TB, ctx context.Context, targetId string, credentialSourceId string)
- func AddGrantToRoleCli(t testing.TB, ctx context.Context, roleId string, grant string)
- func AddHostSourceToTargetApi(t testing.TB, ctx context.Context, client *api.Client, targetId string, ...)
- func AddHostSourceToTargetCli(t testing.TB, ctx context.Context, targetId, hostSourceId string)
- func AddHostToHostSetApi(t testing.TB, ctx context.Context, client *api.Client, hostSetId string, ...)
- func AddHostToHostSetCli(t testing.TB, ctx context.Context, hostSetId string, hostId string)
- func AddPrincipalToRoleCli(t testing.TB, ctx context.Context, roleId string, principal string)
- func AddUserToGroup(t testing.TB, ctx context.Context, userId string, groupId string)
- func AuthenticateAdminCli(t testing.TB, ctx context.Context)
- func AuthenticateCli(t testing.TB, ctx context.Context, authMethodId string, loginName string, ...)
- func CreateNewAccountApi(t testing.TB, ctx context.Context, client *api.Client, loginName string) (accountId string, password string)
- func CreateNewAccountCli(t testing.TB, ctx context.Context, authMethodId string, loginName string) (string, string)
- func CreateNewAddressTargetCli(t testing.TB, ctx context.Context, projectId string, defaultPort string, ...) string
- func CreateNewAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId string, accessKeyId string, ...) string
- func CreateNewAwsHostSetCli(t testing.TB, ctx context.Context, hostCatalogId string, filter string) string
- func CreateNewCredentialStoreStaticApi(t testing.TB, ctx context.Context, client *api.Client, projectId string) string
- func CreateNewCredentialStoreStaticCli(t testing.TB, ctx context.Context, projectId string) string
- func CreateNewCredentialStoreVaultCli(t testing.TB, ctx context.Context, projectId string, vaultAddr string, ...) string
- func CreateNewGroupCli(t testing.TB, ctx context.Context, scopeId string) string
- func CreateNewHostApi(t testing.TB, ctx context.Context, client *api.Client, hostCatalogId string, ...) string
- func CreateNewHostCatalogApi(t testing.TB, ctx context.Context, client *api.Client, projectId string) string
- func CreateNewHostCatalogCli(t testing.TB, ctx context.Context, projectId string) string
- func CreateNewHostCli(t testing.TB, ctx context.Context, hostCatalogId string, address string) string
- func CreateNewHostSetApi(t testing.TB, ctx context.Context, client *api.Client, hostCatalogId string) string
- func CreateNewHostSetCli(t testing.TB, ctx context.Context, hostCatalogId string) string
- func CreateNewOrgApi(t testing.TB, ctx context.Context, client *api.Client) string
- func CreateNewOrgCli(t testing.TB, ctx context.Context) string
- func CreateNewProjectApi(t testing.TB, ctx context.Context, client *api.Client, orgId string) string
- func CreateNewProjectCli(t testing.TB, ctx context.Context, orgId string) string
- func CreateNewRoleCli(t testing.TB, ctx context.Context, scopeId string) string
- func CreateNewStaticCredentialJsonCli(t testing.TB, ctx context.Context, credentialStoreId string, ...) string
- func CreateNewStaticCredentialPasswordCli(t testing.TB, ctx context.Context, credentialStoreId string, user string, ...) string
- func CreateNewStaticCredentialPrivateKeyCli(t testing.TB, ctx context.Context, credentialStoreId string, user string, ...) string
- func CreateNewTargetApi(t testing.TB, ctx context.Context, client *api.Client, projectId string, ...) string
- func CreateNewTargetCli(t testing.TB, ctx context.Context, projectId string, defaultPort string, ...) string
- func CreateNewUserApi(t testing.TB, ctx context.Context, client *api.Client, scopeId string) string
- func CreateNewUserCli(t testing.TB, ctx context.Context, scopeId string) string
- func GetAuthenticationTokenCli(t testing.TB, ctx context.Context, loginName string, password string) string
- func GetAuthenticationTokenIdByTokenNameCli(t testing.TB, ctx context.Context, tokenName string) string
- func NewApiClient() (*api.Client, error)
- func RemoveHostSourceFromTargetCli(t testing.TB, ctx context.Context, targetId, hostSourceId string)
- func SetAccountToUserCli(t testing.TB, ctx context.Context, userId string, accountId string)
- func SetHostSourceToTargetCli(t testing.TB, ctx context.Context, targetId, hostSourceId string)
- func WaitForHostsInHostSetCli(t testing.TB, ctx context.Context, hostSetId string) int
- func WaitForSessionCli(t testing.TB, ctx context.Context, projectId string) *sessions.Session
- func WaitForSessionStatusCli(t testing.TB, ctx context.Context, sessionId string, status string)
- type AuthMethodInfo
- type AuthenticateCliOutput
- type CliError
- type Config
- type DbInitInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCredentialSourceToTargetCli ¶ added in v0.12.0
func AddCredentialSourceToTargetCli(t testing.TB, ctx context.Context, targetId string, credentialSourceId string)
AddCredentialSourceToTargetCli uses the cli to add a credential source (credential library or credential) to a target
func AddGrantToRoleCli ¶ added in v0.12.0
AddGrantToRoleCli adds a grant/permission to a role using the cli
func AddHostSourceToTargetApi ¶ added in v0.12.0
func AddHostSourceToTargetApi(t testing.TB, ctx context.Context, client *api.Client, targetId string, hostSourceId string)
AddHostSourceToTargetApi uses the Go api to add a host source (host set or host) to a target
func AddHostSourceToTargetCli ¶ added in v0.12.0
AddHostSourceToTargetCli uses the cli to add a host source (host set or host) to a target. Boundary's `add-host-sources` functionality appends a new host source to the existing set of host sources in the target.
func AddHostToHostSetApi ¶ added in v0.12.0
func AddHostToHostSetApi(t testing.TB, ctx context.Context, client *api.Client, hostSetId string, hostId string)
AddHostToHostSetApi uses the Go api to add a host to a host set
func AddHostToHostSetCli ¶ added in v0.12.0
AddHostToHostSetCli uses the cli to add a host to a host set
func AddPrincipalToRoleCli ¶ added in v0.12.0
AddPrincipalToRoleCli adds a user/group to a role using the cli
func AddUserToGroup ¶ added in v0.13.0
AddUserToGroup uses the cli to add a user to a group
func AuthenticateAdminCli ¶ added in v0.12.0
AuthenticateAdminCli uses the cli to authenticate the specified Boundary instance as an admin
func AuthenticateCli ¶
func AuthenticateCli(t testing.TB, ctx context.Context, authMethodId string, loginName string, password string, opt ...e2e.Option)
AuthenticateCli uses the cli to authenticate the specified Boundary instance
func CreateNewAccountApi ¶ added in v0.12.0
func CreateNewAccountApi(t testing.TB, ctx context.Context, client *api.Client, loginName string) (accountId string, password string)
CreateNewAccountApi creates a new account using the Go api. Returns the id of the new account as well as the password that was generated
func CreateNewAccountCli ¶ added in v0.12.0
func CreateNewAccountCli(t testing.TB, ctx context.Context, authMethodId string, loginName string) (string, string)
CreateNewAccountCli creates a new account using the cli. Returns the id of the new account as well as the password that was generated
func CreateNewAddressTargetCli ¶ added in v0.12.0
func CreateNewAddressTargetCli(t testing.TB, ctx context.Context, projectId string, defaultPort string, address string) string
CreateNewAddressTargetCli uses the cli to create a new target using an address in boundary. Returns the id of the new target.
func CreateNewAwsHostCatalogCli ¶ added in v0.12.0
func CreateNewAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId string, accessKeyId string, secretAccessKey string) string
CreateNewAwsHostCatalogCli uses the cli to create a new AWS dynamic host catalog. Returns the id of the new host catalog.
func CreateNewAwsHostSetCli ¶ added in v0.12.0
func CreateNewAwsHostSetCli(t testing.TB, ctx context.Context, hostCatalogId string, filter string) string
CreateNewAwsHostSetCli uses the cli to create a new host set from an AWS dynamic host catalog. Returns the id of the new host set.
func CreateNewCredentialStoreStaticApi ¶ added in v0.12.0
func CreateNewCredentialStoreStaticApi(t testing.TB, ctx context.Context, client *api.Client, projectId string) string
CreateNewCredentialStoreStaticApi uses the Go api to create a new static credential store. Returns the id of the new credential store
func CreateNewCredentialStoreStaticCli ¶ added in v0.12.0
CreateNewCredentialStoreStaticCli uses the cli to create a new static credential store. Returns the id of the new credential store
func CreateNewCredentialStoreVaultCli ¶ added in v0.12.0
func CreateNewCredentialStoreVaultCli(t testing.TB, ctx context.Context, projectId string, vaultAddr string, vaultToken string) string
CreateNewCredentialStoreVaultCli uses the cli to create a Vault credential store Returns the id of the new credential store
func CreateNewGroupCli ¶ added in v0.13.0
CreateNewGroupCli uses the cli to create a new group. Returns the id of the new group.
func CreateNewHostApi ¶ added in v0.12.0
func CreateNewHostApi(t testing.TB, ctx context.Context, client *api.Client, hostCatalogId string, address string) string
CreateNewHostApi uses the Go api to create a new host. Returns the id of the new host.
func CreateNewHostCatalogApi ¶ added in v0.12.0
func CreateNewHostCatalogApi(t testing.TB, ctx context.Context, client *api.Client, projectId string) string
CreateNewHostCatalogApi uses the Go api to create a new host catalog. Returns the id of the new host catalog.
func CreateNewHostCatalogCli ¶ added in v0.12.0
CreateNewHostCatalogCli uses the cli to create a new host catalog. Returns the id of the new host catalog.
func CreateNewHostCli ¶ added in v0.12.0
func CreateNewHostCli(t testing.TB, ctx context.Context, hostCatalogId string, address string) string
CreateNewHostCli uses the cli to create a new host. Returns the id of the new host.
func CreateNewHostSetApi ¶ added in v0.12.0
func CreateNewHostSetApi(t testing.TB, ctx context.Context, client *api.Client, hostCatalogId string) string
CreateNewHostSetApi uses the Go api to create a new host set. Returns the id of the new host set.
func CreateNewHostSetCli ¶ added in v0.12.0
CreateNewHostSetCli uses the cli to create a new host set. Returns the id of the new host set.
func CreateNewOrgApi ¶ added in v0.12.0
CreateNewOrgApi creates a new organization in boundary using the Go api. Returns the id of the new org.
func CreateNewOrgCli ¶ added in v0.12.0
CreateNewOrgCli creates a new organization in boundary using the cli. Returns the id of the new org.
func CreateNewProjectApi ¶ added in v0.12.0
func CreateNewProjectApi(t testing.TB, ctx context.Context, client *api.Client, orgId string) string
CreateNewProjectApi creates a new project in boundary using the Go api. The project will be created under the provided org id. Returns the id of the new project.
func CreateNewProjectCli ¶ added in v0.12.0
CreateNewProjectCli creates a new project in boundary using the cli. The project will be created under the provided org id. Returns the id of the new project.
func CreateNewRoleCli ¶ added in v0.12.0
CreateNewRoleCli creates a new role using the cli. Returns the id of the new role.
func CreateNewStaticCredentialJsonCli ¶ added in v0.12.0
func CreateNewStaticCredentialJsonCli(t testing.TB, ctx context.Context, credentialStoreId string, jsonFilePath string) string
CreateNewStaticCredentialJsonCli uses the cli to create a new json credential in the provided static credential store. Returns the id of the new credential
func CreateNewStaticCredentialPasswordCli ¶ added in v0.12.0
func CreateNewStaticCredentialPasswordCli(t testing.TB, ctx context.Context, credentialStoreId string, user string, password string) string
CreateNewStaticCredentialPasswordCli uses the cli to create a new password credential in the provided static credential store. Returns the id of the new credential
func CreateNewStaticCredentialPrivateKeyCli ¶ added in v0.12.0
func CreateNewStaticCredentialPrivateKeyCli(t testing.TB, ctx context.Context, credentialStoreId string, user string, filePath string) string
CreateNewStaticCredentialPrivateKeyCli uses the cli to create a new private key credential in the provided static credential store. Returns the id of the new credential
func CreateNewTargetApi ¶ added in v0.12.0
func CreateNewTargetApi(t testing.TB, ctx context.Context, client *api.Client, projectId string, defaultPort string) string
CreateNewTargetApi uses the Go api to create a new target in boundary Returns the id of the new target.
func CreateNewTargetCli ¶ added in v0.12.0
func CreateNewTargetCli(t testing.TB, ctx context.Context, projectId string, defaultPort string, opt ...target.Option) string
CreateNewTargetCli uses the cli to create a new target in boundary Returns the id of the new target.
func CreateNewUserApi ¶ added in v0.12.0
CreateNewUserCli creates a new user using the Go api. Returns the id of the new user
func CreateNewUserCli ¶ added in v0.12.0
CreateNewUserCli creates a new user using the cli. Returns the id of the new user
func GetAuthenticationTokenCli ¶ added in v0.12.0
func GetAuthenticationTokenCli(t testing.TB, ctx context.Context, loginName string, password string) string
GetAuthenticationTokenCli uses the cli to get an auth token that can be used in subsequent commands
func GetAuthenticationTokenIdByTokenNameCli ¶ added in v0.13.0
func GetAuthenticationTokenIdByTokenNameCli(t testing.TB, ctx context.Context, tokenName string) string
GetAuthenticationTokenIdByTokenNameCli uses the CLI to get an auth-token ID by its name The operation is performed by the user associated with the auth-token
func NewApiClient ¶
NewApiClient creates a new Api client for the specified Boundary instance and attempts to authenticate it. Returns the client.
func RemoveHostSourceFromTargetCli ¶ added in v0.12.0
func RemoveHostSourceFromTargetCli(t testing.TB, ctx context.Context, targetId, hostSourceId string)
RemoveHostSourceFromTargetCli uses the cli to remove a host source (host set or host) to a target
func SetAccountToUserCli ¶ added in v0.12.0
SetAccountToUserCli sets an account to a the specified user using the cli.
func SetHostSourceToTargetCli ¶ added in v0.12.0
SetHostSourceToTargetCli uses the cli to set a host source (host set or host) to a target. Boundary's `set-host-sources` functionality replaces all existing host sets on a target with the provided one.
func WaitForHostsInHostSetCli ¶ added in v0.12.0
WaitForHostsInHostSetCli uses the cli to check if there are hosts in a host set. It will check a few times before returning a result. The method will fail if there are 0 hosts found.
func WaitForSessionCli ¶ added in v0.12.0
WaitForSessionCli waits for a session to appear in the session list and returns the session information
Types ¶
type AuthMethodInfo ¶ added in v0.12.0
type AuthMethodInfo struct {
AuthMethodId string `json:"auth_method_id"`
LoginName string `json:"login_name"`
Password string `json:"password"`
}
AuthMethodInfo parses auth method info in the json response from running `boundary database init`
type AuthenticateCliOutput ¶ added in v0.12.0
type AuthenticateCliOutput struct {
Item *authmethods.AuthenticateResult
StatusCode int `json:"status_code"`
}
AuthenticateCliOutput parses the json response from running `boundary authenticate`
type CliError ¶ added in v0.12.0
type CliError struct {
Status int `json:"status"`
}
CliError parses the Stderr from running a boundary command
type Config ¶ added in v0.12.0
type Config struct {
Address string `envconfig:"BOUNDARY_ADDR" required:"true"` // e.g. http://127.0.0.1:9200
AuthMethodId string `envconfig:"E2E_PASSWORD_AUTH_METHOD_ID" required:"true"` // e.g. ampw_1234567890
AdminLoginName string `envconfig:"E2E_PASSWORD_ADMIN_LOGIN_NAME" default:"admin"`
AdminLoginPassword string `envconfig:"E2E_PASSWORD_ADMIN_PASSWORD" required:"true"`
}
func LoadConfig ¶ added in v0.12.0
type DbInitInfo ¶ added in v0.12.0
type DbInitInfo struct {
AuthMethod AuthMethodInfo `json:"auth_method"`
}
DbInitInfo parses the json response from running `boundary database init`