types

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const OpseeAdmin = "opsee_admin"

the permission which corresponds to opsee administrator

Variables

View Source
var (
	ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAny   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthErrors = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrors   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthPermissions = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPermissions   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTimestamp   = fmt.Errorf("proto: integer overflow")
)
View Source
var AnyTypeRegistry = NewTypesRegistry()
View Source
var PermissionsRegistry = NewPermsRegistry()

Functions

func UnmarshalAny

func UnmarshalAny(any *Any) (interface{}, error)

UnmarshalAny unmarshals an Any object based on its TypeUrl type hint.

Types

type Any

type Any struct {
	TypeUrl              string   `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
	Value                []byte   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func MarshalAny

func MarshalAny(i interface{}) (*Any, error)

func NewPopulatedAny

func NewPopulatedAny(r randyAny, easy bool) *Any

func (*Any) Descriptor

func (*Any) Descriptor() ([]byte, []int)

func (*Any) Equal

func (this *Any) Equal(that interface{}) bool

func (*Any) GetTypeUrl

func (m *Any) GetTypeUrl() string

func (*Any) GetValue

func (m *Any) GetValue() []byte

func (*Any) Marshal

func (m *Any) Marshal() (dAtA []byte, err error)

func (*Any) MarshalJSON

func (a *Any) MarshalJSON() ([]byte, error)

marshal any to json

func (*Any) MarshalTo

func (m *Any) MarshalTo(dAtA []byte) (int, error)

func (*Any) MarshalToSizedBuffer

func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Any) ProtoMessage

func (*Any) ProtoMessage()

func (*Any) Reset

func (m *Any) Reset()

func (*Any) Scan

func (a *Any) Scan(src interface{}) error

func (*Any) Size

func (m *Any) Size() (n int)

func (*Any) String

func (m *Any) String() string

func (*Any) Unmarshal

func (m *Any) Unmarshal(dAtA []byte) error

func (*Any) XXX_DiscardUnknown

func (m *Any) XXX_DiscardUnknown()

func (*Any) XXX_Marshal

func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Any) XXX_Merge

func (m *Any) XXX_Merge(src proto.Message)

func (*Any) XXX_Size

func (m *Any) XXX_Size() int

func (*Any) XXX_Unmarshal

func (m *Any) XXX_Unmarshal(b []byte) error

type BitFlags

type BitFlags interface {
	// represents bitflats as UInt64
	UInt64()
	// returns list of flags that are set
	HighFlags() []string
	// returns list of flags that are unset
	LowFlags() []string
	// sets a flag if it exists, returns err otherwise
	SetFlag(string) error
	// clears a flag or returns error
	ClearFlag(string) error
	// sets flags or returns errors
	SetFlags(...string) []error
	// clears flags or returns error
	ClearFlags(...string) []error
	// tests if flag is set
	TestFlag(string) bool
	// tests flags and returns bool if all flags are set
	TestFlags(...string) bool
	// initializes a flags object from a uint64
	FromUInt64(uint64) error
}

type Error

type Error struct {
	ErrorCode            string   `protobuf:"bytes,1,opt,name=errorCode,proto3" json:"errorCode,omitempty"`
	ErrorMessage         string   `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewError

func NewError(errorCode string, errorMessage string) *Error

func NewInvalidPermissionsError

func NewInvalidPermissionsError(pnames ...string) *Error

func NewPermissionsError

func NewPermissionsError(pnames ...string) *Error

func NewPopulatedError

func NewPopulatedError(r randyErrors, easy bool) *Error

func (Error) Code

func (o Error) Code() string

Error error

func (*Error) Descriptor

func (*Error) Descriptor() ([]byte, []int)

func (*Error) Equal

func (this *Error) Equal(that interface{}) bool

func (Error) Error

func (o Error) Error() string

func (*Error) GetErrorCode

func (m *Error) GetErrorCode() string

func (*Error) GetErrorMessage

func (m *Error) GetErrorMessage() string

func (*Error) Marshal

func (m *Error) Marshal() (dAtA []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(dAtA []byte) (int, error)

func (*Error) MarshalToSizedBuffer

func (m *Error) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Error) Message

func (o Error) Message() string

func (Error) OrigErr

func (o Error) OrigErr() error

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) Size

func (m *Error) Size() (n int)

func (*Error) String

func (m *Error) String() string

func (*Error) Unmarshal

func (m *Error) Unmarshal(dAtA []byte) error

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

type OpseeError

type OpseeError interface {
	error

	// Returns the short phrase depicting the classification of the error.
	Code() string

	// Returns the error details message.
	Message() string

	// Returns the original error if one was set.  Nil is returned if not set.
	OrigErr() error
}

Equivalent to aws-sdk-go Error interface

type Permission

type Permission struct {
	Perm                 uint64   `protobuf:"fixed64,1,opt,name=perm,proto3" json:"perm,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewPermissions

func NewPermissions(name string, perms ...string) (*Permission, error)

Returns new permissions with mapping of bit to perms in order

func NewPopulatedPermission

func NewPopulatedPermission(r randyPermissions, easy bool) *Permission

func (*Permission) CheckPermissions

func (p *Permission) CheckPermissions(pnames ...string) map[string]error

Checks permissions map for permission names, returns errors for those that do not exist

func (*Permission) Clear

func (p *Permission) Clear(i int)

UnSet flag i in permission

func (*Permission) ClearPermission

func (p *Permission) ClearPermission(perm string) bool

Clear permission by name

func (*Permission) ClearPermissions

func (p *Permission) ClearPermissions(perms ...string) (failed []string)

Clear permissions by name

func (*Permission) Descriptor

func (*Permission) Descriptor() ([]byte, []int)

func (*Permission) Equal

func (this *Permission) Equal(that interface{}) bool

func (*Permission) GetName

func (m *Permission) GetName() string

func (*Permission) GetPerm

func (m *Permission) GetPerm() uint64

func (*Permission) HasPermissions

func (p *Permission) HasPermissions(pnames ...string) map[string]bool

Checks permissions map for permission names, returns errors for those that do not exist

func (*Permission) HighBits

func (p *Permission) HighBits() []int

Returns dank bits

func (*Permission) Marshal

func (m *Permission) Marshal() (dAtA []byte, err error)

func (*Permission) MarshalJSON

func (p *Permission) MarshalJSON() ([]byte, error)

Override MarshalJson to return a list of permissions

func (*Permission) MarshalTo

func (m *Permission) MarshalTo(dAtA []byte) (int, error)

func (*Permission) MarshalToSizedBuffer

func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Permission) Permissions

func (p *Permission) Permissions() []string

Returns a list of permissions we have

func (*Permission) ProtoMessage

func (*Permission) ProtoMessage()

func (*Permission) Reset

func (m *Permission) Reset()

func (*Permission) Scan

func (p *Permission) Scan(src interface{}) error

func (*Permission) Set

func (p *Permission) Set(i int)

Set flag i in permission

func (*Permission) SetPermission

func (p *Permission) SetPermission(perm string) bool

Set permission by name

func (*Permission) SetPermissions

func (p *Permission) SetPermissions(perms ...string) (failed []string)

Set permissions by name

func (*Permission) Size

func (m *Permission) Size() (n int)

func (*Permission) String

func (m *Permission) String() string

func (*Permission) Test

func (p *Permission) Test(i int) bool

Flag i in permission contains 1

func (*Permission) Unmarshal

func (m *Permission) Unmarshal(dAtA []byte) error

func (*Permission) Validate

func (p *Permission) Validate() error

func (*Permission) Value

func (p *Permission) Value() (driver.Value, error)

func (*Permission) XXX_DiscardUnknown

func (m *Permission) XXX_DiscardUnknown()

func (*Permission) XXX_Marshal

func (m *Permission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Permission) XXX_Merge

func (m *Permission) XXX_Merge(src proto.Message)

func (*Permission) XXX_Size

func (m *Permission) XXX_Size() int

func (*Permission) XXX_Unmarshal

func (m *Permission) XXX_Unmarshal(b []byte) error

type PermissionsBitmap

type PermissionsBitmap struct {
	Name string

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPermissionsBitmap

func NewPermissionsBitmap(perms ...string) *PermissionsBitmap

Returns new permissions bitmap with mapping of bit to perms in order

func (*PermissionsBitmap) Bit

func (p *PermissionsBitmap) Bit(perm string) (int, bool)

Returns bit number of a permission

func (*PermissionsBitmap) Get

func (p *PermissionsBitmap) Get(i int) (string, bool)

Returns flag given bitnumber

func (*PermissionsBitmap) Length

func (p *PermissionsBitmap) Length() int

Returns number of permissions in the Bitmap

func (*PermissionsBitmap) Register

func (p *PermissionsBitmap) Register(i int, name string)

Registers permission in the Bitmap and the Inverted map

type PermsRegistry

type PermsRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPermsRegistry

func NewPermsRegistry() *PermsRegistry

Registry for Perms bitmaps

func (*PermsRegistry) Get

func (p *PermsRegistry) Get(name string) (*PermissionsBitmap, bool)

func (*PermsRegistry) Register

func (p *PermsRegistry) Register(name string, bmap *PermissionsBitmap)

type Timestamp

type Timestamp struct {
	Seconds              int64    `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
	Nanos                int32    `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewPopulatedTimestamp

func NewPopulatedTimestamp(r randyTimestamp, easy bool) *Timestamp

func NewTimestamp

func NewTimestamp(src interface{}) *Timestamp

Returns a new timestamp by scanning value in src. On scan error, returns the zero value.

func (*Timestamp) Descriptor

func (*Timestamp) Descriptor() ([]byte, []int)

func (*Timestamp) Equal

func (this *Timestamp) Equal(that interface{}) bool

func (*Timestamp) GetNanos

func (m *Timestamp) GetNanos() int32

func (*Timestamp) GetSeconds

func (m *Timestamp) GetSeconds() int64

func (*Timestamp) Marshal

func (m *Timestamp) Marshal() (dAtA []byte, err error)

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) MarshalTo

func (m *Timestamp) MarshalTo(dAtA []byte) (int, error)

func (*Timestamp) MarshalToSizedBuffer

func (m *Timestamp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Timestamp) Millis

func (t *Timestamp) Millis() int64

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) Reset

func (m *Timestamp) Reset()

func (*Timestamp) Scan

func (t *Timestamp) Scan(src interface{}) error

func (*Timestamp) ScanMillis

func (t *Timestamp) ScanMillis(millis int64)

func (*Timestamp) Size

func (m *Timestamp) Size() (n int)

func (*Timestamp) String

func (m *Timestamp) String() string

func (*Timestamp) Time

func (t *Timestamp) Time() time.Time

func (*Timestamp) Unmarshal

func (m *Timestamp) Unmarshal(dAtA []byte) error

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

func (*Timestamp) Validate

func (t *Timestamp) Validate() error

func (*Timestamp) Value

func (t *Timestamp) Value() (driver.Value, error)

func (*Timestamp) XXX_DiscardUnknown

func (m *Timestamp) XXX_DiscardUnknown()

func (*Timestamp) XXX_Marshal

func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Timestamp) XXX_Merge

func (m *Timestamp) XXX_Merge(src proto.Message)

func (*Timestamp) XXX_Size

func (m *Timestamp) XXX_Size() int

func (*Timestamp) XXX_Unmarshal

func (m *Timestamp) XXX_Unmarshal(b []byte) error

type TypesRegistry

type TypesRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTypesRegistry

func NewTypesRegistry() *TypesRegistry

Registry for Any

func (*TypesRegistry) Get

func (this *TypesRegistry) Get(name string) (reflect.Type, bool)

func (*TypesRegistry) Register

func (this *TypesRegistry) Register(name string, t reflect.Type)

Jump to

Keyboard shortcuts

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