Documentation ¶
Index ¶
- Variables
- type ACL
- func (a *ACL) EndpointURL(ctx context.Context) (*url.URL, error)
- func (a *ACL) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *ACL) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *ACL) GetIdentifier(ctx context.Context) (string, error)
- type Backend
- func (b *Backend) EndpointURL(ctx context.Context) (*url.URL, error)
- func (b *Backend) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *Backend) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *Backend) GetIdentifier(ctx context.Context) (string, error)
- type Bind
- func (b *Bind) EndpointURL(ctx context.Context) (*url.URL, error)
- func (b *Bind) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *Bind) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *Bind) GetIdentifier(ctx context.Context) (string, error)
- type Frontend
- func (f *Frontend) EndpointURL(ctx context.Context) (*url.URL, error)
- func (f *Frontend) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *Frontend) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *Frontend) GetIdentifier(ctx context.Context) (string, error)
- type HasState
- type LoadBalancer
- func (lb *LoadBalancer) EndpointURL(ctx context.Context) (*url.URL, error)
- func (lb *LoadBalancer) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *LoadBalancer) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *LoadBalancer) GetIdentifier(ctx context.Context) (string, error)
- func (l LoadBalancer) StateFailure() bool
- func (l LoadBalancer) StateProgressing() bool
- func (l LoadBalancer) StateSuccess() bool
- type LoadBalancerState
- type Mode
- type Rule
- func (r *Rule) EndpointURL(ctx context.Context) (*url.URL, error)
- func (r *Rule) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *Rule) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *Rule) GetIdentifier(ctx context.Context) (string, error)
- type RuleInfo
- type Server
- func (s *Server) EndpointURL(ctx context.Context) (*url.URL, error)
- func (s *Server) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
- func (cm *Server) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)
- func (o *Server) GetIdentifier(ctx context.Context) (string, error)
- type State
- type StateRetriever
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( LoadBalancerStateOK = LoadBalancerState{ID: "0", Text: "OK", Type: 0} LoadBalancerStateError = LoadBalancerState{ID: "1", Text: "Error", Type: 1} LoadBalancerStatePending = LoadBalancerState{ID: "2", Text: "Pending", Type: 2} LoadBalancerStateCreated = LoadBalancerState{ID: "3", Text: "Created", Type: 3} )
var ( Updating = State{ID: "0", Text: "Updating", Type: 0} Updated = State{ID: "1", Text: "Updated", Type: 1} DeploymentError = State{ID: "2", Text: "DeploymentError", Type: 2} Deployed = State{ID: "3", Text: "Deployed", Type: 3} NewlyCreated = State{ID: "4", Text: "NewlyCreated", Type: 4} )
Functions ¶
This section is empty.
Types ¶
type ACL ¶ added in v0.4.4
type ACL struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name,omitempty"` ParentType string `json:"parent_type,omitempty" anxcloud:"filterable"` Criterion string `json:"criterion,omitempty"` Value string `json:"value,omitempty"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // Index is *int to allow zero values but also omitempty // pkg/utils/pointer can be used to create pointers from primitives Index *int `json:"index,omitempty"` // Only the name and identifier fields are used and returned. Frontend Frontend `json:"frontend,omitempty" anxcloud:"filterable"` Backend Backend `json:"backend,omitempty" anxcloud:"filterable"` // contains filtered or unexported fields }
ACL represents an LBaaS ACL
Example ¶
package main import ( "context" "log" "go.anx.io/go-anxcloud/pkg/api" lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1" "go.anx.io/go-anxcloud/pkg/client" "go.anx.io/go-anxcloud/pkg/utils/pointer" ) func main() { a, err := api.NewAPI(api.WithClientOptions(client.AuthFromEnv(false))) if err != nil { log.Fatalf("failed to initialize api client: %s", err) } acl := &lbaasv1.ACL{ Name: "destination port 8080", ParentType: "frontend", Index: pointer.Int(5), Criterion: "dst_port", Value: "8080", Frontend: lbaasv1.Frontend{ Identifier: "<frontend-identifier>", }, } if err := a.Create(context.TODO(), acl); err != nil { log.Fatalf("failed to create ACL: %s", err) } }
Output:
func (*ACL) EndpointURL ¶ added in v0.4.4
EndpointURL returns the URL where to retrieve objects of type ACL and the identifier of the given ACL. It implements the api.Object interface on *ACL, making it usable with the generic API client.
func (*ACL) FilterAPIRequestBody ¶ added in v0.4.4
FilterAPIRequestBody generates the request body for ACLs, replacing linked Objects with just their identifier.
func (*ACL) FilterAPIResponse ¶ added in v0.4.4
type Backend ¶
type Backend struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name"` HealthCheck string `json:"health_check,omitempty"` Mode Mode `json:"mode"` ServerTimeout int `json:"server_timeout,omitempty"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // Only the name and identifier fields are used and returned. LoadBalancer LoadBalancer `json:"load_balancer"` // contains filtered or unexported fields }
The Backend resource configures settings common for all specific backend Server resources linked to it.
func (*Backend) EndpointURL ¶
EndpointURL returns the URL where to retrieve objects of type Backend and the identifier of the given Backend. It implements the api.Object interface on *Backend, making it usable with the generic API client.
func (*Backend) FilterAPIRequestBody ¶
FilterAPIRequestBody generates the request body for Backends, replacing linked Objects with just their identifier.
func (*Backend) FilterAPIResponse ¶
type Bind ¶
type Bind struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name"` Address string `json:"address"` Port int `json:"port"` SSL bool `json:"ssl"` SslCertificatePath string `json:"ssl_certificate_path,omitempty"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // Only the name and identifier fields are used and returned. Frontend Frontend `json:"frontend"` // contains filtered or unexported fields }
Bind represents an LBaaS FrontendBind
func (*Bind) FilterAPIRequestBody ¶
FilterAPIRequestBody generates the request body for Binds, replacing linked Objects with just their identifier.
func (*Bind) FilterAPIResponse ¶
type Frontend ¶
type Frontend struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name"` Mode Mode `json:"mode"` ClientTimeout string `json:"client_timeout,omitempty"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // Only the name and identifier fields are used and returned. LoadBalancer *LoadBalancer `json:"load_balancer,omitempty"` // Only the name and identifier fields are used and returned. DefaultBackend *Backend `json:"default_backend,omitempty"` // contains filtered or unexported fields }
Frontend represents a LBaaS Frontend.
func (*Frontend) EndpointURL ¶
EndpointURL returns the URL where to retrieve objects of type Frontend and the identifier of the given Frontend. It implements the api.Object interface on *Frontend, making it usable with the generic API client.
func (*Frontend) FilterAPIRequestBody ¶
FilterAPIRequestBody generates the request body for Frontends, replacing linked Objects with just their identifier.
func (*Frontend) FilterAPIResponse ¶
type HasState ¶ added in v0.4.2
type HasState struct {
State State `json:"state"`
}
func (HasState) StateFailure ¶ added in v0.4.2
StateFailure checks if the state is marking any failure
func (HasState) StateProgressing ¶ added in v0.4.2
StateProgressing checks if the state is marking any change currently being applied
func (HasState) StateSuccess ¶ added in v0.4.2
StateSuccess checks if the state is one of the successful ones
type LoadBalancer ¶
type LoadBalancer struct { State LoadBalancerState `json:"state"` CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name"` IpAddress string `json:"ip_address"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // contains filtered or unexported fields }
LoadBalancer holds the information of a load balancer instance.
func (*LoadBalancer) EndpointURL ¶
EndpointURL returns the URL where to retrieve objects of type LoadBalancer and the identifier of the given Loadbalancer. It implements the api.Object interface on *LoadBalancer, making it usable with the generic API client.
func (*LoadBalancer) FilterAPIRequestBody ¶
func (lb *LoadBalancer) FilterAPIRequestBody(ctx context.Context) (interface{}, error)
FilterAPIRequestBody generates the request body for creating a new LoadBalancer, which differs from the LoadBalancer object.
func (*LoadBalancer) FilterAPIResponse ¶
func (*LoadBalancer) GetIdentifier ¶ added in v0.4.5
func (o *LoadBalancer) GetIdentifier(ctx context.Context) (string, error)
GetIdentifier returns the primary identifier of a LoadBalancer object
func (LoadBalancer) StateFailure ¶ added in v0.4.3
func (l LoadBalancer) StateFailure() bool
func (LoadBalancer) StateProgressing ¶ added in v0.4.3
func (l LoadBalancer) StateProgressing() bool
func (LoadBalancer) StateSuccess ¶ added in v0.4.3
func (l LoadBalancer) StateSuccess() bool
type LoadBalancerState ¶ added in v0.4.3
type LoadBalancerState struct { // programatically usable enum value ID string `json:"id"` // human readable status text Text string `json:"text"` Type int `json:"type"` }
LoadBalancerState is the same as State, but with different states as they are defined differently for LoadBalancer resources. It still implements StateRetriever, so you can use it like the other resources.
func (LoadBalancerState) MarshalJSON ¶ added in v0.4.3
func (s LoadBalancerState) MarshalJSON() ([]byte, error)
func (LoadBalancerState) StateFailure ¶ added in v0.4.3
func (s LoadBalancerState) StateFailure() bool
StateFailure checks if the state is marking any failure
func (LoadBalancerState) StateProgressing ¶ added in v0.4.3
func (s LoadBalancerState) StateProgressing() bool
StateProgressing checks if the state is marking any change currently being applied
func (LoadBalancerState) StateSuccess ¶ added in v0.4.3
func (s LoadBalancerState) StateSuccess() bool
StateSuccess checks if the state is one of the successful ones
type Rule ¶ added in v0.4.4
type Rule struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name,omitempty"` ParentType string `json:"parent_type,omitempty" anxcloud:"filterable"` Condition string `json:"condition,omitempty" anxcloud:"filterable"` ConditionTest string `json:"condition_test,omitempty"` Type string `json:"type,omitempty" anxcloud:"filterable"` Action string `json:"action,omitempty" anxcloud:"filterable"` RedirectionType string `json:"redirection_type,omitempty" anxcloud:"filterable"` RedirectionValue string `json:"redirection_value,omitempty"` RedirectionCode string `json:"redirection_code,omitempty" anxcloud:"filterable"` RuleType string `json:"rule_type,omitempty" anxcloud:"filterable"` // Index is *int to allow zero values but also omitempty // pkg/utils/pointer can be used to create pointers from primitives Index *int `json:"index,omitempty"` // Only the name and identifier fields are used and returned. Frontend Frontend `json:"frontend,omitempty" anxcloud:"filterable"` Backend Backend `json:"backend,omitempty" anxcloud:"filterable"` // contains filtered or unexported fields }
Rule represents an LBaaS Rule
func (*Rule) EndpointURL ¶ added in v0.4.4
EndpointURL returns the URL where to retrieve objects of type Rule and the identifier of the given Rule. It implements the api.Object interface on *Rule, making it usable with the generic API client.
func (*Rule) FilterAPIRequestBody ¶ added in v0.4.4
FilterAPIRequestBody generates the request body for Rules, replacing linked Objects with just their identifier.
func (*Rule) FilterAPIResponse ¶ added in v0.4.4
type RuleInfo ¶
type RuleInfo struct { Identifier string `json:"identifier" anxcloud:"identifier"` Name string `json:"name"` }
RuleInfo holds the name and identifier of a rule.
type Server ¶
type Server struct { HasState CustomerIdentifier string `json:"customer_identifier,omitempty"` ResellerIdentifier string `json:"reseller_identifier,omitempty"` Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` Name string `json:"name"` IP string `json:"ip"` Port int `json:"port"` Check string `json:"check,omitempty"` AutomationRules []RuleInfo `json:"automation_rules,omitempty"` // Only the name and identifier fields are used and returned. Backend Backend `json:"backend"` // contains filtered or unexported fields }
Server holds the information of a load balancers backend server
func (*Server) EndpointURL ¶
EndpointURL returns the URL where to retrieve objects of type Server and the identifier of the given Server. It implements the api.Object interface on *Server, making it usable with the generic API client.
func (*Server) FilterAPIRequestBody ¶
FilterAPIRequestBody generates the request body for Servers, replacing linked Objects with just their identifier.
func (*Server) FilterAPIResponse ¶
type State ¶
type State struct { // programatically usable enum value ID string `json:"id"` // human readable status text Text string `json:"text"` Type int `json:"type"` }
func (State) MarshalJSON ¶
func (State) StateFailure ¶ added in v0.4.2
StateFailure checks if the state is marking any failure
func (State) StateProgressing ¶ added in v0.4.2
StateProgressing checks if the state is marking any change currently being applied
func (State) StateSuccess ¶ added in v0.4.2
StateSuccess checks if the state is one of the successful ones
type StateRetriever ¶ added in v0.4.2
Source Files ¶
- acl_genclient.go
- acl_types.go
- backend_genclient.go
- backend_types.go
- bind_genclient.go
- bind_types.go
- frontend_genclient.go
- frontend_types.go
- helper.go
- loadbalancer_genclient.go
- loadbalancer_types.go
- rule_genclient.go
- rule_types.go
- server_genclient.go
- server_types.go
- state.go
- types.go
- xxgenerated_object.go