56 lines
1021 B
Go
56 lines
1021 B
Go
package request
|
|
|
|
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]
|
|
}
|