resourcemanager

package
v0.0.0-...-b5aa0b6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package resourcemanager is a generated protocol buffer package.

It is generated from these files:

resources.proto

It has these top-level messages:

PrincipalInfo
CombinedPrincipal
ResourceInfo
ResourceMasterInfo

Index

Constants

This section is empty.

Variables

View Source
var ResourceType_name = map[int32]string{
	1: "FILE",
	2: "DIRECTORY",
}
View Source
var ResourceType_value = map[string]int32{
	"FILE":      1,
	"DIRECTORY": 2,
}

Functions

func DecodeTime

func DecodeTime(s string) (*time.Time, error)

func EncodeTime

func EncodeTime(t time.Time) (string, error)

func FindCombinedPrincipalPosition

func FindCombinedPrincipalPosition(toFind CombinedPrincipal, cpList []*CombinedPrincipal) int

FindCombinedPrincipalPosition looks up the resource by its name and returns position in stack.

func PrintPrincipalList

func PrintPrincipalList(pl []*CombinedPrincipal)

func ReadTable

func ReadTable(table *ResourceMasterInfo, tableFileName string, fileSecrets []byte, mutex *sync.RWMutex) bool

func SameCombinedPrincipal

func SameCombinedPrincipal(p1 CombinedPrincipal, p2 CombinedPrincipal) bool

func SaveTable

func SaveTable(table *ResourceMasterInfo, tableFileName string, fileSecrets []byte, mutex *sync.RWMutex) bool

Types

type CombinedPrincipal

type CombinedPrincipal struct {
	Principals       []*PrincipalInfo `protobuf:"bytes,1,rep,name=principals" json:"principals,omitempty"`
	XXX_unrecognized []byte           `json:"-"`
}

A combined principal is several principals like application, user, all of which have to be authenticated to constitute an authorization.

func MakeCombinedPrincipalFromOne

func MakeCombinedPrincipalFromOne(appPrincipal *PrincipalInfo) *CombinedPrincipal

MakeCombinedPrincipalFromOne

func MakeCombinedPrincipalFromTwo

func MakeCombinedPrincipalFromTwo(appPrincipal *PrincipalInfo, userPrincipal *PrincipalInfo) *CombinedPrincipal

MakeCombinedPrincipalFromTwo

func (*CombinedPrincipal) Descriptor

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

func (*CombinedPrincipal) GetPrincipals

func (m *CombinedPrincipal) GetPrincipals() []*PrincipalInfo

func (*CombinedPrincipal) PrintCombinedPrincipal

func (cp *CombinedPrincipal) PrintCombinedPrincipal()

func (*CombinedPrincipal) ProtoMessage

func (*CombinedPrincipal) ProtoMessage()

func (*CombinedPrincipal) Reset

func (m *CombinedPrincipal) Reset()

func (*CombinedPrincipal) String

func (m *CombinedPrincipal) String() string

type PrincipalInfo

type PrincipalInfo struct {
	// Principal name (should match common name in cert, if user, OU if application).
	Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	// Signed certificate.
	Cert             []byte `protobuf:"bytes,2,opt,name=cert" json:"cert,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

func (*PrincipalInfo) Descriptor

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

func (*PrincipalInfo) GetCert

func (m *PrincipalInfo) GetCert() []byte

func (*PrincipalInfo) GetName

func (m *PrincipalInfo) GetName() string

func (*PrincipalInfo) PrintPrincipal

func (p *PrincipalInfo) PrintPrincipal()

func (*PrincipalInfo) ProtoMessage

func (*PrincipalInfo) ProtoMessage()

func (*PrincipalInfo) Reset

func (m *PrincipalInfo) Reset()

func (*PrincipalInfo) String

func (m *PrincipalInfo) String() string

type ResourceInfo

type ResourceInfo struct {
	// Resource name,  e.g. - directory1/directory2/filename.
	Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
	// Always ResourceType.FILE.
	Type *int32 `protobuf:"varint,2,opt,name=type" json:"type,omitempty"`
	// Encoded created time.
	DateCreated *string `protobuf:"bytes,3,opt,name=date_created,json=dateCreated" json:"date_created,omitempty"`
	// Encoded modified time.
	DateModified *string `protobuf:"bytes,4,opt,name=date_modified,json=dateModified" json:"date_modified,omitempty"`
	// Size in bytes.
	Size *int32 `protobuf:"varint,5,opt,name=size" json:"size,omitempty"`
	// File encryption and integrity keys.
	Keys []byte `protobuf:"bytes,6,opt,name=keys" json:"keys,omitempty"`
	// List of owners.
	Owners []*CombinedPrincipal `protobuf:"bytes,7,rep,name=owners" json:"owners,omitempty"`
	// List of writers.
	Writers []*CombinedPrincipal `protobuf:"bytes,8,rep,name=writers" json:"writers,omitempty"`
	// List of readers.
	Readers          []*CombinedPrincipal `protobuf:"bytes,9,rep,name=readers" json:"readers,omitempty"`
	XXX_unrecognized []byte               `json:"-"`
}

Readers and writers can delegate writes. Writers to a directory can create and delete files in the directory.

func (*ResourceInfo) AddOwner

func (info *ResourceInfo) AddOwner(p CombinedPrincipal, mutex *sync.RWMutex) error

Add Owner

func (*ResourceInfo) AddReader

func (info *ResourceInfo) AddReader(p CombinedPrincipal, mutex *sync.RWMutex) error

Add Reader

func (*ResourceInfo) AddWriter

func (info *ResourceInfo) AddWriter(p CombinedPrincipal, mutex *sync.RWMutex) error

Add Writer

func (*ResourceInfo) DeleteOwner

func (info *ResourceInfo) DeleteOwner(p CombinedPrincipal, mutex *sync.RWMutex) error

TODO(jlm): add test Delete Owner

func (*ResourceInfo) DeleteReader

func (info *ResourceInfo) DeleteReader(p CombinedPrincipal, mutex *sync.RWMutex) error

TODO(jlm): add test Delete Reader

func (*ResourceInfo) DeleteWriter

func (info *ResourceInfo) DeleteWriter(p CombinedPrincipal, mutex *sync.RWMutex) error

TODO(jlm): add test Delete Writer.

func (*ResourceInfo) Descriptor

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

func (*ResourceInfo) GetDateCreated

func (m *ResourceInfo) GetDateCreated() string

func (*ResourceInfo) GetDateModified

func (m *ResourceInfo) GetDateModified() string

func (*ResourceInfo) GetKeys

func (m *ResourceInfo) GetKeys() []byte

func (*ResourceInfo) GetName

func (m *ResourceInfo) GetName() string

func (*ResourceInfo) GetOwners

func (m *ResourceInfo) GetOwners() []*CombinedPrincipal

func (*ResourceInfo) GetReaders

func (m *ResourceInfo) GetReaders() []*CombinedPrincipal

func (*ResourceInfo) GetSize

func (m *ResourceInfo) GetSize() int32

func (*ResourceInfo) GetType

func (m *ResourceInfo) GetType() int32

func (*ResourceInfo) GetWriters

func (m *ResourceInfo) GetWriters() []*CombinedPrincipal

func (*ResourceInfo) PrintResource

func (r *ResourceInfo) PrintResource(directory string, printContents bool)

PrintResource prints a resource to the log.

func (*ResourceInfo) ProtoMessage

func (*ResourceInfo) ProtoMessage()

func (*ResourceInfo) Read

func (r *ResourceInfo) Read(directory string) ([]byte, error)

Read causes the bytes of the file to be decrypted and read to the message stream. By the time this function is called, the remote principal has already been authenticated and the operation has already been authorized.

func (*ResourceInfo) Reset

func (m *ResourceInfo) Reset()

func (*ResourceInfo) String

func (m *ResourceInfo) String() string

func (*ResourceInfo) Write

func (r *ResourceInfo) Write(directory string, fileContents []byte) error

Write causes the bytes of the file to be encrypted and integrity-protected and written to disk as they are read from the MessageStream.

type ResourceMasterInfo

type ResourceMasterInfo struct {
	// Service name owning resources (files).
	ServiceName *string `protobuf:"bytes,1,opt,name=service_name,json=serviceName" json:"service_name,omitempty"`
	// Directory files are stored.
	BaseDirectoryName *string `protobuf:"bytes,2,opt,name=base_directory_name,json=baseDirectoryName" json:"base_directory_name,omitempty"`
	// Policy key used to sign user certs, etc.
	PolicyCert []byte `protobuf:"bytes,3,opt,name=policy_cert,json=policyCert" json:"policy_cert,omitempty"`
	// Resources.
	Resources        []*ResourceInfo `protobuf:"bytes,4,rep,name=resources" json:"resources,omitempty"`
	XXX_unrecognized []byte          `json:"-"`
}

func (*ResourceMasterInfo) DeleteResource

func (m *ResourceMasterInfo) DeleteResource(resourceName string, mutex *sync.RWMutex) error

DeleteResource deletes a resource.

func (*ResourceMasterInfo) Descriptor

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

func (*ResourceMasterInfo) FindResource

func (m *ResourceMasterInfo) FindResource(resourceName string, mutex *sync.RWMutex) *ResourceInfo

FindResource looks up the resource by its name.

func (*ResourceMasterInfo) GetBaseDirectoryName

func (m *ResourceMasterInfo) GetBaseDirectoryName() string

func (*ResourceMasterInfo) GetPolicyCert

func (m *ResourceMasterInfo) GetPolicyCert() []byte

func (*ResourceMasterInfo) GetResources

func (m *ResourceMasterInfo) GetResources() []*ResourceInfo

func (*ResourceMasterInfo) GetServiceName

func (m *ResourceMasterInfo) GetServiceName() string

func (*ResourceMasterInfo) InsertResource

func (m *ResourceMasterInfo) InsertResource(info *ResourceInfo, mutex *sync.RWMutex) error

InsertResource adds a resource.

func (*ResourceMasterInfo) PrintMaster

func (m *ResourceMasterInfo) PrintMaster(printResources bool)

PrintMaster prints the ResourceMaster into the log.

func (*ResourceMasterInfo) ProtoMessage

func (*ResourceMasterInfo) ProtoMessage()

func (*ResourceMasterInfo) Reset

func (m *ResourceMasterInfo) Reset()

func (*ResourceMasterInfo) String

func (m *ResourceMasterInfo) String() string

type ResourceType

type ResourceType int32
const (
	ResourceType_FILE      ResourceType = 1
	ResourceType_DIRECTORY ResourceType = 2
)

func (ResourceType) Enum

func (x ResourceType) Enum() *ResourceType

func (ResourceType) EnumDescriptor

func (ResourceType) EnumDescriptor() ([]byte, []int)

func (ResourceType) String

func (x ResourceType) String() string

func (*ResourceType) UnmarshalJSON

func (x *ResourceType) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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