util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 17 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpAPIError

func DumpAPIError(err error) (*model.ApiError, *apierrors.ErrorTypeEnum)

if ApiError is nil, check ErrorTypeEnum, such as ServiceUnavailable if both return value are nil, the error is not on the list there is no httpstatus, ApiError does't include it

func HandleHTTPResponse

func HandleHTTPResponse(response *http.Response, result interface{}, debug bool) (error, []byte)

func ParseVPCPath

func ParseVPCPath(nsxResourcePath string) (orgID string, projectID string, vpcID string, resourceID string)

func ShouldGroundPoint

func ShouldGroundPoint(err error) bool

ShouldGroundPoint checks if it's a error which grounds an endpoint.

func ShouldRegenerate

func ShouldRegenerate(err error) bool

ShouldRegenerate check if it's a error should regenerate pool.

func ShouldRetry

func ShouldRetry(err error) bool

ShouldRetry checks if it's a retriable error.

func VerifyNsxCertWithThumbprint added in v0.0.3

func VerifyNsxCertWithThumbprint(der []byte, thumbprint string) error

Types

type APITransactionAborted

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

func CreateAPITransactionAborted

func CreateAPITransactionAborted() *APITransactionAborted

type BackendResourceNotFound

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

func CreateBackendResourceNotFound

func CreateBackendResourceNotFound(details string, manager string, operation string) BackendResourceNotFound

type BadJSONWebTokenProviderRequest

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

func CreateBadJSONWebTokenProviderRequest

func CreateBadJSONWebTokenProviderRequest(msg string) *BadJSONWebTokenProviderRequest

func (*BadJSONWebTokenProviderRequest) Error

func (impl *BadJSONWebTokenProviderRequest) Error() string

type BadXSRFToken

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

func CreateBadXSRFToken

func CreateBadXSRFToken() *BadXSRFToken

type CannotConnectToServer

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

func CreateCannotConnectToServer

func CreateCannotConnectToServer() *CannotConnectToServer

type CertificateError

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

func CreateCertificateError

func CreateCertificateError(msg string) *CertificateError

func (*CertificateError) Error

func (impl *CertificateError) Error() string

type ClientCertificateNotTrusted

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

func CreateClientCertificateNotTrusted

func CreateClientCertificateNotTrusted() *ClientCertificateNotTrusted

type ConnectionError

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

func CreateConnectionError

func CreateConnectionError(host string) *ConnectionError

func (*ConnectionError) Error

func (impl *ConnectionError) Error() string

type DetailedRealizationTimeoutError

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

func CreateDetailedRealizationTimeoutError

func CreateDetailedRealizationTimeoutError(resourceType string, resourceID string, realizedType string, relatedType string, relatedID string, attempts string, sleep string) *DetailedRealizationTimeoutError

type ErrorDetail

type ErrorDetail struct {
	StatusCode         int
	ErrorCode          int
	RelatedErrorCodes  []int
	RelatedStatusCodes []string
	Details            string
}

ErrorDetail is error detail which info extracted from http.Response.Body.

func (*ErrorDetail) Error

func (e *ErrorDetail) Error() string

type GeneralManagerError

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

func CreateGeneralManagerError

func CreateGeneralManagerError(manager string, operation string, details string) *GeneralManagerError

type GeneralNsxError

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

func (*GeneralNsxError) Error

func (impl *GeneralNsxError) Error() string

type GeneralNsxLibInvalidInput

type GeneralNsxLibInvalidInput struct {
	NsxLibInvalidInputImpl
}

func CreateNsxLibInvalidInput

func CreateNsxLibInvalidInput(errorMessage string) *GeneralNsxLibInvalidInput

func (*GeneralNsxLibInvalidInput) Error

func (impl *GeneralNsxLibInvalidInput) Error() string

type GeneralSearchError

type GeneralSearchError struct {
	NsxSearchErrorImpl
}

func CreateGeneralNsxSearchError

func CreateGeneralNsxSearchError() *GeneralSearchError

func (*GeneralSearchError) Error

func (impl *GeneralSearchError) Error() string

type GeneralServerBusy

type GeneralServerBusy struct {
	ServerBusyImpl
}

func CreateGeneralServerBusy

func CreateGeneralServerBusy(resourceType string, resourceID string, realizedType string, relatedType string, relatedID string, attempts string, sleep string) *GeneralServerBusy

type IPBlockAllExhaustedError

type IPBlockAllExhaustedError struct {
	Desc string
}

func (IPBlockAllExhaustedError) Error

func (err IPBlockAllExhaustedError) Error() string

type InvalidCredentials

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

func CreateInvalidCredentials

func CreateInvalidCredentials(msg string) *InvalidCredentials

type InvalidInput

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

func CreateInvalidInput

func CreateInvalidInput(operation string, argVal string, argName string) *InvalidInput

type InvalidLicense

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

func CreateInvalidLicense

func CreateInvalidLicense(msg string) *InvalidLicense

type ManagerError

type ManagerError interface {
	NsxError
	// contains filtered or unexported methods
}

type MultipleResourcesFound

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

func CreateMultipleResourcesFound

func CreateMultipleResourcesFound(manager string, operation string) *MultipleResourcesFound

type NSGroupIsFull

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

func CreateNSGroupIsFull

func CreateNSGroupIsFull(nsgroupID string) *NSGroupIsFull

type NSGroupMemberNotFound

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

func CreateNSGroupMemberNotFound

func CreateNSGroupMemberNotFound(nsgroupID string, memberID string) *NSGroupMemberNotFound

type NoEffectiveOption

type NoEffectiveOption struct {
	Desc string
}

func (NoEffectiveOption) Error

func (err NoEffectiveOption) Error() string

type NotImplemented

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

func CreateNotImplemented

func CreateNotImplemented(operation string) *NotImplemented

func (*NotImplemented) Error

func (impl *NotImplemented) Error() string

type NsxError

type NsxError interface {
	Error() string
	// contains filtered or unexported methods
}

func InitErrorFromResponse

func InitErrorFromResponse(host string, statusCode int, body []byte) NsxError

InitErrorFromResponse returns error based on http.Response

type NsxIndexingInProgress

type NsxIndexingInProgress struct {
	NsxSearchErrorImpl
}

func CreateNsxIndexingInProgress

func CreateNsxIndexingInProgress() *NsxIndexingInProgress

func (*NsxIndexingInProgress) Error

func (impl *NsxIndexingInProgress) Error() string

type NsxLibInvalidInput

type NsxLibInvalidInput interface {
	NsxError
	// contains filtered or unexported methods
}

type NsxLibInvalidInputImpl

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

func (*NsxLibInvalidInputImpl) Error

func (impl *NsxLibInvalidInputImpl) Error() string

type NsxOverlapAddresses

type NsxOverlapAddresses struct {
	NsxLibInvalidInputImpl
}

func CreateNsxOverlapAddresses

func CreateNsxOverlapAddresses(details string) *NsxOverlapAddresses

func (*NsxOverlapAddresses) Error

func (impl *NsxOverlapAddresses) Error() string

type NsxOverlapVlan

type NsxOverlapVlan struct {
	NsxLibInvalidInputImpl
}

func CreateNsxOverlapVlan

func CreateNsxOverlapVlan() *NsxOverlapVlan

func (*NsxOverlapVlan) Error

func (impl *NsxOverlapVlan) Error() string

type NsxPendingDelete

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

func CreateNsxPendingDelete

func CreateNsxPendingDelete() *NsxPendingDelete

func (*NsxPendingDelete) Error

func (impl *NsxPendingDelete) Error() string

type NsxSearchError

type NsxSearchError interface {
	NsxError
	// contains filtered or unexported methods
}

type NsxSearchErrorImpl

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

func (*NsxSearchErrorImpl) Error

func (impl *NsxSearchErrorImpl) Error() string

type NsxSearchInvalidQuery

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

func CreateNsxSearchInvalidQuery

func CreateNsxSearchInvalidQuery(reason string) *NsxSearchInvalidQuery

func (*NsxSearchInvalidQuery) Error

func (impl *NsxSearchInvalidQuery) Error() string

type NsxSearchOutOfSync

type NsxSearchOutOfSync struct {
	NsxSearchErrorImpl
}

func CreateNsxSearchOutOfSync

func CreateNsxSearchOutOfSync() *NsxSearchOutOfSync

func (*NsxSearchOutOfSync) Error

func (impl *NsxSearchOutOfSync) Error() string

type NsxSearchTimeout

type NsxSearchTimeout struct {
	NsxSearchErrorImpl
}

func CreateNsxSearchTimeout

func CreateNsxSearchTimeout() *NsxSearchTimeout

func (*NsxSearchTimeout) Error

func (impl *NsxSearchTimeout) Error() string

type NsxSegmentWithVM

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

func CreateNsxSegmentWithVM

func CreateNsxSegmentWithVM() *NsxSegmentWithVM

type ObjectAlreadyExists

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

ObjectAlreadyExists means object already exsists on the backend

func CreateObjectAlreadyExists

func CreateObjectAlreadyExists(objectType string) *ObjectAlreadyExists

func (*ObjectAlreadyExists) Error

func (impl *ObjectAlreadyExists) Error() string

type ObjectNotGenerated

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

func CreateObjectNotGenerated

func CreateObjectNotGenerated(objectType string) *ObjectNotGenerated

func (*ObjectNotGenerated) Error

func (impl *ObjectNotGenerated) Error() string

type PageMaxError

type PageMaxError struct {
	Desc string
}

PageMaxError For client usage

func (PageMaxError) Error

func (err PageMaxError) Error() string

type PodIPNotFound

type PodIPNotFound struct {
	Desc string
}

func (PodIPNotFound) Error

func (err PodIPNotFound) Error() string

type PodNotRunning

type PodNotRunning struct {
	Desc string
}

func (PodNotRunning) Error

func (err PodNotRunning) Error() string

type PortAddress

type PortAddress struct {
	// Port is the port number.
	Port int `json:"port"`
	// IPs is a list of IPs associated to port number.
	IPs []string `json:"ips"`
}

PortAddress is used when named port is specified.

func MergeAddressByPort

func MergeAddressByPort(portAddressOriginal []PortAddress) []PortAddress

type RealizationError

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

func CreateRealizationError

func CreateRealizationError(operation string, argVal string, argName string) *RealizationError

type RealizationErrorStateError

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

func CreateRealizationErrorStateError

func CreateRealizationErrorStateError(resourceType string, resourceID string, error string) *RealizationErrorStateError

type RealizationTimeoutError

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

func CreateRealizationTimeoutError

func CreateRealizationTimeoutError(resourceType string, resourceID string, attempts string, sleep string) *RealizationTimeoutError

type ResourceInUse

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

func CreateResourceInUse

func CreateResourceInUse() *ResourceInUse

type ResourceNotFound

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

ResourceNotFound indicates resource not found by backend

func CreateResourceNotFound

func CreateResourceNotFound(manager string, operation string) *ResourceNotFound

type RestrictionError

type RestrictionError struct {
	Desc string
}

func (RestrictionError) Error

func (err RestrictionError) Error() string

type SecurityGroupMaximumCapacityReached

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

func CreateSecurityGroupMaximumCapacityReached

func CreateSecurityGroupMaximumCapacityReached(sgID string) *SecurityGroupMaximumCapacityReached

type ServerBusy

type ServerBusy interface {
	ManagerError
	// contains filtered or unexported methods
}

type ServerBusyImpl

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

type ServiceClusterUnavailable

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

func CreateServiceClusterUnavailable

func CreateServiceClusterUnavailable(clusterID string) *ServiceClusterUnavailable

type ServiceUnavailable

type ServiceUnavailable struct {
	ServerBusyImpl
}

func CreateServiceUnavailable

func CreateServiceUnavailable(resourceType string, resourceID string, realizedType string, relatedType string, relatedID string, attempts string, sleep string) *ServiceUnavailable

type StaleRevision

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

func CreateStaleRevision

func CreateStaleRevision(resourceType string, resourceID string, realizedType string, relatedType string, relatedID string, attempts string, sleep string) *StaleRevision

type Timeout

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

func CreateTimeout

func CreateTimeout(host string) *Timeout

func (*Timeout) Error

func (impl *Timeout) Error() string

type TooManyRequests

type TooManyRequests struct {
	ServerBusyImpl
}

func CreateTooManyRequests

func CreateTooManyRequests(resourceType string, resourceID string, realizedType string, relatedType string, relatedID string, attempts string, sleep string) *TooManyRequests

Jump to

Keyboard shortcuts

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