frostfs-node/pkg/ape/request/request.go
Airat Arifullin 00faa9f854 [#1574] ape: Introduce Properties() method for Request and Resource
* Both methods are helpers only, they are not required for interface
  implementation.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2025-02-24 19:27:00 +03:00

63 lines
1.1 KiB
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
}
func (r Request) Properties() map[string]string {
return r.properties
}
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]
}
func (r Resource) Properties() map[string]string {
return r.properties
}