c2

package
v0.0.0-...-09899ef Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteLoadBalancer

func DeleteLoadBalancer(token, loadBalancerID string) error

DeleteLoadBalancer undeploys and deletes the given load balancer

func DeleteNode

func DeleteNode(token, nodeID string) error

DeleteNode undeploys and deletes the given node

Types

type ContainerCreateResult

type ContainerCreateResult struct {
	ContainerIds        []string
	ContainerInterfaces []*NetworkInterface
}

ContainerCreateResult is a struct representing the response from container creation function.

type ContainerParams

type ContainerParams struct {
	Region             string
	ResourceGroupName  string
	Image              *string
	VirtualNetworkID   *string
	ContainerGroupName *string
	ContainerName      *string
	CPU                *int64
	Memory             *int64
	Entrypoint         []*string
	SecurityGroupIds   []string
	SubnetIds          []string
	Environment        map[string]interface{}
	Security           map[string]interface{}
}

ContainerParams is a structure of params common to AWS and Azure containers

type LoadBalancer

type LoadBalancer struct {
	api.Model

	NetworkID      uuid.UUID              `json:"network_id,omitempty"`
	ApplicationID  *uuid.UUID             `json:"application_id,omitempty"`
	OrganizationID *uuid.UUID             `json:"organization_id,omitempty"`
	Name           *string                `json:"name"`
	Description    *string                `json:"description"`
	Type           *string                `json:"type"`
	Host           *string                `json:"host"`
	IPv4           *string                `json:"ipv4"`
	IPv6           *string                `json:"ipv6"`
	Region         *string                `json:"region"`
	Status         *string                `json:"status"`
	Config         map[string]interface{} `json:"config"`
}

LoadBalancer instances represent a physical or virtual load balancer of a specific type

func CreateLoadBalancer

func CreateLoadBalancer(token string, params map[string]interface{}) (*LoadBalancer, error)

CreateLoadBalancer creates and deploys a new load balancer for the given authorization scope

func ListLoadBalancers

func ListLoadBalancers(token string, params map[string]interface{}) ([]*LoadBalancer, error)

ListLoadBalancers list load balancers for the given authorization scope

func (*LoadBalancer) DNSName

func (l *LoadBalancer) DNSName() *string

DNSName returns the preferred DNS name for the load balancer

func (*LoadBalancer) ReachableOnPort

func (l *LoadBalancer) ReachableOnPort(port uint) bool

ReachableOnPort returns true if the given load balancer port is reachable via TCP

type NetworkInterface

type NetworkInterface struct {
	Host        *string
	IPv4        *string
	IPv6        *string
	PrivateIPv4 *string
	PrivateIPv6 *string
}

NetworkInterface represents a common network interface

type Node

type Node struct {
	api.Model

	NetworkID      uuid.UUID              `json:"network_id"`
	UserID         *uuid.UUID             `json:"user_id"`
	ApplicationID  *uuid.UUID             `json:"application_id"`
	OrganizationID *uuid.UUID             `json:"organization_id"`
	Bootnode       bool                   `json:"-"`
	Host           *string                `json:"host"`
	IPv4           *string                `json:"ipv4"`
	IPv6           *string                `json:"ipv6"`
	PrivateIPv4    *string                `json:"private_ipv4"`
	PrivateIPv6    *string                `json:"private_ipv6"`
	Description    *string                `json:"description"`
	Role           *string                `json:"role"`
	Status         *string                `json:"status"`
	Config         map[string]interface{} `json:"config"`
}

Node instances represent physical or virtual, cloud-agnostic infrastructure on a network

func CreateNode

func CreateNode(token string, params map[string]interface{}) (*Node, error)

CreateNode creates and deploys a new node for the given authorization scope

func GetNodeDetails

func GetNodeDetails(token, nodeID string, params map[string]interface{}) (*Node, error)

GetNodeDetails fetches details for the given node

func ListNodes

func ListNodes(token string, params map[string]interface{}) ([]*Node, error)

ListNodes list nodes for the given authorization scope

func (*Node) ReachableOnPort

func (n *Node) ReachableOnPort(port uint) bool

ReachableOnPort returns true if the given node port is reachable via TCP

type NodeLog

type NodeLog struct {
	Timestamp       *int64 `json:"timestamp"`
	IngestTimestamp *int64 `json:"ingest_timestamp"`
	Message         string `json:"message"`
}

NodeLog represents an abstract API response containing syslog or similar messages

type NodeLogsResponse

type NodeLogsResponse struct {
	Logs      []*NodeLog `json:"logs"`
	PrevToken *string    `json:"prev_token"`
	NextToken *string    `json:"next_token"`
}

NodeLogsResponse represents an abstract API response containing NodeLogs and pointer tokens to the next set of events in the stream

func GetNodeLogs

func GetNodeLogs(token, nodeID string, params map[string]interface{}) (*NodeLogsResponse, error)

GetNodeLogs fetches the logs for the given node

type Service

type Service struct {
	api.Client
}

Service for the c2 api

func InitC2Service

func InitC2Service(token string) *Service

InitC2Service convenience method to initialize an `c2.Service` instance

type TargetCredentials

type TargetCredentials struct {
	AWSAccessKeyID     *string
	AWSSecretAccessKey *string

	AzureSubscriptionID *string
	AzureTenantID       *string
	AzureClientID       *string
	AzureClientSecret   *string
}

TargetCredentials struct has all credentials to access AWS and Azure in one place

func (*TargetCredentials) IsValidAWSCredentials

func (t *TargetCredentials) IsValidAWSCredentials() bool

IsValidAWSCredentials returns `true` if the `TargetCredentials` struct has both `AWSAccessKeyID` and `AWSSecretAccessKey`

func (*TargetCredentials) IsValidAzureCredentials

func (t *TargetCredentials) IsValidAzureCredentials() bool

IsValidAzureCredentials returns `true` if the `TargetCredentials` struct has `AzureSubscriptionID`, `AzureTenantID`, `AzureClientID` and `AzureClientSecret`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL