bastionzero

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 29 Imported by: 19

Documentation

Index

Constants

View Source
const (

	// DefaultBaseURL is the default BastionZero API URL the Client communicates
	// with
	DefaultBaseURL = "https://cloud.bastionzero.com/"
)

Variables

This section is empty.

Functions

func PtrTo

func PtrTo[T any](v T) *T

PtrTo returns a pointer to the provided input.

func ToStringSlice

func ToStringSlice[T ~string](elems []T) []string

ToStringSlice returns a list of strings given any list of a type that is aliased to a string.

Types

type Client

Client manages communication with the BastionZero API

func New

func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error)

New returns a new BastionZero API client instance. If httpClient is nil, the default HTTP client provided by the http package is used.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new BastionZero API client, using the given http.Client to perform all requests. If httpClient is nil, the default HTTP client provided by the http package is used.

func NewFromAPISecret

func NewFromAPISecret(httpClient *http.Client, apiSecret string, opts ...ClientOpt) (*Client, error)

NewFromAPISecret returns a new BastionZero API client that authenticates its requests with the given API secret. If httpClient is nil, the default HTTP client provided by the http package is used.

func (*Client) Do

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

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.

The error type will be *ErrorResponse if the API response is considered an error

func (*Client) Host

func (c *Client) Host() string

Host returns the BastionZero server URL this client is configured to issue API requests against.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body if applicable for the provided HTTP method.

type ClientOpt

type ClientOpt clientOpt

ClientOpt are options for New.

func WithBaseURL

func WithBaseURL(baseUrl string) ClientOpt

WithBaseURL is a client option for setting the base URL.

func WithRequestHeaders

func WithRequestHeaders(headers map[string]string) ClientOpt

WithRequestHeaders sets optional HTTP headers on the client that are sent on each HTTP request.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOpt

WithUserAgent is a client option for seting the user agent.

Directories

Path Synopsis
Package service provides modularized service objects for interacting with different components of the BastionZero API.
Package service provides modularized service objects for interacting with different components of the BastionZero API.
agents/agentstatus
Code generated by "string-enumer -t AgentStatus -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t AgentStatus -o ./generated.go ."; DO NOT EDIT.
agents/agenttype
Code generated by "string-enumer -t AgentType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t AgentType -o ./generated.go ."; DO NOT EDIT.
autodiscoveryscripts/targetnameoption
Code generated by "string-enumer -t TargetNameOption -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t TargetNameOption -o ./generated.go ."; DO NOT EDIT.
connections/connectionstate
Code generated by "string-enumer -t ConnectionState -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t ConnectionState -o ./generated.go ."; DO NOT EDIT.
connections/connectiontype
Code generated by "string-enumer -t ConnectionType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t ConnectionType -o ./generated.go ."; DO NOT EDIT.
connections/datstate
Code generated by "string-enumer -t DATState -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t DATState -o ./generated.go ."; DO NOT EDIT.
events/connectioneventtype
Code generated by "string-enumer -t ConnectionEventType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t ConnectionEventType -o ./generated.go ."; DO NOT EDIT.
mfa
policies/policytype
Code generated by "string-enumer -t PolicyType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t PolicyType -o ./generated.go ."; DO NOT EDIT.
policies/verbtype
Code generated by "string-enumer -t VerbType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t VerbType -o ./generated.go ."; DO NOT EDIT.
subjects/roletype
Code generated by "string-enumer -t RoleType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t RoleType -o ./generated.go ."; DO NOT EDIT.
targets/dacstatus
Code generated by "string-enumer -t DynamicAccessConfigurationStatus -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t DynamicAccessConfigurationStatus -o ./generated.go ."; DO NOT EDIT.
targets/targetstatus
Code generated by "string-enumer -t TargetStatus -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t TargetStatus -o ./generated.go ."; DO NOT EDIT.
Package types provides common API objects used by all BastionZero services
Package types provides common API objects used by all BastionZero services
subjecttype
Code generated by "string-enumer -t SubjectType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t SubjectType -o ./generated.go ."; DO NOT EDIT.
targettype
Code generated by "string-enumer -t TargetType -o ./generated.go ."; DO NOT EDIT.
Code generated by "string-enumer -t TargetType -o ./generated.go ."; DO NOT EDIT.

Jump to

Keyboard shortcuts

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