cphalo

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: MIT Imports: 10 Imported by: 2

README

CPHalo GoLang Package

Go package for consuming CloudPassage Halo API.

pipeline status coverage report coverage report coverage report coverage report

CPHalo API documentation (credentials needed)

Usage

Install

go get -u gitlab.com/kiwicom/cphalo-go

Import package

import "gitlab.com/kiwicom/cphalo-go"

Initialize client

cpAppKey := "CP_APPLICATION_KEY"
cpAppSecret := "CP_APPLICATION_SECRET"

client := cphalo.NewClient(cpAppKey, cpAppSecret, nil)

Do stuff

resp, err := client.ListServerGroups()

if err != nil {
    log.Fatalf("failed to get server groups: %v", err)
}

for _, sg := range resp.Groups {
    fmt.Println(sg.Name)
}
Example

The following example prints names of all Server Groups.

package main

import (
	"fmt"
	"log"

	"gitlab.com/kiwicom/cphalo-go"
)

func main() {
	cpAppKey := "CP_APPLICATION_KEY"
	cpAppSecret := "CP_APPLICATION_SECRET"

	client := cphalo.NewClient(cpAppKey, cpAppSecret, nil)

	resp, err := client.ListServerGroups()

	if err != nil {
		log.Fatalf("failed to get server groups: %v", err)
	}

	for _, sg := range resp.Groups {
		fmt.Println(sg.Name)
	}
}

Contributing

Bug reports, fixes and enhancements are always welcome!

License

MIT

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout for the client.
	DefaultTimeout = 10 * time.Second
	// DefaultMaxAuthTries determines how many times to try to auth before giving up.
	DefaultMaxAuthTries = 3
	// DefaultBaseURL of the CPHalo API endpoint.
	DefaultBaseURL = "https://api.cloudpassage.com"
	// DefaultAPIVersion is the version of the CPHalo API endpoint.
	DefaultAPIVersion = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertProfile

type AlertProfile struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	GroupID     string    `json:"group_id"`
	GroupName   string    `json:"group_name"`
	Description string    `json:"description"`
	Frequency   string    `json:"frequency"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	CreatedBy   string    `json:"created_by"`
	UpdatedBy   string    `json:"updated_by"`
	Shared      bool      `json:"shared"`
	UsedBy      []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"used_by"`
}

AlertProfile represent a CPHalo alert profile.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#alert-profile-representation

type CSPAccount

type CSPAccount struct {
	ID                       string `json:"id"`
	CSPAccountType           string `json:"csp_account_type,omitempty"`
	CSPRegionType            string `json:"csp_region_type,omitempty"`
	CSPAccountID             string `json:"csp_account_id,omitempty"`
	CSPAccountAlias          string `json:"csp_account_alias,omitempty"`
	AccountDisplayName       string `json:"account_display_name,omitempty"`
	CreatedAt                string `json:"created_at,omitempty"`
	UpdatedAt                string `json:"updated_at,omitempty"`
	UserID                   string `json:"user_id,omitempty"`
	GroupID                  string `json:"group_id,omitempty"`
	MonitoringState          string `json:"monitoring_state,omitempty"`
	InitialScanCompleted     bool   `json:"initial_scan_completed,omitempty"`
	InitialRulesRunCompleted bool   `json:"initial_rules_run_completed,omitempty"`
	InitialScanSummary       struct {
		S3         string `json:"s3,omitempty"`
		Route53    string `json:"route53,omitempty"`
		Lambda     string `json:"lambda,omitempty"`
		Iam        string `json:"iam,omitempty"`
		Ec2        string `json:"ec2,omitempty"`
		Vpc        string `json:"vpc,omitempty"`
		CloudTrail string `json:"cloud_trail,omitempty"`
		APIGateway string `json:"api_gateway,omitempty"`
	} `json:"initial_scan_summary,omitempty"`
	ScanStatus          string `json:"scan_status,omitempty"`
	ErrorDetail         string `json:"error_detail,omitempty"`
	TimeOfLastScan      string `json:"time_of_last_scan,omitempty"`
	AzureDirectoryID    string `json:"azure_directory_id,omitempty"`
	AzureApplicationID  string `json:"azure_application_id,omitempty"`
	AzureApplicationKey string `json:"azure_application_key,omitempty"`
	AWSAccessKey        string `json:"aws_access_key,omitempty"`
	AWSSecret           string `json:"aws_secret,omitempty"`
	AWSRoleArn          string `json:"aws_role_arn,omitempty"`
	AWSExternalID       string `json:"aws_external_id,omitempty"`
	AWSSnsStatus        string `json:"aws_sns_status,omitempty"`
	AwsSnsArn           string `json:"aws_sns_arn,omitempty"`
	AwsSnsErrorDetail   string `json:"aws_sns_error_detail,omitempty"`
}

CSPAccount represent a CPHalo CSP account.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-accounts-object

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages communication with CPHalo API.

func NewClient

func NewClient(appKey string, appSecret string, client *http.Client) *Client

NewClient creates a new CPHalo Client

func (*Client) CreateCSPAccount

func (c *Client) CreateCSPAccount(account CreateCSPAccountAWSRequest) (response CreateCSPAccountResponse, err error)

CreateCSPAccount creates a new CSP account.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-create-account

func (*Client) CreateFirewallInterface

func (c *Client) CreateFirewallInterface(fwInterface FirewallInterface) (response CreateFirewallInterfaceResponse, err error)

CreateFirewallInterface creates a new firewall interface.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#create-a-new-firewall-interface

func (*Client) CreateFirewallPolicy

func (c *Client) CreateFirewallPolicy(policy FirewallPolicy) (response CreateFirewallPolicyResponse, err error)

CreateFirewallPolicy creates a new firewall policy.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#create-new-firewall-policy

func (*Client) CreateFirewallRule

func (c *Client) CreateFirewallRule(policyID string, rule FirewallRule) (response CreateFirewallRuleResponse, err error)

CreateFirewallRule creates a new firewall rule.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#add-new-firewall-rule-to-the-firewall-policy

func (*Client) CreateFirewallService

func (c *Client) CreateFirewallService(service FirewallService) (response CreateFirewallServiceResponse, err error)

CreateFirewallService creates a new firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#create-a-new-firewall-service

func (*Client) CreateFirewallZone

func (c *Client) CreateFirewallZone(zone FirewallZone) (response CreateFirewallZoneResponse, err error)

CreateFirewallZone creates a new firewall zone.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#create-a-new-firewall-zone

func (*Client) CreateServerGroup

func (c *Client) CreateServerGroup(group ServerGroup) (response CreateServerGroupResponse, err error)

CreateServerGroup creates new server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#create-a-new-server-group

func (*Client) DeleteCSPAccount

func (c *Client) DeleteCSPAccount(ID string) error

DeleteCSPAccount deletes a CSP account.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-delete-account

func (*Client) DeleteFirewallInterface

func (c *Client) DeleteFirewallInterface(ID string) error

DeleteFirewallInterface deletes a firewall interface.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-firewall-interface

func (*Client) DeleteFirewallPolicy

func (c *Client) DeleteFirewallPolicy(ID string) error

DeleteFirewallPolicy deletes a firewall policy.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-firewall-policy

func (*Client) DeleteFirewallRule

func (c *Client) DeleteFirewallRule(policyID, ruleID string) error

DeleteFirewallRule deletes a firewall rule.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-firewall-rule

func (*Client) DeleteFirewallService

func (c *Client) DeleteFirewallService(ID string) error

DeleteFirewallService deletes a firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-firewall-service

func (*Client) DeleteFirewallZone

func (c *Client) DeleteFirewallZone(ID string) error

DeleteFirewallZone deletes a firewall zone.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-firewall-zone

func (*Client) DeleteServer

func (c *Client) DeleteServer(ID string) error

DeleteServer deletes the server.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-server

func (*Client) DeleteServerGroup

func (c *Client) DeleteServerGroup(ID string) error

DeleteServerGroup deletes server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#delete-server-group-without-any-servers

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do executes the request CPHalo API.

func (*Client) GetCSPAccount

func (c *Client) GetCSPAccount(ID string) (response GetCSPAccountResponse, err error)

GetCSPAccount returns details of the CSP account.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-accounts

func (*Client) GetFirewallInterface

func (c *Client) GetFirewallInterface(ID string) (response GetFirewallInterfaceResponse, err error)

GetFirewallInterface returns details of the firewall interface.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-firewall-interface-details

func (*Client) GetFirewallPolicy

func (c *Client) GetFirewallPolicy(ID string) (response GetFirewallPolicyResponse, err error)

GetFirewallPolicy returns details of the firewall policy.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-firewall-policy-details-including-firewall-rules

func (*Client) GetFirewallRule

func (c *Client) GetFirewallRule(policyID, ruleID string) (response GetFirewallRuleResponse, err error)

GetFirewallRule returns details of the firewall rule.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-firewall-rule-details

func (*Client) GetFirewallService

func (c *Client) GetFirewallService(ID string) (response GetFirewallServiceResponse, err error)

GetFirewallService returns details of the firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-firewall-service-details

func (*Client) GetFirewallZone

func (c *Client) GetFirewallZone(ID string) (response GetFirewallZoneResponse, err error)

GetFirewallZone returns details of the firewall zone.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-zones

func (*Client) GetServer

func (c *Client) GetServer(ID string) (response GetServersResponse, err error)

GetServer returns the server information.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-a-single-server

func (*Client) GetServerGroup

func (c *Client) GetServerGroup(ID string) (response GetServerGroupResponse, err error)

GetServerGroup return information describing a single group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-a-single-server-group

func (*Client) GetServerGroupFirewallPolicy added in v0.1.2

func (c *Client) GetServerGroupFirewallPolicy(ID string) (response GetServerGroupFirewallPolicyResponse, err error)

GetServerGroupFirewallPolicy return information describing firewall policies for a single group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#get-a-single-server-group

func (*Client) ListAlertProfiles

func (c *Client) ListAlertProfiles() (response ListAlertProfilesResponse, err error)

ListAlertProfiles lists all defined alert profiles.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-alert-profiles

func (*Client) ListCSPAccounts

func (c *Client) ListCSPAccounts() (response ListCSPAccountsResponse, err error)

ListCSPAccounts lists all CSP accounts.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-get-list-accounts

func (*Client) ListFirewallInterfaces

func (c *Client) ListFirewallInterfaces() (response ListFirewallInterfacesResponse, err error)

ListFirewallInterfaces lists all firewall interfaces.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-interfaces

func (*Client) ListFirewallPolicies

func (c *Client) ListFirewallPolicies() (response ListFirewallPoliciesResponse, err error)

ListFirewallPolicies lists all firewall policies.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-policies

func (*Client) ListFirewallRules

func (c *Client) ListFirewallRules(policyID string) (response ListFirewallRulesResponse, err error)

ListFirewallRules lists all firewall rules.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-rules-in-firewall-policy

func (*Client) ListFirewallServices

func (c *Client) ListFirewallServices() (response ListFirewallServicesResponse, err error)

ListFirewallServices lists all firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-services

func (*Client) ListFirewallZones

func (c *Client) ListFirewallZones() (response ListFirewallZonesResponse, err error)

ListFirewallZones lists all firewall zones.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-firewall-zones

func (*Client) ListServerGroups

func (c *Client) ListServerGroups() (response ListServerGroupsResponse, err error)

ListServerGroups lists all server groups.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-server-groups

func (*Client) ListServers

func (c *Client) ListServers() (response ListServersResponse, err error)

ListServers lists all servers.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-servers

func (*Client) MoveServer

func (c *Client) MoveServer(ID, gID string) error

MoveServer moves the server into another group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#move-server-into-a-server-group

func (*Client) RetireServer

func (c *Client) RetireServer(ID string) error

RetireServer retires the server.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#retire-server

func (*Client) UpdateCSPAccount

func (c *Client) UpdateCSPAccount(account CSPAccount) error

UpdateCSPAccount updates CSP account.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#csp-update-account

func (*Client) UpdateFirewallInterface

func (c *Client) UpdateFirewallInterface(fwInterface FirewallInterface) error

UpdateFirewallInterface updates firewall interface.

CPHalo API Docs: https://library.cloudpassage.com/help/cloudpassage-api-documentation#firewall-interfaces

func (*Client) UpdateFirewallPolicy

func (c *Client) UpdateFirewallPolicy(policy FirewallPolicy) error

UpdateFirewallPolicy updates firewall policy.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#update-name-or-description-for-the-firewall-policy

func (*Client) UpdateFirewallRule

func (c *Client) UpdateFirewallRule(policyID string, rule FirewallRule) error

UpdateFirewallRule updates firewall rule.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#update-firewall-rule

func (*Client) UpdateFirewallService

func (c *Client) UpdateFirewallService(service FirewallService) error

UpdateFirewallService updates firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/cloudpassage-api-documentation#firewall-services

func (*Client) UpdateFirewallZone

func (c *Client) UpdateFirewallZone(zone FirewallZone) error

UpdateFirewallZone updates firewall zone.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#update-firewall-zone

func (*Client) UpdateServerGroup

func (c *Client) UpdateServerGroup(group ServerGroup) error

UpdateServerGroup updates server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#update-server-group-attributes

func (*Client) UpdateServerGroupFirewallPolicy added in v0.1.2

func (c *Client) UpdateServerGroupFirewallPolicy(group ServerGroupFirewallPolicy) error

UpdateServerGroupFirewallPolicy updates firewall policies for a server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#assign-a-firewall-policy-to-the-server-group

type CreateCSPAccountAWSRequest

type CreateCSPAccountAWSRequest struct {
	ExternalID         string `json:"aws_external_id,omitempty"`
	RoleArn            string `json:"aws_role_arn,omitempty"`
	SnsArn             string `json:"aws_sns_arn,omitempty"`
	GroupID            string `json:"group_id,omitempty"`
	CSPAccountType     string `json:"csp_account_type,omitempty"`
	CSPRegionType      string `json:"csp_region_type,omitempty"`
	AccountDisplayName string `json:"account_display_name,omitempty"`
}

CreateCSPAccountAWSRequest represent a create CSP account request.

type CreateCSPAccountResponse

type CreateCSPAccountResponse GetCSPAccountResponse

CreateCSPAccountResponse represent a create CSP account response.

type CreateFirewallInterfaceRequest

type CreateFirewallInterfaceRequest = GetFirewallInterfaceResponse

CreateFirewallInterfaceRequest represent a create firewall interface request.

type CreateFirewallInterfaceResponse

type CreateFirewallInterfaceResponse = GetFirewallInterfaceResponse

CreateFirewallInterfaceResponse represent a create firewall interface response.

type CreateFirewallPolicyRequest

type CreateFirewallPolicyRequest = GetFirewallPolicyResponse

CreateFirewallPolicyRequest represent a create firewall policy request.

type CreateFirewallPolicyResponse

type CreateFirewallPolicyResponse = GetFirewallPolicyResponse

CreateFirewallPolicyResponse represent a create firewall policy response.

type CreateFirewallRuleRequest

type CreateFirewallRuleRequest = GetFirewallRuleResponse

CreateFirewallRuleRequest represent a create firewall rule request.

type CreateFirewallRuleResponse

type CreateFirewallRuleResponse = GetFirewallRuleResponse

CreateFirewallRuleResponse represent a create firewall rule response.

type CreateFirewallServiceRequest

type CreateFirewallServiceRequest = GetFirewallServiceResponse

CreateFirewallServiceRequest represent a create firewall service request.

type CreateFirewallServiceResponse

type CreateFirewallServiceResponse = GetFirewallServiceResponse

CreateFirewallServiceResponse represent a create firewall service response.

type CreateFirewallZoneRequest

type CreateFirewallZoneRequest = GetFirewallZoneResponse

CreateFirewallZoneRequest represent a create firewall zone request.

type CreateFirewallZoneResponse

type CreateFirewallZoneResponse = GetFirewallZoneResponse

CreateFirewallZoneResponse represent a create firewall zone response.

type CreateServerGroupRequest

type CreateServerGroupRequest = GetServerGroupResponse

CreateServerGroupRequest represent a CPHalo server group create request.

type CreateServerGroupResponse

type CreateServerGroupResponse = GetServerGroupResponse

CreateServerGroupResponse represent a CPHalo server group create response.

type FirewallInterface

type FirewallInterface struct {
	ID     string `json:"id,omitempty"`
	URL    string `json:"url,omitempty"`
	Name   string `json:"name,omitempty"`
	System bool   `json:"system,omitempty"`
}

FirewallInterface represent a CPHalo firewall interface.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-8

type FirewallPolicy

type FirewallPolicy struct {
	ID                    string         `json:"id,omitempty"`
	URL                   string         `json:"url,omitempty"`
	Name                  string         `json:"name,omitempty"`
	Platform              string         `json:"platform,omitempty"`
	Description           string         `json:"description,omitempty"`
	Shared                StringableBool `json:"shared"`
	FirewallRules         []FirewallRule `json:"firewall_rules,omitempty"`
	IgnoreForwardingRules bool           `json:"ignore_forwarding_rules,omitempty"`
}

FirewallPolicy represent a CPHalo firewall policy.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-6

type FirewallRule

type FirewallRule struct {
	ID                string                    `json:"id,omitempty"`
	URL               string                    `json:"url,omitempty"`
	Chain             string                    `json:"chain,omitempty"`
	Action            string                    `json:"action,omitempty"`
	Active            bool                      `json:"active,omitempty"`
	ConnectionStates  string                    `json:"connection_states,omitempty"`
	Position          int                       `json:"position,omitempty"`
	FirewallInterface *FirewallInterface        `json:"firewall_interface,omitempty"`
	FirewallService   *FirewallService          `json:"firewall_service,omitempty"`
	FirewallSource    *FirewallRuleSourceTarget `json:"firewall_source,omitempty"`
	FirewallTarget    *FirewallRuleSourceTarget `json:"firewall_target,omitempty"`
	Log               bool                      `json:"log,omitempty"`
	LogPrefix         string                    `json:"log_prefix,omitempty"`
	Comment           string                    `json:"comment,omitempty"`
}

FirewallRule represent a CPHalo firewall rule.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-7

type FirewallRuleSourceTarget

type FirewallRuleSourceTarget struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	IPAddress string `json:"ip_address,omitempty"`
	Kind      string `json:"type,omitempty"`
}

FirewallRuleSourceTarget represent a CPHalo firewall source and target.

func (*FirewallRuleSourceTarget) GetID

func (f *FirewallRuleSourceTarget) GetID() string

GetID returns ID if exists, otherwise Name

type FirewallService

type FirewallService struct {
	ID       string `json:"id,omitempty"`
	URL      string `json:"url,omitempty"`
	Name     string `json:"name,omitempty"`
	Protocol string `json:"protocol,omitempty"`
	Port     string `json:"port,omitempty"`
	System   bool   `json:"system,omitempty"`
}

FirewallService represent a CPHalo firewall service.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-9

type FirewallZone

type FirewallZone struct {
	ID          string `json:"id,omitempty"`
	URL         string `json:"url,omitempty"`
	Name        string `json:"name,omitempty"`
	IPAddress   IPList `json:"ip_address,omitempty"`
	Description string `json:"description,omitempty"`
	System      bool   `json:"system,omitempty"`
}

FirewallZone represent a CPHalo firewall zone.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-10

type GetCSPAccountResponse

type GetCSPAccountResponse struct {
	CSPAccount CSPAccount `json:"csp_account"`
}

GetCSPAccountResponse represent a get CSP account response.

type GetFirewallInterfaceResponse

type GetFirewallInterfaceResponse struct {
	Interface FirewallInterface `json:"firewall_interface"`
}

GetFirewallInterfaceResponse represent a get firewall interface response.

type GetFirewallPolicyResponse

type GetFirewallPolicyResponse struct {
	Policy FirewallPolicy `json:"firewall_policy"`
}

GetFirewallPolicyResponse represent a get firewall policy response.

type GetFirewallRuleResponse

type GetFirewallRuleResponse struct {
	Rule FirewallRule `json:"firewall_rule"`
}

GetFirewallRuleResponse represent a get firewall rule response.

type GetFirewallServiceResponse

type GetFirewallServiceResponse struct {
	Service FirewallService `json:"firewall_service"`
}

GetFirewallServiceResponse represent a get firewall service response.

type GetFirewallZoneResponse

type GetFirewallZoneResponse struct {
	Zone FirewallZone `json:"firewall_zone"`
}

GetFirewallZoneResponse represent a get firewall zone response.

type GetServerGroupFirewallPolicyResponse added in v0.1.2

type GetServerGroupFirewallPolicyResponse struct {
	Group ServerGroupFirewallPolicy `json:"group"`
}

GetServerGroupFirewallPolicyResponse represents a CPHalo server group firewall policies get response.

type GetServerGroupResponse

type GetServerGroupResponse struct {
	Group ServerGroup `json:"group"`
}

GetServerGroupResponse represent a CPHalo server group get response.

type GetServersResponse

type GetServersResponse struct {
	Server Server `json:"server"`
}

GetServersResponse represent a CPHalo server get response.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-a-single-server

type IPList added in v0.1.3

type IPList []string

IPList is a list of strings, which marshals into string and vice versa.

func (IPList) MarshalJSON added in v0.1.3

func (i IPList) MarshalJSON() ([]byte, error)

MarshalJSON is used by marshaler interface.

func (*IPList) UnmarshalJSON added in v0.1.3

func (i *IPList) UnmarshalJSON(in []byte) error

UnmarshalJSON is used by unmarshaler interface.

type ListAlertProfilesResponse

type ListAlertProfilesResponse struct {
	Count         int            `json:"count"`
	AlertProfiles []AlertProfile `json:"alert_profiles"`
}

ListAlertProfilesResponse represent a CPHalo alert profile response.

type ListCSPAccountsResponse

type ListCSPAccountsResponse struct {
	Count       int          `json:"count"`
	CSPAccounts []CSPAccount `json:"csp_accounts"`
}

ListCSPAccountsResponse represent a list of CSP accounts response.

type ListFirewallInterfacesResponse

type ListFirewallInterfacesResponse struct {
	Count      int                 `json:"count"`
	Interfaces []FirewallInterface `json:"firewall_interfaces"`
}

ListFirewallInterfacesResponse represent a list of firewall interfaces response.

type ListFirewallPoliciesResponse

type ListFirewallPoliciesResponse struct {
	Count    int              `json:"count"`
	Policies []FirewallPolicy `json:"firewall_policies"`
}

ListFirewallPoliciesResponse represent a list of firewall policies response.

type ListFirewallRulesResponse

type ListFirewallRulesResponse struct {
	Count int            `json:"count"`
	Rules []FirewallRule `json:"firewall_rules"`
}

ListFirewallRulesResponse represent a list of firewall rules response.

type ListFirewallServicesResponse

type ListFirewallServicesResponse struct {
	Count    int               `json:"count"`
	Services []FirewallService `json:"firewall_services"`
}

ListFirewallServicesResponse represent a list of firewall services response.

type ListFirewallZonesResponse

type ListFirewallZonesResponse struct {
	Count int            `json:"count"`
	Zones []FirewallZone `json:"firewall_zones"`
}

ListFirewallZonesResponse represent a list of firewall zones response.

type ListServerGroupsResponse

type ListServerGroupsResponse struct {
	Count  int           `json:"count"`
	Groups []ServerGroup `json:"groups"`
}

ListServerGroupsResponse represent a CPHalo server group list response.

type ListServersResponse

type ListServersResponse struct {
	Count   int      `json:"count"`
	Servers []Server `json:"servers"`
}

ListServersResponse represent a CPHalo server list response.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#list-servers

type MoveServerRequest

type MoveServerRequest struct {
	Server struct {
		GroupID string `json:"group_id"`
	} `json:"server"`
}

MoveServerRequest represent a request for server move endpoint.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#move-server-into-a-server-group

type NullableString

type NullableString string

NullableString is a string, which marshals empty string into null and vice versa.

func (NullableString) MarshalJSON

func (s NullableString) MarshalJSON() ([]byte, error)

MarshalJSON is used by marshaler interface.

func (*NullableString) UnmarshalJSON

func (s *NullableString) UnmarshalJSON(in []byte) error

UnmarshalJSON is used by unmarshaler interface.

type ResponseError

type ResponseError interface {
	Error() string
	GetStatusCode() int
}

ResponseError is a interface for all response errors.

type ResponseError400

type ResponseError400 struct {
	Message    string
	StatusCode int
}

ResponseError400 is a representation of 400 error.

func (ResponseError400) Error

func (e ResponseError400) Error() string

func (ResponseError400) GetStatusCode

func (e ResponseError400) GetStatusCode() int

GetStatusCode returns response status code.

type ResponseError404

type ResponseError404 struct {
	Resource string `json:"resource"`
	Field    string `json:"field"`
	Value    string `json:"value"`
}

ResponseError404 is a representation of 404 error.

func (ResponseError404) Error

func (e ResponseError404) Error() string

func (ResponseError404) GetStatusCode

func (e ResponseError404) GetStatusCode() int

GetStatusCode returns response status code.

type ResponseError422

type ResponseError422 struct {
	Message string `json:"message"`
	Errors  []struct {
		Field   string `json:"field"`
		Value   string `json:"value"`
		Code    string `json:"code"`
		Details string `json:"details"`
	} `json:"errors"`
}

ResponseError422 is a representation of 422 error.

func (ResponseError422) Error

func (e ResponseError422) Error() string

func (ResponseError422) GetStatusCode

func (e ResponseError422) GetStatusCode() int

GetStatusCode returns response status code.

type ResponseError429

type ResponseError429 struct{}

ResponseError429 is a representation of 429 error.

func (ResponseError429) Error

func (e ResponseError429) Error() string

func (ResponseError429) GetStatusCode

func (e ResponseError429) GetStatusCode() int

GetStatusCode returns response status code.

type ResponseError500

type ResponseError500 struct {
	Message    string `json:"message"`
	StatusCode int    `json:"code"`
}

ResponseError500 is a representation of 500 error.

func (ResponseError500) Error

func (e ResponseError500) Error() string

func (ResponseError500) GetStatusCode

func (e ResponseError500) GetStatusCode() int

GetStatusCode returns response status code.

type ResponseErrorGeneral

type ResponseErrorGeneral struct {
	Message    string `json:"expectedErr"`
	StatusCode int
}

ResponseErrorGeneral is a representation of general error.

func (ResponseErrorGeneral) Error

func (e ResponseErrorGeneral) Error() string

func (ResponseErrorGeneral) GetStatusCode

func (e ResponseErrorGeneral) GetStatusCode() int

GetStatusCode returns response status code.

type RetireServerRequest

type RetireServerRequest struct {
	Server struct {
		Retire bool `json:"retire"`
	} `json:"server"`
}

RetireServerRequest represent a request for server retire endpoint.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#retire-server

type Server

type Server struct {
	CreatedAt              time.Time `json:"created_at"`
	ID                     string    `json:"id"`
	URL                    string    `json:"url"`
	Hostname               string    `json:"hostname"`
	ServerLabel            string    `json:"server_label"`
	ReportedFQDN           string    `json:"reported_fqdn"`
	PrimaryIPAddress       string    `json:"primary_ip_address"`
	ConnectingIPAddress    string    `json:"connecting_ip_address"`
	State                  string    `json:"state"`
	DaemonVersion          string    `json:"daemon_version"`
	ReadOnly               bool      `json:"read_only"`
	Platform               string    `json:"platform"`
	PlatformVersion        string    `json:"platform_version"`
	OSVersion              string    `json:"os_version"`
	KernelName             string    `json:"kernel_name"`
	KernelMachine          string    `json:"kernel_machine"`
	SelfVerificationFailed bool      `json:"self_verification_failed"`
	ConnectingIPFQDN       string    `json:"connecting_ip_fqdn"`
	LastStateChange        time.Time `json:"last_state_change"`
	DockerInspection       string    `json:"docker_inspection"`
	GroupID                string    `json:"group_id"`
	GroupName              string    `json:"group_name"`
	GroupPath              string    `json:"group_path"`
}

Server represent a CPHalo server.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-2

type ServerGroup

type ServerGroup struct {
	ID              string   `json:"id,omitempty"`
	URL             string   `json:"url,omitempty"`
	Name            string   `json:"name,omitempty"`
	Description     string   `json:"description,omitempty"`
	ParentID        string   `json:"parent_id,omitempty"`
	HasChildren     bool     `json:"has_children,omitempty"`
	Tag             string   `json:"tag,omitempty"`
	AlertProfileIDs []string `json:"alert_profile_ids,omitempty"`
}

ServerGroup represent a CPHalo server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-1

type ServerGroupFirewallPolicy added in v0.1.2

type ServerGroupFirewallPolicy struct {
	GroupID               string
	LinuxFirewallPolicyID NullableString `json:"linux_firewall_policy_id"`
}

ServerGroupFirewallPolicy represents firewall policies for a CPHalo server group.

CPHalo API Docs: https://library.cloudpassage.com/help/article/link/cloudpassage-api-documentation#object-representation-1

type StringableBool added in v0.1.1

type StringableBool bool

StringableBool is a bool, which marshals bool into string and vice versa.

func (StringableBool) MarshalJSON added in v0.1.1

func (b StringableBool) MarshalJSON() ([]byte, error)

MarshalJSON is used by marshaler interface.

func (*StringableBool) UnmarshalJSON added in v0.1.1

func (b *StringableBool) UnmarshalJSON(in []byte) error

UnmarshalJSON is used by unmarshaler interface.

type UpdateFirewallInterfaceRequest

type UpdateFirewallInterfaceRequest = GetFirewallInterfaceResponse

UpdateFirewallInterfaceRequest represent a update firewall interface request.

type UpdateFirewallPolicyRequest

type UpdateFirewallPolicyRequest = GetFirewallPolicyResponse

UpdateFirewallPolicyRequest represent a update firewall policy request.

type UpdateFirewallRuleRequest

type UpdateFirewallRuleRequest = GetFirewallRuleResponse

UpdateFirewallRuleRequest represent a create firewall rule request.

type UpdateFirewallServiceRequest

type UpdateFirewallServiceRequest = GetFirewallServiceResponse

UpdateFirewallServiceRequest represent a update firewall service request.

type UpdateFirewallZoneRequest

type UpdateFirewallZoneRequest = GetFirewallZoneResponse

UpdateFirewallZoneRequest represent a update firewall zone request.

type UpdateServerGroupFirewallPolicyRequest added in v0.1.2

type UpdateServerGroupFirewallPolicyRequest = GetServerGroupFirewallPolicyResponse

UpdateServerGroupFirewallPolicyRequest represents a CPHalo server group firewall policies update request.

type UpdateServerGroupRequest

type UpdateServerGroupRequest = GetServerGroupResponse

UpdateServerGroupRequest represent a CPHalo server group update request.

Jump to

Keyboard shortcuts

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