Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type AAA
- type Building
- func (building *Building) AddFloor(floor *Floor)
- func (building *Building) DeleteFloor(floor *Floor)
- func (l *Building) Description() string
- func (building *Building) Floors() []*Floor
- func (l *Building) Name() string
- func (l *Building) SetCreated() string
- func (l *Building) SetDeleted() string
- func (l *Building) SetDescription(description string) error
- func (l *Building) SetName(name string) error
- func (l *Building) Status() string
- func (l *Building) String() string
- type Client
- func (c *Client) Cookie() string
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Login(ctx context.Context) error
- func (c *Client) NewRequest(method string, path string, body interface{}) (*http.Request, error)
- func (c *Client) Password() string
- func (c *Client) SetCookie(r *http.Response)
- func (c *Client) SetPassword(s string)
- func (c *Client) SetUsername(s string)
- func (c *Client) Username() string
- type Config
- type DecommissionAttributes
- type Error
- type ErrorResponse
- type FabricInstance
- type FabricInstanceContainer
- type FabricMembershipService
- func (s *FabricMembershipService) DecommissionNode(ctx context.Context, node *Node) (NodesResponse, error)
- func (s *FabricMembershipService) List(ctx context.Context) ([]*Node, error)
- func (s *FabricMembershipService) NewNode(name, ID, pod, serial, role string) (*Node, error)
- func (s *FabricMembershipService) Update(ctx context.Context, nodes ...*Node) (NodesResponse, error)
- type FabricNode
- type FabricNodeContainer
- type FabricNodeIdentP
- type Floor
- func (floor *Floor) AddRoom(room *Room)
- func (floor *Floor) DeleteRoom(room *Room)
- func (l *Floor) Description() string
- func (l *Floor) Name() string
- func (floor *Floor) Rooms() []*Room
- func (l *Floor) SetCreated() string
- func (l *Floor) SetDeleted() string
- func (l *Floor) SetDescription(description string) error
- func (l *Floor) SetName(name string) error
- func (l *Floor) Status() string
- func (l *Floor) String() string
- type GeoAttrs
- type GeoBuilding
- type GeoBuildingContainer
- type GeoFloor
- type GeoFloorContainer
- type GeoRack
- type GeoRackContainer
- type GeoRoom
- type GeoRoomContainer
- type GeoRow
- type GeoRowContainer
- type GeoSite
- type GeoSiteContainer
- type GeolocationResponse
- type GeolocationService
- func (s *GeolocationService) ListSites(ctx context.Context) ([]*Site, error)
- func (s *GeolocationService) NewBuilding(name, description string) (*Building, error)
- func (s *GeolocationService) NewFloor(name, description string) (*Floor, error)
- func (s *GeolocationService) NewRack(name, description string) (*Rack, error)
- func (s *GeolocationService) NewRoom(name, description string) (*Room, error)
- func (s *GeolocationService) NewRow(name, description string) (*Row, error)
- func (s *GeolocationService) NewSite(name, description string) (*Site, error)
- func (s *GeolocationService) UpdateSite(ctx context.Context, site *Site) (GeolocationResponse, error)
- type Mapper
- type Node
- func (n *Node) Equal(o *Node) bool
- func (n *Node) ID() string
- func (n *Node) Name() string
- func (n *Node) Pod() string
- func (n *Node) Role() string
- func (n *Node) Serial() string
- func (n *Node) SetCreated() string
- func (n *Node) SetDeleted() string
- func (n *Node) SetID(id string) error
- func (n *Node) SetName(name string) error
- func (n *Node) SetPod(id string) error
- func (n *Node) SetRole(role string) error
- func (n *Node) SetSerial(serial string) error
- func (n *Node) Status() string
- func (n *Node) String() string
- type NodeDecommission
- type NodeDecommissionContainer
- type NodeIdentProfContainer
- type NodeIdentityProfile
- type NodeRequestAttrs
- type NodeResponseAttrs
- type NodesImdata
- type NodesResponse
- type Rack
- type Room
- func (room *Room) AddRow(row *Row)
- func (room *Room) DeleteRow(row *Row)
- func (l *Room) Description() string
- func (l *Room) Name() string
- func (room *Room) Rows() []*Row
- func (l *Room) SetCreated() string
- func (l *Room) SetDeleted() string
- func (l *Room) SetDescription(description string) error
- func (l *Room) SetName(name string) error
- func (l *Room) Status() string
- func (l *Room) String() string
- type Row
- func (row *Row) AddRack(rack *Rack)
- func (row *Row) DeleteRack(rack *Rack)
- func (l *Row) Description() string
- func (l *Row) Name() string
- func (row *Row) Racks() []*Rack
- func (l *Row) SetCreated() string
- func (l *Row) SetDeleted() string
- func (l *Row) SetDescription(description string) error
- func (l *Row) SetName(name string) error
- func (l *Row) Status() string
- func (l *Row) String() string
- type Site
- func (site *Site) AddBuilding(building *Building)
- func (site *Site) Buildings() []*Building
- func (site *Site) DeleteBuilding(building *Building)
- func (l *Site) Description() string
- func (l *Site) Name() string
- func (l *Site) SetCreated() string
- func (l *Site) SetDeleted() string
- func (l *Site) SetDescription(description string) error
- func (l *Site) SetName(name string) error
- func (l *Site) Status() string
- func (l *Site) String() string
Constants ¶
const (
// ErrAlreadyDiscovered - Can't remove node identity policy - Node TEP-1-102 is already discovered. Please decommission first.
ErrAlreadyDiscovered = "107"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type AAA ¶
type AAA struct {
// contains filtered or unexported fields
}
AAA is part of the authentication process that holds authentication attributes
type Building ¶
type Building struct {
// contains filtered or unexported fields
}
Building ...
func (*Building) Description ¶
func (l *Building) Description() string
Description resturns a location description.
func (*Building) SetCreated ¶
func (l *Building) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Building) SetDeleted ¶
func (l *Building) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Building) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+
func (*Building) SetName ¶
SetName validates and sets the name of a location
A site name can be up to 64 characters and must begin with an alphanumeric character. It can only contain alphanumeric characters and the following symbols: -.:_
type Client ¶
type Client struct { BaseURL *url.URL Config Config // Services used for talking to different parts of the APIC API FabricMembership *FabricMembershipService Geolocation *GeolocationService // contains filtered or unexported fields }
Client manages communication with the APIC API
func (*Client) Cookie ¶
Cookie returns the APIC authentication cookie. Returns an empty string if it has not been set.
func (*Client) NewRequest ¶
NewRequest forms an http request for use with an APIC client
func (*Client) SetCookie ¶
SetCookie sets the value of the APIC authentication cookie It requires the response received from a login request.
func (*Client) SetPassword ¶
SetPassword sets the authentication password of the APIC client
func (*Client) SetUsername ¶
SetUsername set the authentication username of the APIC client
type DecommissionAttributes ¶
type DecommissionAttributes struct { TDN string `json:"tDn"` // "topology/pod-<pod>/node-<nodeID>" Status string `json:"status"` // createModify RemoveFromController string `json:"removeFromController"` // "true" }
DecommissionAttributes are the attributes of the node to be decomissioned
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is the error response from the APIC server
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Errors []Error `json:"imdata"` // APIC details on errors }
ErrorResponse reports any errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type FabricInstance ¶
type FabricInstance struct { GeoAttrs `json:"attributes"` GeoSites []GeoSiteContainer `json:"children"` }
FabricInstance ...
type FabricInstanceContainer ¶
type FabricInstanceContainer struct {
FabricInstance `json:"fabricInst"`
}
FabricInstanceContainer ...
type FabricMembershipService ¶
type FabricMembershipService service
FabricMembershipService handles communication with the fabric membership related methods of the APIC API.
func (*FabricMembershipService) DecommissionNode ¶
func (s *FabricMembershipService) DecommissionNode(ctx context.Context, node *Node) (NodesResponse, error)
DecommissionNode decommisions a fabric membership node
func (*FabricMembershipService) List ¶
func (s *FabricMembershipService) List(ctx context.Context) ([]*Node, error)
List lists all node members of the ACI fabric
func (*FabricMembershipService) NewNode ¶
func (s *FabricMembershipService) NewNode(name, ID, pod, serial, role string) (*Node, error)
NewNode instanstatiates a valid ACI fabric membership node
func (*FabricMembershipService) Update ¶
func (s *FabricMembershipService) Update(ctx context.Context, nodes ...*Node) (NodesResponse, error)
Update ...
type FabricNode ¶
type FabricNode struct {
NodeResponseAttrs `json:"attributes"`
}
FabricNode is the node identity profile
type FabricNodeContainer ¶
type FabricNodeContainer struct {
FabricNodeIdentP `json:"fabricNodeIdentP"`
}
FabricNodeContainer is a container for a Fabric Node Identity Profile
type FabricNodeIdentP ¶
type FabricNodeIdentP struct {
NodeRequestAttrs `json:"attributes"`
}
FabricNodeIdentP is the node identity profile
type Floor ¶
type Floor struct {
// contains filtered or unexported fields
}
Floor ...
func (*Floor) Description ¶
func (l *Floor) Description() string
Description resturns a location description.
func (*Floor) SetCreated ¶
func (l *Floor) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Floor) SetDeleted ¶
func (l *Floor) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Floor) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+
type GeoAttrs ¶
type GeoAttrs struct { Descr string `json:"descr,omitempty"` DN string `json:"dn,omitempty"` Name string `json:"name,omitempty"` RN string `json:"rn,omitempty"` Status string `json:"status,omitempty"` }
GeoAttrs ...
type GeoBuilding ¶
type GeoBuilding struct { GeoAttrs `json:"attributes,omitempty"` GeoFloors []GeoFloorContainer `json:"children,omitempty"` }
GeoBuilding ...
type GeoBuildingContainer ¶
type GeoBuildingContainer struct {
GeoBuilding `json:"geoBuilding,omitempty"`
}
GeoBuildingContainer ...
type GeoFloor ¶
type GeoFloor struct { GeoAttrs `json:"attributes,omitempty"` GeoRooms []GeoRoomContainer `json:"children,omitempty"` }
GeoFloor ...
type GeoFloorContainer ¶
type GeoFloorContainer struct {
GeoFloor `json:"geoFloor,omitempty"`
}
GeoFloorContainer ...
type GeoRack ¶
type GeoRack struct { GeoAttrs `json:"attributes,omitempty"` GeoNodes []interface{} `json:"children,omitempty"` }
GeoRack ...
type GeoRackContainer ¶
type GeoRackContainer struct {
GeoRack `json:"geoRack,omitempty"`
}
GeoRackContainer ...
type GeoRoom ¶
type GeoRoom struct { GeoAttrs `json:"attributes,omitempty"` GeoRows []GeoRowContainer `json:"children,omitempty"` }
GeoRoom ...
type GeoRoomContainer ¶
type GeoRoomContainer struct {
GeoRoom `json:"geoRoom,omitempty"`
}
GeoRoomContainer ...
type GeoRow ¶
type GeoRow struct { GeoAttrs `json:"attributes,omitempty"` GeoRacks []GeoRackContainer `json:"children,omitempty"` }
GeoRow ...
type GeoRowContainer ¶
type GeoRowContainer struct {
GeoRow `json:"geoRow,omitempty"`
}
GeoRowContainer ...
type GeoSite ¶
type GeoSite struct { GeoAttrs `json:"attributes,omitempty"` GeoBuildings []GeoBuildingContainer `json:"children,omitempty"` }
GeoSite ...
type GeoSiteContainer ¶
type GeoSiteContainer struct {
GeoSite `json:"geoSite,omitempty"`
}
GeoSiteContainer ...
type GeolocationResponse ¶
type GeolocationResponse struct { TotalCount string `json:"totalCount"` Imdata []interface{} `json:"imdata"` }
GeolocationResponse ...
type GeolocationService ¶
type GeolocationService service
GeolocationService handles communication with the geolocation related methods of the APIC API.
func (*GeolocationService) ListSites ¶
func (s *GeolocationService) ListSites(ctx context.Context) ([]*Site, error)
ListSites ...
func (*GeolocationService) NewBuilding ¶
func (s *GeolocationService) NewBuilding(name, description string) (*Building, error)
NewBuilding instantiates a Building.
func (*GeolocationService) NewFloor ¶
func (s *GeolocationService) NewFloor(name, description string) (*Floor, error)
NewFloor instantiates a Floor.
func (*GeolocationService) NewRack ¶
func (s *GeolocationService) NewRack(name, description string) (*Rack, error)
NewRack instantiates a Rack.
func (*GeolocationService) NewRoom ¶
func (s *GeolocationService) NewRoom(name, description string) (*Room, error)
NewRoom instantiates a Room.
func (*GeolocationService) NewRow ¶
func (s *GeolocationService) NewRow(name, description string) (*Row, error)
NewRow instantiates a Row.
func (*GeolocationService) NewSite ¶
func (s *GeolocationService) NewSite(name, description string) (*Site, error)
NewSite instantiates a Site.
func (*GeolocationService) UpdateSite ¶
func (s *GeolocationService) UpdateSite(ctx context.Context, site *Site) (GeolocationResponse, error)
UpdateSite ...
type Mapper ¶
Mapper wraps basic key/value methods. This is useful for building hashmaps of ACI objects.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is an ACI fabric membership node
func (*Node) SetCreated ¶
SetCreated sets the status of the node to "created,modified".
func (*Node) SetDeleted ¶
SetDeleted sets the status of the node to "deleted".
func (*Node) SetID ¶
SetID validates and sets the node ID.
A node ID must be a number between 101 and 4000 inclusive.
func (*Node) SetName ¶
SetName validates and sets the node name.
A node name can be up to 64 characters and can only contain alphanumeric, hyphen and underscore characters. It must begin and end with an alphanumeric character.
func (*Node) SetPod ¶
SetPod validates and sets the id of the pod the node is attached to.
A pod id must be a number between 0 and 255.
type NodeDecommission ¶
type NodeDecommission struct {
DecommissionAttributes `json:"attributes"`
}
NodeDecommission describes the node to decommission
type NodeDecommissionContainer ¶
type NodeDecommissionContainer struct {
NodeDecommission `json:"fabricRsDecommissionNode"`
}
NodeDecommissionContainer is a container for the request to decommission a fabric membership node
type NodeIdentProfContainer ¶
type NodeIdentProfContainer struct {
NodeIdentityProfile `json:"fabricNodeIdentPol"`
}
NodeIdentProfContainer is a container for a NodeIdentityProfile
type NodeIdentityProfile ¶
type NodeIdentityProfile struct { NodeResponseAttrs `json:"attributes"` Children []FabricNodeContainer `json:"children"` }
NodeIdentityProfile describes the node identity profile
type NodeRequestAttrs ¶
type NodeRequestAttrs struct { DN string `json:"dn,omitempty"` Serial string `json:"serial,omitempty"` NodeID string `json:"nodeId,omitempty"` Name string `json:"name,omitempty"` Role string `json:"role,omitempty"` RN string `json:"rn,omitempty"` Status string `json:"status,omitempty"` }
NodeRequestAttrs contains all the attributes of an ACI fabric node API request
type NodeResponseAttrs ¶
type NodeResponseAttrs struct { DN string `json:"dn,omitempty"` FabricSt string `json:"fabricSt,omitempty"` ID string `json:"id,omitempty"` Model string `json:"model,omitempty"` Name string `json:"name,omitempty"` Role string `json:"role,omitempty"` Serial string `json:"serial,omitempty"` Status string `json:"status,omitempty"` UID string `json:"uid,omitempty"` Vendor string `json:"vendor,omitempty"` Version string `json:"version,omitempty"` }
NodeResponseAttrs contains all the attributes of an ACI fabric node API response
type NodesImdata ¶
type NodesImdata struct {
FabricNode `json:"fabricNode"`
}
NodesImdata contains the node in the nodes response structure
type NodesResponse ¶
type NodesResponse struct {
NodesImdata []NodesImdata `json:"imdata"`
}
NodesResponse contains the response for ACI fabric nodes requests
type Rack ¶
type Rack struct {
// contains filtered or unexported fields
}
Rack ...
func (*Rack) Description ¶
func (l *Rack) Description() string
Description resturns a location description.
func (*Rack) SetCreated ¶
func (l *Rack) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Rack) SetDeleted ¶
func (l *Rack) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Rack) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+
type Room ¶
type Room struct {
// contains filtered or unexported fields
}
Room ...
func (*Room) Description ¶
func (l *Room) Description() string
Description resturns a location description.
func (*Room) SetCreated ¶
func (l *Room) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Room) SetDeleted ¶
func (l *Room) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Room) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row ...
func (*Row) Description ¶
func (l *Row) Description() string
Description resturns a location description.
func (*Row) SetCreated ¶
func (l *Row) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Row) SetDeleted ¶
func (l *Row) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Row) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+
type Site ¶
type Site struct {
// contains filtered or unexported fields
}
Site ...
func (*Site) DeleteBuilding ¶
DeleteBuilding ...
func (*Site) Description ¶
func (l *Site) Description() string
Description resturns a location description.
func (*Site) SetCreated ¶
func (l *Site) SetCreated() string
SetCreated sets the status of the location to "created,modified".
func (*Site) SetDeleted ¶
func (l *Site) SetDeleted() string
SetDeleted sets the status of the location to "deleted".
func (*Site) SetDescription ¶
SetDescription validates and sets the description of a location
A site description can be up to 128 characters. It can only contain alphanumeric characters and the following symbols: !#$%()*,-.:;@_{|}~?&+