Documentation ¶
Index ¶
- Constants
- func AddCommandIfFeatureFlag(rootCmd *cobra.Command, cmd *cobra.Command, featureFlag FeatureFlag)
- func AwsCredentialsFromEnv() (awsCreds.Value, error)
- func AwsInstanceTypesWithEphemeralStorageOnly(instanceType string) bool
- func AzureStorageCredentialsFromEnv() (string, error)
- func CompareYbVersions(v1 string, v2 string) (int, error)
- func CompletedStates() []string
- func ConfirmCommand(message string, bypass bool) error
- func CreateSingletonList(in interface{}) []interface{}
- func ErrorFromHTTPResponse(resp *http.Response, apiError error, entityName, operation string) error
- func ErrorFromResponseBody(errorBlock YbaStructuredError) string
- func ErrorStates() []string
- func GcpGetCredentialsAsMap() (map[string]interface{}, error)
- func GcpGetCredentialsAsMapFromFilePath(filePath string) (map[string]interface{}, error)
- func GcpGetCredentialsAsString() (string, error)
- func GcpGetCredentialsAsStringFromFilePath(filePath string) (string, error)
- func GetBoolPointer(in bool) *bool
- func GetFloat64Pointer(in float64) *float64
- func GetInt32Pointer(in int32) *int32
- func GetInt64Pointer(in int64) *int64
- func GetStringPointer(in string) *string
- func IncompleteStates() []string
- func IsFeatureFlagEnabled(featureFlag FeatureFlag) bool
- func IsOutputType(t string) bool
- func IsVersionStable(version string) bool
- func IsYBVersion(v string) (bool, error)
- func MapFromSingletonList(in []interface{}) map[string]interface{}
- func MapListFromInterfaceList(in []interface{}) []map[string]interface{}
- func ReadSSHPrivateKey(filePath string) (*string, error)
- func StringMap(in map[string]interface{}) *map[string]string
- func StringSlice(in []interface{}) *[]string
- func StringSliceFromString(in []string) *[]string
- func StringtoStringMap(in map[string]string) *map[string]string
- func YAMLtoString(filePath string) string
- func YBARestrictBackupVersions() []string
- func YBARestrictFailedSubtasksVersions() []string
- type AzureCredentials
- type FeatureFlag
- type GCPCredentials
- type KuberenetesMetadata
- type KubernetesPullSecretYAML
- type StringListListFlag
- type YbaStructuredError
Constants ¶
const ( // GCPCredentialsEnv env variable name for gcp provider/storage config/releases GCPCredentialsEnv = "GOOGLE_APPLICATION_CREDENTIALS" // GCSCredentialsJSON field name to denote in Json request GCSCredentialsJSON = "GCS_CREDENTIALS_JSON" // UseGCPIAM field name to denote in Json request UseGCPIAM = "USE_GCP_IAM" // AWSAccessKeyEnv env variable name for aws provider/storage config/releases AWSAccessKeyEnv = "AWS_ACCESS_KEY_ID" // AWSSecretAccessKeyEnv env variable name for aws provider/storage config/releases AWSSecretAccessKeyEnv = "AWS_SECRET_ACCESS_KEY" // IAMInstanceProfile field name to denote in Json request IAMInstanceProfile = "IAM_INSTANCE_PROFILE" // AzureSubscriptionIDEnv env variable name for azure provider AzureSubscriptionIDEnv = "AZURE_SUBSCRIPTION_ID" // AzureRGEnv env variable name for azure provider AzureRGEnv = "AZURE_RG" // AzureTenantIDEnv env variable name for azure provider AzureTenantIDEnv = "AZURE_TENANT_ID" // AzureClientIDEnv env variable name for azure provider AzureClientIDEnv = "AZURE_CLIENT_ID" // AzureClientSecretEnv env variable name for azure provider AzureClientSecretEnv = "AZURE_CLIENT_SECRET" // AzureStorageSasTokenEnv env variable name azure storage config AzureStorageSasTokenEnv = "AZURE_STORAGE_SAS_TOKEN" )
Environment variable fields
const ( // YBAAllowUniverseMinVersion specifies minimum version // required to use Universe resource via YBA CLI YBAAllowUniverseMinVersion = "2.17.1.0-b371" // YBAAllowBackupMinVersion specifies minimum version // required to use Scheduled Backup resource via YBA CLI YBAAllowBackupMinVersion = "2.18.1.0-b20" // YBAAllowEditProviderMinVersion specifies minimum version // required to Edit a Provider (onprem or cloud) resource // via YBA CLI YBAAllowNewProviderMinVersion = "2.18.0.0-b65" // YBAAllowFailureSubTaskListMinVersion specifies minimum version // required to fetch failed subtask message from YugabyteDB Anywhere YBAAllowFailureSubTaskListMinVersion = "2.19.0.0-b68" MinCLIStableVersion = "2024.1.0.0-b4" MinCLIPreviewVersion = "2.21.0.0-b545" )
Minimum YugabyteDB Anywhere versions to support operation
const ( // ReadyUniverseState state ReadyUniverseState = "Ready" // PausedUniverseState state PausedUniverseState = "Paused" // PendingUniverseState state PendingUniverseState = "Pending" // WarningUniverseState state WarningUniverseState = "Warning" // BadUniverseState state BadUniverseState = "Error" // UnknownUniverseState state UnknownUniverseState = "Loading" )
UniverseStates
const ( // ReadyProviderState state ReadyProviderState = "READY" // UpdatingProviderState state UpdatingProviderState = "UPDATING" // ErrorroviderState state ErrorProviderState = "ERROR" // DeletingProviderState state DeletingProviderState = "DELETING" )
ProviderStates
const ( // CreateTaskStatus task status CreatedTaskStatus = "Created" // InitializingTaskStatus task status InitializingTaskStatus = "Initializing" // RunningTaskStatus task status RunningTaskStatus = "Running" // SuccessTaskStatus task status SuccessTaskStatus = "Success" // FailureTaskStatus task status FailureTaskStatus = "Failure" // UnknownTaskStatus task status UnknownTaskStatus = "Unknown" // AbortTaskStatus task status AbortTaskStatus = "Abort" // AbortedTaskStatus task status AbortedTaskStatus = "Aborted" )
Allowed states for YugabyteDB Anywhere Tasks
const ( // AddNode operation AddNode = "ADD" // StartNode operation StartNode = "START" // RebootNode operation RebootNode = "REBOOT" // StopNode operation StopNode = "STOP" // RemoveNode operation RemoveNode = "REMOVE" // ReprovisionNode operation ReprovisionNode = "REPROVISION" // ReleaseNode operation ReleaseNode = "RELEASE" )
Node operations allowed on universe
const ( // MasterServerType for master processes MasterServerType = "MASTER" // TserverServerType for tserver processes TserverServerType = "TSERVER" // ControllerServerType for YBC processes ControllerServerType = "CONTROLLER" )
Server Type values
const ( // UpgradeOperation type UpgradeOperation = "Upgrade" // EditOperation type EditOperation = "Edit" )
Operation Type
const ( // UniverseType resource UniverseType = "universe" // ProviderType resource ProviderType = "provider" // StorageConfigurationType resource StorageConfigurationType = "storage configuration" )
Different resource types that are supported in CLI
const ( // util.AWSProviderType type AWSProviderType = "aws" // AzureProviderType type AzureProviderType = "azu" // GCPProviderType type GCPProviderType = "gcp" // K8sProviderType type K8sProviderType = "kubernetes" // OnpremProviderType type OnpremProviderType = "onprem" )
Different cloud provider types
const ( // S3StorageConfigType type S3StorageConfigType = "S3" // AzureStorageConfigType type AzureStorageConfigType = "AZ" // GCSStorageConfigType type GCSStorageConfigType = "GCS" // NFSStorageConfigType type NFSStorageConfigType = "NFS" )
Different storage configuration types
const ( // PrimaryClusterType for primary cluster PrimaryClusterType = "PRIMARY" // ReadReplicaClusterType for rrs ReadReplicaClusterType = "ASYNC" )
ClusterTypes for universe
const (
// StorageCustomerConfigType field name to denote in request bodies
StorageCustomerConfigType = "STORAGE"
)
Variables ¶
This section is empty.
Functions ¶
func AddCommandIfFeatureFlag ¶
func AddCommandIfFeatureFlag(rootCmd *cobra.Command, cmd *cobra.Command, featureFlag FeatureFlag)
AddCommandIfFeatureFlag adds the command to root if feature flag is enabled
func AwsCredentialsFromEnv ¶
AwsCredentialsFromEnv retrives values of "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY" from env variables
func AwsInstanceTypesWithEphemeralStorageOnly ¶
AwsInstanceTypesWithEphemeralStorageOnly returns true if the instance type has only ephemeral storage
func AzureStorageCredentialsFromEnv ¶
AzureStorageCredentialsFromEnv retrives value of "AZURE_STORAGE_SAS_TOKEN" from env variables
func CompareYbVersions ¶
CompareYbVersions returns -1 if version1 < version2, 0 if version1 = version2, 1 if version1 > version2
func CompletedStates ¶
func CompletedStates() []string
CompletedStates returns set of states that mark the task as completed
func ConfirmCommand ¶
ConfirmCommand function will add an interactive comfirmation with the message provided
func CreateSingletonList ¶
func CreateSingletonList(in interface{}) []interface{}
CreateSingletonList returns a list of single entry from an interface
func ErrorFromHTTPResponse ¶
ErrorFromHTTPResponse extracts the error message from the HTTP response of the API
func ErrorFromResponseBody ¶
func ErrorFromResponseBody(errorBlock YbaStructuredError) string
ErrorFromResponseBody is a function to extract error interfaces into string
func ErrorStates ¶
func ErrorStates() []string
ErrorStates return set of states that mark state as failure
func GcpGetCredentialsAsMap ¶
GcpGetCredentialsAsMap returns the GCE JSON file contents as a map
func GcpGetCredentialsAsMapFromFilePath ¶
GcpGetCredentialsAsMapFromFilePath returns the GCE JSON file contents as a map from the file path
func GcpGetCredentialsAsString ¶
GcpGetCredentialsAsString returns the GCE JSON file contents as a string
func GcpGetCredentialsAsStringFromFilePath ¶
GcpGetCredentialsAsStringFromFilePath returns the GCE JSON file contents as a string
func GetBoolPointer ¶
GetBoolPointer returns a pointer to bool value
func GetFloat64Pointer ¶
GetFloat64Pointer returns a pointer to float64 type
func GetInt32Pointer ¶
GetInt32Pointer returns a pointer to int32 value
func GetInt64Pointer ¶
GetInt64Pointer returns a pointer to int64 value
func GetStringPointer ¶
GetStringPointer returns a pointer to string value
func IncompleteStates ¶
func IncompleteStates() []string
IncompleteStates return set of states for ongoing tasks
func IsFeatureFlagEnabled ¶
func IsFeatureFlagEnabled(featureFlag FeatureFlag) bool
IsFeatureFlagEnabled checks if feature flag is set in the env variable
func IsVersionStable ¶
func IsYBVersion ¶
IsYBVersion checks if the given string is a valid YB version string
func MapFromSingletonList ¶
func MapFromSingletonList(in []interface{}) map[string]interface{}
MapFromSingletonList returns a map of string -> interface from a slice of interface
func MapListFromInterfaceList ¶
func MapListFromInterfaceList(in []interface{}) []map[string]interface{}
MapListFromInterfaceList returns a map of string -> interface from a slice of interface
func ReadSSHPrivateKey ¶
ReadSSHPrivateKey retrives private key file contents from env variable
func StringMap ¶
StringMap accepts a string -> interface map and returns pointer to string -> string map
func StringSlice ¶
func StringSlice(in []interface{}) *[]string
StringSlice accepts array of interface and returns a pointer to slice of string
func StringSliceFromString ¶
StringSliceFromString accepts slice of string and returns a pointer to slice of string
func StringtoStringMap ¶
StringtoStringMap accepts a string -> string map and returns pointer to string -> string map
func YAMLtoString ¶
YAMLtoString reads yaml file and converts the data into a string
func YBARestrictBackupVersions ¶
func YBARestrictBackupVersions() []string
YBARestrictBackupVersions are certain YugabyteDB Anywhere versions >= min version for backups that would not support the operation
func YBARestrictFailedSubtasksVersions ¶
func YBARestrictFailedSubtasksVersions() []string
YBARestrictFailedSubtasksVersions are certain YugabyteDB Anywhere versions >= min version for of fetching failed subtask lists that would not support the operation
Types ¶
type AzureCredentials ¶
type AzureCredentials struct { TenantID string `json:"tenant_id"` SubscriptionID string `json:"subscription_id"` ClientSecret string `json:"client_secret"` ClientID string `json:"client_id"` ResourceGroup string `json:"resource_group"` }
AzureCredentials required for cloud provider
func AzureCredentialsFromEnv ¶
func AzureCredentialsFromEnv() (AzureCredentials, error)
AzureCredentialsFromEnv retrives azure credentials from env variables
type FeatureFlag ¶
type FeatureFlag string
FeatureFlag string holds the defined feature flags that can be set
const ( // TOOLS is a feature flag enabling doc generation TOOLS FeatureFlag = "TOOLS" PREVIEW FeatureFlag = "PREVIEW" )
func (FeatureFlag) String ¶
func (f FeatureFlag) String() string
type GCPCredentials ¶
type GCPCredentials struct { AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url,omitempty"` AuthURI string `json:"auth_uri,omitempty"` ClientEmail string `json:"client_email"` ClientID string `json:"client_id"` ClientX509CertURL string `json:"client_x509_cert_url"` PrivateKey string `json:"private_key"` PrivateKeyID string `json:"private_key_id"` ProjectID string `json:"project_id"` TokenURI string `json:"token_uri,omitempty"` Type string `json:"type"` }
GCPCredentials is a struct to hold values retrieved by parsing the GCE credentials json file
type KuberenetesMetadata ¶
type KuberenetesMetadata struct {
Name string `yaml:"name"`
}
KuberenetesMetadata to extract image pull secret name
type KubernetesPullSecretYAML ¶
type KubernetesPullSecretYAML struct {
Metadata *KuberenetesMetadata `yaml:"metadata"`
}
KuberenetesPullSecretYAML to extract image pull secret name
type StringListListFlag ¶
type StringListListFlag [][]string
StringListListFlag describes a list of list of strings
func (*StringListListFlag) Set ¶
func (s *StringListListFlag) Set(value string) error
Set value adds the value string to a list of list of string
func (*StringListListFlag) String ¶
func (s *StringListListFlag) String() string
String returns a string version of the JSON list of lists
func (*StringListListFlag) Type ¶
func (s *StringListListFlag) Type() string
Type function describes the custom defined type
type YbaStructuredError ¶
type YbaStructuredError struct { // User-visible unstructured error message Error *interface{} `json:"error,omitempty"` // Method for HTTP call that resulted in this error HTTPMethod *string `json:"httpMethod,omitempty"` // URI for HTTP request that resulted in this error RequestURI *string `json:"requestUri,omitempty"` // Mostly set to false to indicate failure Success *bool `json:"success,omitempty"` }
YbaStructuredError is a structure mimicking YBPError, with error being an interface{} to accomodate errors thrown as YBPStructuredError