DEPRECATED use https://github.com/datastax/astra-client-go instead
Go API bindings for the Astra DevOps API with zero external dependencies. Apache 2.0 License.
import "github.com/rsds143/astra-devops-sdk-go/astraops"
func main() {
//using an auth token
verbose := true
client, err := astraopsv1.AuthenticateToken("AstraCS:scrambled:scrabmled", verbose)
}
import "github.com/rsds143/astra-devops-sdk-go/astraops"
func main() {
//using a legacy service account
c := ClientInfo {
ClientName: "[email protected]",
ClientID: "3e241be3-2a5f-4cb1-b702-739e38975b1a",
ClientSecret: "33c338b0-91b5-45a6-be14-416059deb820",
}
verbose := true
client, err := astraopsv1.Authenticate(c, verbose)
}
Will block until creation
createDb := CreateDb{
Name: "testerdblist",
Keyspace: "mykeyspace",
Region: "europe-west1",
CloudProvider: "GCP",
CapacityUnits: 1,
Tier: "serverless",
User: "myuser",
Password: "mypass",
}
//id is a uuid
//db is the following type
//type DataBase struct {
// ID string `json:"id"`
// OrgID string `json:"orgId"`
// OwnerID string `json:"ownerId"`
// Info Info `json:"info"`
// CreationTime string `json:"creationTime"`
// TerminationTime string `json:"terminationTime"`
// Status string `json:"status"`
// Storage Storage `json:"storage"`
// AvailableActions []string `json:"availableActions"`
// Message string `json:"message"`
// StudioURL string `json:"studioUrl"`
// GrafanaURL string `json:"grafanaUrl"`
// CqlshURL string `json:"cqlshUrl"`
// GraphqlURL string `json:"graphUrl"`
// DataEndpointURL string `json:"dataEndpointUrl"`
//}
id, db, err := client.CreateDb(createDb)
Will block until terminating status or terminated status is returned
//id is database ID one gets when using ListDb or CreateDb
//preparedStateOnly is an internal field, do not use unless directed to by support
preparedStateOnly := false
err := client.Terminate(id, preparedStateOnly)
dbs, err := client.ListDb("", "", "", 10)
//returns an array of DataBases
db, err := client.FindDb(id)
//type DataBase struct {
// ID string `json:"id"`
// OrgID string `json:"orgId"`
// OwnerID string `json:"ownerId"`
// Info Info `json:"info"`
// CreationTime string `json:"creationTime"`
// TerminationTime string `json:"terminationTime"`
// Status string `json:"status"`
// Storage Storage `json:"storage"`
// AvailableActions []string `json:"availableActions"`
// Message string `json:"message"`
// StudioURL string `json:"studioUrl"`
// GrafanaURL string `json:"grafanaUrl"`
// CqlshURL string `json:"cqlshUrl"`
// GraphqlURL string `json:"graphUrl"`
// DataEndpointURL string `json:"dataEndpointUrl"`
}
*/
secureBundle, err := client.GetSecureBundle(id)
/*
type SecureBundle struct {
DownloadURL string `json:"downloadURL"`
DownloadURLInternal string `json:"downloadURLInternal"`
DownloadURLMigrationProxy string `json:"downloadURLMigrationProxy"`
}
*/
Will block until parking complete
err := client.Park(id)
Will block until unparking complete, this can take very long
err := client.UnPark(id)
var int32 capacityUnits = 5
err := Resize(id, capacityUnits)
tiers, err := GetTierInfo()
//returns a list of TierInfo
//type TierInfo struct {
// Tier string `json:"tier"`
// Description string `json:"description"`
// CloudProvider string `json:"cloudProvider"`
// Region string `json:"region"`
// RegionDisplay string `json:"regionDisplay"`
// RegionContinent string `json:"regionContinent"`
// Cost TierCost `json:"cost"`
// DatabaseCountUsed int `json:"databaseCountUsed"`
// DatabaseCountLimit int `json:"databaseCountLimit"`
// CapacityUnitsUsed int `json:"capacityUnitsUsed"`
// CapacityUnitsLimit int `json:"capacityUnitsLimit"`
// DefaultStoragePerCapacityUnitGb int `json:"defaultStoragePerCapacityUnitGb"`
//}
//
//tier cost has the following fields
//type TierCost struct {
// CostPerMinCents float64 `json:"costPerMinCents"`
// CostPerHourCents float64 `json:"costPerHourCents"`
// CostPerDayCents float64 `json:"costPerDayCents"`
// CostPerMonthCents float64 `json:"costPerMonthCents"`
// CostPerMinMRCents float64 `json:"costPerMinMRCents"`
// CostPerHourMRCents float64 `json:"costPerHourMRCents"`
// CostPerDayMRCents float64 `json:"costPerDayMRCents"`
// CostPerMonthMRCents float64 `json:"costPerMonthMRCents"`
// CostPerMinParkedCents float64 `json:"costPerMinParkedCents"`
// CostPerHourParkedCents float64 `json:"costPerHourParkedCents"`
// CostPerDayParkedCents float64 `json:"costPerDayParkedCents"`
// CostPerMonthParkedCents float64 `json:"costPerMonthParkedCents"`
// CostPerNetworkGbCents float64 `json:"costPerNetworkGbCents"`
// CostPerWrittenGbCents float64 `json:"costPerWrittenGbCents"`
// CostPerReadGbCents float64 `json:"costPerReadGbCents"`
//}