forked from TrueCloudLab/frostfs-node
55 lines
1,017 B
Go
55 lines
1,017 B
Go
package ape
|
|
|
|
import (
|
|
aperesource "git.frostfs.info/TrueCloudLab/policy-engine/pkg/resource"
|
|
)
|
|
|
|
type Request struct {
|
|
operation string
|
|
resource Resource
|
|
properties map[string]string
|
|
}
|
|
|
|
func NewRequest(operation string, resource Resource, properties map[string]string) Request {
|
|
return Request{
|
|
operation: operation,
|
|
resource: resource,
|
|
properties: properties,
|
|
}
|
|
}
|
|
|
|
var _ aperesource.Request = Request{}
|
|
|
|
func (r Request) Operation() string {
|
|
return r.operation
|
|
}
|
|
|
|
func (r Request) Property(key string) string {
|
|
return r.properties[key]
|
|
}
|
|
|
|
func (r Request) Resource() aperesource.Resource {
|
|
return r.resource
|
|
}
|
|
|
|
type Resource struct {
|
|
name string
|
|
properties map[string]string
|
|
}
|
|
|
|
var _ aperesource.Resource = Resource{}
|
|
|
|
func NewResource(name string, properties map[string]string) Resource {
|
|
return Resource{
|
|
name: name,
|
|
properties: properties,
|
|
}
|
|
}
|
|
|
|
func (r Resource) Name() string {
|
|
return r.name
|
|
}
|
|
|
|
func (r Resource) Property(key string) string {
|
|
return r.properties[key]
|
|
}
|