Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( Updating = gs.State{ID: "0", Text: "Updating", Type: gs.StateTypeOK} Updated = gs.State{ID: "1", Text: "Updated", Type: gs.StateTypeOK} DeploymentError = gs.State{ID: "2", Text: "DeploymentError", Type: gs.StateTypeError} Deployed = gs.State{ID: "3", Text: "Deployed", Type: gs.StateTypeOK} NewlyCreated = gs.State{ID: "4", Text: "NewlyCreated", Type: gs.StateTypePending} )
Functions ¶
This section is empty.
Types ¶
type ACL ¶ added in v0.4.4
type ACL struct { gs.GenericService gs.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"` }
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.
type Backend ¶
type Backend struct { gs.GenericService gs.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"` }
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.
type Bind ¶
type Bind struct { gs.GenericService gs.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"` }
Bind represents an LBaaS FrontendBind
func (*Bind) FilterAPIRequestBody ¶
FilterAPIRequestBody generates the request body for Binds, replacing linked Objects with just their identifier.
type Frontend ¶
type Frontend struct { gs.GenericService gs.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"` }
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.
type LoadBalancer ¶
type LoadBalancer struct { gs.GenericService State gs.HasState `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"` }
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) GetIdentifier ¶ added in v0.4.5
func (o *LoadBalancer) GetIdentifier(ctx context.Context) (string, error)
GetIdentifier returns the primary identifier of a LoadBalancer object
type Rule ¶ added in v0.4.4
type Rule struct { gs.GenericService gs.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"` }
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.
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 { gs.GenericService gs.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"` }
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.
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