client

package
v0.0.0-...-74cdd25 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DHCPGroupModuleURL = "/controller/dc/v3/publicservice/dhcpgroups"
View Source
const EndPortModuleURL = "/controller/dc/v3/logicnetwork/endports"
View Source
const ExternalGatewayModuleURL = "/controller/dc/v3/publicservice/external-gateways"
View Source
const FabricModuleURL = "/controller/dc/v3/physicalnetwork/fabricresource/fabrics"
View Source
const LogicalNetworkModuleURL = "/controller/dc/v3/logicnetwork/networks"
View Source
const LogicalPortModuleURL = "/controller/dc/v3/logicnetwork/ports"
View Source
const LogicalRouterModuleURL = "/controller/dc/v3/logicnetwork/routers"
View Source
const LogicalSwitchModuleURL = "/controller/dc/v3/logicnetwork/switchs"
View Source
const TenantModuleURL = "/controller/dc/v3/tenants"

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) *bool

func Int32

func Int32(value int32) *int32

func Int64

func Int64(value int64) *int64

func String

func String(value string) *string

Types

type Auth

type Auth struct {
	Token  string
	Expiry time.Time
	// contains filtered or unexported fields
}

func (*Auth) CaclulateOffset

func (t *Auth) CaclulateOffset()

func (*Auth) IsValid

func (au *Auth) IsValid() bool

type AuthResponse

type AuthResponse struct {
	Data      interface{} `json:"data,omitempty"`
	ErrorCode string      `json:"errcode,omitempty"`
	ErrMsg    string      `json:"errmsg,omitempty"`
}

type Client

type Client struct {
	BaseURL string

	AuthToken *Auth

	*ServiceManager
	// contains filtered or unexported fields
}

Client is the main entry point

func GetClient

func GetClient(clientUrl, username, password string, options ...Option) *Client

GetClient returns a singleton

func GetClientTest

func GetClientTest() *Client

func NewClient

func NewClient(clientUrl, username, password string, options ...Option) *Client

NewClient returns a new Instance of the client - allowing for simultaneous connections to the same APIC

func (*Client) Authenticate

func (c *Client) Authenticate() error

func (*Client) InjectAuthenticationHeader

func (client *Client) InjectAuthenticationHeader(req *resty.Request) error

func (*Client) Request

func (c *Client) Request(method, url string, opts RequestOpts) (*resty.Response, error)

type ErrorResponse

type ErrorResponse struct {
	ErrorMessage   string
	URL            string
	Method         string
	HttpStatusCode int
}

func CheckForErrors

func CheckForErrors(response *resty.Response, method, url string) *ErrorResponse

func (*ErrorResponse) Error

func (err *ErrorResponse) Error() string

type Option

type Option func(*Client)

func Insecure

func Insecure(insecure bool) Option

func LogLevel

func LogLevel(level int) Option

func RetryCount

func RetryCount(retryCount int) Option

func RetryMaxWaitTimeSeconds

func RetryMaxWaitTimeSeconds(retryMaxWaitTime int) Option

func RetryWaitTimeInSeconds

func RetryWaitTimeInSeconds(retryWaitTime int) Option

func SkipLoggingPayload

func SkipLoggingPayload(skipLoggingPayload bool) Option

func TimeoutInSeconds

func TimeoutInSeconds(timeout int) Option

type RequestOpts

type RequestOpts struct {
	QueryString interface{}

	// JSONBody, if provided, will be encoded as JSON and used as the body of the HTTP request. The
	// content type of the request will default to "application/json" unless overridden by MoreHeaders.
	// It's an error to specify both a JSONBody and a RawBody.
	Body interface{}

	// JSONResponse, if provided, will be populated with the contents of the response body parsed as
	// JSON.
	Response interface{}
}

RequestOpts customizes the behavior of the provider.Request() method.

type ServiceManager

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

func NewServiceManager

func NewServiceManager(client *Client) *ServiceManager

func (*ServiceManager) CreateEndPort

func (sm *ServiceManager) CreateEndPort(id, name *string, endPortAttr *models.EndPortAttributes) error

func (*ServiceManager) CreateLogicalNetwork

func (sm *ServiceManager) CreateLogicalNetwork(id, name *string, logicalNetworkAttr *models.LogicalNetworkAttributes) error

func (*ServiceManager) CreateLogicalPort

func (sm *ServiceManager) CreateLogicalPort(id, name *string, logicalPortAttr *models.LogicalPortAttributes) error

func (*ServiceManager) CreateLogicalRouter

func (sm *ServiceManager) CreateLogicalRouter(id, name *string, logicalRouterAttr *models.LogicalRouterAttributes) error

func (*ServiceManager) CreateLogicalSwitch

func (sm *ServiceManager) CreateLogicalSwitch(id, name *string, logicalSwitchAttr *models.LogicalSwitchAttributes) error

func (*ServiceManager) CreateTenant

func (sm *ServiceManager) CreateTenant(id, name *string, tenantAttr *models.TenantAttributes) error

func (*ServiceManager) Del

func (sm *ServiceManager) Del(modulename, url, id string, opts *RequestOpts) (*resty.Response, error)

func (*ServiceManager) DeleteEndPort

func (sm *ServiceManager) DeleteEndPort(id string) error

func (*ServiceManager) DeleteLogicalNetwork

func (sm *ServiceManager) DeleteLogicalNetwork(id string) error

func (*ServiceManager) DeleteLogicalPort

func (sm *ServiceManager) DeleteLogicalPort(id string) error

func (*ServiceManager) DeleteLogicalRouter

func (sm *ServiceManager) DeleteLogicalRouter(id string) error

func (*ServiceManager) DeleteLogicalSwitch

func (sm *ServiceManager) DeleteLogicalSwitch(id string) error

func (*ServiceManager) DeleteTenant

func (sm *ServiceManager) DeleteTenant(id string) error

func (*ServiceManager) Get

func (sm *ServiceManager) Get(modulename, url, id string, opts *RequestOpts) (*resty.Response, error)

func (*ServiceManager) GetDHCPGroup

func (sm *ServiceManager) GetDHCPGroup(id string) (*models.DHCPGroup, error)

func (*ServiceManager) GetEndPort

func (sm *ServiceManager) GetEndPort(id string) (*models.EndPort, error)

func (*ServiceManager) GetExternalGateway

func (sm *ServiceManager) GetExternalGateway(id string) (*models.ExternalGateway, error)

func (*ServiceManager) GetFabric

func (sm *ServiceManager) GetFabric(id string) (*models.Fabric, error)

func (*ServiceManager) GetLogicalNetwork

func (sm *ServiceManager) GetLogicalNetwork(id string) (*models.LogicalNetwork, error)

func (*ServiceManager) GetLogicalPort

func (sm *ServiceManager) GetLogicalPort(id string) (*models.LogicalPort, error)

func (*ServiceManager) GetLogicalRouter

func (sm *ServiceManager) GetLogicalRouter(id string) (*models.LogicalRouter, error)

func (*ServiceManager) GetLogicalSwitch

func (sm *ServiceManager) GetLogicalSwitch(id string) (*models.LogicalSwitch, error)

func (*ServiceManager) GetTenant

func (sm *ServiceManager) GetTenant(id string) (*models.Tenant, error)

func (*ServiceManager) List

func (sm *ServiceManager) List(url string, opts *RequestOpts) (*resty.Response, error)

func (*ServiceManager) ListDHCPGroups

func (sm *ServiceManager) ListDHCPGroups(queryParameters *models.DHCPGroupRequestOpts) ([]*models.DHCPGroup, error)

func (*ServiceManager) ListEndPorts

func (sm *ServiceManager) ListEndPorts(queryParameters *models.EndPortRequestOpts) ([]*models.EndPort, error)

func (*ServiceManager) ListExternalGateways

func (sm *ServiceManager) ListExternalGateways(queryParameters *models.ExternalGatewayRequestOpts) ([]*models.ExternalGateway, error)

func (*ServiceManager) ListFabrics

func (sm *ServiceManager) ListFabrics(queryParameters *models.FabricRequestOpts) ([]*models.Fabric, error)

func (*ServiceManager) ListLogicalNetworks

func (sm *ServiceManager) ListLogicalNetworks(queryParameters *models.LogicalNetworkRequestOpts) ([]*models.LogicalNetwork, error)

func (*ServiceManager) ListLogicalPorts

func (sm *ServiceManager) ListLogicalPorts(queryParameters *models.LogicalPortRequestOpts) ([]*models.LogicalPort, error)

func (*ServiceManager) ListLogicalRouters

func (sm *ServiceManager) ListLogicalRouters(queryParameters *models.LogicalRouterRequestOpts) ([]*models.LogicalRouter, error)

func (*ServiceManager) ListLogicalSwitches

func (sm *ServiceManager) ListLogicalSwitches(queryParameters *models.LogicalSwitchRequestOpts) ([]*models.LogicalSwitch, error)

func (*ServiceManager) ListTenants

func (sm *ServiceManager) ListTenants(queryParameters *models.TenantRequestOpts) ([]*models.Tenant, error)

func (*ServiceManager) Post

func (sm *ServiceManager) Post(url string, opts *RequestOpts) (*resty.Response, error)

func (*ServiceManager) Put

func (sm *ServiceManager) Put(modulename, url, id string, opts *RequestOpts) (*resty.Response, error)

func (*ServiceManager) UpdateEndPort

func (sm *ServiceManager) UpdateEndPort(id, name *string, endPortAttr *models.EndPortAttributes) (*models.EndPort, error)

func (*ServiceManager) UpdateLogicalNetwork

func (sm *ServiceManager) UpdateLogicalNetwork(id, name *string, logicalNetworkAttr *models.LogicalNetworkAttributes) (*models.LogicalNetwork, error)

func (*ServiceManager) UpdateLogicalPort

func (sm *ServiceManager) UpdateLogicalPort(id, name *string, logicalPortAttr *models.LogicalPortAttributes) (*models.LogicalPort, error)

func (*ServiceManager) UpdateLogicalRouter

func (sm *ServiceManager) UpdateLogicalRouter(id, name *string, logicalRouterAttr *models.LogicalRouterAttributes) (*models.LogicalRouter, error)

func (*ServiceManager) UpdateLogicalSwitch

func (sm *ServiceManager) UpdateLogicalSwitch(id, name *string, logicalSwitchAttr *models.LogicalSwitchAttributes) (*models.LogicalSwitch, error)

func (*ServiceManager) UpdateTenant

func (sm *ServiceManager) UpdateTenant(id, name *string, tenantAttr *models.TenantAttributes) (*models.Tenant, error)

Jump to

Keyboard shortcuts

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