### Install Afero Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/spf13/afero/README.md Use `go get` to install the Afero library. Then, import it into your Go application. ```bash go get github.com/spf13/afero ``` ```go import "github.com/spf13/afero" ``` -------------------------------- ### Install blackfriday-tool Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/russross/blackfriday/v2/README.md Download and install the `blackfriday-tool` command-line utility using `go get`. ```go go get github.com/russross/blackfriday-tool ``` -------------------------------- ### Install Golang Color Library Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/fatih/color/README.md Use 'go get' to install the color library. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install go.yaml.in/yaml/v3 Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/go.yaml.in/yaml/v3/README.md Use 'go get' to install the package. This command fetches and installs the specified package and its dependencies. ```bash go get go.yaml.in/yaml/v3 ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty package using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install uniseg Package Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/rivo/uniseg/README.md Use 'go get' to install the package. This command fetches and installs the specified package and its dependencies. ```bash go get github.com/rivo/uniseg ``` -------------------------------- ### Install Locafero Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/sagikazarmark/locafero/README.md Use this command to install the Locafero library using go get. ```shell go get github.com/sagikazarmark/locafero ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo/v2/README.md Use 'go get' to retrieve the SDK and add it to your GOPATH workspace or Go module dependencies. To update to the latest version, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/mongo.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/mongo.git ``` -------------------------------- ### Install Blackfriday v2 Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/russross/blackfriday/v2/README.md Use `go get` to install the package. It will be added to your current development module. ```go go get github.com/russross/blackfriday/v2 ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/vpn/v2/README.md Use 'go get' to retrieve the SDK and add it to your GOPATH workspace or project's Go module dependencies. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/vpn.git ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or Go module dependencies. To update, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/containerregistry.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/containerregistry.git ``` -------------------------------- ### Install go-tty Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/mattn/go-tty/README.md Installs the go-tty package using the go get command. ```bash $ go get github.com/mattn/go-tty ``` -------------------------------- ### Install Monitoring SDK Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/monitoring/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/monitoring.git ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/inmemorydb/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/inmemorydb.git ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/cdn.git ``` -------------------------------- ### Get Example Encryption Configuration Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/bucket/encryption/put.md Use this command to print an example JSON configuration for bucket encryption. This is useful for understanding the required structure before creating your own configuration file. ```text ionosctl object-storage bucket encryption put --json-properties-example ``` -------------------------------- ### Build and Run Cobra-Prompt Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionoscloudsdk/comptplus/README.md Navigate to the example directory, build the executable, and run it to explore the functionality of the original Cobra-Prompt. ```bash cd _example go build -o cobra-prompt ./cobra-prompt ``` -------------------------------- ### Install SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cert/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. To update, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/cert.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/cert.git ``` -------------------------------- ### Install uax29/v2/graphemes Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/clipperhouse/uax29/v2/graphemes/README.md Install the graphemes package using go get. ```bash go get github.com/clipperhouse/uax29/v2/graphemes ``` -------------------------------- ### Install ionosctl Locally on Windows Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/README.md After cloning the repository, use the 'go install' command to build and install the development version of ionosctl on Windows. ```bash go install ``` -------------------------------- ### Install Logging SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/logging/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/logging.git ``` -------------------------------- ### Install SDK with go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go/v6/README.md Use 'go get' to add the SDK to your GOPATH workspace or project's Go module dependencies. To update, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go/v6 ``` -------------------------------- ### Install Viper Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/spf13/viper/README.md Install Viper using go get. Viper uses Go Modules for dependency management. ```shell go get github.com/spf13/viper ``` -------------------------------- ### Install MariaDB SDK using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mariadb/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or Go module dependencies. To update, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mariadb.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mariadb.git ``` -------------------------------- ### Install Cobra Library Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/spf13/cobra/README.md Install the latest version of the Cobra library using go get. ```bash go get -u github.com/spf13/cobra@latest ``` -------------------------------- ### Show Example Tagging Configuration Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/bucket/tagging/put.md Execute this command to print an example JSON configuration for bucket tagging. This is useful for understanding the required format for the --json-properties flag. ```text ionosctl object-storage bucket tagging put --json-properties-example ``` -------------------------------- ### Install ionosctl on Windows using Scoop Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/README.md Add the Ionos Cloud scoop bucket and then install ionosctl on Windows. ```bash scoop bucket add ionos-cloud https://github.com/ionos-cloud/scoop-bucket.git scoop install ionos-cloud/ionosctl ``` -------------------------------- ### Install Dependencies Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-vm-autoscaling/README.md Install the necessary Go dependencies for the IONOS Cloud VM Auto Scaling client. Ensure you have `testify/assert` and `golang.org/x/net/context` installed. ```shell go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` -------------------------------- ### Install Latest SDK using go get with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/psql/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. To specifically get the latest repository version, use '@latest'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/psql@latest ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/mattn/go-colorable/README.md Install the go-colorable package using the go get command. This is the standard method for adding external Go packages to your project. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Get Example Lifecycle Configuration JSON Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/bucket/lifecycle/put.md Execute this command to print an example JSON structure for lifecycle configuration. This is useful for understanding the required format before creating your own configuration file. ```bash ionosctl object-storage bucket lifecycle put --json-properties-example ``` -------------------------------- ### Install IONOS Cloud SDK for Go Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/auth/v2/README.md Use 'go get' to add the SDK to your GOPATH workspace or Go module dependencies. To update, use 'go get -u'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/auth.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/auth.git ``` -------------------------------- ### Install Latest SDK with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cert/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to fetch the most recent SDK repository. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/cert@latest ``` -------------------------------- ### Install Specific SDK Version using Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. To fetch a specific version, append '@' to the command. Use '@latest' to get the most recent repository version. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/mongo@latest ``` -------------------------------- ### Install IONOS Cloud DNS SDK for Go Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dns/v2/README.md Use 'go get' to add the SDK to your project's Go module dependencies. To update to the latest version, use the '-u' flag. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/dns.git ``` ```bash go get -u github.com/ionos-cloud/sdk-go-bundle/products/dns.git ``` -------------------------------- ### Install Latest SDK Repository with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go/v6/README.md To get the latest SDK repository using Go modules, append '@latest' to your 'go get' command. ```bash go get github.com/ionos-cloud/sdk-go/v6@latest ``` -------------------------------- ### Install and Use Ionosctl CLI Source: https://github.com/ionos-cloud/ionosctl/blob/master/README.md Follow these steps to install ionosctl using Homebrew, authenticate your account, verify your identity, and run your first command to list datacenters. Finally, explore all available commands. ```bash # 1. Install (macOS example -- see Installation for all platforms) brew tap ionos-cloud/homebrew-ionos-cloud && brew install ionosctl # 2. Authenticate ionosctl login # 3. Verify your identity ionosctl cfg whoami # 4. Run your first command ionosctl datacenter list # 5. Explore available commands ionosctl --help ``` -------------------------------- ### Install Specific SDK Version using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2/README.md If using Go modules, you can specify a release version using '@' or '@latest' to get the latest tagged release. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/containerregistry@latest ``` -------------------------------- ### Setup Bash Auto-Completion Source: https://github.com/ionos-cloud/ionosctl/blob/master/README.md Source the completion script for the current session or add it to your ~/.bashrc for permanent setup. ```bash # Current session source <(ionosctl completion bash) # Permanent (add to ~/.bashrc) echo 'source <(ionosctl completion bash)' >> ~/.bashrc ``` -------------------------------- ### Install Specific SDK Version with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go/v6/README.md When using Go modules, specify a release version using '@' in your 'go get' command. ```bash go get github.com/ionos-cloud/sdk-go/v6@v6.0.0 ``` -------------------------------- ### Install Fake CLI Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/cilium/fake/README.md Compile and install the 'fake' binary using the 'install' make target. The binary is typically installed to /usr/local/bin/fake by default. You can specify a custom installation directory using the BINDIR environment variable. ```bash make install BINDIR=~/.local/bin make install ``` -------------------------------- ### Show Example Public Access Block Configuration Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/bucket/public/access/block/put.md Execute this command to display an example JSON structure for the public access block configuration. This is useful for understanding the required format before creating your own configuration file. ```text ionosctl object-storage bucket public-access-block put --json-properties-example ``` -------------------------------- ### View Example Bucket Policy JSON Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/bucket/policy/put.md Execute this command to print an example of the bucket policy JSON structure. This is useful for understanding the required format before creating your own policy file. ```text ionosctl object-storage bucket policy put --json-properties-example ``` -------------------------------- ### Start a Server Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Compute Engine/server/start.md Use this command to start a Server from a Virtual Data Center. If the Server's public IP was deallocated then a new IP will be assigned. Required values are Data Center ID and Server ID. ```text ionosctl compute server start --datacenter-id DATACENTER_ID --server-id SERVER_ID ``` -------------------------------- ### Get DNS Quotas Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/DNS/quota/get.md Use this command to retrieve your current DNS quota usage and limits. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl dns quota get ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go/v6/README.md Demonstrates how to set up basic HTTP authentication using the SDK. Ensure you replace placeholder values with your actual credentials and host URL. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go/v6" "log" ) func basicAuthExample() error { cfg := ionoscloud.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.Debug = true apiClient := ionoscloud.NewAPIClient(cfg) datacenters, _, err := apiClient.DataCentersApi.DatacentersGet(context.Background()).Depth(1).Execute() if err != nil { return fmt.Errorf("error retrieving datacenters %w", err) } if datacenters.HasItems() { for _, dc := range *datacenters.GetItems() { if dc.HasProperties() && dc.GetProperties().HasName() { fmt.Println(*dc.GetProperties().GetName()) } } } return nil } ``` -------------------------------- ### Install Dependencies for Go Client Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-cert-manager/README.md Installs necessary dependencies for the Go API client. Ensure these are present before integrating the SDK. ```shell go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context go get github.com/antihax/optional ``` -------------------------------- ### Install Ionosctl via Binary Download Source: https://github.com/ionos-cloud/ionosctl/blob/master/README.md Download the latest release archive for your OS and architecture, extract it, move the binary to a directory in your PATH, and verify the installation by checking the version. ```bash # Download and extract (replace with the full semantic version) curl -sL https://github.com/ionos-cloud/ionosctl/releases/download/v/ionosctl--linux-amd64.tar.gz | tar -xzv # Move to a directory in your PATH sudo mv ionosctl /usr/local/bin/ # Verify ionosctl version ``` -------------------------------- ### Get Mongo API Versions Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Database-as-a-Service/mongo/api/versions.md Use this command to retrieve a list of available Mongo API versions. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl dbaas mongo api-versions ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mongo/v2/README.md Demonstrates how to configure the SDK for basic authentication using username and password. Ensure you replace placeholder values with your actual credentials and host URL. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" mongo "github.com/ionos-cloud/sdk-go-bundle/products/mongo" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := mongo.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/inmemorydb/v2/README.md Demonstrates how to configure the SDK client using basic HTTP authentication with username and password. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" inmemorydb "github.com/ionos-cloud/sdk-go-bundle/products/inmemorydb" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := inmemorydb.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2/README.md Demonstrates how to configure the SDK for basic HTTP authentication. Ensure you replace placeholder credentials and host URL with your actual values. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := containerregistry.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Generate Example Tagging Configuration Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Object-Storage/object/tagging/put.md Execute this command to print an example JSON structure for object tagging configuration. This is useful for understanding the required format before creating your own tagging file. ```text ionosctl object-storage object tagging put --json-properties-example ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2/README.md Example demonstrating how to set up basic authentication for the CDN API client. It shows how to create a configuration with credentials and host URL, and then initialize the API client. Ensure to replace placeholders with your actual credentials and desired host URL. ```golang import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" cdn "github.com/ionos-cloud/sdk-go-bundle/products/cdn" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := cdn.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/auth/v2/README.md Demonstrates how to set up basic HTTP authentication using the IONOS Cloud SDK for Go. Configure credentials and optionally set the log level. ```golang import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" auth "github.com/ionos-cloud/sdk-go-bundle/products/auth" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := auth.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Generate Example YAML Config Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/CLI Setup/login.md Prints an example YAML configuration file to standard output without performing an authentication step. Useful for understanding the config file structure. ```text ionosctl config login --example ``` -------------------------------- ### Initializing OsFs Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/spf13/afero/README.md Demonstrates the initialization of OsFs, which wraps native OS calls. This is useful for using the actual operating system's file system during operation. ```go appfs := afero.NewOsFs() appfs.MkdirAll("src/a", 0755) ``` -------------------------------- ### Download and Install ionosctl from GitHub Release Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/README.md Manually download, extract, and install the ionosctl binary from a GitHub release. Ensure /usr/local/bin is in your PATH. ```bash # Check if /usr/local/bin is part of your PATH echo $PATH # Download and extract the binary ( is the full semantic version): curl -sL https://github.com/ionos-cloud/ionosctl/releases/download/v/ionosctl--linux-amd64.tar.gz | tar -xzv # Move the binary somewhere in your $PATH: sudo mv ionosctl /usr/local/bin # Use the ionosctl CLI ionosctl help ``` -------------------------------- ### Commented TOML Configuration Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/pelletier/go-toml/v2/README.md Example of a TOML configuration file that includes comments and commented-out values, demonstrating go-toml's ability to preserve these annotations. ```toml # Host IP to connect to. host = '127.0.0.1' # Port of the remote server. port = 4242 # Encryption parameters (optional) # [TLS] # cipher = 'AEAD-AES128-GCM-SHA256' # version = 'TLS 1.3' ``` -------------------------------- ### Generate Example JSON for Pipeline Creation Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Logging-Service/pipeline/create.md Execute this command to generate an example JSON structure that can be used with the `--json-properties` flag. This helps in understanding the required format for pipeline configuration. ```text ionosctl logging-service pipeline create --json-properties-example ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/logging/v2/README.md Demonstrates how to configure the API client for basic HTTP authentication. Ensure you replace placeholder values with your actual credentials and host URL. The log level can be set to Trace for detailed logging. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" logging "github.com/ionos-cloud/sdk-go-bundle/products/logging" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := logging.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Get Cobra-Prompt Module Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionoscloudsdk/comptplus/README.md Use this command to get the original Cobra-Prompt module. Comptplus is a fork and may have different installation instructions. ```bash go get github.com/stromland/cobra-prompt ``` -------------------------------- ### Initializing MemMapFs Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/spf13/afero/README.md Shows how to initialize MemMapFs, an atomic, fully concurrent memory-backed filesystem. It's ideal for mocking and speeding up operations when persistence is not required. ```go mm := afero.NewMemMapFs() mm.MkdirAll("src/a", 0755) ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/auth/v2/README.md Demonstrates how to initialize the IONOS Cloud SDK client using basic authentication with username and password, and optionally setting a host URL and log level. ```APIDOC ## Basic Authentication Example ### Description This example shows how to set up basic authentication for the IONOS Cloud SDK using your IONOS Cloud portal credentials. You can also specify a custom API URL and log level. ### Method Initialization of the SDK client. ### Endpoint Not applicable (SDK client initialization). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```golang import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" auth "github.com/ionos-cloud/sdk-go-bundle/products/auth" "log" ) func basicAuthExample() error { // Initialize configuration with username, password, token (empty string if not used), and optional host URL. cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") // Set the log level for the SDK. cfg.LogLevel = Trace // Create a new API client using the configuration. apiClient := auth.NewAPIClient(cfg) // The apiClient is now ready to be used for authentication-related operations. fmt.Println("API client initialized successfully.") return nil } ``` ### Response #### Success Response (200) Initialization of the client does not return a direct HTTP response. Success is indicated by the absence of errors during client creation. #### Response Example None (SDK client initialization). ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cert/v2/README.md Demonstrates how to set up basic authentication for the IONOS Cloud API client using username, password, and an optional host URL. The log level can also be configured. ```golang import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" cert "github.com/ionos-cloud/sdk-go-bundle/products/cert" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiclient := cert.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Install Specific MariaDB SDK Version using go get Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mariadb/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. To specify a version, use '@'. To get the latest repository, use '@latest'. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/dbaas/mariadb@latest ``` -------------------------------- ### Token Authentication Example (Manual Token) Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/logging/v2/README.md Illustrates configuring the Logging API client using a pre-generated token. This method assumes you have already generated a token using `ionosctl` and exported it as an environment variable `IONOS_TOKEN`. The log level is set to Trace. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/products/auth" logging "github.com/ionos-cloud/sdk-go-bundle/products/logging" "log" ) func TokenAuthExample() error { //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_TOKEN as env variables authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv()) cfg.LogLevel = Trace apiClient := logging.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Create In-Memory DB Replica Set with Persistence and Eviction Policies Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Database-as-a-Service/In-Memory-DB/replicaset/create.md This example demonstrates creating an In-Memory DB replica set with specific persistence and eviction policies. Persistence modes include None, AOF, RDB, and RDB_AOF. Eviction policies manage how data is removed when memory limits are reached, with options like noeviction, allkeys-lru, volatile-lfu, and more. ```text ionosctl dbaas in-memory-db replicaset create --name --datacenter --region --availability-zone --memory-size --replicas --persistence-mode --eviction-policy ``` -------------------------------- ### List Snapshots Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Compute Engine/snapshot/list.md Use this command to retrieve a list of all available snapshots. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl compute snapshot list ``` -------------------------------- ### Token Authentication Example (SDK Generated Token) Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/logging/v2/README.md Shows how to generate an authentication token using the auth SDK and then configure the Logging API client with it. This method requires setting IONOS_USERNAME and IONOS_PASSWORD environment variables for token generation. The generated token is then used in the configuration. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/products/auth" "github.com/ionos-cloud/sdk-go-bundle/shared" logging "github.com/ionos-cloud/sdk-go-bundle/products/logging" "log" ) func TokenAuthExample() error { //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_USERNAME and IONOS_PASSWORD as env variables authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv()) jwt, _, err := auth.TokensApi.TokensGenerate(context.Background()).Execute() if err != nil { return fmt.Errorf("error occurred while generating token (%w)", err) } if !jwt.HasToken() { return fmt.Errorf("could not generate token") } cfg := shared.NewConfiguration("", "", *jwt.GetToken(), "hostUrl_here") cfg.LogLevel = Trace apiClient := logging.NewAPIClient(cfg) return nil } ``` -------------------------------- ### List BackupUnits Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Managed-Backup/list.md Use this command to retrieve a list of all BackupUnits associated with your account. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl compute backupunit list ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/psql/v2/README.md Demonstrates how to set up basic HTTP authentication for the IONOS Cloud API client. Ensure to replace placeholder credentials and host URL. The LogLevel can be set to Trace for debugging. ```golang import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" psql "github.com/ionos-cloud/sdk-go-bundle/products/psql" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := psql.NewAPIClient(cfg) return nil } ``` -------------------------------- ### List PostgreSQL Backups Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Database-as-a-Service/postgres/v2/backup/list.md Use this command to retrieve a list of PostgreSQL Backups. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl dbaas postgres-v2 backup list ``` -------------------------------- ### List All Container Registries Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Container-Registry/registry/list.md Use this command to retrieve a list of all container registries. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl container-registry registry list ``` -------------------------------- ### Token Authentication using SDK Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/inmemorydb/v2/README.md Shows how to generate an authentication token using the SDK's auth product and then configure the In-MemoryDB client with it. Requires IONOS_USERNAME and IONOS_PASSWORD environment variables. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/products/auth" "github.com/ionos-cloud/sdk-go-bundle/shared" inmemorydb "github.com/ionos-cloud/sdk-go-bundle/products/inmemorydb" "log" ) func TokenAuthExample() error { //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_USERNAME and IONOS_PASSWORD as env variables authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv()) jwt, _, err := auth.TokensApi.TokensGenerate(context.Background()).Execute() if err != nil { return fmt.Errorf("error occurred while generating token (%w)", err) } if !jwt.HasToken() { return fmt.Errorf("could not generate token") } cfg := shared.NewConfiguration("", "", *jwt.GetToken(), "hostUrl_here") cfg.LogLevel = Trace apiClient := inmemorydb.NewAPIClient(cfg) return nil } ``` -------------------------------- ### List WireGuard Gateways Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/VPN Gateway/wireguard/gateway/list.md Use this command to retrieve a list of all configured WireGuard Gateways. No specific setup is required beyond having the ionosctl CLI installed and authenticated. ```text ionosctl vpn wireguard gateway list ``` -------------------------------- ### List PostgreSQL Clusters Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Database-as-a-Service/postgres/v2/cluster/list.md Use this command to retrieve a list of all PostgreSQL Clusters provisioned under your account. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl dbaas postgres-v2 cluster list ``` -------------------------------- ### API Key Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-vm-autoscaling/README.md Demonstrates how to set up API key authentication for requests. The API key must be added to a map with the key 'Authorization' and passed as the auth context. ```golang auth := context.WithValue( context.Background(), sw.ContextAPIKeys, map[string]sw.APIKey{ "Authorization": {Key: "API_KEY_STRING"}, }, ) r, err := client.Service.Operation(auth, args) ``` -------------------------------- ### List PostgreSQL Backup Locations Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/subcommands/Database-as-a-Service/postgres/v2/backup/location/list.md Use this command to retrieve a list of PostgreSQL Backup Locations. No specific setup is required beyond having the ionosctl CLI installed and configured. ```text ionosctl dbaas postgres-v2 backup location list ``` -------------------------------- ### Basic Authentication Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/kafka/v2/README.md Demonstrates how to configure the Kafka API client using basic HTTP authentication with username and password. ```go import ( "context" "fmt" "github.com/ionos-cloud/sdk-go-bundle/shared" kafka "github.com/ionos-cloud/sdk-go-bundle/products/kafka" "log" ) func basicAuthExample() error { cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") cfg.LogLevel = Trace apiClient := kafka.NewAPIClient(cfg) return nil } ``` -------------------------------- ### Clean Parseable Output with --no-headers and --cols Source: https://github.com/ionos-cloud/ionosctl/blob/master/README.md Use --no-headers and --cols flags to get clean, parseable output containing only specific columns. This example lists server IDs. ```bash # Use --no-headers and --cols for clean parseable output ionosctl server list --datacenter-id "$DC_ID" --cols ServerId --no-headers ``` -------------------------------- ### Basic Interactive Prompt with Autocompletion Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/elk-language/go-prompt/README.md This example demonstrates how to set up a basic interactive prompt with autocompletion functionality. It defines a completer function that suggests table names based on user input and uses the prompt.Input function to display the prompt. ```go package main import ( "fmt" "github.com/elk-language/go-prompt" pstrings "github.com/elk-language/go-prompt/strings" ) func completer(d prompt.Document) ([]prompt.Suggest, pstrings.RuneNumber, pstrings.RuneNumber) { endIndex := d.CurrentRuneIndex() w := d.GetWordBeforeCursor() startIndex := endIndex - pstrings.RuneCount(w) s := []prompt.Suggest{ {Text: "users", Description: "Store the username and age"}, {Text: "articles", Description: "Store the article text posted by user"}, {Text: "comments", Description: "Store the text commented to articles"}, } return prompt.FilterHasPrefix(s, w, true), startIndex, endIndex } func main() { fmt.Println("Please select table.") t := prompt.Input( prompt.WithPrefix("> "), prompt.WithCompleter(completer), ) fmt.Println("You selected " + t) } ``` -------------------------------- ### Install ionosctl on macOS using Homebrew Source: https://github.com/ionos-cloud/ionosctl/blob/master/docs/README.md Install ionosctl on macOS by adding the Ionos Cloud tap and then installing the package. ```bash brew tap ionos-cloud/homebrew-ionos-cloud brew install ionosctl ``` -------------------------------- ### Basic fsnotify Watcher Example Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/fsnotify/fsnotify/README.md This example demonstrates how to create a new watcher, listen for events and errors in a goroutine, add a path to watch, and then block the main goroutine indefinitely. Ensure you handle watcher errors and close the watcher when done. ```go package main import ( "log" "github.com/fsnotify/fsnotify" ) func main() { // Create new watcher. watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() // Start listening for events. go func() { for { select { case event, ok := <-watcher.Events: if !ok { return } log.Println("event:", event) if event.Has(fsnotify.Write) { log.Println("modified file:", event.Name) } case err, ok := <-watcher.Errors: if !ok { return } log.Println("error:", err) } } }() // Add a path. err = watcher.Add("/tmp") if err != nil { log.Fatal(err) } // Block main goroutine forever. <-make(chan struct{}) } ``` -------------------------------- ### Get Latest SDK with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/kafka/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to explicitly get the latest repository version. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/kafka@latest ``` -------------------------------- ### Get Latest SDK Version with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/monitoring/v2/README.md When using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to get the latest SDK repository. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/monitoring@latest ``` -------------------------------- ### Get Latest SDK Repository with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/dbaas/inmemorydb/v2/README.md If using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to get the latest repository version. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/inmemorydb@latest ``` -------------------------------- ### Get Latest SDK Repository with Go Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2/README.md If using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to get the latest repository version. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/cdn@latest ``` -------------------------------- ### Get Latest IONOS Cloud SDK for Go with Modules Source: https://github.com/ionos-cloud/ionosctl/blob/master/vendor/github.com/ionos-cloud/sdk-go-bundle/products/auth/v2/README.md If using Go modules, 'go get' defaults to the latest tagged release. Use '@latest' to get the latest repository version. ```bash go get github.com/ionos-cloud/sdk-go-bundle/products/auth@latest ```