Documentation
¶
Overview ¶
Package pkg is the top level package for shared libraries
Package pkg is the top level package for shared libraries ¶
Package pkg is the top level package for shared libraries ¶
Package pkg is the top level package for shared libraries ¶
Package pkg is the top level package for shared libraries
Index ¶
- Constants
- Variables
- func FormatErrors(es []Error) string
- func PathWithEnv(f string) string
- func ReadToken(tokenFile string) (string, error)
- func WriteRows(w io.Writer, rows [][]string) error
- type AuthenticatedClient
- func (a *AuthenticatedClient) AddKeyspaceToDb(databaseID string, keyspaceName string) error
- func (a *AuthenticatedClient) CreateDb(createDb astra.DatabaseInfoCreate) (astra.Database, error)
- func (a *AuthenticatedClient) FindDb(databaseID string) (astra.Database, error)
- func (a *AuthenticatedClient) GetSecureBundle(databaseID string) (astra.CredsURL, error)
- func (a *AuthenticatedClient) GetTierInfo() ([]astra.AvailableRegionCombination, error)
- func (a *AuthenticatedClient) ListDb(include string, provider string, startingAfter string, limit int) ([]astra.Database, error)
- func (a *AuthenticatedClient) Park(databaseID string) error
- func (a *AuthenticatedClient) ParkAsync(databaseID string) error
- func (a *AuthenticatedClient) ResetPassword(databaseID, username, password string) error
- func (a *AuthenticatedClient) Resize(databaseID string, capacityUnits int) error
- func (a *AuthenticatedClient) Terminate(id string, preparedStateOnly bool) error
- func (a *AuthenticatedClient) Unpark(databaseID string) error
- func (a *AuthenticatedClient) UnparkAsync(databaseID string) error
- func (a *AuthenticatedClient) WaitUntil(id string, tries int, intervalSeconds int, status ...astra.StatusEnum) (astra.Database, error)
- type Client
- type ClientInfo
- type ConfFiles
- type Creds
- type Error
- type ErrorResponse
- type FileNotFoundError
- type JSONParseError
- type LoginService
- type ParseError
Constants ¶
const ( // JSONFormat is for the command line flag -o JSONFormat = "json" // TextFormat is for the command line flag -o TextFormat = "text" )
Variables ¶
var Env = "prod"
Functions ¶
func FormatErrors ¶ added in v0.5.0
FormatErrors puts the API errors into a well formatted text output
func PathWithEnv ¶ added in v0.6.0
Types ¶
type AuthenticatedClient ¶ added in v0.5.0
type AuthenticatedClient struct {
// contains filtered or unexported fields
}
AuthenticatedClient has a token and the methods to query the Astra DevOps API
func Authenticate ¶ added in v0.5.0
func Authenticate(clientInfo ClientInfo, verbose bool) (*AuthenticatedClient, error)
func AuthenticateToken ¶ added in v0.5.0
func AuthenticateToken(token string, verbose bool) (*AuthenticatedClient, error)
func (*AuthenticatedClient) AddKeyspaceToDb ¶ added in v0.5.0
func (a *AuthenticatedClient) AddKeyspaceToDb(databaseID string, keyspaceName string) error
AddKeyspaceToDb Adds keyspace into database * @param databaseID string representation of the database ID * @param keyspaceName Name of database keyspace @return error
func (*AuthenticatedClient) CreateDb ¶ added in v0.5.0
func (a *AuthenticatedClient) CreateDb(createDb astra.DatabaseInfoCreate) (astra.Database, error)
CreateDb creates a database in Astra, username and password fields are required only on legacy tiers and waits until it is in a created state * @param createDb Definition of new database @return (Database, error)
func (*AuthenticatedClient) FindDb ¶ added in v0.5.0
func (a *AuthenticatedClient) FindDb(databaseID string) (astra.Database, error)
FindDb Returns specified database * @param databaseID string representation of the database ID @return (Database, error)
func (*AuthenticatedClient) GetSecureBundle ¶ added in v0.5.0
func (a *AuthenticatedClient) GetSecureBundle(databaseID string) (astra.CredsURL, error)
GetSecureBundle Returns a temporary URL to download a zip file with certificates for connecting to the database. The URL expires after five minutes.<p>There are two types of the secure bundle URL: <ul> * @param databaseID string representation of the database ID @return (SecureBundle, error)
func (*AuthenticatedClient) GetTierInfo ¶ added in v0.5.0
func (a *AuthenticatedClient) GetTierInfo() ([]astra.AvailableRegionCombination, error)
GetTierInfo Returns all supported tier, cloud, region, count, and capacitity combinations @return ([]TierInfo, error)
func (*AuthenticatedClient) ListDb ¶ added in v0.5.0
func (a *AuthenticatedClient) ListDb(include string, provider string, startingAfter string, limit int) ([]astra.Database, error)
ListDb find all databases that match the parameters * @param "include" (optional.string) - Allows filtering so that databases in listed states are returned * @param "provider" (optional.string) - Allows filtering so that databases from a given provider are returned * @param "startingAfter" (optional.string) - Optional parameter for pagination purposes. Used as this value for starting retrieving a specific page of results * @param "limit" (optional.int) - Optional parameter for pagination purposes. Specify the number of items for one page of data @return ([]Database, error)
func (*AuthenticatedClient) Park ¶ added in v0.5.0
func (a *AuthenticatedClient) Park(databaseID string) error
Park parks the database at the specified id and will block until the database is parked * @param databaseID string representation of the database ID @return error
func (*AuthenticatedClient) ParkAsync ¶ added in v0.5.0
func (a *AuthenticatedClient) ParkAsync(databaseID string) error
ParkAsync parks the database at the specified id. Note you cannot park a serverless database * @param databaseID string representation of the database ID @return error
func (*AuthenticatedClient) ResetPassword ¶ added in v0.5.0
func (a *AuthenticatedClient) ResetPassword(databaseID, username, password string) error
ResetPassword changes the password for the database at the specified id * @param databaseID string representation of the database ID * @param username string containing username * @param password string containing password. The specified password will be updated for the specified database user @return error
func (*AuthenticatedClient) Resize ¶ added in v0.5.0
func (a *AuthenticatedClient) Resize(databaseID string, capacityUnits int) error
Resize a database. Total number of capacity units desired should be specified. Reducing a size of a database is not supported at this time. Note you cannot resize a serverless database * @param databaseID string representation of the database ID * @param capacityUnits int32 containing capacityUnits key with a value greater than the current number of capacity units (max increment of 3 additional capacity units) @return error
func (*AuthenticatedClient) Terminate ¶ added in v0.5.0
func (a *AuthenticatedClient) Terminate(id string, preparedStateOnly bool) error
Terminate deletes the database at the specified id and will block until it shows up as deleted or is removed from the system * @param databaseID string representation of the database ID * @param "PreparedStateOnly" - For internal use only. Used to safely terminate prepared databases @return error
func (*AuthenticatedClient) Unpark ¶ added in v0.5.0
func (a *AuthenticatedClient) Unpark(databaseID string) error
Unpark unparks the database at the specified id and will block until the database is unparked * @param databaseID String representation of the database ID @return error
func (*AuthenticatedClient) UnparkAsync ¶ added in v0.5.0
func (a *AuthenticatedClient) UnparkAsync(databaseID string) error
UnparkAsync unparks the database at the specified id. NOTE you cannot unpark a serverless database * @param databaseID String representation of the database ID @return error
func (*AuthenticatedClient) WaitUntil ¶ added in v0.5.0
func (a *AuthenticatedClient) WaitUntil(id string, tries int, intervalSeconds int, status ...astra.StatusEnum) (astra.Database, error)
WaitUntil will keep checking the database for the requested status until it is available. Eventually it will timeout if the operation is not yet complete. * @param id string - the database id to find * @param tries int - number of attempts * @param intervalSeconds int - seconds to wait between tries * @param status StatusEnum - status to wait for @returns (Database, error)
type Client ¶ added in v0.3.2
type Client interface {
CreateDb(astraops.DatabaseInfoCreate) (astraops.Database, error)
Terminate(string, bool) error
FindDb(string) (astraops.Database, error)
ListDb(string, string, string, int) ([]astraops.Database, error)
Park(string) error
Unpark(string) error
Resize(string, int) error
GetSecureBundle(string) (astraops.CredsURL, error)
GetTierInfo() ([]astraops.AvailableRegionCombination, error)
}
Client is the abstraction for client interactions. Allows alternative db management clients
type ClientInfo ¶ added in v0.5.0
ClientInfo provides access to
func ReadLogin ¶
func ReadLogin(saJSONFile string) (ClientInfo, error)
ReadLogin retrieves the login from the specified json file
type ConfFiles ¶ added in v0.2.0
ConfFiles supports both formats of credentials and will say if the token one is present
func GetHome ¶
GetHome returns the configuration directory and file error will return if there is no user home folder
func (ConfFiles) HasServiceAccount ¶ added in v0.2.0
HasServiceAccount returns true if there is a service account file present and accessible
type Creds ¶ added in v0.3.2
type Creds struct {
GetHomeFunc func() (string, error) // optional. If not specified os.UserHomeDir is used for log base directory to find creds
}
Creds knows how handle and store credentials
type Error ¶ added in v0.5.0
type Error struct {
// API specific error code
ID int
// User-friendly description of error
Message string
}
Error when the api has an error this is the structure
type ErrorResponse ¶ added in v0.5.0
type ErrorResponse struct {
Errors []Error
}
ErrorResponse when the API has an error
type FileNotFoundError ¶ added in v0.1.3
FileNotFoundError when unable to read file
func (*FileNotFoundError) Error ¶ added in v0.1.3
func (j *FileNotFoundError) Error() string
Error returns the error string
type JSONParseError ¶ added in v0.1.3
JSONParseError when unable to read JSON
func (*JSONParseError) Error ¶ added in v0.1.3
func (j *JSONParseError) Error() string
Error returns the error string
type LoginService ¶ added in v0.3.2
LoginService provides interface to implement logins and produce an Client
type ParseError ¶
ParseError is used to indicate there is an error in the command line args
func (*ParseError) Error ¶
func (p *ParseError) Error() string
Error outpus the error with the args provided, if there are no args that becomes the error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package env is the package where global environment configuration goes
|
Package env is the package where global environment configuration goes |
|
Package httputils provides common http functions and utilities
|
Package httputils provides common http functions and utilities |
|
Package test is for test utilies and mocks
|
Package test is for test utilies and mocks |