cmd

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 19 Imported by: 0

README

guacinator/cmd

The guacinator/cmd package provides guacamole CLI utilities.

Table of contents:


Functions

CreateAdminUser
CreateAdminUser(string) error

CreateAdminUser creates a new admin user in Guacamole with the specified username and password.

Parameters:

user: A string representing the desired username for the new admin user. password: A string representing the desired password for the new admin user.

Returns:

error: An error if the admin user cannot be created.

CreateGuacamoleConnection
CreateGuacamoleConnection(VncHost) error

CreateGuacamoleConnection establishes a new connection in Guacamole using the provided VncHost information.

Parameters:

vncHost: A VncHost struct containing the necessary information for the connection.

Returns:

error: An error if the connection cannot be created.

DeleteGuacUser
DeleteGuacUser(string) error

DeleteGuacUser removes a specified Guacamole user.

Parameters:

user: A string representing the username of the Guacamole user to be deleted.

Returns:

error: An error if the specified user cannot be deleted.

Execute
Execute()

Execute runs the root cobra command


Installation

To use the guacinator/cmd package, you first need to install it. Follow the steps below to install via go get.

go get github.com/guacinator/cowdogmoo/cmd

Usage

After installation, you can import the package in your Go project using the following import statement:

import "github.com/guacinator/cowdogmoo/cmd"

Tests

To ensure the package is working correctly, run the following command to execute the tests for guacinator/cmd:

go test -v

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute runs the root cobra command

Types

type GuacService added in v1.0.1

type GuacService interface {
	CreateGuacamoleConnection(vnchost VncHost) error
	CreateAdminUser(user, password string) error
	DeleteGuacUser(user string) error
}

GuacService represents the interface for interacting with the Guacamole API.

**Methods:** CreateGuacamoleConnection: Creates a new Guacamole connection. CreateAdminUser: Creates a new Guacamole admin user. DeleteGuacUser: Deletes a Guacamole user.

type GuacServiceImpl added in v1.0.1

type GuacServiceImpl struct{}

GuacServiceImpl represents the implementation of the GuacService interface.

func (*GuacServiceImpl) CreateAdminUser added in v1.0.1

func (g *GuacServiceImpl) CreateAdminUser(user, password string) error

CreateAdminUser creates a new admin user in Guacamole with the specified username and password.

**Parameters:**

user: A string representing the desired username for the new admin user.

password: A string representing the desired password for the new admin user.

**Returns:**

error: An error if the admin user cannot be created.

Example
package main

import (
	"fmt"
)

func main() {
	// Define a username and password for the new admin user
	username := "test_admin"
	password := "test_password"

	// Create an actual instance of Guacamole service
	// guacService := guacinator.NewGuacService()

	// Call the function with the username and password
	// Here, instead of calling the actual function, we're just demonstrating how it would be used
	fmt.Println("guacService.CreateAdminUser(username, password)")

	_ = username
	_ = password
}
Output:

guacService.CreateAdminUser(username, password)

func (*GuacServiceImpl) CreateGuacamoleConnection added in v1.0.1

func (g *GuacServiceImpl) CreateGuacamoleConnection(vncHost VncHost) error

CreateGuacamoleConnection establishes a new connection

in Guacamole using the provided VncHost information. CreatePackageDocs generates documentation for all Go packages in the current directory and its subdirectories. It traverses the file tree using a provided afero.Fs and Repo to create a new README.md file in each directory containing a Go package. It uses a specified template file for generating the README files.

**Parameters:**

vncHost: A VncHost struct containing the necessary information for the connection.

**Returns:**

error: An error if the connection cannot be created.

Example
package main

import (
	"fmt"

	guacinator "github.com/cowdogmoo/guacinator/cmd"
)

func main() {
	// Define a VncHost struct
	vncHost := guacinator.VncHost{Name: "Test", IP: "192.168.1.1", Port: 5900, Password: "test_password"}

	// Create an actual instance of Guacamole service
	// guacService := guacinator.NewGuacService()

	// Call the function with the struct
	// Here, instead of calling the actual function, we're just demonstrating how it would be used
	fmt.Println("guacService.CreateGuacamoleConnection(vncHost)")

	_ = vncHost
}
Output:

guacService.CreateGuacamoleConnection(vncHost)

func (*GuacServiceImpl) DeleteGuacUser added in v1.0.1

func (g *GuacServiceImpl) DeleteGuacUser(user string) error

DeleteGuacUser removes a specified Guacamole user.

**Parameters:**

user: A string representing the username of the Guacamole user to be deleted.

**Returns:**

error: An error if the specified user cannot be deleted.

Example
package main

import (
	"fmt"
)

func main() {
	// Define a username for the Guacamole user to be deleted
	username := "test_user"

	// Create an actual instance of Guacamole service
	// guacService := guacinator.NewGuacService()

	// Call the function with the username
	// Here, instead of calling the actual function, we're just demonstrating how it would be used
	fmt.Println("guacService.DeleteGuacUser(username)")

	_ = username
}
Output:

guacService.DeleteGuacUser(username)

type VncHost

type VncHost struct {
	Name     string
	IP       string
	Port     int
	Password string
}

VncHost represents the parameters used to establish a new connection in Guacamole.

**Attributes:** Name: A string representing the name of the VNC host. IP: A string representing the IP address of the VNC host. Port: An integer representing the port to connect to on the VNC host. Password: A string representing the password for the VNC host.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳