forked from TrueCloudLab/frostfs-s3-gw
[#406] Remove control api
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
280d11c794
commit
2b04fcb5ec
14 changed files with 7 additions and 4047 deletions
|
@ -23,6 +23,7 @@ This document outlines major changes between releases.
|
||||||
- Support updated naming in native policy JSON (#385)
|
- Support updated naming in native policy JSON (#385)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- Remove control api (#406)
|
||||||
|
|
||||||
## [0.29.0] - Zemu - 2024-05-27
|
## [0.29.0] - Zemu - 2024-05-27
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -38,8 +37,6 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/version"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/version"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/wallet"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/wallet"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/metrics"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/metrics"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
|
|
||||||
controlSvc "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control/server"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
||||||
|
@ -77,8 +74,6 @@ type (
|
||||||
unbindServers []ServerInfo
|
unbindServers []ServerInfo
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
|
|
||||||
controlAPI *grpc.Server
|
|
||||||
|
|
||||||
metrics *metrics.AppMetrics
|
metrics *metrics.AppMetrics
|
||||||
bucketResolver *resolver.BucketResolver
|
bucketResolver *resolver.BucketResolver
|
||||||
services []*Service
|
services []*Service
|
||||||
|
@ -108,7 +103,6 @@ type (
|
||||||
aclEnabled bool
|
aclEnabled bool
|
||||||
namespaceHeader string
|
namespaceHeader string
|
||||||
defaultNamespaces []string
|
defaultNamespaces []string
|
||||||
authorizedControlAPIKeys [][]byte
|
|
||||||
policyDenyByDefault bool
|
policyDenyByDefault bool
|
||||||
sourceIPHeader string
|
sourceIPHeader string
|
||||||
retryMaxAttempts int
|
retryMaxAttempts int
|
||||||
|
@ -151,7 +145,7 @@ func newApp(ctx context.Context, log *Logger, v *viper.Viper) *App {
|
||||||
webDone: make(chan struct{}, 1),
|
webDone: make(chan struct{}, 1),
|
||||||
wrkDone: make(chan struct{}, 1),
|
wrkDone: make(chan struct{}, 1),
|
||||||
|
|
||||||
settings: newAppSettings(log, v, key),
|
settings: newAppSettings(log, v),
|
||||||
}
|
}
|
||||||
|
|
||||||
app.init(ctx)
|
app.init(ctx)
|
||||||
|
@ -165,7 +159,6 @@ func (a *App) init(ctx context.Context) {
|
||||||
a.initPolicyStorage(ctx)
|
a.initPolicyStorage(ctx)
|
||||||
a.initAPI(ctx)
|
a.initAPI(ctx)
|
||||||
a.initMetrics()
|
a.initMetrics()
|
||||||
a.initControlAPI()
|
|
||||||
a.initServers(ctx)
|
a.initServers(ctx)
|
||||||
a.initTracing(ctx)
|
a.initTracing(ctx)
|
||||||
}
|
}
|
||||||
|
@ -209,7 +202,7 @@ func (a *App) initLayer(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAppSettings(log *Logger, v *viper.Viper, key *keys.PrivateKey) *appSettings {
|
func newAppSettings(log *Logger, v *viper.Viper) *appSettings {
|
||||||
settings := &appSettings{
|
settings := &appSettings{
|
||||||
logLevel: log.lvl,
|
logLevel: log.lvl,
|
||||||
maxClient: newMaxClients(v),
|
maxClient: newMaxClients(v),
|
||||||
|
@ -225,12 +218,12 @@ func newAppSettings(log *Logger, v *viper.Viper, key *keys.PrivateKey) *appSetti
|
||||||
settings.resolveZoneList = v.GetStringSlice(cfgResolveBucketDeny)
|
settings.resolveZoneList = v.GetStringSlice(cfgResolveBucketDeny)
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.update(v, log.logger, key)
|
settings.update(v, log.logger)
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *appSettings) update(v *viper.Viper, log *zap.Logger, key *keys.PrivateKey) {
|
func (s *appSettings) update(v *viper.Viper, log *zap.Logger) {
|
||||||
s.updateNamespacesSettings(v, log)
|
s.updateNamespacesSettings(v, log)
|
||||||
s.useDefaultXMLNamespace(v.GetBool(cfgKludgeUseDefaultXMLNS))
|
s.useDefaultXMLNamespace(v.GetBool(cfgKludgeUseDefaultXMLNS))
|
||||||
s.setACLEnabled(v.GetBool(cfgKludgeACLEnabled))
|
s.setACLEnabled(v.GetBool(cfgKludgeACLEnabled))
|
||||||
|
@ -238,7 +231,6 @@ func (s *appSettings) update(v *viper.Viper, log *zap.Logger, key *keys.PrivateK
|
||||||
s.setClientCut(v.GetBool(cfgClientCut))
|
s.setClientCut(v.GetBool(cfgClientCut))
|
||||||
s.setBufferMaxSizeForPut(v.GetUint64(cfgBufferMaxSizeForPut))
|
s.setBufferMaxSizeForPut(v.GetUint64(cfgBufferMaxSizeForPut))
|
||||||
s.setMD5Enabled(v.GetBool(cfgMD5Enabled))
|
s.setMD5Enabled(v.GetBool(cfgMD5Enabled))
|
||||||
s.setAuthorizedControlAPIKeys(append(fetchAuthorizedKeys(log, v), key.PublicKey()))
|
|
||||||
s.setPolicyDenyByDefault(v.GetBool(cfgPolicyDenyByDefault))
|
s.setPolicyDenyByDefault(v.GetBool(cfgPolicyDenyByDefault))
|
||||||
s.setSourceIPHeader(v.GetString(cfgSourceIPHeader))
|
s.setSourceIPHeader(v.GetString(cfgSourceIPHeader))
|
||||||
s.setRetryMaxAttempts(fetchRetryMaxAttempts(v))
|
s.setRetryMaxAttempts(fetchRetryMaxAttempts(v))
|
||||||
|
@ -408,23 +400,6 @@ func (s *appSettings) isDefaultNamespace(ns string) bool {
|
||||||
return slices.Contains(namespaces, ns)
|
return slices.Contains(namespaces, ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *appSettings) FetchRawKeys() [][]byte {
|
|
||||||
s.mu.RLock()
|
|
||||||
defer s.mu.RUnlock()
|
|
||||||
return s.authorizedControlAPIKeys
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *appSettings) setAuthorizedControlAPIKeys(keys keys.PublicKeys) {
|
|
||||||
rawPubs := make([][]byte, len(keys))
|
|
||||||
for i := range keys {
|
|
||||||
rawPubs[i] = keys[i].Bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
s.mu.Lock()
|
|
||||||
s.authorizedControlAPIKeys = rawPubs
|
|
||||||
s.mu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *appSettings) ResolveNamespaceAlias(namespace string) string {
|
func (s *appSettings) ResolveNamespaceAlias(namespace string) string {
|
||||||
if s.isDefaultNamespace(namespace) {
|
if s.isDefaultNamespace(namespace) {
|
||||||
return defaultNamespace
|
return defaultNamespace
|
||||||
|
@ -498,18 +473,6 @@ func (a *App) initAPI(ctx context.Context) {
|
||||||
a.initHandler()
|
a.initHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) initControlAPI() {
|
|
||||||
svc := controlSvc.New(
|
|
||||||
controlSvc.WithSettings(a.settings),
|
|
||||||
controlSvc.WithLogger(a.log),
|
|
||||||
controlSvc.WithChainStorage(a.policyStorage.LocalStorage()),
|
|
||||||
)
|
|
||||||
|
|
||||||
a.controlAPI = grpc.NewServer()
|
|
||||||
|
|
||||||
control.RegisterControlServiceServer(a.controlAPI, svc)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *App) initMetrics() {
|
func (a *App) initMetrics() {
|
||||||
cfg := metrics.AppMetricsConfig{
|
cfg := metrics.AppMetricsConfig{
|
||||||
Logger: a.log,
|
Logger: a.log,
|
||||||
|
@ -796,16 +759,6 @@ func (a *App) Serve(ctx context.Context) {
|
||||||
a.scheduleReconnect(ctx, srv)
|
a.scheduleReconnect(ctx, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
|
||||||
address := a.cfg.GetString(cfgControlGRPCEndpoint)
|
|
||||||
a.log.Info(logs.StartingControlAPI, zap.String("address", address))
|
|
||||||
if listener, err := net.Listen("tcp", address); err != nil {
|
|
||||||
a.log.Fatal(logs.ListenAndServe, zap.Error(err))
|
|
||||||
} else if err = a.controlAPI.Serve(listener); err != nil {
|
|
||||||
a.log.Fatal(logs.ListenAndServe, zap.Error(err))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGHUP)
|
signal.Notify(sigs, syscall.SIGHUP)
|
||||||
|
|
||||||
|
@ -824,7 +777,6 @@ LOOP:
|
||||||
|
|
||||||
a.log.Info(logs.StoppingServer, zap.Error(srv.Shutdown(ctx)))
|
a.log.Info(logs.StoppingServer, zap.Error(srv.Shutdown(ctx)))
|
||||||
|
|
||||||
a.stopControlAPI()
|
|
||||||
a.metrics.Shutdown()
|
a.metrics.Shutdown()
|
||||||
a.stopServices()
|
a.stopServices()
|
||||||
a.shutdownTracing()
|
a.shutdownTracing()
|
||||||
|
@ -836,25 +788,6 @@ func shutdownContext() (context.Context, context.CancelFunc) {
|
||||||
return context.WithTimeout(context.Background(), defaultShutdownTimeout)
|
return context.WithTimeout(context.Background(), defaultShutdownTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) stopControlAPI() {
|
|
||||||
ctx, cancel := shutdownContext()
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
a.controlAPI.GracefulStop()
|
|
||||||
cancel()
|
|
||||||
}()
|
|
||||||
|
|
||||||
<-ctx.Done()
|
|
||||||
|
|
||||||
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
|
||||||
a.log.Info(logs.ControlAPICannotShutdownGracefully)
|
|
||||||
a.controlAPI.Stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
a.log.Info(logs.ControlAPIServiceStopped)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *App) configReload(ctx context.Context) {
|
func (a *App) configReload(ctx context.Context) {
|
||||||
a.log.Info(logs.SIGHUPConfigReloadStarted)
|
a.log.Info(logs.SIGHUPConfigReloadStarted)
|
||||||
|
|
||||||
|
@ -896,7 +829,7 @@ func (a *App) updateSettings() {
|
||||||
a.settings.logLevel.SetLevel(lvl)
|
a.settings.logLevel.SetLevel(lvl)
|
||||||
}
|
}
|
||||||
|
|
||||||
a.settings.update(a.cfg, a.log, a.key)
|
a.settings.update(a.cfg, a.log)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) startServices() {
|
func (a *App) startServices() {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
||||||
"git.frostfs.info/TrueCloudLab/zapjournald"
|
"git.frostfs.info/TrueCloudLab/zapjournald"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/ssgreg/journald"
|
"github.com/ssgreg/journald"
|
||||||
|
@ -90,10 +89,6 @@ const ( // Settings.
|
||||||
cfgTLSKeyFile = "tls.key_file"
|
cfgTLSKeyFile = "tls.key_file"
|
||||||
cfgTLSCertFile = "tls.cert_file"
|
cfgTLSCertFile = "tls.cert_file"
|
||||||
|
|
||||||
// Control API.
|
|
||||||
cfgControlAuthorizedKeys = "control.authorized_keys"
|
|
||||||
cfgControlGRPCEndpoint = "control.grpc.endpoint"
|
|
||||||
|
|
||||||
// Pool config.
|
// Pool config.
|
||||||
cfgConnectTimeout = "connect_timeout"
|
cfgConnectTimeout = "connect_timeout"
|
||||||
cfgStreamTimeout = "stream_timeout"
|
cfgStreamTimeout = "stream_timeout"
|
||||||
|
@ -693,23 +688,6 @@ func fetchServers(v *viper.Viper, log *zap.Logger) []ServerInfo {
|
||||||
return servers
|
return servers
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchAuthorizedKeys(l *zap.Logger, v *viper.Viper) keys.PublicKeys {
|
|
||||||
strKeys := v.GetStringSlice(cfgControlAuthorizedKeys)
|
|
||||||
pubs := make(keys.PublicKeys, 0, len(strKeys))
|
|
||||||
|
|
||||||
for i := range strKeys {
|
|
||||||
pub, err := keys.NewPublicKeyFromString(strKeys[i])
|
|
||||||
if err != nil {
|
|
||||||
l.Warn(logs.FailedToParsePublicKey, zap.String("key", strKeys[i]))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
pubs = append(pubs, pub)
|
|
||||||
}
|
|
||||||
|
|
||||||
return pubs
|
|
||||||
}
|
|
||||||
|
|
||||||
func newSettings() *viper.Viper {
|
func newSettings() *viper.Viper {
|
||||||
v := viper.New()
|
v := viper.New()
|
||||||
|
|
||||||
|
@ -768,8 +746,6 @@ func newSettings() *viper.Viper {
|
||||||
v.SetDefault(cfgPProfAddress, "localhost:8085")
|
v.SetDefault(cfgPProfAddress, "localhost:8085")
|
||||||
v.SetDefault(cfgPrometheusAddress, "localhost:8086")
|
v.SetDefault(cfgPrometheusAddress, "localhost:8086")
|
||||||
|
|
||||||
v.SetDefault(cfgControlGRPCEndpoint, "localhost:8083")
|
|
||||||
|
|
||||||
// frostfs
|
// frostfs
|
||||||
v.SetDefault(cfgBufferMaxSizeForPut, 1024*1024) // 1mb
|
v.SetDefault(cfgBufferMaxSizeForPut, 1024*1024) // 1mb
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,6 @@ S3_GW_SERVER_1_TLS_KEY_FILE=/path/to/tls/key
|
||||||
# How often to reconnect to the servers
|
# How often to reconnect to the servers
|
||||||
S3_GW_RECONNECT_INTERVAL: 1m
|
S3_GW_RECONNECT_INTERVAL: 1m
|
||||||
|
|
||||||
# Control API
|
|
||||||
# List of hex-encoded public keys that have rights to use the Control Service
|
|
||||||
S3_GW_CONTROL_AUTHORIZED_KEYS=035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6
|
|
||||||
# Endpoint that is listened by the Control Service
|
|
||||||
S3_GW_CONTROL_GRPC_ENDPOINT=localhost:8083
|
|
||||||
|
|
||||||
# Domains to be able to use virtual-hosted-style access to bucket.
|
# Domains to be able to use virtual-hosted-style access to bucket.
|
||||||
S3_GW_LISTEN_DOMAINS=s3dev.frostfs.devenv
|
S3_GW_LISTEN_DOMAINS=s3dev.frostfs.devenv
|
||||||
|
|
||||||
|
|
|
@ -39,15 +39,6 @@ server:
|
||||||
cert_file: /path/to/cert
|
cert_file: /path/to/cert
|
||||||
key_file: /path/to/key
|
key_file: /path/to/key
|
||||||
|
|
||||||
control:
|
|
||||||
# List of hex-encoded public keys that have rights to use the Control Service
|
|
||||||
authorized_keys:
|
|
||||||
- 035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11
|
|
||||||
- 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6
|
|
||||||
grpc:
|
|
||||||
# Endpoint that is listened by the Control Service
|
|
||||||
endpoint: localhost:8083
|
|
||||||
|
|
||||||
# Domains to be able to use virtual-hosted-style access to bucket.
|
# Domains to be able to use virtual-hosted-style access to bucket.
|
||||||
listen_domains:
|
listen_domains:
|
||||||
- s3dev.frostfs.devenv
|
- s3dev.frostfs.devenv
|
||||||
|
|
|
@ -175,7 +175,6 @@ There are some custom types used for brevity:
|
||||||
| `peers` | [Nodes configuration](#peers-section) |
|
| `peers` | [Nodes configuration](#peers-section) |
|
||||||
| `placement_policy` | [Placement policy configuration](#placement_policy-section) |
|
| `placement_policy` | [Placement policy configuration](#placement_policy-section) |
|
||||||
| `server` | [Server configuration](#server-section) |
|
| `server` | [Server configuration](#server-section) |
|
||||||
| `control` | [Control API configuration](#control-section) |
|
|
||||||
| `logger` | [Logger configuration](#logger-section) |
|
| `logger` | [Logger configuration](#logger-section) |
|
||||||
| `cache` | [Cache configuration](#cache-section) |
|
| `cache` | [Cache configuration](#cache-section) |
|
||||||
| `nats` | [NATS configuration](#nats-section) |
|
| `nats` | [NATS configuration](#nats-section) |
|
||||||
|
@ -362,24 +361,6 @@ server:
|
||||||
| `tls.cert_file` | `string` | yes | | Path to the TLS certificate. |
|
| `tls.cert_file` | `string` | yes | | Path to the TLS certificate. |
|
||||||
| `tls.key_file` | `string` | yes | | Path to the key. |
|
| `tls.key_file` | `string` | yes | | Path to the key. |
|
||||||
|
|
||||||
### `control` section
|
|
||||||
|
|
||||||
Control API parameters.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
control:
|
|
||||||
authorized_keys:
|
|
||||||
- 035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11
|
|
||||||
- 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6
|
|
||||||
grpc:
|
|
||||||
endpoint: localhost:8083
|
|
||||||
```
|
|
||||||
|
|
||||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
|
||||||
|-------------------|------------|---------------|------------------|------------------------------------------------------------------------------|
|
|
||||||
| `authorized_keys` | `[]string` | yes | | List of hex-encoded public keys that have rights to use the Control Service. |
|
|
||||||
| `grpc.endpoint` | `string` | | `localhost:8083` | Endpoint that is listened by the Control Service. |
|
|
||||||
|
|
||||||
### `logger` section
|
### `logger` section
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine"
|
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine"
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine/inmemory"
|
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/resource"
|
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/resource"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -16,8 +15,6 @@ type Storage struct {
|
||||||
router engine.ChainRouter
|
router engine.ChainRouter
|
||||||
|
|
||||||
morph *MorphRuleChainStorage
|
morph *MorphRuleChainStorage
|
||||||
|
|
||||||
local engine.LocalOverrideStorage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type StorageConfig struct {
|
type StorageConfig struct {
|
||||||
|
@ -43,8 +40,6 @@ type Contract interface {
|
||||||
var _ handler.APE = (*Storage)(nil)
|
var _ handler.APE = (*Storage)(nil)
|
||||||
|
|
||||||
func NewStorage(cfg StorageConfig) *Storage {
|
func NewStorage(cfg StorageConfig) *Storage {
|
||||||
local := inmemory.NewInmemoryLocalStorage()
|
|
||||||
|
|
||||||
morph := NewMorphRuleChainStorage(&MorphRuleChainStorageConfig{
|
morph := NewMorphRuleChainStorage(&MorphRuleChainStorageConfig{
|
||||||
Contract: cfg.Contract,
|
Contract: cfg.Contract,
|
||||||
Cache: cfg.Cache,
|
Cache: cfg.Cache,
|
||||||
|
@ -52,9 +47,8 @@ func NewStorage(cfg StorageConfig) *Storage {
|
||||||
})
|
})
|
||||||
|
|
||||||
return &Storage{
|
return &Storage{
|
||||||
router: engine.NewDefaultChainRouterWithLocalOverrides(morph, local),
|
router: engine.NewDefaultChainRouter(morph),
|
||||||
morph: morph,
|
morph: morph,
|
||||||
local: local,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +56,6 @@ func (s *Storage) IsAllowed(name chain.Name, target engine.RequestTarget, r reso
|
||||||
return s.router.IsAllowed(name, target, r)
|
return s.router.IsAllowed(name, target, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) LocalStorage() engine.LocalOverrideStorage {
|
|
||||||
return s.local
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Storage) PutBucketPolicy(ns string, cnrID cid.ID, policy []byte, policyChains []*chain.Chain) error {
|
func (s *Storage) PutBucketPolicy(ns string, cnrID cid.ID, policy []byte, policyChains []*chain.Chain) error {
|
||||||
return s.morph.PutBucketPolicy(ns, cnrID, policy, policyChains)
|
return s.morph.PutBucketPolicy(ns, cnrID, policy, policyChains)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ const (
|
||||||
ApplicationFinished = "application finished" // Info in ../../cmd/s3-gw/app.go
|
ApplicationFinished = "application finished" // Info in ../../cmd/s3-gw/app.go
|
||||||
FetchDomainsPrepareToUseAPI = "fetch domains, prepare to use API" // Info in ../../cmd/s3-gw/app.go
|
FetchDomainsPrepareToUseAPI = "fetch domains, prepare to use API" // Info in ../../cmd/s3-gw/app.go
|
||||||
StartingServer = "starting server" // Info in ../../cmd/s3-gw/app.go
|
StartingServer = "starting server" // Info in ../../cmd/s3-gw/app.go
|
||||||
StartingControlAPI = "starting control API server" // Info in ../../cmd/s3-gw/app.go
|
|
||||||
StoppingServer = "stopping server" // Info in ../../cmd/s3-gw/app.go
|
StoppingServer = "stopping server" // Info in ../../cmd/s3-gw/app.go
|
||||||
SIGHUPConfigReloadStarted = "SIGHUP config reload started" // Info in ../../cmd/s3-gw/app.go
|
SIGHUPConfigReloadStarted = "SIGHUP config reload started" // Info in ../../cmd/s3-gw/app.go
|
||||||
FailedToReloadConfigBecauseItsMissed = "failed to reload config because it's missed" // Warn in ../../cmd/s3-gw/app.go
|
FailedToReloadConfigBecauseItsMissed = "failed to reload config because it's missed" // Warn in ../../cmd/s3-gw/app.go
|
||||||
|
@ -34,8 +33,6 @@ const (
|
||||||
FailedToAddServer = "failed to add server" // Warn in ../../cmd/s3-gw/app.go
|
FailedToAddServer = "failed to add server" // Warn in ../../cmd/s3-gw/app.go
|
||||||
AddServer = "add server" // Info in ../../cmd/s3-gw/app.go
|
AddServer = "add server" // Info in ../../cmd/s3-gw/app.go
|
||||||
ResolverNNSWontBeUsedSinceRPCEndpointIsntProvided = "resolver 'nns' won't be used since 'rpc_endpoint' isn't provided" // Warn in ../../cmd/s3-gw/app.go
|
ResolverNNSWontBeUsedSinceRPCEndpointIsntProvided = "resolver 'nns' won't be used since 'rpc_endpoint' isn't provided" // Warn in ../../cmd/s3-gw/app.go
|
||||||
ControlAPICannotShutdownGracefully = "control API cannot shutdown gracefully, forcing stop" // Info in ../../cmd/s3-gw/app.go
|
|
||||||
ControlAPIServiceStopped = "control API service stopped" // Info in ../../cmd/s3-gw/app.go
|
|
||||||
InvalidLifetimeUsingDefaultValue = "invalid lifetime, using default value (in seconds)" // Error in ../../cmd/s3-gw/app_settings.go
|
InvalidLifetimeUsingDefaultValue = "invalid lifetime, using default value (in seconds)" // Error in ../../cmd/s3-gw/app_settings.go
|
||||||
InvalidCacheSizeUsingDefaultValue = "invalid cache size, using default value" // Error in ../../cmd/s3-gw/app_settings.go
|
InvalidCacheSizeUsingDefaultValue = "invalid cache size, using default value" // Error in ../../cmd/s3-gw/app_settings.go
|
||||||
FailedToParseDefaultLocationConstraint = "failed to parse 'default' location constraint, default one will be used" // Warn in cmd/s3-gw/app_settings.go
|
FailedToParseDefaultLocationConstraint = "failed to parse 'default' location constraint, default one will be used" // Warn in cmd/s3-gw/app_settings.go
|
||||||
|
@ -44,7 +41,6 @@ const (
|
||||||
FailedToParseLocationConstraint = "failed to parse location constraint, it cannot be used" // Warn in cmd/s3-gw/app_settings.go
|
FailedToParseLocationConstraint = "failed to parse location constraint, it cannot be used" // Warn in cmd/s3-gw/app_settings.go
|
||||||
FailedToParseDefaultCopiesNumbers = "failed to parse 'default' copies numbers, default one will be used" // Warn in cmd/s3-gw/app_settings.go
|
FailedToParseDefaultCopiesNumbers = "failed to parse 'default' copies numbers, default one will be used" // Warn in cmd/s3-gw/app_settings.go
|
||||||
FailedToParseCopiesNumbers = "failed to parse copies numbers, skip" // Warn in cmd/s3-gw/app_settings.go
|
FailedToParseCopiesNumbers = "failed to parse copies numbers, skip" // Warn in cmd/s3-gw/app_settings.go
|
||||||
FailedToParsePublicKey = "failed to parse public key, skip" // Warn in cmd/s3-gw/app_settings.go
|
|
||||||
DefaultNamespacesCannotBeEmpty = "default namespaces cannot be empty, defaults will be used" // Warn in cmd/s3-gw/app_settings.go
|
DefaultNamespacesCannotBeEmpty = "default namespaces cannot be empty, defaults will be used" // Warn in cmd/s3-gw/app_settings.go
|
||||||
FailedToParseNamespacesConfig = "failed to unmarshal namespaces config" // Warn in cmd/s3-gw/app_settings.go
|
FailedToParseNamespacesConfig = "failed to unmarshal namespaces config" // Warn in cmd/s3-gw/app_settings.go
|
||||||
DefaultNamespaceConfigValuesBeOverwritten = "default namespace config value be overwritten by values from 'namespaces.config'" // Warn in cmd/s3-gw/app_settings.go
|
DefaultNamespaceConfigValuesBeOverwritten = "default namespace config value be overwritten by values from 'namespaces.config'" // Warn in cmd/s3-gw/app_settings.go
|
||||||
|
@ -129,11 +125,6 @@ const (
|
||||||
FrostfsIDValidationFailed = "FrostfsID validation failed" // Error in ../../api/middleware/auth.go
|
FrostfsIDValidationFailed = "FrostfsID validation failed" // Error in ../../api/middleware/auth.go
|
||||||
InitFrostfsIDContractFailed = "init frostfsid contract failed" // Fatal in ../../cmd/s3-gw/app.go
|
InitFrostfsIDContractFailed = "init frostfsid contract failed" // Fatal in ../../cmd/s3-gw/app.go
|
||||||
InitPolicyContractFailed = "init policy contract failed" // Fatal in ../../cmd/s3-gw/app.go
|
InitPolicyContractFailed = "init policy contract failed" // Fatal in ../../cmd/s3-gw/app.go
|
||||||
ControlAPIHealthcheck = "healthcheck request"
|
|
||||||
ControlAPIPutPolicies = "put policies request"
|
|
||||||
ControlAPIRemovePolicies = "remove policies request"
|
|
||||||
ControlAPIGetPolicy = "get policy request"
|
|
||||||
ControlAPIListPolicies = "list policies request"
|
|
||||||
PolicyValidationFailed = "policy validation failed"
|
PolicyValidationFailed = "policy validation failed"
|
||||||
ServerReconnecting = "reconnecting server..."
|
ServerReconnecting = "reconnecting server..."
|
||||||
ServerReconnectedSuccessfully = "server reconnected successfully"
|
ServerReconnectedSuccessfully = "server reconnected successfully"
|
||||||
|
|
|
@ -1,184 +0,0 @@
|
||||||
package client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
policycontract "git.frostfs.info/TrueCloudLab/frostfs-contract/policy"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
|
|
||||||
controlSvc "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control/server"
|
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Client struct {
|
|
||||||
svc control.ControlServiceClient
|
|
||||||
key *keys.PrivateKey
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
Logger *zap.Logger
|
|
||||||
}
|
|
||||||
|
|
||||||
type PolicyData struct {
|
|
||||||
Kind policycontract.Kind
|
|
||||||
Name string
|
|
||||||
Chain *chain.Chain
|
|
||||||
}
|
|
||||||
|
|
||||||
type PolicyInfo struct {
|
|
||||||
Kind policycontract.Kind
|
|
||||||
Name string
|
|
||||||
ChainID chain.ID
|
|
||||||
}
|
|
||||||
|
|
||||||
func kindToTarget(k policycontract.Kind) control.PolicyTarget {
|
|
||||||
switch k {
|
|
||||||
case policycontract.Container:
|
|
||||||
return control.PolicyTarget_CONTAINER
|
|
||||||
case policycontract.Namespace:
|
|
||||||
return control.PolicyTarget_NAMESPACE
|
|
||||||
case 'u':
|
|
||||||
return control.PolicyTarget_USER
|
|
||||||
case 'g':
|
|
||||||
return control.PolicyTarget_GROUP
|
|
||||||
default:
|
|
||||||
return control.PolicyTarget_TARGET_UNDEFINED
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(ctx context.Context, addr string, key *keys.PrivateKey) (*Client, error) {
|
|
||||||
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to dial s3 gw control api: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
svc := control.NewControlServiceClient(conn)
|
|
||||||
|
|
||||||
cli := &Client{
|
|
||||||
svc: svc,
|
|
||||||
key: key,
|
|
||||||
}
|
|
||||||
|
|
||||||
return cli, cli.Healthcheck(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) Healthcheck(ctx context.Context) error {
|
|
||||||
req := &control.HealthCheckRequest{}
|
|
||||||
if err := controlSvc.SignMessage(&c.key.PrivateKey, req); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
res, err := c.svc.HealthCheck(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if res.Body.HealthStatus != control.HealthStatus_READY {
|
|
||||||
return fmt.Errorf("service isn't ready, status: %s", res.Body.HealthStatus)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) PutPolicies(ctx context.Context, policies []PolicyData) error {
|
|
||||||
chainDatas := make([]*control.PutPoliciesRequest_ChainData, len(policies))
|
|
||||||
for i := range policies {
|
|
||||||
chainDatas[i] = &control.PutPoliciesRequest_ChainData{
|
|
||||||
Target: kindToTarget(policies[i].Kind),
|
|
||||||
Name: policies[i].Name,
|
|
||||||
Chain: policies[i].Chain.Bytes(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
req := &control.PutPoliciesRequest{
|
|
||||||
Body: &control.PutPoliciesRequest_Body{
|
|
||||||
ChainDatas: chainDatas,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := controlSvc.SignMessage(&c.key.PrivateKey, req); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := c.svc.PutPolicies(ctx, req)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) RemovePolicies(ctx context.Context, policies []PolicyInfo) error {
|
|
||||||
chainInfos := make([]*control.RemovePoliciesRequest_ChainInfo, len(policies))
|
|
||||||
for i := range policies {
|
|
||||||
chainInfos[i] = &control.RemovePoliciesRequest_ChainInfo{
|
|
||||||
Target: kindToTarget(policies[i].Kind),
|
|
||||||
Name: policies[i].Name,
|
|
||||||
ChainID: []byte(policies[i].ChainID),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
req := &control.RemovePoliciesRequest{
|
|
||||||
Body: &control.RemovePoliciesRequest_Body{
|
|
||||||
ChainInfos: chainInfos,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := controlSvc.SignMessage(&c.key.PrivateKey, req); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := c.svc.RemovePolicies(ctx, req)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) GetPolicy(ctx context.Context, kind policycontract.Kind, name string, chainID chain.ID) (*chain.Chain, error) {
|
|
||||||
req := &control.GetPolicyRequest{
|
|
||||||
Body: &control.GetPolicyRequest_Body{
|
|
||||||
Target: kindToTarget(kind),
|
|
||||||
Name: name,
|
|
||||||
ChainID: []byte(chainID),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := controlSvc.SignMessage(&c.key.PrivateKey, req); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := c.svc.GetPolicy(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var policyChain chain.Chain
|
|
||||||
if err = policyChain.DecodeBytes(resp.GetBody().GetChain()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &policyChain, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) ListPolicies(ctx context.Context, kind policycontract.Kind, name string) ([]chain.ID, error) {
|
|
||||||
req := &control.ListPoliciesRequest{
|
|
||||||
Body: &control.ListPoliciesRequest_Body{
|
|
||||||
Target: kindToTarget(kind),
|
|
||||||
Name: name,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := controlSvc.SignMessage(&c.key.PrivateKey, req); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := c.svc.ListPolicies(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
res := make([]chain.ID, len(resp.GetBody().GetChainIDs()))
|
|
||||||
for i, chainID := range resp.GetBody().GetChainIDs() {
|
|
||||||
res[i] = chain.ID(chainID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
|
@ -1,352 +0,0 @@
|
||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"crypto/ecdsa"
|
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
|
|
||||||
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
|
|
||||||
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine"
|
|
||||||
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine/inmemory"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Server struct {
|
|
||||||
*cfg
|
|
||||||
}
|
|
||||||
|
|
||||||
type Settings interface {
|
|
||||||
ResolveNamespaceAlias(ns string) string
|
|
||||||
FetchRawKeys() [][]byte
|
|
||||||
}
|
|
||||||
|
|
||||||
type defaultSettings struct{}
|
|
||||||
|
|
||||||
func (f defaultSettings) FetchRawKeys() [][]byte { return nil }
|
|
||||||
func (f defaultSettings) ResolveNamespaceAlias(ns string) string { return ns }
|
|
||||||
|
|
||||||
// Option of the Server's constructor.
|
|
||||||
type Option func(*cfg)
|
|
||||||
|
|
||||||
type cfg struct {
|
|
||||||
log *zap.Logger
|
|
||||||
|
|
||||||
settings Settings
|
|
||||||
|
|
||||||
chainStorage engine.LocalOverrideStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
func defaultCfg() *cfg {
|
|
||||||
return &cfg{
|
|
||||||
log: zap.NewNop(),
|
|
||||||
settings: defaultSettings{},
|
|
||||||
chainStorage: inmemory.NewInmemoryLocalStorage(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// New creates, initializes and returns new Server instance.
|
|
||||||
func New(opts ...Option) *Server {
|
|
||||||
c := defaultCfg()
|
|
||||||
|
|
||||||
for _, opt := range opts {
|
|
||||||
opt(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.log = c.log.With(zap.String("service", "control API"))
|
|
||||||
|
|
||||||
return &Server{
|
|
||||||
cfg: c,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithSettings returns option to add settings to use Control service.
|
|
||||||
func WithSettings(settings Settings) Option {
|
|
||||||
return func(c *cfg) {
|
|
||||||
c.settings = settings
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithLogger returns option to set logger.
|
|
||||||
func WithLogger(log *zap.Logger) Option {
|
|
||||||
return func(c *cfg) {
|
|
||||||
c.log = log
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithChainStorage returns option to set logger.
|
|
||||||
func WithChainStorage(chainStorage engine.LocalOverrideStorage) Option {
|
|
||||||
return func(c *cfg) {
|
|
||||||
c.chainStorage = chainStorage
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// HealthCheck returns health status of the local node.
|
|
||||||
//
|
|
||||||
// If request is unsigned or signed by disallowed key, permission error returns.
|
|
||||||
func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error) {
|
|
||||||
s.log.Info(logs.ControlAPIHealthcheck, zap.String("key", hex.EncodeToString(req.Signature.Key)))
|
|
||||||
|
|
||||||
// verify request
|
|
||||||
if err := s.isValidRequest(req); err != nil {
|
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
resp := &control.HealthCheckResponse{
|
|
||||||
Body: &control.HealthCheckResponse_Body{
|
|
||||||
HealthStatus: control.HealthStatus_READY,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutPolicies replaces existing policies.
|
|
||||||
//
|
|
||||||
// If request is unsigned or signed by disallowed key, permission error returns.
|
|
||||||
func (s *Server) PutPolicies(_ context.Context, req *control.PutPoliciesRequest) (*control.PutPoliciesResponse, error) {
|
|
||||||
s.log.Info(logs.ControlAPIPutPolicies, zap.String("key", hex.EncodeToString(req.Signature.Key)))
|
|
||||||
|
|
||||||
// verify request
|
|
||||||
if err := s.isValidRequest(req); err != nil {
|
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, data := range req.GetBody().GetChainDatas() {
|
|
||||||
if err := s.putPolicy(data); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &control.PutPoliciesResponse{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) putPolicy(data *control.PutPoliciesRequest_ChainData) error {
|
|
||||||
var overrideChain chain.Chain
|
|
||||||
if err := overrideChain.DecodeBytes(data.GetChain()); err != nil {
|
|
||||||
return status.Error(codes.InvalidArgument, fmt.Sprintf("failed to parse body: %s", err.Error()))
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(overrideChain.ID) == 0 {
|
|
||||||
return status.Error(codes.InvalidArgument, "missing chain id")
|
|
||||||
}
|
|
||||||
|
|
||||||
t, err := s.parseTarget(data.Target, data.Name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := s.chainStorage.AddOverride(chain.S3, t, &overrideChain); err != nil {
|
|
||||||
return status.Error(codes.Internal, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) parseTarget(target control.PolicyTarget, name string) (engine.Target, error) {
|
|
||||||
var (
|
|
||||||
t engine.Target
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
switch target {
|
|
||||||
case control.PolicyTarget_NAMESPACE:
|
|
||||||
ns := s.settings.ResolveNamespaceAlias(name)
|
|
||||||
t = engine.NamespaceTarget(ns)
|
|
||||||
case control.PolicyTarget_CONTAINER:
|
|
||||||
t = engine.ContainerTarget(name)
|
|
||||||
case control.PolicyTarget_USER:
|
|
||||||
t = engine.UserTarget(name)
|
|
||||||
case control.PolicyTarget_GROUP:
|
|
||||||
t = engine.GroupTarget(name)
|
|
||||||
default:
|
|
||||||
err = status.Error(codes.InvalidArgument, fmt.Sprintf("invalid target: %s", target.String()))
|
|
||||||
}
|
|
||||||
return t, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemovePolicies removes existing policies.
|
|
||||||
//
|
|
||||||
// If request is unsigned or signed by disallowed key, permission error returns.
|
|
||||||
func (s *Server) RemovePolicies(_ context.Context, req *control.RemovePoliciesRequest) (*control.RemovePoliciesResponse, error) {
|
|
||||||
s.log.Info(logs.ControlAPIRemovePolicies, zap.String("key", hex.EncodeToString(req.Signature.Key)))
|
|
||||||
|
|
||||||
// verify request
|
|
||||||
if err := s.isValidRequest(req); err != nil {
|
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, info := range req.GetBody().GetChainInfos() {
|
|
||||||
if err := s.removePolicy(info); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &control.RemovePoliciesResponse{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) removePolicy(info *control.RemovePoliciesRequest_ChainInfo) error {
|
|
||||||
t, err := s.parseTarget(info.Target, info.Name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = s.chainStorage.RemoveOverride(chain.S3, t, chain.ID(info.GetChainID()))
|
|
||||||
if err != nil {
|
|
||||||
if isNotFoundError(err) {
|
|
||||||
return status.Error(codes.NotFound, err.Error())
|
|
||||||
}
|
|
||||||
return status.Error(codes.InvalidArgument, err.Error())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPolicy returns existing policy.
|
|
||||||
//
|
|
||||||
// If request is unsigned or signed by disallowed key, permission error returns.
|
|
||||||
func (s *Server) GetPolicy(_ context.Context, req *control.GetPolicyRequest) (*control.GetPolicyResponse, error) {
|
|
||||||
s.log.Info(logs.ControlAPIGetPolicy, zap.Stringer("target", req.GetBody().GetTarget()), zap.String("name", req.GetBody().GetName()),
|
|
||||||
zap.Binary("chainId", req.GetBody().GetChainID()), zap.String("key", hex.EncodeToString(req.Signature.Key)))
|
|
||||||
|
|
||||||
t, err := s.parseTarget(req.GetBody().GetTarget(), req.GetBody().GetName())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify request
|
|
||||||
if err := s.isValidRequest(req); err != nil {
|
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
overrideChain, err := s.chainStorage.GetOverride(chain.S3, t, chain.ID(req.GetBody().GetChainID()))
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return &control.GetPolicyResponse{Body: &control.GetPolicyResponse_Body{Chain: overrideChain.Bytes()}}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPolicies lists existing policies.
|
|
||||||
//
|
|
||||||
// If request is unsigned or signed by disallowed key, permission error returns.
|
|
||||||
func (s *Server) ListPolicies(_ context.Context, req *control.ListPoliciesRequest) (*control.ListPoliciesResponse, error) {
|
|
||||||
s.log.Info(logs.ControlAPIListPolicies, zap.Stringer("target", req.GetBody().GetTarget()), zap.String("name", req.GetBody().GetName()),
|
|
||||||
zap.String("key", hex.EncodeToString(req.Signature.Key)))
|
|
||||||
|
|
||||||
t, err := s.parseTarget(req.GetBody().GetTarget(), req.GetBody().GetName())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify request
|
|
||||||
if err := s.isValidRequest(req); err != nil {
|
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
chains, err := s.chainStorage.ListOverrides(chain.S3, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
res := make([][]byte, len(chains))
|
|
||||||
for i := range chains {
|
|
||||||
res[i] = []byte(chains[i].ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &control.ListPoliciesResponse{Body: &control.ListPoliciesResponse_Body{ChainIDs: res}}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedMessage is an interface of Control service message.
|
|
||||||
type SignedMessage interface {
|
|
||||||
ReadSignedData([]byte) ([]byte, error)
|
|
||||||
GetSignature() *control.Signature
|
|
||||||
SetSignature(*control.Signature)
|
|
||||||
}
|
|
||||||
|
|
||||||
var errDisallowedKey = errors.New("key is not in the allowed list")
|
|
||||||
var errMissingSignature = errors.New("missing signature")
|
|
||||||
var errInvalidSignature = errors.New("invalid signature")
|
|
||||||
|
|
||||||
func (s *Server) isValidRequest(req SignedMessage) error {
|
|
||||||
sign := req.GetSignature()
|
|
||||||
if sign == nil {
|
|
||||||
return errMissingSignature
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
key = sign.GetKey()
|
|
||||||
allowed = false
|
|
||||||
)
|
|
||||||
|
|
||||||
// check if key is allowed
|
|
||||||
for _, authKey := range s.settings.FetchRawKeys() {
|
|
||||||
if allowed = bytes.Equal(authKey, key); allowed {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !allowed {
|
|
||||||
return errDisallowedKey
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify signature
|
|
||||||
binBody, err := req.ReadSignedData(nil)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("marshal request body: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigV2 refs.Signature
|
|
||||||
sigV2.SetKey(sign.GetKey())
|
|
||||||
sigV2.SetSign(sign.GetSign())
|
|
||||||
sigV2.SetScheme(refs.ECDSA_SHA512)
|
|
||||||
|
|
||||||
var sig frostfscrypto.Signature
|
|
||||||
if err := sig.ReadFromV2(sigV2); err != nil {
|
|
||||||
return fmt.Errorf("can't read signature: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !sig.Verify(binBody) {
|
|
||||||
return errInvalidSignature
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignMessage signs Control service message with private key.
|
|
||||||
func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error {
|
|
||||||
binBody, err := msg.ReadSignedData(nil)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("marshal request body: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var sig frostfscrypto.Signature
|
|
||||||
|
|
||||||
err = sig.Calculate(frostfsecdsa.Signer(*key), binBody)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("calculate signature: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigV2 refs.Signature
|
|
||||||
sig.WriteToV2(&sigV2)
|
|
||||||
|
|
||||||
var sigControl control.Signature
|
|
||||||
sigControl.Key = sigV2.GetKey()
|
|
||||||
sigControl.Sign = sigV2.GetSign()
|
|
||||||
|
|
||||||
msg.SetSignature(&sigControl)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func isNotFoundError(err error) bool {
|
|
||||||
return errors.Is(err, engine.ErrChainNameNotFound) ||
|
|
||||||
errors.Is(err, engine.ErrChainNotFound) ||
|
|
||||||
errors.Is(err, engine.ErrResourceNotFound)
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,206 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package s3gw.control;
|
|
||||||
|
|
||||||
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control";
|
|
||||||
|
|
||||||
// `ControlService` provides an interface for internal work with the storage node.
|
|
||||||
service ControlService {
|
|
||||||
// Performs health check of the storage node.
|
|
||||||
rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse);
|
|
||||||
|
|
||||||
rpc PutPolicies (PutPoliciesRequest) returns (PutPoliciesResponse);
|
|
||||||
|
|
||||||
rpc RemovePolicies (RemovePoliciesRequest) returns (RemovePoliciesResponse);
|
|
||||||
|
|
||||||
rpc GetPolicy (GetPolicyRequest) returns (GetPolicyResponse);
|
|
||||||
|
|
||||||
rpc ListPolicies (ListPoliciesRequest) returns (ListPoliciesResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signature of some message.
|
|
||||||
message Signature {
|
|
||||||
// Public key used for signing.
|
|
||||||
bytes key = 1 [json_name = "key"];
|
|
||||||
|
|
||||||
// Binary signature.
|
|
||||||
bytes sign = 2 [json_name = "signature"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Health check request.
|
|
||||||
message HealthCheckRequest {
|
|
||||||
message Body {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Body of health check request message.
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
// Body signature.
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Health check response.
|
|
||||||
message HealthCheckResponse {
|
|
||||||
// Health check response body
|
|
||||||
message Body {
|
|
||||||
// Health status of storage node application.
|
|
||||||
HealthStatus health_status = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Body of health check response message.
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Health status of the storage node application.
|
|
||||||
enum HealthStatus {
|
|
||||||
// Undefined status, default value.
|
|
||||||
HEALTH_STATUS_UNDEFINED = 0;
|
|
||||||
|
|
||||||
// Storage node application is starting.
|
|
||||||
STARTING = 1;
|
|
||||||
|
|
||||||
// Storage node application is started and serves all services.
|
|
||||||
READY = 2;
|
|
||||||
|
|
||||||
// Storage node application is shutting down.
|
|
||||||
SHUTTING_DOWN = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Policy target to store chains.
|
|
||||||
enum PolicyTarget {
|
|
||||||
// Undefined target, invalid to use.
|
|
||||||
TARGET_UNDEFINED = 0;
|
|
||||||
|
|
||||||
// Container target for bucket policies.
|
|
||||||
CONTAINER = 1;
|
|
||||||
|
|
||||||
// Namespace target for namespace policies.
|
|
||||||
NAMESPACE = 2;
|
|
||||||
|
|
||||||
// User target for namespace user policies.
|
|
||||||
USER = 3;
|
|
||||||
|
|
||||||
// Group target for namespace target policies.
|
|
||||||
GROUP = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put policies request.
|
|
||||||
message PutPoliciesRequest {
|
|
||||||
message ChainData {
|
|
||||||
// Policy entity type.
|
|
||||||
PolicyTarget target = 1;
|
|
||||||
// Policy name.
|
|
||||||
string name = 2;
|
|
||||||
// Chain rules.
|
|
||||||
bytes chain = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Body {
|
|
||||||
repeated ChainData chainDatas = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
// Body signature.
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put policies response.
|
|
||||||
message PutPoliciesResponse {
|
|
||||||
message Body {
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove policies request.
|
|
||||||
message RemovePoliciesRequest {
|
|
||||||
message ChainInfo {
|
|
||||||
// Policy entity type.
|
|
||||||
PolicyTarget target = 1;
|
|
||||||
// Policy name.
|
|
||||||
string name = 2;
|
|
||||||
// Chain id to remove.
|
|
||||||
bytes chainID = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Body {
|
|
||||||
repeated ChainInfo chainInfos = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
// Body signature.
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove policies response.
|
|
||||||
message RemovePoliciesResponse {
|
|
||||||
message Body {
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get policy request.
|
|
||||||
message GetPolicyRequest {
|
|
||||||
message Body {
|
|
||||||
// Policy entity type.
|
|
||||||
PolicyTarget target = 1;
|
|
||||||
// Policy name.
|
|
||||||
string name = 2;
|
|
||||||
// Chain id to get.
|
|
||||||
bytes chainID = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
// Body signature.
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get policy response.
|
|
||||||
message GetPolicyResponse {
|
|
||||||
message Body {
|
|
||||||
// Chain rules.
|
|
||||||
bytes chain = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// List policies request.
|
|
||||||
message ListPoliciesRequest {
|
|
||||||
message Body {
|
|
||||||
// Policy entity type.
|
|
||||||
PolicyTarget target = 1;
|
|
||||||
// Policy name.
|
|
||||||
string name = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
// Body signature.
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// List policies response.
|
|
||||||
message ListPoliciesResponse {
|
|
||||||
message Body {
|
|
||||||
// Chain ids.
|
|
||||||
repeated bytes chainIDs = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Body body = 1;
|
|
||||||
|
|
||||||
Signature signature = 2;
|
|
||||||
}
|
|
|
@ -1,955 +0,0 @@
|
||||||
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
|
|
||||||
|
|
||||||
package control
|
|
||||||
|
|
||||||
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *Signature) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.BytesSize(1, x.Key)
|
|
||||||
size += proto.BytesSize(2, x.Sign)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *Signature) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.BytesMarshal(1, buf[offset:], x.Key)
|
|
||||||
offset += proto.BytesMarshal(2, buf[offset:], x.Sign)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *HealthCheckRequest_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *HealthCheckRequest_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *HealthCheckRequest) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *HealthCheckRequest) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *HealthCheckRequest) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HealthCheckRequest) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *HealthCheckResponse_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.EnumSize(1, int32(x.HealthStatus))
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.HealthStatus))
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *HealthCheckResponse) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *HealthCheckResponse) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *HealthCheckResponse) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HealthCheckResponse) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *PutPoliciesRequest_ChainData) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.EnumSize(1, int32(x.Target))
|
|
||||||
size += proto.StringSize(2, x.Name)
|
|
||||||
size += proto.BytesSize(3, x.Chain)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *PutPoliciesRequest_ChainData) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.Target))
|
|
||||||
offset += proto.StringMarshal(2, buf[offset:], x.Name)
|
|
||||||
offset += proto.BytesMarshal(3, buf[offset:], x.Chain)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *PutPoliciesRequest_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
for i := range x.ChainDatas {
|
|
||||||
size += proto.NestedStructureSize(1, x.ChainDatas[i])
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *PutPoliciesRequest_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
for i := range x.ChainDatas {
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.ChainDatas[i])
|
|
||||||
}
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *PutPoliciesRequest) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *PutPoliciesRequest) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *PutPoliciesRequest) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *PutPoliciesRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PutPoliciesRequest) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *PutPoliciesResponse_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *PutPoliciesResponse_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *PutPoliciesResponse) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *PutPoliciesResponse) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *PutPoliciesResponse) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *PutPoliciesResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PutPoliciesResponse) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *RemovePoliciesRequest_ChainInfo) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.EnumSize(1, int32(x.Target))
|
|
||||||
size += proto.StringSize(2, x.Name)
|
|
||||||
size += proto.BytesSize(3, x.ChainID)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *RemovePoliciesRequest_ChainInfo) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.Target))
|
|
||||||
offset += proto.StringMarshal(2, buf[offset:], x.Name)
|
|
||||||
offset += proto.BytesMarshal(3, buf[offset:], x.ChainID)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *RemovePoliciesRequest_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
for i := range x.ChainInfos {
|
|
||||||
size += proto.NestedStructureSize(1, x.ChainInfos[i])
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *RemovePoliciesRequest_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
for i := range x.ChainInfos {
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.ChainInfos[i])
|
|
||||||
}
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *RemovePoliciesRequest) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *RemovePoliciesRequest) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *RemovePoliciesRequest) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *RemovePoliciesRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RemovePoliciesRequest) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *RemovePoliciesResponse_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *RemovePoliciesResponse_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *RemovePoliciesResponse) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *RemovePoliciesResponse) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *RemovePoliciesResponse) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *RemovePoliciesResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RemovePoliciesResponse) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *GetPolicyRequest_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.EnumSize(1, int32(x.Target))
|
|
||||||
size += proto.StringSize(2, x.Name)
|
|
||||||
size += proto.BytesSize(3, x.ChainID)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *GetPolicyRequest_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.Target))
|
|
||||||
offset += proto.StringMarshal(2, buf[offset:], x.Name)
|
|
||||||
offset += proto.BytesMarshal(3, buf[offset:], x.ChainID)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *GetPolicyRequest) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *GetPolicyRequest) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *GetPolicyRequest) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *GetPolicyRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetPolicyRequest) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *GetPolicyResponse_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.BytesSize(1, x.Chain)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *GetPolicyResponse_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.BytesMarshal(1, buf[offset:], x.Chain)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *GetPolicyResponse) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *GetPolicyResponse) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *GetPolicyResponse) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *GetPolicyResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *GetPolicyResponse) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *ListPoliciesRequest_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.EnumSize(1, int32(x.Target))
|
|
||||||
size += proto.StringSize(2, x.Name)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *ListPoliciesRequest_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.Target))
|
|
||||||
offset += proto.StringMarshal(2, buf[offset:], x.Name)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *ListPoliciesRequest) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *ListPoliciesRequest) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *ListPoliciesRequest) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *ListPoliciesRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ListPoliciesRequest) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *ListPoliciesResponse_Body) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.RepeatedBytesSize(1, x.ChainIDs)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *ListPoliciesResponse_Body) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.RepeatedBytesMarshal(1, buf[offset:], x.ChainIDs)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize returns the size of x in protobuf format.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary size.
|
|
||||||
func (x *ListPoliciesResponse) StableSize() (size int) {
|
|
||||||
if x == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
size += proto.NestedStructureSize(1, x.Body)
|
|
||||||
size += proto.NestedStructureSize(2, x.Signature)
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
|
||||||
//
|
|
||||||
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same binary format.
|
|
||||||
func (x *ListPoliciesResponse) StableMarshal(buf []byte) []byte {
|
|
||||||
if x == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, x.StableSize())
|
|
||||||
}
|
|
||||||
var offset int
|
|
||||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
|
||||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadSignedData fills buf with signed data of x.
|
|
||||||
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
||||||
//
|
|
||||||
// Returns any error encountered which did not allow writing the data completely.
|
|
||||||
// Otherwise, returns the buffer in which the data is written.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data.
|
|
||||||
func (x *ListPoliciesResponse) SignedDataSize() int {
|
|
||||||
return x.GetBody().StableSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedDataSize returns size of the request signed data in bytes.
|
|
||||||
//
|
|
||||||
// Structures with the same field values have the same signed data size.
|
|
||||||
func (x *ListPoliciesResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
||||||
return x.GetBody().StableMarshal(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ListPoliciesResponse) SetSignature(sig *Signature) {
|
|
||||||
x.Signature = sig
|
|
||||||
}
|
|
|
@ -1,249 +0,0 @@
|
||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
|
||||||
// - protoc v3.21.12
|
|
||||||
// source: pkg/service/control/service.proto
|
|
||||||
|
|
||||||
package control
|
|
||||||
|
|
||||||
import (
|
|
||||||
context "context"
|
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
// Requires gRPC-Go v1.32.0 or later.
|
|
||||||
const _ = grpc.SupportPackageIsVersion7
|
|
||||||
|
|
||||||
// ControlServiceClient is the client API for ControlService service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
||||||
type ControlServiceClient interface {
|
|
||||||
// Performs health check of the storage node.
|
|
||||||
HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
|
|
||||||
PutPolicies(ctx context.Context, in *PutPoliciesRequest, opts ...grpc.CallOption) (*PutPoliciesResponse, error)
|
|
||||||
RemovePolicies(ctx context.Context, in *RemovePoliciesRequest, opts ...grpc.CallOption) (*RemovePoliciesResponse, error)
|
|
||||||
GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error)
|
|
||||||
ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type controlServiceClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewControlServiceClient(cc grpc.ClientConnInterface) ControlServiceClient {
|
|
||||||
return &controlServiceClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
|
|
||||||
out := new(HealthCheckResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/s3gw.control.ControlService/HealthCheck", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controlServiceClient) PutPolicies(ctx context.Context, in *PutPoliciesRequest, opts ...grpc.CallOption) (*PutPoliciesResponse, error) {
|
|
||||||
out := new(PutPoliciesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/s3gw.control.ControlService/PutPolicies", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controlServiceClient) RemovePolicies(ctx context.Context, in *RemovePoliciesRequest, opts ...grpc.CallOption) (*RemovePoliciesResponse, error) {
|
|
||||||
out := new(RemovePoliciesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/s3gw.control.ControlService/RemovePolicies", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controlServiceClient) GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error) {
|
|
||||||
out := new(GetPolicyResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/s3gw.control.ControlService/GetPolicy", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controlServiceClient) ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error) {
|
|
||||||
out := new(ListPoliciesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/s3gw.control.ControlService/ListPolicies", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControlServiceServer is the server API for ControlService service.
|
|
||||||
// All implementations should embed UnimplementedControlServiceServer
|
|
||||||
// for forward compatibility
|
|
||||||
type ControlServiceServer interface {
|
|
||||||
// Performs health check of the storage node.
|
|
||||||
HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
|
|
||||||
PutPolicies(context.Context, *PutPoliciesRequest) (*PutPoliciesResponse, error)
|
|
||||||
RemovePolicies(context.Context, *RemovePoliciesRequest) (*RemovePoliciesResponse, error)
|
|
||||||
GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error)
|
|
||||||
ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedControlServiceServer should be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedControlServiceServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (UnimplementedControlServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedControlServiceServer) PutPolicies(context.Context, *PutPoliciesRequest) (*PutPoliciesResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method PutPolicies not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedControlServiceServer) RemovePolicies(context.Context, *RemovePoliciesRequest) (*RemovePoliciesResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RemovePolicies not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedControlServiceServer) GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetPolicy not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedControlServiceServer) ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ListPolicies not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnsafeControlServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
||||||
// Use of this interface is not recommended, as added methods to ControlServiceServer will
|
|
||||||
// result in compilation errors.
|
|
||||||
type UnsafeControlServiceServer interface {
|
|
||||||
mustEmbedUnimplementedControlServiceServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterControlServiceServer(s grpc.ServiceRegistrar, srv ControlServiceServer) {
|
|
||||||
s.RegisterService(&ControlService_ServiceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _ControlService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(HealthCheckRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(ControlServiceServer).HealthCheck(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/s3gw.control.ControlService/HealthCheck",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(ControlServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _ControlService_PutPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(PutPoliciesRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(ControlServiceServer).PutPolicies(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/s3gw.control.ControlService/PutPolicies",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(ControlServiceServer).PutPolicies(ctx, req.(*PutPoliciesRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _ControlService_RemovePolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(RemovePoliciesRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(ControlServiceServer).RemovePolicies(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/s3gw.control.ControlService/RemovePolicies",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(ControlServiceServer).RemovePolicies(ctx, req.(*RemovePoliciesRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _ControlService_GetPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(GetPolicyRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(ControlServiceServer).GetPolicy(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/s3gw.control.ControlService/GetPolicy",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(ControlServiceServer).GetPolicy(ctx, req.(*GetPolicyRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _ControlService_ListPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ListPoliciesRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(ControlServiceServer).ListPolicies(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/s3gw.control.ControlService/ListPolicies",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(ControlServiceServer).ListPolicies(ctx, req.(*ListPoliciesRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControlService_ServiceDesc is the grpc.ServiceDesc for ControlService service.
|
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
|
||||||
// and not to be introspected or modified (even as a copy)
|
|
||||||
var ControlService_ServiceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "s3gw.control.ControlService",
|
|
||||||
HandlerType: (*ControlServiceServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "HealthCheck",
|
|
||||||
Handler: _ControlService_HealthCheck_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "PutPolicies",
|
|
||||||
Handler: _ControlService_PutPolicies_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "RemovePolicies",
|
|
||||||
Handler: _ControlService_RemovePolicies_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "GetPolicy",
|
|
||||||
Handler: _ControlService_GetPolicy_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ListPolicies",
|
|
||||||
Handler: _ControlService_ListPolicies_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{},
|
|
||||||
Metadata: "pkg/service/control/service.proto",
|
|
||||||
}
|
|
Loading…
Reference in a new issue