client

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MPL-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForErrors

func CheckForErrors(cont *container.Container, method string) error

CheckForErrors parses the response and checks of there is an error attribute in the response

func GetObjectNameByUUID added in v1.19.0

func GetObjectNameByUUID(objectRef string, objectCont *container.Container) (string, bool)

GetObjectNameByUUID returns the name of an object given its UUID and boolean indicating whether the object was found or not.

func GetObjectUUIDByName added in v1.19.0

func GetObjectUUIDByName(objectName string, objectCont *container.Container) (string, bool)

GetObjectUUIDByName returns the UUID of an object given its name and boolean indicating whether the object was found or not.

func StrtoInt

func StrtoInt(s string, startIndex int, bitSize int) (int64, error)

Types

type Auth

type Auth struct {
	Token  string
	Expiry time.Time
}

func (*Auth) CalculateExpiry

func (t *Auth) CalculateExpiry(willExpire int64)

func (*Auth) IsValid

func (au *Auth) IsValid() bool

type Client

type Client struct {
	BaseURL *url.URL

	AuthToken *Auth
	Mutex     sync.Mutex
	// contains filtered or unexported fields
}

Client is the main entry point

func GetClient

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

GetClient returns a singleton

func (*Client) Authenticate

func (c *Client) Authenticate() error

Authenticate is used to

func (*Client) CompareVersion added in v1.9.1

func (c *Client) CompareVersion(v string) (int, error)

Compares the version to the retrieved version. This returns -1, 0, or 1 if this version is smaller, equal, or larger than the retrieved version, respectively.

func (*Client) CreateAnpEpgUsegAttr added in v1.3.8

func (client *Client) CreateAnpEpgUsegAttr(obj *models.SiteUsegAttr) error

func (*Client) CreateDHCPOptionPolicy added in v1.3.1

func (client *Client) CreateDHCPOptionPolicy(obj *models.DHCPOptionPolicy) (*container.Container, error)

func (*Client) CreateDHCPOptionPolicyOption added in v1.3.1

func (client *Client) CreateDHCPOptionPolicyOption(obj *models.DHCPOptionPolicyOption) error

func (*Client) CreateDHCPRelayPolicy added in v1.3.1

func (client *Client) CreateDHCPRelayPolicy(obj *models.DHCPRelayPolicy) (*container.Container, error)

func (*Client) CreateDHCPRelayPolicyProvider added in v1.3.1

func (client *Client) CreateDHCPRelayPolicyProvider(obj *models.DHCPRelayPolicyProvider) error

func (*Client) CreateInterSchemaSiteVrfRegionHubNetwork added in v1.3.1

func (client *Client) CreateInterSchemaSiteVrfRegionHubNetwork(obj *models.InterSchemaSiteVrfRegionHubNetork) error

func (*Client) CreateIntersiteL3outs added in v1.3.1

func (client *Client) CreateIntersiteL3outs(obj *models.IntersiteL3outs) error

func (*Client) CreateTemplateBDDHCPPolicy added in v1.3.1

func (client *Client) CreateTemplateBDDHCPPolicy(obj *models.TemplateBDDHCPPolicy) (*container.Container, error)

func (*Client) DeleteAnpEpgUsegAttr added in v1.3.8

func (client *Client) DeleteAnpEpgUsegAttr(obj *models.SiteUsegAttr) error

func (*Client) DeleteDHCPOptionPolicy added in v1.3.1

func (client *Client) DeleteDHCPOptionPolicy(id string) error

func (*Client) DeleteDHCPOptionPolicyOption added in v1.3.1

func (client *Client) DeleteDHCPOptionPolicyOption(id string) error

func (*Client) DeleteDHCPRelayPolicy added in v1.3.1

func (client *Client) DeleteDHCPRelayPolicy(id string) error

func (*Client) DeleteDHCPRelayPolicyProvider added in v1.3.1

func (client *Client) DeleteDHCPRelayPolicyProvider(obj *models.DHCPRelayPolicyProvider) error

func (*Client) DeleteInterSchemaSiteVrfRegionHubNetwork added in v1.3.1

func (client *Client) DeleteInterSchemaSiteVrfRegionHubNetwork(obj *models.InterSchemaSiteVrfRegionHubNetork) error

func (*Client) DeleteIntersiteL3outs added in v1.3.1

func (client *Client) DeleteIntersiteL3outs(obj *models.IntersiteL3outs) error

func (*Client) DeleteTemplateBDDHCPPolicy added in v1.3.1

func (client *Client) DeleteTemplateBDDHCPPolicy(obj *models.TemplateBDDHCPPolicy) (*container.Container, error)

func (*Client) DeletebyId

func (c *Client) DeletebyId(url string) error

func (*Client) Do

func (*Client) GetDHCPOptionPolicyID added in v1.3.1

func (client *Client) GetDHCPOptionPolicyID(name string) (string, error)

func (*Client) GetDHCPPoliciesNameByUUID added in v1.19.0

func (client *Client) GetDHCPPoliciesNameByUUID(tenantID string, objectRefs []interface{}) ([]interface{}, error)

GetDHCPPoliciesNameByUUID retrieves the DHCP policies' names by UUID. It takes in the tenant ID and a list of object references as parameters. The function returns a list of interface{} and an error.

func (*Client) GetDHCPPoliciesUUIDByName added in v1.19.0

func (client *Client) GetDHCPPoliciesUUIDByName(tenantID string, objectNames []interface{}) ([]interface{}, error)

GetDHCPPoliciesUUIDByName retrieves the DHCP policies UUIDs by name for a given tenant ID.

Parameters: - tenantID: The ID of the tenant. - objectNames: An array of objects containing the relay name and option name.

func (*Client) GetDHCPRelayPolicyID added in v1.3.1

func (client *Client) GetDHCPRelayPolicyID(name string) (string, error)

func (*Client) GetDomainId

func (c *Client) GetDomainId(domain string) (string, error)

func (*Client) GetPlatform

func (c *Client) GetPlatform() string

func (*Client) GetPoliciesByTenantID added in v1.19.0

func (client *Client) GetPoliciesByTenantID(objectType, tenantID string) (*container.Container, error)

GetPoliciesByTenantID returns the policies container object based on the tenant id.

func (*Client) GetPolicyByTenantID added in v1.19.0

func (client *Client) GetPolicyByTenantID(objectType, objectName, tenantID string) (map[string]interface{}, error)

GetPolicyByTenantID retrieves a policy based on the given object type, object name, and tenant ID.

func (*Client) GetSchemaValidate added in v1.3.1

func (c *Client) GetSchemaValidate(endpoint string) (*container.Container, error)

func (*Client) GetTenantIDFromSchemaTemplate added in v1.19.0

func (client *Client) GetTenantIDFromSchemaTemplate(schemaID, templateName string) (string, error)

GetTenantIDFromSchemaTemplate retrieves the Tenant ID from the schema template object.

func (*Client) GetVersion added in v1.9.1

func (c *Client) GetVersion() (string, error)

func (*Client) GetViaURL

func (c *Client) GetViaURL(endpoint string) (*container.Container, error)

func (*Client) InjectAuthenticationHeader

func (client *Client) InjectAuthenticationHeader(req *http.Request, path string) (*http.Request, error)

func (*Client) MakeRestRequest

func (c *Client) MakeRestRequest(method string, path string, body *container.Container, authenticated bool) (*http.Request, error)

func (*Client) PatchbyID

func (c *Client) PatchbyID(endpoint string, objList ...models.Model) (*container.Container, error)

func (*Client) PrepareModel

func (c *Client) PrepareModel(obj models.Model) (*container.Container, error)

func (*Client) Put

func (c *Client) Put(endpoint string, obj models.Model) (*container.Container, error)

func (*Client) ReadAnpEpgUsegAttr added in v1.3.8

func (client *Client) ReadAnpEpgUsegAttr(obj *models.SiteUsegAttr) (*models.SiteUsegAttr, int, error)

func (*Client) ReadDHCPOptionPolicy added in v1.3.1

func (client *Client) ReadDHCPOptionPolicy(id string) (*container.Container, error)

func (*Client) ReadDHCPOptionPolicyOption added in v1.3.1

func (client *Client) ReadDHCPOptionPolicyOption(id string) (*models.DHCPOptionPolicyOption, error)

func (*Client) ReadDHCPRelayPolicy added in v1.3.1

func (client *Client) ReadDHCPRelayPolicy(id string) (*container.Container, error)

func (*Client) ReadDHCPRelayPolicyProvider added in v1.3.1

func (client *Client) ReadDHCPRelayPolicyProvider(obj *models.DHCPRelayPolicyProvider) (*models.DHCPRelayPolicyProvider, error)

func (*Client) ReadInterSchemaSiteVrfRegionHubNetwork added in v1.3.1

func (client *Client) ReadInterSchemaSiteVrfRegionHubNetwork(obj *models.InterSchemaSiteVrfRegionHubNetork) (*models.InterSchemaSiteVrfRegionHubNetork, error)

func (*Client) ReadIntersiteL3outs added in v1.3.1

func (client *Client) ReadIntersiteL3outs(obj *models.IntersiteL3outs) (*models.IntersiteL3outs, error)

func (*Client) ReadSchemaValidate added in v1.3.1

func (client *Client) ReadSchemaValidate(obj *models.SchemValidate) (*models.SchemValidate, error)

func (*Client) ReadTemplateBDDHCPPolicy added in v1.3.1

func (client *Client) ReadTemplateBDDHCPPolicy(schemaID string) (*container.Container, error)

func (*Client) Save

func (c *Client) Save(endpoint string, obj models.Model) (*container.Container, error)

func (*Client) UpdateAnpEpgUsegAttr added in v1.3.8

func (client *Client) UpdateAnpEpgUsegAttr(obj *models.SiteUsegAttr) error

func (*Client) UpdateDHCPOptionPolicy added in v1.3.1

func (client *Client) UpdateDHCPOptionPolicy(id string, obj *models.DHCPOptionPolicy) (*container.Container, error)

func (*Client) UpdateDHCPOptionPolicyOption added in v1.3.1

func (client *Client) UpdateDHCPOptionPolicyOption(obj *models.DHCPOptionPolicyOption) error

func (*Client) UpdateDHCPRelayPolicy added in v1.3.1

func (client *Client) UpdateDHCPRelayPolicy(id string, obj *models.DHCPRelayPolicy) (*container.Container, error)

func (*Client) UpdateDHCPRelayPolicyProvider added in v1.3.1

func (client *Client) UpdateDHCPRelayPolicyProvider(new *models.DHCPRelayPolicyProvider, old *models.DHCPRelayPolicyProvider) error

func (*Client) UpdateTemplateBDDHCPPolicy added in v1.3.1

func (client *Client) UpdateTemplateBDDHCPPolicy(obj *models.TemplateBDDHCPPolicy) (*container.Container, error)

type Option

type Option func(*Client)

func Domain

func Domain(domain string) Option

func Insecure

func Insecure(insecure bool) Option

func Password

func Password(password string) Option

func Platform

func Platform(platform string) Option

func ProxyUrl

func ProxyUrl(pUrl string) Option

func SkipLoggingPayload added in v1.3.9

func SkipLoggingPayload(skipLoggingPayload bool) Option

func Version added in v1.9.1

func Version(version string) Option

Jump to

Keyboard shortcuts

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