diff --git a/.github/workflows/s3-policy-tests.yml b/.github/workflows/s3-policy-tests.yml index 2ddd19226..a428788d1 100644 --- a/.github/workflows/s3-policy-tests.yml +++ b/.github/workflows/s3-policy-tests.yml @@ -9,6 +9,7 @@ on: - 'weed/s3api/policy/**' - 'weed/iam/**' - 'test/s3/iam/**' + - 'test/s3/policy/**' - '.github/workflows/s3-policy-tests.yml' push: branches: [ master, main ] @@ -19,6 +20,7 @@ on: - 'weed/s3api/policy/**' - 'weed/iam/**' - 'test/s3/iam/**' + - 'test/s3/policy/**' - '.github/workflows/s3-policy-tests.yml' concurrency: @@ -389,3 +391,36 @@ jobs: name: trusted-proxy-test-logs path: /tmp/weed_proxy_test.log retention-days: 3 + + # S3 Policy Shell Integration Tests + s3-policy-shell-tests: + name: S3 Policy Shell Integration Tests + runs-on: ubuntu-22.04 + timeout-minutes: 15 + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: 'go.mod' + id: go + + - name: Install SeaweedFS + run: | + go install -buildvcs=false + + - name: Run S3 Policy Shell Tests + timeout-minutes: 10 + working-directory: test/s3/policy + run: | + set -x + echo "=== Running S3 Policy Shell Tests ===" + + # Set WEED_BINARY to use the installed version (though test uses 'weed' command) + export WEED_BINARY=$(which weed) + export PATH=$PATH:$(dirname $WEED_BINARY) + + go test -v -timeout 10m ./... diff --git a/test/s3/policy/policy_test.go b/test/s3/policy/policy_test.go new file mode 100644 index 000000000..2b181bf89 --- /dev/null +++ b/test/s3/policy/policy_test.go @@ -0,0 +1,296 @@ +package policy + +import ( + "context" + "fmt" + "net" + "net/http" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "sync" + "testing" + "time" + + "github.com/seaweedfs/seaweedfs/weed/command" + "github.com/seaweedfs/seaweedfs/weed/glog" + flag "github.com/seaweedfs/seaweedfs/weed/util/fla9" + "github.com/stretchr/testify/require" +) + +// TestCluster manages the weed mini instance for integration testing +type TestCluster struct { + dataDir string + ctx context.Context + cancel context.CancelFunc + isRunning bool + wg sync.WaitGroup + masterPort int + volumePort int + filerPort int + s3Port int + s3Endpoint string +} + +func TestS3PolicyShellRevised(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + cluster, err := startMiniCluster(t) + require.NoError(t, err) + defer cluster.Stop() + + policyContent := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}` + tmpPolicyFile, err := os.CreateTemp("", "test_policy_*.json") + if err != nil { + t.Fatalf("Failed to create temp policy file: %v", err) + } + defer os.Remove(tmpPolicyFile.Name()) + _, err = tmpPolicyFile.WriteString(policyContent) + require.NoError(t, err) + require.NoError(t, tmpPolicyFile.Close()) + + weedCmd := "weed" + masterAddr := fmt.Sprintf("127.0.0.1:%d", cluster.masterPort) + filerAddr := fmt.Sprintf("127.0.0.1:%d", cluster.filerPort) + + // Put + execShell(t, weedCmd, masterAddr, filerAddr, fmt.Sprintf("s3.policy -put -name=testpolicy -file=%s", tmpPolicyFile.Name())) + + // List + out := execShell(t, weedCmd, masterAddr, filerAddr, "s3.policy -list") + if !contains(out, "Name: testpolicy") { + t.Errorf("List failed: %s", out) + } + + // Get + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.policy -get -name=testpolicy") + if !contains(out, "Statement") { + t.Errorf("Get failed: %s", out) + } + + // Delete + execShell(t, weedCmd, masterAddr, filerAddr, "s3.policy -delete -name=testpolicy") + + // Verify + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.policy -list") + if contains(out, "Name: testpolicy") { + t.Errorf("delete failed, policy 'testpolicy' should not be in the list: %s", out) + } + // Verify s3.configure linking policies + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -actions=Read -policies=testpolicy -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if !contains(out, "\"policyNames\": [\n \"testpolicy\"\n ]") { + // relaxed check + if !contains(out, "\"testpolicy\"") || !contains(out, "policyNames") { + t.Errorf("s3.configure failed to link policy: %s", out) + } + } + + // 1. Update User: Add Write action + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -actions=Write -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if !contains(out, "Write") { + t.Errorf("s3.configure failed to add Write action: %s", out) + } + + // 2. Granular Delete: Delete Read action + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -actions=Read -delete -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if contains(out, "\"Read\"") { // Quote to avoid matching partial words if any + t.Errorf("s3.configure failed to delete Read action: %s", out) + } + if !contains(out, "Write") { + t.Errorf("s3.configure deleted Write action unnecessarily: %s", out) + } + + // 3. Access Key Management + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -access_key=testkey -secret_key=testsecret -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if !contains(out, "testkey") { + t.Errorf("s3.configure failed to add access key: %s", out) + } + + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -access_key=testkey -delete -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if contains(out, "testkey") { + t.Errorf("s3.configure failed to delete access key: %s", out) + } + + // 4. Delete User + execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure -user=test -delete -apply") + out = execShell(t, weedCmd, masterAddr, filerAddr, "s3.configure") + if contains(out, "\"Name\": \"test\"") { + t.Errorf("s3.configure failed to delete user: %s", out) + } +} + +func execShell(t *testing.T, weedCmd, master, filer, shellCmd string) string { + // weed shell -master=... -filer=... + args := []string{"shell", "-master=" + master, "-filer=" + filer} + t.Logf("Running: %s %v <<< %s", weedCmd, args, shellCmd) + + cmd := exec.Command(weedCmd, args...) + cmd.Stdin = strings.NewReader(shellCmd + "\n") + + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("Failed to run %s: %v\nOutput: %s", shellCmd, err, string(out)) + } + return string(out) +} + +// --- Test setup helpers --- + +func findAvailablePort() (int, error) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + return 0, err + } + defer listener.Close() + addr := listener.Addr().(*net.TCPAddr) + return addr.Port, nil +} + +// findAvailablePortPair finds an available http port P such that P and P+10000 (grpc) are both available +func findAvailablePortPair() (int, int, error) { + for i := 0; i < 100; i++ { + httpPort, err := findAvailablePort() + if err != nil { + return 0, 0, err + } + grpcPort := httpPort + 10000 + + // check if grpc port is available + listener, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", grpcPort)) + if err == nil { + listener.Close() + return httpPort, grpcPort, nil + } + } + return 0, 0, fmt.Errorf("failed to find available port pair") +} + +func startMiniCluster(t *testing.T) (*TestCluster, error) { + masterPort, masterGrpcPort, err := findAvailablePortPair() + require.NoError(t, err) + volumePort, volumeGrpcPort, err := findAvailablePortPair() + require.NoError(t, err) + filerPort, filerGrpcPort, err := findAvailablePortPair() + require.NoError(t, err) + s3Port, s3GrpcPort, err := findAvailablePortPair() + require.NoError(t, err) + + testDir := t.TempDir() + + ctx, cancel := context.WithCancel(context.Background()) + s3Endpoint := fmt.Sprintf("http://127.0.0.1:%d", s3Port) + cluster := &TestCluster{ + dataDir: testDir, + ctx: ctx, + cancel: cancel, + masterPort: masterPort, + volumePort: volumePort, + filerPort: filerPort, + s3Port: s3Port, + s3Endpoint: s3Endpoint, + } + + // Disable authentication for tests + securityToml := filepath.Join(testDir, "security.toml") + err = os.WriteFile(securityToml, []byte("# Empty security config\n"), 0644) + require.NoError(t, err) + + // Configure credential store for IAM tests + credentialToml := filepath.Join(testDir, "credential.toml") + credentialConfig := ` +[credential.memory] +enabled = true +` + err = os.WriteFile(credentialToml, []byte(credentialConfig), 0644) + require.NoError(t, err) + + cluster.wg.Add(1) + go func() { + defer cluster.wg.Done() + oldDir, _ := os.Getwd() + oldArgs := os.Args + defer func() { + os.Chdir(oldDir) + os.Args = oldArgs + }() + os.Chdir(testDir) + os.Args = []string{ + "weed", + "-dir=" + testDir, + "-master.port=" + strconv.Itoa(masterPort), + "-master.port.grpc=" + strconv.Itoa(masterGrpcPort), + "-volume.port=" + strconv.Itoa(volumePort), + "-volume.port.grpc=" + strconv.Itoa(volumeGrpcPort), + "-filer.port=" + strconv.Itoa(filerPort), + "-filer.port.grpc=" + strconv.Itoa(filerGrpcPort), + "-s3.port=" + strconv.Itoa(s3Port), + "-s3.port.grpc=" + strconv.Itoa(s3GrpcPort), + "-webdav.port=0", + "-admin.ui=false", + "-master.volumeSizeLimitMB=32", + "-ip=127.0.0.1", + "-master.peers=none", + } + glog.MaxSize = 1024 * 1024 + for _, cmd := range command.Commands { + if cmd.Name() == "mini" && cmd.Run != nil { + cmd.Flag.Parse(os.Args[1:]) + cmd.Run(cmd, cmd.Flag.Args()) + return + } + } + }() + + // Wait for S3 + err = waitForS3Ready(cluster.s3Endpoint, 60*time.Second) + if err != nil { + cancel() + return nil, err + } + cluster.isRunning = true + return cluster, nil +} + +func waitForS3Ready(endpoint string, timeout time.Duration) error { + client := &http.Client{Timeout: 1 * time.Second} + deadline := time.Now().Add(timeout) + for time.Now().Before(deadline) { + resp, err := client.Get(endpoint) + if err == nil { + resp.Body.Close() + return nil + } + time.Sleep(200 * time.Millisecond) + } + return fmt.Errorf("timeout waiting for S3") +} + +func (c *TestCluster) Stop() { + if c.cancel != nil { + c.cancel() + } + if c.isRunning { + time.Sleep(500 * time.Millisecond) + } + // Simplified stop + for _, cmd := range command.Commands { + if cmd.Name() == "mini" { + cmd.Flag.VisitAll(func(f *flag.Flag) { + f.Value.Set(f.DefValue) + }) + break + } + } +} + +func contains(s, substr string) bool { + return strings.Contains(s, substr) +} diff --git a/weed/admin/dash/admin_server.go b/weed/admin/dash/admin_server.go index 80f3263b3..f1e60252d 100644 --- a/weed/admin/dash/admin_server.go +++ b/weed/admin/dash/admin_server.go @@ -28,6 +28,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/s3api" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "github.com/seaweedfs/seaweedfs/weed/worker/tasks" + + _ "github.com/seaweedfs/seaweedfs/weed/credential/grpc" // Register gRPC credential store ) // FilerConfig holds filer configuration needed for bucket operations @@ -136,7 +138,7 @@ func NewAdminServer(masters string, templateFS http.FileSystem, dataDir string) server.topicRetentionPurger = NewTopicRetentionPurger(server) // Initialize credential manager with defaults - credentialManager, err := credential.NewCredentialManagerWithDefaults("") + credentialManager, err := credential.NewCredentialManagerWithDefaults(credential.StoreTypeGrpc) if err != nil { glog.Warningf("Failed to initialize credential manager: %v", err) // Continue without credential manager - will fall back to legacy approach diff --git a/weed/command/filer.go b/weed/command/filer.go index 64d227b95..f8a7234d3 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -18,10 +18,15 @@ import ( "google.golang.org/grpc/credentials/tls/certprovider/pemfile" "google.golang.org/grpc/reflection" + "github.com/seaweedfs/seaweedfs/weed/credential" + _ "github.com/seaweedfs/seaweedfs/weed/credential/filer_etc" + _ "github.com/seaweedfs/seaweedfs/weed/credential/memory" + _ "github.com/seaweedfs/seaweedfs/weed/credential/postgres" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" "github.com/seaweedfs/seaweedfs/weed/security" weed_server "github.com/seaweedfs/seaweedfs/weed/server" stats_collect "github.com/seaweedfs/seaweedfs/weed/stats" @@ -324,6 +329,16 @@ func (fo *FilerOptions) startFiler() { filerAddress := pb.NewServerAddress(*fo.ip, *fo.port, *fo.portGrpc) + // Initialize credential manager for IAM gRPC service + var credentialManager *credential.CredentialManager + var err error + credentialManager, err = credential.NewCredentialManagerWithDefaults("") + if err != nil { + glog.Warningf("Failed to initialize credential manager: %v", err) + } else { + glog.V(0).Infof("Initialized credential manager: %s", credentialManager.GetStoreName()) + } + fs, nfs_err := weed_server.NewFilerServer(defaultMux, publicVolumeMux, &weed_server.FilerOption{ Masters: fo.masters, FilerGroup: *fo.filerGroup, @@ -346,6 +361,7 @@ func (fo *FilerOptions) startFiler() { DiskType: *fo.diskType, AllowedOrigins: strings.Split(*fo.allowedOrigins, ","), TusBasePath: *fo.tusBasePath, + CredentialManager: credentialManager, }) if nfs_err != nil { glog.Fatalf("Filer startup error: %v", nfs_err) @@ -389,6 +405,14 @@ func (fo *FilerOptions) startFiler() { } grpcS := pb.NewGrpcServer(security.LoadServerTLS(util.GetViper(), "grpc.filer")) filer_pb.RegisterSeaweedFilerServer(grpcS, fs) + + // Register IAM gRPC service if credential manager is available + if credentialManager != nil { + iamGrpcServer := weed_server.NewIamGrpcServer(credentialManager) + iam_pb.RegisterSeaweedIdentityAccessManagementServer(grpcS, iamGrpcServer) + glog.V(0).Info("Registered IAM gRPC service on filer") + } + reflection.Register(grpcS) if grpcLocalL != nil { go grpcS.Serve(grpcLocalL) diff --git a/weed/credential/credential_manager.go b/weed/credential/credential_manager.go index d4323e920..8c139d083 100644 --- a/weed/credential/credential_manager.go +++ b/weed/credential/credential_manager.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "github.com/seaweedfs/seaweedfs/weed/s3api/policy_engine" "github.com/seaweedfs/seaweedfs/weed/util" ) @@ -46,6 +47,14 @@ func (cm *CredentialManager) GetStore() CredentialStore { return cm.store } +// GetStoreName returns the name of the underlying credential store +func (cm *CredentialManager) GetStoreName() string { + if cm.store != nil { + return string(cm.store.GetName()) + } + return "" +} + // LoadConfiguration loads the S3 API configuration func (cm *CredentialManager) LoadConfiguration(ctx context.Context) (*iam_pb.S3ApiConfiguration, error) { return cm.store.LoadConfiguration(ctx) @@ -96,6 +105,26 @@ func (cm *CredentialManager) DeleteAccessKey(ctx context.Context, username strin return cm.store.DeleteAccessKey(ctx, username, accessKey) } +// GetPolicies returns all policies +func (cm *CredentialManager) GetPolicies(ctx context.Context) (map[string]policy_engine.PolicyDocument, error) { + return cm.store.GetPolicies(ctx) +} + +// PutPolicy creates or updates a policy +func (cm *CredentialManager) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + return cm.store.PutPolicy(ctx, name, document) +} + +// DeletePolicy removes a policy +func (cm *CredentialManager) DeletePolicy(ctx context.Context, name string) error { + return cm.store.DeletePolicy(ctx, name) +} + +// GetPolicy retrieves a policy by name +func (cm *CredentialManager) GetPolicy(ctx context.Context, name string) (*policy_engine.PolicyDocument, error) { + return cm.store.GetPolicy(ctx, name) +} + // Shutdown performs cleanup func (cm *CredentialManager) Shutdown() { if cm.store != nil { diff --git a/weed/credential/credential_store.go b/weed/credential/credential_store.go index 6e1b4a3ae..abfd64a28 100644 --- a/weed/credential/credential_store.go +++ b/weed/credential/credential_store.go @@ -25,6 +25,7 @@ const ( StoreTypeFilerEtc CredentialStoreTypeName = "filer_etc" StoreTypeFilerMultiple CredentialStoreTypeName = "filer_multiple" StoreTypePostgres CredentialStoreTypeName = "postgres" + StoreTypeGrpc CredentialStoreTypeName = "grpc" ) // CredentialStore defines the interface for user credential storage and retrieval @@ -65,6 +66,13 @@ type CredentialStore interface { // DeleteAccessKey removes an access key for a user DeleteAccessKey(ctx context.Context, username string, accessKey string) error + // Policy Management + GetPolicies(ctx context.Context) (map[string]policy_engine.PolicyDocument, error) + // PutPolicy creates or replaces a policy document. + PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error + DeletePolicy(ctx context.Context, name string) error + GetPolicy(ctx context.Context, name string) (*policy_engine.PolicyDocument, error) + // Shutdown performs cleanup when the store is being shut down Shutdown() } diff --git a/weed/credential/filer_etc/filer_etc_policy.go b/weed/credential/filer_etc/filer_etc_policy.go index 96ef0cca7..c1a5b9e80 100644 --- a/weed/credential/filer_etc/filer_etc_policy.go +++ b/weed/credential/filer_etc/filer_etc_policy.go @@ -98,6 +98,11 @@ func (store *FilerEtcStore) UpdatePolicy(ctx context.Context, name string, docum }) } +// PutPolicy creates or updates an IAM policy in the filer +func (store *FilerEtcStore) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + return store.UpdatePolicy(ctx, name, document) +} + // DeletePolicy deletes an IAM policy from the filer func (store *FilerEtcStore) DeletePolicy(ctx context.Context, name string) error { return store.updatePolicies(ctx, func(policies map[string]policy_engine.PolicyDocument) { diff --git a/weed/credential/filer_multiple/filer_multiple_store.go b/weed/credential/filer_multiple/filer_multiple_store.go index df94fcb9c..e6b595b51 100644 --- a/weed/credential/filer_multiple/filer_multiple_store.go +++ b/weed/credential/filer_multiple/filer_multiple_store.go @@ -429,6 +429,14 @@ func (store *FilerMultipleStore) CreatePolicy(ctx context.Context, name string, }) } +func (store *FilerMultipleStore) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + return store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { + // We can just overwrite. The distinction between Create and Update in filer_multiple was just checking existence. + // Put implies "create or replace". + return store.savePolicy(ctx, client, name, document) + }) +} + func (store *FilerMultipleStore) UpdatePolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { return store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { filename := name + ".json" diff --git a/weed/credential/grpc/grpc_identity.go b/weed/credential/grpc/grpc_identity.go new file mode 100644 index 000000000..af0e5249e --- /dev/null +++ b/weed/credential/grpc/grpc_identity.go @@ -0,0 +1,120 @@ +package grpc + +import ( + "context" + + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" +) + +func (store *IamGrpcStore) LoadConfiguration(ctx context.Context) (*iam_pb.S3ApiConfiguration, error) { + var config *iam_pb.S3ApiConfiguration + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.GetConfiguration(ctx, &iam_pb.GetConfigurationRequest{}) + if err != nil { + return err + } + config = resp.Configuration + return nil + }) + return config, err +} + +func (store *IamGrpcStore) SaveConfiguration(ctx context.Context, config *iam_pb.S3ApiConfiguration) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.PutConfiguration(ctx, &iam_pb.PutConfigurationRequest{ + Configuration: config, + }) + return err + }) +} + +func (store *IamGrpcStore) CreateUser(ctx context.Context, identity *iam_pb.Identity) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.CreateUser(ctx, &iam_pb.CreateUserRequest{ + Identity: identity, + }) + return err + }) +} + +func (store *IamGrpcStore) GetUser(ctx context.Context, username string) (*iam_pb.Identity, error) { + var identity *iam_pb.Identity + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.GetUser(ctx, &iam_pb.GetUserRequest{ + Username: username, + }) + if err != nil { + return err + } + identity = resp.Identity + return nil + }) + return identity, err +} + +func (store *IamGrpcStore) UpdateUser(ctx context.Context, username string, identity *iam_pb.Identity) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.UpdateUser(ctx, &iam_pb.UpdateUserRequest{ + Username: username, + Identity: identity, + }) + return err + }) +} + +func (store *IamGrpcStore) DeleteUser(ctx context.Context, username string) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.DeleteUser(ctx, &iam_pb.DeleteUserRequest{ + Username: username, + }) + return err + }) +} + +func (store *IamGrpcStore) ListUsers(ctx context.Context) ([]string, error) { + var usernames []string + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.ListUsers(ctx, &iam_pb.ListUsersRequest{}) + if err != nil { + return err + } + usernames = resp.Usernames + return nil + }) + return usernames, err +} + +func (store *IamGrpcStore) GetUserByAccessKey(ctx context.Context, accessKey string) (*iam_pb.Identity, error) { + var identity *iam_pb.Identity + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.GetUserByAccessKey(ctx, &iam_pb.GetUserByAccessKeyRequest{ + AccessKey: accessKey, + }) + if err != nil { + return err + } + identity = resp.Identity + return nil + }) + return identity, err +} + +func (store *IamGrpcStore) CreateAccessKey(ctx context.Context, username string, credential *iam_pb.Credential) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.CreateAccessKey(ctx, &iam_pb.CreateAccessKeyRequest{ + Username: username, + Credential: credential, + }) + return err + }) +} + +func (store *IamGrpcStore) DeleteAccessKey(ctx context.Context, username string, accessKey string) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.DeleteAccessKey(ctx, &iam_pb.DeleteAccessKeyRequest{ + Username: username, + AccessKey: accessKey, + }) + return err + }) +} diff --git a/weed/credential/grpc/grpc_policy.go b/weed/credential/grpc/grpc_policy.go new file mode 100644 index 000000000..07d15f3d5 --- /dev/null +++ b/weed/credential/grpc/grpc_policy.go @@ -0,0 +1,69 @@ +package grpc + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "github.com/seaweedfs/seaweedfs/weed/s3api/policy_engine" +) + +func (store *IamGrpcStore) GetPolicies(ctx context.Context) (map[string]policy_engine.PolicyDocument, error) { + policies := make(map[string]policy_engine.PolicyDocument) + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.ListPolicies(ctx, &iam_pb.ListPoliciesRequest{}) + if err != nil { + return err + } + for _, p := range resp.Policies { + var doc policy_engine.PolicyDocument + if err := json.Unmarshal([]byte(p.Content), &doc); err != nil { + return fmt.Errorf("failed to unmarshal policy %s: %v", p.Name, err) + } + policies[p.Name] = doc + } + return nil + }) + return policies, err +} + +func (store *IamGrpcStore) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + content, err := json.Marshal(document) + if err != nil { + return err + } + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.PutPolicy(ctx, &iam_pb.PutPolicyRequest{ + Name: name, + Content: string(content), + }) + return err + }) +} + +func (store *IamGrpcStore) DeletePolicy(ctx context.Context, name string) error { + return store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + _, err := client.DeletePolicy(ctx, &iam_pb.DeletePolicyRequest{ + Name: name, + }) + return err + }) +} + +func (store *IamGrpcStore) GetPolicy(ctx context.Context, name string) (*policy_engine.PolicyDocument, error) { + var doc policy_engine.PolicyDocument + err := store.withIamClient(func(client iam_pb.SeaweedIdentityAccessManagementClient) error { + resp, err := client.GetPolicy(ctx, &iam_pb.GetPolicyRequest{ + Name: name, + }) + if err != nil { + return err + } + return json.Unmarshal([]byte(resp.Content), &doc) + }) + if err != nil { + return nil, err + } + return &doc, nil +} diff --git a/weed/credential/grpc/grpc_store.go b/weed/credential/grpc/grpc_store.go new file mode 100644 index 000000000..aa86cc915 --- /dev/null +++ b/weed/credential/grpc/grpc_store.go @@ -0,0 +1,72 @@ +package grpc + +import ( + "fmt" + "sync" + + "github.com/seaweedfs/seaweedfs/weed/credential" + "github.com/seaweedfs/seaweedfs/weed/pb" + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "github.com/seaweedfs/seaweedfs/weed/util" + "google.golang.org/grpc" +) + +func init() { + credential.Stores = append(credential.Stores, &IamGrpcStore{}) +} + +// IamGrpcStore implements CredentialStore using SeaweedFS IAM gRPC service +type IamGrpcStore struct { + filerAddressFunc func() pb.ServerAddress // Function to get current active filer + grpcDialOption grpc.DialOption + mu sync.RWMutex // Protects filerAddressFunc and grpcDialOption +} + +func (store *IamGrpcStore) GetName() credential.CredentialStoreTypeName { + return credential.StoreTypeGrpc +} + +func (store *IamGrpcStore) Initialize(configuration util.Configuration, prefix string) error { + if configuration != nil { + filerAddr := configuration.GetString(prefix + "filer") + if filerAddr != "" { + store.mu.Lock() + store.filerAddressFunc = func() pb.ServerAddress { + return pb.ServerAddress(filerAddr) + } + store.mu.Unlock() + } + } + return nil +} + +func (store *IamGrpcStore) SetFilerAddressFunc(getFiler func() pb.ServerAddress, grpcDialOption grpc.DialOption) { + store.mu.Lock() + defer store.mu.Unlock() + store.filerAddressFunc = getFiler + store.grpcDialOption = grpcDialOption +} + +func (store *IamGrpcStore) withIamClient(fn func(client iam_pb.SeaweedIdentityAccessManagementClient) error) error { + store.mu.RLock() + if store.filerAddressFunc == nil { + store.mu.RUnlock() + return fmt.Errorf("iam_grpc: filer not yet available") + } + + filerAddress := store.filerAddressFunc() + dialOption := store.grpcDialOption + store.mu.RUnlock() + + if filerAddress == "" { + return fmt.Errorf("iam_grpc: no filer discovered yet") + } + + return pb.WithGrpcClient(false, 0, func(conn *grpc.ClientConn) error { + client := iam_pb.NewSeaweedIdentityAccessManagementClient(conn) + return fn(client) + }, filerAddress.ToGrpcAddress(), false, dialOption) +} + +func (store *IamGrpcStore) Shutdown() { +} diff --git a/weed/credential/memory/memory_policy.go b/weed/credential/memory/memory_policy.go index 8a4700467..b5e7fdb7a 100644 --- a/weed/credential/memory/memory_policy.go +++ b/weed/credential/memory/memory_policy.go @@ -63,6 +63,19 @@ func (store *MemoryStore) UpdatePolicy(ctx context.Context, name string, documen return nil } +// PutPolicy creates or updates an IAM policy in memory +func (store *MemoryStore) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + store.mu.Lock() + defer store.mu.Unlock() + + if !store.initialized { + return fmt.Errorf("store not initialized") + } + + store.policies[name] = document + return nil +} + // DeletePolicy deletes an IAM policy from memory func (store *MemoryStore) DeletePolicy(ctx context.Context, name string) error { store.mu.Lock() diff --git a/weed/credential/postgres/postgres_policy.go b/weed/credential/postgres/postgres_policy.go index 061646f7f..e3a831ae4 100644 --- a/weed/credential/postgres/postgres_policy.go +++ b/weed/credential/postgres/postgres_policy.go @@ -62,6 +62,11 @@ func (store *PostgresStore) CreatePolicy(ctx context.Context, name string, docum return nil } +// PutPolicy creates or updates an IAM policy in PostgreSQL +func (store *PostgresStore) PutPolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { + return store.CreatePolicy(ctx, name, document) +} + // UpdatePolicy updates an existing IAM policy in PostgreSQL func (store *PostgresStore) UpdatePolicy(ctx context.Context, name string, document policy_engine.PolicyDocument) error { if !store.configured { diff --git a/weed/pb/filer_pb/filer.pb.go b/weed/pb/filer_pb/filer.pb.go index 279bd6d5d..7b96f095d 100644 --- a/weed/pb/filer_pb/filer.pb.go +++ b/weed/pb/filer_pb/filer.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: filer.proto package filer_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/filer_pb/filer_grpc.pb.go b/weed/pb/filer_pb/filer_grpc.pb.go index b34996773..f3e3dcf1c 100644 --- a/weed/pb/filer_pb/filer_grpc.pb.go +++ b/weed/pb/filer_pb/filer_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: filer.proto package filer_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/pb/iam.proto b/weed/pb/iam.proto index d485ce011..4a17f36e9 100644 --- a/weed/pb/iam.proto +++ b/weed/pb/iam.proto @@ -9,7 +9,111 @@ option java_outer_classname = "IamProto"; ////////////////////////////////////////////////// service SeaweedIdentityAccessManagement { + // Configuration Management + rpc GetConfiguration (GetConfigurationRequest) returns (GetConfigurationResponse); + rpc PutConfiguration (PutConfigurationRequest) returns (PutConfigurationResponse); + + // User Management + rpc CreateUser (CreateUserRequest) returns (CreateUserResponse); + rpc GetUser (GetUserRequest) returns (GetUserResponse); + rpc UpdateUser (UpdateUserRequest) returns (UpdateUserResponse); + rpc DeleteUser (DeleteUserRequest) returns (DeleteUserResponse); + rpc ListUsers (ListUsersRequest) returns (ListUsersResponse); + + // Access Key Management + rpc CreateAccessKey (CreateAccessKeyRequest) returns (CreateAccessKeyResponse); + rpc DeleteAccessKey (DeleteAccessKeyRequest) returns (DeleteAccessKeyResponse); + rpc GetUserByAccessKey (GetUserByAccessKeyRequest) returns (GetUserByAccessKeyResponse); + + // Policy Management + rpc PutPolicy (PutPolicyRequest) returns (PutPolicyResponse); + rpc GetPolicy (GetPolicyRequest) returns (GetPolicyResponse); + rpc ListPolicies (ListPoliciesRequest) returns (ListPoliciesResponse); + rpc DeletePolicy (DeletePolicyRequest) returns (DeletePolicyResponse); +} + +////////////////////////////////////////////////// +// Configuration Management Messages + +message GetConfigurationRequest { +} + +message GetConfigurationResponse { + S3ApiConfiguration configuration = 1; +} + +message PutConfigurationRequest { + S3ApiConfiguration configuration = 1; +} + +message PutConfigurationResponse { +} + +////////////////////////////////////////////////// +// User Management Messages + +message CreateUserRequest { + Identity identity = 1; +} + +message CreateUserResponse { +} + +message GetUserRequest { + string username = 1; +} + +message GetUserResponse { + Identity identity = 1; +} + +message UpdateUserRequest { + string username = 1; + Identity identity = 2; +} + +message UpdateUserResponse { +} + +message DeleteUserRequest { + string username = 1; +} + +message DeleteUserResponse { +} + +message ListUsersRequest { +} + +message ListUsersResponse { + repeated string usernames = 1; +} + +////////////////////////////////////////////////// +// Access Key Management Messages + +message CreateAccessKeyRequest { + string username = 1; + Credential credential = 2; +} + +message CreateAccessKeyResponse { +} + +message DeleteAccessKeyRequest { + string username = 1; + string access_key = 2; +} + +message DeleteAccessKeyResponse { +} + +message GetUserByAccessKeyRequest { + string access_key = 1; +} +message GetUserByAccessKeyResponse { + Identity identity = 1; } ////////////////////////////////////////////////// @@ -18,6 +122,7 @@ message S3ApiConfiguration { repeated Identity identities = 1; repeated Account accounts = 2; repeated ServiceAccount service_accounts = 3; + repeated Policy policies = 4; } message Identity { @@ -56,21 +161,38 @@ message ServiceAccount { string created_by = 9; // Who created this service account } -/* -message Policy { - repeated Statement statements = 1; +message PutPolicyRequest { + string name = 1; + string content = 2; } -message Statement { - repeated Action action = 1; - repeated Resource resource = 2; +message PutPolicyResponse { } -message Action { - string action = 1; +message GetPolicyRequest { + string name = 1; +} + +message GetPolicyResponse { + string name = 1; + string content = 2; +} + +message ListPoliciesRequest { +} + +message ListPoliciesResponse { + repeated Policy policies = 1; } -message Resource { - string bucket = 1; - // string path = 2; + +message DeletePolicyRequest { + string name = 1; +} + +message DeletePolicyResponse { +} + +message Policy { + string name = 1; + string content = 2; // JSON content of the policy } -*/ diff --git a/weed/pb/iam_pb/iam.pb.go b/weed/pb/iam_pb/iam.pb.go index 367afc5ef..825cc57c2 100644 --- a/weed/pb/iam_pb/iam.pb.go +++ b/weed/pb/iam_pb/iam.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: iam.proto package iam_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -22,30 +21,1309 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type S3ApiConfiguration struct { - state protoimpl.MessageState `protogen:"open.v1"` - Identities []*Identity `protobuf:"bytes,1,rep,name=identities,proto3" json:"identities,omitempty"` - Accounts []*Account `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"` - ServiceAccounts []*ServiceAccount `protobuf:"bytes,3,rep,name=service_accounts,json=serviceAccounts,proto3" json:"service_accounts,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GetConfigurationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConfigurationRequest) Reset() { + *x = GetConfigurationRequest{} + mi := &file_iam_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigurationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigurationRequest) ProtoMessage() {} + +func (x *GetConfigurationRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConfigurationRequest.ProtoReflect.Descriptor instead. +func (*GetConfigurationRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{0} +} + +type GetConfigurationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Configuration *S3ApiConfiguration `protobuf:"bytes,1,opt,name=configuration,proto3" json:"configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConfigurationResponse) Reset() { + *x = GetConfigurationResponse{} + mi := &file_iam_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigurationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigurationResponse) ProtoMessage() {} + +func (x *GetConfigurationResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConfigurationResponse.ProtoReflect.Descriptor instead. +func (*GetConfigurationResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{1} +} + +func (x *GetConfigurationResponse) GetConfiguration() *S3ApiConfiguration { + if x != nil { + return x.Configuration + } + return nil +} + +type PutConfigurationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Configuration *S3ApiConfiguration `protobuf:"bytes,1,opt,name=configuration,proto3" json:"configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutConfigurationRequest) Reset() { + *x = PutConfigurationRequest{} + mi := &file_iam_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutConfigurationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutConfigurationRequest) ProtoMessage() {} + +func (x *PutConfigurationRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutConfigurationRequest.ProtoReflect.Descriptor instead. +func (*PutConfigurationRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{2} +} + +func (x *PutConfigurationRequest) GetConfiguration() *S3ApiConfiguration { + if x != nil { + return x.Configuration + } + return nil +} + +type PutConfigurationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutConfigurationResponse) Reset() { + *x = PutConfigurationResponse{} + mi := &file_iam_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutConfigurationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutConfigurationResponse) ProtoMessage() {} + +func (x *PutConfigurationResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutConfigurationResponse.ProtoReflect.Descriptor instead. +func (*PutConfigurationResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{3} +} + +type CreateUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Identity *Identity `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} + mi := &file_iam_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserRequest) ProtoMessage() {} + +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateUserRequest) GetIdentity() *Identity { + if x != nil { + return x.Identity + } + return nil +} + +type CreateUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserResponse) Reset() { + *x = CreateUserResponse{} + mi := &file_iam_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResponse) ProtoMessage() {} + +func (x *CreateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead. +func (*CreateUserResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{5} +} + +type GetUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserRequest) Reset() { + *x = GetUserRequest{} + mi := &file_iam_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserRequest) ProtoMessage() {} + +func (x *GetUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead. +func (*GetUserRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{6} +} + +func (x *GetUserRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +type GetUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Identity *Identity `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserResponse) Reset() { + *x = GetUserResponse{} + mi := &file_iam_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserResponse) ProtoMessage() {} + +func (x *GetUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead. +func (*GetUserResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{7} +} + +func (x *GetUserResponse) GetIdentity() *Identity { + if x != nil { + return x.Identity + } + return nil +} + +type UpdateUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Identity *Identity `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserRequest) Reset() { + *x = UpdateUserRequest{} + mi := &file_iam_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserRequest) ProtoMessage() {} + +func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateUserRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateUserRequest) GetIdentity() *Identity { + if x != nil { + return x.Identity + } + return nil +} + +type UpdateUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserResponse) Reset() { + *x = UpdateUserResponse{} + mi := &file_iam_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserResponse) ProtoMessage() {} + +func (x *UpdateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{9} +} + +type DeleteUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} + mi := &file_iam_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserRequest) ProtoMessage() {} + +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{10} +} + +func (x *DeleteUserRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +type DeleteUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserResponse) Reset() { + *x = DeleteUserResponse{} + mi := &file_iam_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserResponse) ProtoMessage() {} + +func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{11} +} + +type ListUsersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUsersRequest) Reset() { + *x = ListUsersRequest{} + mi := &file_iam_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersRequest) ProtoMessage() {} + +func (x *ListUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead. +func (*ListUsersRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{12} +} + +type ListUsersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Usernames []string `protobuf:"bytes,1,rep,name=usernames,proto3" json:"usernames,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUsersResponse) Reset() { + *x = ListUsersResponse{} + mi := &file_iam_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersResponse) ProtoMessage() {} + +func (x *ListUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead. +func (*ListUsersResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{13} +} + +func (x *ListUsersResponse) GetUsernames() []string { + if x != nil { + return x.Usernames + } + return nil +} + +type CreateAccessKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Credential *Credential `protobuf:"bytes,2,opt,name=credential,proto3" json:"credential,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccessKeyRequest) Reset() { + *x = CreateAccessKeyRequest{} + mi := &file_iam_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccessKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccessKeyRequest) ProtoMessage() {} + +func (x *CreateAccessKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAccessKeyRequest.ProtoReflect.Descriptor instead. +func (*CreateAccessKeyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateAccessKeyRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateAccessKeyRequest) GetCredential() *Credential { + if x != nil { + return x.Credential + } + return nil +} + +type CreateAccessKeyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccessKeyResponse) Reset() { + *x = CreateAccessKeyResponse{} + mi := &file_iam_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccessKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccessKeyResponse) ProtoMessage() {} + +func (x *CreateAccessKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAccessKeyResponse.ProtoReflect.Descriptor instead. +func (*CreateAccessKeyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{15} +} + +type DeleteAccessKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + AccessKey string `protobuf:"bytes,2,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteAccessKeyRequest) Reset() { + *x = DeleteAccessKeyRequest{} + mi := &file_iam_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAccessKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAccessKeyRequest) ProtoMessage() {} + +func (x *DeleteAccessKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteAccessKeyRequest.ProtoReflect.Descriptor instead. +func (*DeleteAccessKeyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{16} +} + +func (x *DeleteAccessKeyRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *DeleteAccessKeyRequest) GetAccessKey() string { + if x != nil { + return x.AccessKey + } + return "" +} + +type DeleteAccessKeyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteAccessKeyResponse) Reset() { + *x = DeleteAccessKeyResponse{} + mi := &file_iam_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAccessKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAccessKeyResponse) ProtoMessage() {} + +func (x *DeleteAccessKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteAccessKeyResponse.ProtoReflect.Descriptor instead. +func (*DeleteAccessKeyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{17} +} + +type GetUserByAccessKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AccessKey string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByAccessKeyRequest) Reset() { + *x = GetUserByAccessKeyRequest{} + mi := &file_iam_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByAccessKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByAccessKeyRequest) ProtoMessage() {} + +func (x *GetUserByAccessKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByAccessKeyRequest.ProtoReflect.Descriptor instead. +func (*GetUserByAccessKeyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{18} +} + +func (x *GetUserByAccessKeyRequest) GetAccessKey() string { + if x != nil { + return x.AccessKey + } + return "" +} + +type GetUserByAccessKeyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Identity *Identity `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByAccessKeyResponse) Reset() { + *x = GetUserByAccessKeyResponse{} + mi := &file_iam_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByAccessKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByAccessKeyResponse) ProtoMessage() {} + +func (x *GetUserByAccessKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByAccessKeyResponse.ProtoReflect.Descriptor instead. +func (*GetUserByAccessKeyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{19} +} + +func (x *GetUserByAccessKeyResponse) GetIdentity() *Identity { + if x != nil { + return x.Identity + } + return nil +} + +type S3ApiConfiguration struct { + state protoimpl.MessageState `protogen:"open.v1"` + Identities []*Identity `protobuf:"bytes,1,rep,name=identities,proto3" json:"identities,omitempty"` + Accounts []*Account `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"` + ServiceAccounts []*ServiceAccount `protobuf:"bytes,3,rep,name=service_accounts,json=serviceAccounts,proto3" json:"service_accounts,omitempty"` + Policies []*Policy `protobuf:"bytes,4,rep,name=policies,proto3" json:"policies,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *S3ApiConfiguration) Reset() { + *x = S3ApiConfiguration{} + mi := &file_iam_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *S3ApiConfiguration) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S3ApiConfiguration) ProtoMessage() {} + +func (x *S3ApiConfiguration) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use S3ApiConfiguration.ProtoReflect.Descriptor instead. +func (*S3ApiConfiguration) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{20} +} + +func (x *S3ApiConfiguration) GetIdentities() []*Identity { + if x != nil { + return x.Identities + } + return nil +} + +func (x *S3ApiConfiguration) GetAccounts() []*Account { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *S3ApiConfiguration) GetServiceAccounts() []*ServiceAccount { + if x != nil { + return x.ServiceAccounts + } + return nil +} + +func (x *S3ApiConfiguration) GetPolicies() []*Policy { + if x != nil { + return x.Policies + } + return nil +} + +type Identity struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Credentials []*Credential `protobuf:"bytes,2,rep,name=credentials,proto3" json:"credentials,omitempty"` + Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"` + Account *Account `protobuf:"bytes,4,opt,name=account,proto3" json:"account,omitempty"` + Disabled bool `protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"` // User status: false = enabled (default), true = disabled + ServiceAccountIds []string `protobuf:"bytes,6,rep,name=service_account_ids,json=serviceAccountIds,proto3" json:"service_account_ids,omitempty"` // IDs of service accounts owned by this user + PolicyNames []string `protobuf:"bytes,7,rep,name=policy_names,json=policyNames,proto3" json:"policy_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Identity) Reset() { + *x = Identity{} + mi := &file_iam_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Identity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Identity) ProtoMessage() {} + +func (x *Identity) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Identity.ProtoReflect.Descriptor instead. +func (*Identity) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{21} +} + +func (x *Identity) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Identity) GetCredentials() []*Credential { + if x != nil { + return x.Credentials + } + return nil +} + +func (x *Identity) GetActions() []string { + if x != nil { + return x.Actions + } + return nil +} + +func (x *Identity) GetAccount() *Account { + if x != nil { + return x.Account + } + return nil +} + +func (x *Identity) GetDisabled() bool { + if x != nil { + return x.Disabled + } + return false +} + +func (x *Identity) GetServiceAccountIds() []string { + if x != nil { + return x.ServiceAccountIds + } + return nil +} + +func (x *Identity) GetPolicyNames() []string { + if x != nil { + return x.PolicyNames + } + return nil +} + +type Credential struct { + state protoimpl.MessageState `protogen:"open.v1"` + AccessKey string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` + SecretKey string `protobuf:"bytes,2,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` // Access key status: "Active" or "Inactive" + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Credential) Reset() { + *x = Credential{} + mi := &file_iam_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Credential) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Credential) ProtoMessage() {} + +func (x *Credential) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Credential.ProtoReflect.Descriptor instead. +func (*Credential) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{22} +} + +func (x *Credential) GetAccessKey() string { + if x != nil { + return x.AccessKey + } + return "" +} + +func (x *Credential) GetSecretKey() string { + if x != nil { + return x.SecretKey + } + return "" +} + +func (x *Credential) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type Account struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + EmailAddress string `protobuf:"bytes,3,opt,name=email_address,json=emailAddress,proto3" json:"email_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Account) Reset() { + *x = Account{} + mi := &file_iam_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Account) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Account) ProtoMessage() {} + +func (x *Account) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Account.ProtoReflect.Descriptor instead. +func (*Account) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{23} +} + +func (x *Account) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Account) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *Account) GetEmailAddress() string { + if x != nil { + return x.EmailAddress + } + return "" +} + +// ServiceAccount represents a service account - special credentials for applications. +// Service accounts are linked to a parent user and can have restricted permissions. +type ServiceAccount struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier (e.g., "sa-xxxxx") + ParentUser string `protobuf:"bytes,2,opt,name=parent_user,json=parentUser,proto3" json:"parent_user,omitempty"` // Parent identity name + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // Optional description + Credential *Credential `protobuf:"bytes,4,opt,name=credential,proto3" json:"credential,omitempty"` // Access key/secret for this service account + Actions []string `protobuf:"bytes,5,rep,name=actions,proto3" json:"actions,omitempty"` // Allowed actions (subset of parent) + Expiration int64 `protobuf:"varint,6,opt,name=expiration,proto3" json:"expiration,omitempty"` // Unix timestamp, 0 = no expiration + Disabled bool `protobuf:"varint,7,opt,name=disabled,proto3" json:"disabled,omitempty"` // Status: false = enabled (default) + CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // Creation timestamp + CreatedBy string `protobuf:"bytes,9,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"` // Who created this service account + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServiceAccount) Reset() { + *x = ServiceAccount{} + mi := &file_iam_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServiceAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceAccount) ProtoMessage() {} + +func (x *ServiceAccount) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceAccount.ProtoReflect.Descriptor instead. +func (*ServiceAccount) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{24} +} + +func (x *ServiceAccount) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ServiceAccount) GetParentUser() string { + if x != nil { + return x.ParentUser + } + return "" +} + +func (x *ServiceAccount) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ServiceAccount) GetCredential() *Credential { + if x != nil { + return x.Credential + } + return nil +} + +func (x *ServiceAccount) GetActions() []string { + if x != nil { + return x.Actions + } + return nil +} + +func (x *ServiceAccount) GetExpiration() int64 { + if x != nil { + return x.Expiration + } + return 0 +} + +func (x *ServiceAccount) GetDisabled() bool { + if x != nil { + return x.Disabled + } + return false +} + +func (x *ServiceAccount) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ServiceAccount) GetCreatedBy() string { + if x != nil { + return x.CreatedBy + } + return "" +} + +type PutPolicyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutPolicyRequest) Reset() { + *x = PutPolicyRequest{} + mi := &file_iam_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutPolicyRequest) ProtoMessage() {} + +func (x *PutPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutPolicyRequest.ProtoReflect.Descriptor instead. +func (*PutPolicyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{25} +} + +func (x *PutPolicyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PutPolicyRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type PutPolicyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *S3ApiConfiguration) Reset() { - *x = S3ApiConfiguration{} - mi := &file_iam_proto_msgTypes[0] +func (x *PutPolicyResponse) Reset() { + *x = PutPolicyResponse{} + mi := &file_iam_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *S3ApiConfiguration) String() string { +func (x *PutPolicyResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*S3ApiConfiguration) ProtoMessage() {} +func (*PutPolicyResponse) ProtoMessage() {} -func (x *S3ApiConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_iam_proto_msgTypes[0] +func (x *PutPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -56,60 +1334,78 @@ func (x *S3ApiConfiguration) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use S3ApiConfiguration.ProtoReflect.Descriptor instead. -func (*S3ApiConfiguration) Descriptor() ([]byte, []int) { - return file_iam_proto_rawDescGZIP(), []int{0} +// Deprecated: Use PutPolicyResponse.ProtoReflect.Descriptor instead. +func (*PutPolicyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{26} } -func (x *S3ApiConfiguration) GetIdentities() []*Identity { - if x != nil { - return x.Identities - } - return nil +type GetPolicyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *S3ApiConfiguration) GetAccounts() []*Account { +func (x *GetPolicyRequest) Reset() { + *x = GetPolicyRequest{} + mi := &file_iam_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPolicyRequest) ProtoMessage() {} + +func (x *GetPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[27] if x != nil { - return x.Accounts + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (x *S3ApiConfiguration) GetServiceAccounts() []*ServiceAccount { +// Deprecated: Use GetPolicyRequest.ProtoReflect.Descriptor instead. +func (*GetPolicyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{27} +} + +func (x *GetPolicyRequest) GetName() string { if x != nil { - return x.ServiceAccounts + return x.Name } - return nil + return "" } -type Identity struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Credentials []*Credential `protobuf:"bytes,2,rep,name=credentials,proto3" json:"credentials,omitempty"` - Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"` - Account *Account `protobuf:"bytes,4,opt,name=account,proto3" json:"account,omitempty"` - Disabled bool `protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"` // User status: false = enabled (default), true = disabled - ServiceAccountIds []string `protobuf:"bytes,6,rep,name=service_account_ids,json=serviceAccountIds,proto3" json:"service_account_ids,omitempty"` // IDs of service accounts owned by this user - PolicyNames []string `protobuf:"bytes,7,rep,name=policy_names,json=policyNames,proto3" json:"policy_names,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GetPolicyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *Identity) Reset() { - *x = Identity{} - mi := &file_iam_proto_msgTypes[1] +func (x *GetPolicyResponse) Reset() { + *x = GetPolicyResponse{} + mi := &file_iam_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Identity) String() string { +func (x *GetPolicyResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Identity) ProtoMessage() {} +func (*GetPolicyResponse) ProtoMessage() {} -func (x *Identity) ProtoReflect() protoreflect.Message { - mi := &file_iam_proto_msgTypes[1] +func (x *GetPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120,84 +1416,83 @@ func (x *Identity) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Identity.ProtoReflect.Descriptor instead. -func (*Identity) Descriptor() ([]byte, []int) { - return file_iam_proto_rawDescGZIP(), []int{1} +// Deprecated: Use GetPolicyResponse.ProtoReflect.Descriptor instead. +func (*GetPolicyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{28} } -func (x *Identity) GetName() string { +func (x *GetPolicyResponse) GetName() string { if x != nil { return x.Name } return "" } -func (x *Identity) GetCredentials() []*Credential { +func (x *GetPolicyResponse) GetContent() string { if x != nil { - return x.Credentials + return x.Content } - return nil + return "" } -func (x *Identity) GetActions() []string { - if x != nil { - return x.Actions - } - return nil +type ListPoliciesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *Identity) GetAccount() *Account { - if x != nil { - return x.Account - } - return nil +func (x *ListPoliciesRequest) Reset() { + *x = ListPoliciesRequest{} + mi := &file_iam_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *Identity) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false +func (x *ListPoliciesRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *Identity) GetServiceAccountIds() []string { +func (*ListPoliciesRequest) ProtoMessage() {} + +func (x *ListPoliciesRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[29] if x != nil { - return x.ServiceAccountIds + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (x *Identity) GetPolicyNames() []string { - if x != nil { - return x.PolicyNames - } - return nil +// Deprecated: Use ListPoliciesRequest.ProtoReflect.Descriptor instead. +func (*ListPoliciesRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{29} } -type Credential struct { +type ListPoliciesResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - AccessKey string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` - SecretKey string `protobuf:"bytes,2,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` - Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` // Access key status: "Active" or "Inactive" + Policies []*Policy `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *Credential) Reset() { - *x = Credential{} - mi := &file_iam_proto_msgTypes[2] +func (x *ListPoliciesResponse) Reset() { + *x = ListPoliciesResponse{} + mi := &file_iam_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Credential) String() string { +func (x *ListPoliciesResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Credential) ProtoMessage() {} +func (*ListPoliciesResponse) ProtoMessage() {} -func (x *Credential) ProtoReflect() protoreflect.Message { - mi := &file_iam_proto_msgTypes[2] +func (x *ListPoliciesResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -208,56 +1503,40 @@ func (x *Credential) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Credential.ProtoReflect.Descriptor instead. -func (*Credential) Descriptor() ([]byte, []int) { - return file_iam_proto_rawDescGZIP(), []int{2} -} - -func (x *Credential) GetAccessKey() string { - if x != nil { - return x.AccessKey - } - return "" -} - -func (x *Credential) GetSecretKey() string { - if x != nil { - return x.SecretKey - } - return "" +// Deprecated: Use ListPoliciesResponse.ProtoReflect.Descriptor instead. +func (*ListPoliciesResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{30} } -func (x *Credential) GetStatus() string { +func (x *ListPoliciesResponse) GetPolicies() []*Policy { if x != nil { - return x.Status + return x.Policies } - return "" + return nil } -type Account struct { +type DeletePolicyRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - EmailAddress string `protobuf:"bytes,3,opt,name=email_address,json=emailAddress,proto3" json:"email_address,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *Account) Reset() { - *x = Account{} - mi := &file_iam_proto_msgTypes[3] +func (x *DeletePolicyRequest) Reset() { + *x = DeletePolicyRequest{} + mi := &file_iam_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Account) String() string { +func (x *DeletePolicyRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Account) ProtoMessage() {} +func (*DeletePolicyRequest) ProtoMessage() {} -func (x *Account) ProtoReflect() protoreflect.Message { - mi := &file_iam_proto_msgTypes[3] +func (x *DeletePolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -268,64 +1547,39 @@ func (x *Account) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Account.ProtoReflect.Descriptor instead. -func (*Account) Descriptor() ([]byte, []int) { - return file_iam_proto_rawDescGZIP(), []int{3} -} - -func (x *Account) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Account) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" +// Deprecated: Use DeletePolicyRequest.ProtoReflect.Descriptor instead. +func (*DeletePolicyRequest) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{31} } -func (x *Account) GetEmailAddress() string { +func (x *DeletePolicyRequest) GetName() string { if x != nil { - return x.EmailAddress + return x.Name } return "" } -// ServiceAccount represents a service account - special credentials for applications. -// Service accounts are linked to a parent user and can have restricted permissions. -type ServiceAccount struct { +type DeletePolicyResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier (e.g., "sa-xxxxx") - ParentUser string `protobuf:"bytes,2,opt,name=parent_user,json=parentUser,proto3" json:"parent_user,omitempty"` // Parent identity name - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // Optional description - Credential *Credential `protobuf:"bytes,4,opt,name=credential,proto3" json:"credential,omitempty"` // Access key/secret for this service account - Actions []string `protobuf:"bytes,5,rep,name=actions,proto3" json:"actions,omitempty"` // Allowed actions (subset of parent) - Expiration int64 `protobuf:"varint,6,opt,name=expiration,proto3" json:"expiration,omitempty"` // Unix timestamp, 0 = no expiration - Disabled bool `protobuf:"varint,7,opt,name=disabled,proto3" json:"disabled,omitempty"` // Status: false = enabled (default) - CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // Creation timestamp - CreatedBy string `protobuf:"bytes,9,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"` // Who created this service account unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ServiceAccount) Reset() { - *x = ServiceAccount{} - mi := &file_iam_proto_msgTypes[4] +func (x *DeletePolicyResponse) Reset() { + *x = DeletePolicyResponse{} + mi := &file_iam_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ServiceAccount) String() string { +func (x *DeletePolicyResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ServiceAccount) ProtoMessage() {} +func (*DeletePolicyResponse) ProtoMessage() {} -func (x *ServiceAccount) ProtoReflect() protoreflect.Message { - mi := &file_iam_proto_msgTypes[4] +func (x *DeletePolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -336,70 +1590,59 @@ func (x *ServiceAccount) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ServiceAccount.ProtoReflect.Descriptor instead. -func (*ServiceAccount) Descriptor() ([]byte, []int) { - return file_iam_proto_rawDescGZIP(), []int{4} -} - -func (x *ServiceAccount) GetId() string { - if x != nil { - return x.Id - } - return "" +// Deprecated: Use DeletePolicyResponse.ProtoReflect.Descriptor instead. +func (*DeletePolicyResponse) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{32} } -func (x *ServiceAccount) GetParentUser() string { - if x != nil { - return x.ParentUser - } - return "" +type Policy struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // JSON content of the policy + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *ServiceAccount) GetDescription() string { - if x != nil { - return x.Description - } - return "" +func (x *Policy) Reset() { + *x = Policy{} + mi := &file_iam_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *ServiceAccount) GetCredential() *Credential { - if x != nil { - return x.Credential - } - return nil +func (x *Policy) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *ServiceAccount) GetActions() []string { - if x != nil { - return x.Actions - } - return nil -} +func (*Policy) ProtoMessage() {} -func (x *ServiceAccount) GetExpiration() int64 { +func (x *Policy) ProtoReflect() protoreflect.Message { + mi := &file_iam_proto_msgTypes[33] if x != nil { - return x.Expiration + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return 0 + return mi.MessageOf(x) } -func (x *ServiceAccount) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false +// Deprecated: Use Policy.ProtoReflect.Descriptor instead. +func (*Policy) Descriptor() ([]byte, []int) { + return file_iam_proto_rawDescGZIP(), []int{33} } -func (x *ServiceAccount) GetCreatedAt() int64 { +func (x *Policy) GetName() string { if x != nil { - return x.CreatedAt + return x.Name } - return 0 + return "" } -func (x *ServiceAccount) GetCreatedBy() string { +func (x *Policy) GetContent() string { if x != nil { - return x.CreatedBy + return x.Content } return "" } @@ -408,13 +1651,53 @@ var File_iam_proto protoreflect.FileDescriptor const file_iam_proto_rawDesc = "" + "\n" + - "\tiam.proto\x12\x06iam_pb\"\xb6\x01\n" + + "\tiam.proto\x12\x06iam_pb\"\x19\n" + + "\x17GetConfigurationRequest\"\\\n" + + "\x18GetConfigurationResponse\x12@\n" + + "\rconfiguration\x18\x01 \x01(\v2\x1a.iam_pb.S3ApiConfigurationR\rconfiguration\"[\n" + + "\x17PutConfigurationRequest\x12@\n" + + "\rconfiguration\x18\x01 \x01(\v2\x1a.iam_pb.S3ApiConfigurationR\rconfiguration\"\x1a\n" + + "\x18PutConfigurationResponse\"A\n" + + "\x11CreateUserRequest\x12,\n" + + "\bidentity\x18\x01 \x01(\v2\x10.iam_pb.IdentityR\bidentity\"\x14\n" + + "\x12CreateUserResponse\",\n" + + "\x0eGetUserRequest\x12\x1a\n" + + "\busername\x18\x01 \x01(\tR\busername\"?\n" + + "\x0fGetUserResponse\x12,\n" + + "\bidentity\x18\x01 \x01(\v2\x10.iam_pb.IdentityR\bidentity\"]\n" + + "\x11UpdateUserRequest\x12\x1a\n" + + "\busername\x18\x01 \x01(\tR\busername\x12,\n" + + "\bidentity\x18\x02 \x01(\v2\x10.iam_pb.IdentityR\bidentity\"\x14\n" + + "\x12UpdateUserResponse\"/\n" + + "\x11DeleteUserRequest\x12\x1a\n" + + "\busername\x18\x01 \x01(\tR\busername\"\x14\n" + + "\x12DeleteUserResponse\"\x12\n" + + "\x10ListUsersRequest\"1\n" + + "\x11ListUsersResponse\x12\x1c\n" + + "\tusernames\x18\x01 \x03(\tR\tusernames\"h\n" + + "\x16CreateAccessKeyRequest\x12\x1a\n" + + "\busername\x18\x01 \x01(\tR\busername\x122\n" + + "\n" + + "credential\x18\x02 \x01(\v2\x12.iam_pb.CredentialR\n" + + "credential\"\x19\n" + + "\x17CreateAccessKeyResponse\"S\n" + + "\x16DeleteAccessKeyRequest\x12\x1a\n" + + "\busername\x18\x01 \x01(\tR\busername\x12\x1d\n" + + "\n" + + "access_key\x18\x02 \x01(\tR\taccessKey\"\x19\n" + + "\x17DeleteAccessKeyResponse\":\n" + + "\x19GetUserByAccessKeyRequest\x12\x1d\n" + + "\n" + + "access_key\x18\x01 \x01(\tR\taccessKey\"J\n" + + "\x1aGetUserByAccessKeyResponse\x12,\n" + + "\bidentity\x18\x01 \x01(\v2\x10.iam_pb.IdentityR\bidentity\"\xe2\x01\n" + "\x12S3ApiConfiguration\x120\n" + "\n" + "identities\x18\x01 \x03(\v2\x10.iam_pb.IdentityR\n" + "identities\x12+\n" + "\baccounts\x18\x02 \x03(\v2\x0f.iam_pb.AccountR\baccounts\x12A\n" + - "\x10service_accounts\x18\x03 \x03(\v2\x16.iam_pb.ServiceAccountR\x0fserviceAccounts\"\x88\x02\n" + + "\x10service_accounts\x18\x03 \x03(\v2\x16.iam_pb.ServiceAccountR\x0fserviceAccounts\x12*\n" + + "\bpolicies\x18\x04 \x03(\v2\x0e.iam_pb.PolicyR\bpolicies\"\x88\x02\n" + "\bIdentity\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x124\n" + "\vcredentials\x18\x02 \x03(\v2\x12.iam_pb.CredentialR\vcredentials\x12\x18\n" + @@ -450,8 +1733,43 @@ const file_iam_proto_rawDesc = "" + "\n" + "created_at\x18\b \x01(\x03R\tcreatedAt\x12\x1d\n" + "\n" + - "created_by\x18\t \x01(\tR\tcreatedBy2!\n" + - "\x1fSeaweedIdentityAccessManagementBK\n" + + "created_by\x18\t \x01(\tR\tcreatedBy\"@\n" + + "\x10PutPolicyRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\acontent\x18\x02 \x01(\tR\acontent\"\x13\n" + + "\x11PutPolicyResponse\"&\n" + + "\x10GetPolicyRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"A\n" + + "\x11GetPolicyResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\acontent\x18\x02 \x01(\tR\acontent\"\x15\n" + + "\x13ListPoliciesRequest\"B\n" + + "\x14ListPoliciesResponse\x12*\n" + + "\bpolicies\x18\x01 \x03(\v2\x0e.iam_pb.PolicyR\bpolicies\")\n" + + "\x13DeletePolicyRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x16\n" + + "\x14DeletePolicyResponse\"6\n" + + "\x06Policy\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\acontent\x18\x02 \x01(\tR\acontent2\xbb\b\n" + + "\x1fSeaweedIdentityAccessManagement\x12U\n" + + "\x10GetConfiguration\x12\x1f.iam_pb.GetConfigurationRequest\x1a .iam_pb.GetConfigurationResponse\x12U\n" + + "\x10PutConfiguration\x12\x1f.iam_pb.PutConfigurationRequest\x1a .iam_pb.PutConfigurationResponse\x12C\n" + + "\n" + + "CreateUser\x12\x19.iam_pb.CreateUserRequest\x1a\x1a.iam_pb.CreateUserResponse\x12:\n" + + "\aGetUser\x12\x16.iam_pb.GetUserRequest\x1a\x17.iam_pb.GetUserResponse\x12C\n" + + "\n" + + "UpdateUser\x12\x19.iam_pb.UpdateUserRequest\x1a\x1a.iam_pb.UpdateUserResponse\x12C\n" + + "\n" + + "DeleteUser\x12\x19.iam_pb.DeleteUserRequest\x1a\x1a.iam_pb.DeleteUserResponse\x12@\n" + + "\tListUsers\x12\x18.iam_pb.ListUsersRequest\x1a\x19.iam_pb.ListUsersResponse\x12R\n" + + "\x0fCreateAccessKey\x12\x1e.iam_pb.CreateAccessKeyRequest\x1a\x1f.iam_pb.CreateAccessKeyResponse\x12R\n" + + "\x0fDeleteAccessKey\x12\x1e.iam_pb.DeleteAccessKeyRequest\x1a\x1f.iam_pb.DeleteAccessKeyResponse\x12[\n" + + "\x12GetUserByAccessKey\x12!.iam_pb.GetUserByAccessKeyRequest\x1a\".iam_pb.GetUserByAccessKeyResponse\x12@\n" + + "\tPutPolicy\x12\x18.iam_pb.PutPolicyRequest\x1a\x19.iam_pb.PutPolicyResponse\x12@\n" + + "\tGetPolicy\x12\x18.iam_pb.GetPolicyRequest\x1a\x19.iam_pb.GetPolicyResponse\x12I\n" + + "\fListPolicies\x12\x1b.iam_pb.ListPoliciesRequest\x1a\x1c.iam_pb.ListPoliciesResponse\x12I\n" + + "\fDeletePolicy\x12\x1b.iam_pb.DeletePolicyRequest\x1a\x1c.iam_pb.DeletePolicyResponseBK\n" + "\x10seaweedfs.clientB\bIamProtoZ-github.com/seaweedfs/seaweedfs/weed/pb/iam_pbb\x06proto3" var ( @@ -466,26 +1784,92 @@ func file_iam_proto_rawDescGZIP() []byte { return file_iam_proto_rawDescData } -var file_iam_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_iam_proto_msgTypes = make([]protoimpl.MessageInfo, 34) var file_iam_proto_goTypes = []any{ - (*S3ApiConfiguration)(nil), // 0: iam_pb.S3ApiConfiguration - (*Identity)(nil), // 1: iam_pb.Identity - (*Credential)(nil), // 2: iam_pb.Credential - (*Account)(nil), // 3: iam_pb.Account - (*ServiceAccount)(nil), // 4: iam_pb.ServiceAccount + (*GetConfigurationRequest)(nil), // 0: iam_pb.GetConfigurationRequest + (*GetConfigurationResponse)(nil), // 1: iam_pb.GetConfigurationResponse + (*PutConfigurationRequest)(nil), // 2: iam_pb.PutConfigurationRequest + (*PutConfigurationResponse)(nil), // 3: iam_pb.PutConfigurationResponse + (*CreateUserRequest)(nil), // 4: iam_pb.CreateUserRequest + (*CreateUserResponse)(nil), // 5: iam_pb.CreateUserResponse + (*GetUserRequest)(nil), // 6: iam_pb.GetUserRequest + (*GetUserResponse)(nil), // 7: iam_pb.GetUserResponse + (*UpdateUserRequest)(nil), // 8: iam_pb.UpdateUserRequest + (*UpdateUserResponse)(nil), // 9: iam_pb.UpdateUserResponse + (*DeleteUserRequest)(nil), // 10: iam_pb.DeleteUserRequest + (*DeleteUserResponse)(nil), // 11: iam_pb.DeleteUserResponse + (*ListUsersRequest)(nil), // 12: iam_pb.ListUsersRequest + (*ListUsersResponse)(nil), // 13: iam_pb.ListUsersResponse + (*CreateAccessKeyRequest)(nil), // 14: iam_pb.CreateAccessKeyRequest + (*CreateAccessKeyResponse)(nil), // 15: iam_pb.CreateAccessKeyResponse + (*DeleteAccessKeyRequest)(nil), // 16: iam_pb.DeleteAccessKeyRequest + (*DeleteAccessKeyResponse)(nil), // 17: iam_pb.DeleteAccessKeyResponse + (*GetUserByAccessKeyRequest)(nil), // 18: iam_pb.GetUserByAccessKeyRequest + (*GetUserByAccessKeyResponse)(nil), // 19: iam_pb.GetUserByAccessKeyResponse + (*S3ApiConfiguration)(nil), // 20: iam_pb.S3ApiConfiguration + (*Identity)(nil), // 21: iam_pb.Identity + (*Credential)(nil), // 22: iam_pb.Credential + (*Account)(nil), // 23: iam_pb.Account + (*ServiceAccount)(nil), // 24: iam_pb.ServiceAccount + (*PutPolicyRequest)(nil), // 25: iam_pb.PutPolicyRequest + (*PutPolicyResponse)(nil), // 26: iam_pb.PutPolicyResponse + (*GetPolicyRequest)(nil), // 27: iam_pb.GetPolicyRequest + (*GetPolicyResponse)(nil), // 28: iam_pb.GetPolicyResponse + (*ListPoliciesRequest)(nil), // 29: iam_pb.ListPoliciesRequest + (*ListPoliciesResponse)(nil), // 30: iam_pb.ListPoliciesResponse + (*DeletePolicyRequest)(nil), // 31: iam_pb.DeletePolicyRequest + (*DeletePolicyResponse)(nil), // 32: iam_pb.DeletePolicyResponse + (*Policy)(nil), // 33: iam_pb.Policy } var file_iam_proto_depIdxs = []int32{ - 1, // 0: iam_pb.S3ApiConfiguration.identities:type_name -> iam_pb.Identity - 3, // 1: iam_pb.S3ApiConfiguration.accounts:type_name -> iam_pb.Account - 4, // 2: iam_pb.S3ApiConfiguration.service_accounts:type_name -> iam_pb.ServiceAccount - 2, // 3: iam_pb.Identity.credentials:type_name -> iam_pb.Credential - 3, // 4: iam_pb.Identity.account:type_name -> iam_pb.Account - 2, // 5: iam_pb.ServiceAccount.credential:type_name -> iam_pb.Credential - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 20, // 0: iam_pb.GetConfigurationResponse.configuration:type_name -> iam_pb.S3ApiConfiguration + 20, // 1: iam_pb.PutConfigurationRequest.configuration:type_name -> iam_pb.S3ApiConfiguration + 21, // 2: iam_pb.CreateUserRequest.identity:type_name -> iam_pb.Identity + 21, // 3: iam_pb.GetUserResponse.identity:type_name -> iam_pb.Identity + 21, // 4: iam_pb.UpdateUserRequest.identity:type_name -> iam_pb.Identity + 22, // 5: iam_pb.CreateAccessKeyRequest.credential:type_name -> iam_pb.Credential + 21, // 6: iam_pb.GetUserByAccessKeyResponse.identity:type_name -> iam_pb.Identity + 21, // 7: iam_pb.S3ApiConfiguration.identities:type_name -> iam_pb.Identity + 23, // 8: iam_pb.S3ApiConfiguration.accounts:type_name -> iam_pb.Account + 24, // 9: iam_pb.S3ApiConfiguration.service_accounts:type_name -> iam_pb.ServiceAccount + 33, // 10: iam_pb.S3ApiConfiguration.policies:type_name -> iam_pb.Policy + 22, // 11: iam_pb.Identity.credentials:type_name -> iam_pb.Credential + 23, // 12: iam_pb.Identity.account:type_name -> iam_pb.Account + 22, // 13: iam_pb.ServiceAccount.credential:type_name -> iam_pb.Credential + 33, // 14: iam_pb.ListPoliciesResponse.policies:type_name -> iam_pb.Policy + 0, // 15: iam_pb.SeaweedIdentityAccessManagement.GetConfiguration:input_type -> iam_pb.GetConfigurationRequest + 2, // 16: iam_pb.SeaweedIdentityAccessManagement.PutConfiguration:input_type -> iam_pb.PutConfigurationRequest + 4, // 17: iam_pb.SeaweedIdentityAccessManagement.CreateUser:input_type -> iam_pb.CreateUserRequest + 6, // 18: iam_pb.SeaweedIdentityAccessManagement.GetUser:input_type -> iam_pb.GetUserRequest + 8, // 19: iam_pb.SeaweedIdentityAccessManagement.UpdateUser:input_type -> iam_pb.UpdateUserRequest + 10, // 20: iam_pb.SeaweedIdentityAccessManagement.DeleteUser:input_type -> iam_pb.DeleteUserRequest + 12, // 21: iam_pb.SeaweedIdentityAccessManagement.ListUsers:input_type -> iam_pb.ListUsersRequest + 14, // 22: iam_pb.SeaweedIdentityAccessManagement.CreateAccessKey:input_type -> iam_pb.CreateAccessKeyRequest + 16, // 23: iam_pb.SeaweedIdentityAccessManagement.DeleteAccessKey:input_type -> iam_pb.DeleteAccessKeyRequest + 18, // 24: iam_pb.SeaweedIdentityAccessManagement.GetUserByAccessKey:input_type -> iam_pb.GetUserByAccessKeyRequest + 25, // 25: iam_pb.SeaweedIdentityAccessManagement.PutPolicy:input_type -> iam_pb.PutPolicyRequest + 27, // 26: iam_pb.SeaweedIdentityAccessManagement.GetPolicy:input_type -> iam_pb.GetPolicyRequest + 29, // 27: iam_pb.SeaweedIdentityAccessManagement.ListPolicies:input_type -> iam_pb.ListPoliciesRequest + 31, // 28: iam_pb.SeaweedIdentityAccessManagement.DeletePolicy:input_type -> iam_pb.DeletePolicyRequest + 1, // 29: iam_pb.SeaweedIdentityAccessManagement.GetConfiguration:output_type -> iam_pb.GetConfigurationResponse + 3, // 30: iam_pb.SeaweedIdentityAccessManagement.PutConfiguration:output_type -> iam_pb.PutConfigurationResponse + 5, // 31: iam_pb.SeaweedIdentityAccessManagement.CreateUser:output_type -> iam_pb.CreateUserResponse + 7, // 32: iam_pb.SeaweedIdentityAccessManagement.GetUser:output_type -> iam_pb.GetUserResponse + 9, // 33: iam_pb.SeaweedIdentityAccessManagement.UpdateUser:output_type -> iam_pb.UpdateUserResponse + 11, // 34: iam_pb.SeaweedIdentityAccessManagement.DeleteUser:output_type -> iam_pb.DeleteUserResponse + 13, // 35: iam_pb.SeaweedIdentityAccessManagement.ListUsers:output_type -> iam_pb.ListUsersResponse + 15, // 36: iam_pb.SeaweedIdentityAccessManagement.CreateAccessKey:output_type -> iam_pb.CreateAccessKeyResponse + 17, // 37: iam_pb.SeaweedIdentityAccessManagement.DeleteAccessKey:output_type -> iam_pb.DeleteAccessKeyResponse + 19, // 38: iam_pb.SeaweedIdentityAccessManagement.GetUserByAccessKey:output_type -> iam_pb.GetUserByAccessKeyResponse + 26, // 39: iam_pb.SeaweedIdentityAccessManagement.PutPolicy:output_type -> iam_pb.PutPolicyResponse + 28, // 40: iam_pb.SeaweedIdentityAccessManagement.GetPolicy:output_type -> iam_pb.GetPolicyResponse + 30, // 41: iam_pb.SeaweedIdentityAccessManagement.ListPolicies:output_type -> iam_pb.ListPoliciesResponse + 32, // 42: iam_pb.SeaweedIdentityAccessManagement.DeletePolicy:output_type -> iam_pb.DeletePolicyResponse + 29, // [29:43] is the sub-list for method output_type + 15, // [15:29] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_iam_proto_init() } @@ -499,7 +1883,7 @@ func file_iam_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_iam_proto_rawDesc), len(file_iam_proto_rawDesc)), NumEnums: 0, - NumMessages: 5, + NumMessages: 34, NumExtensions: 0, NumServices: 1, }, diff --git a/weed/pb/iam_pb/iam_grpc.pb.go b/weed/pb/iam_pb/iam_grpc.pb.go index 12e70e9b6..b70268a62 100644 --- a/weed/pb/iam_pb/iam_grpc.pb.go +++ b/weed/pb/iam_pb/iam_grpc.pb.go @@ -1,13 +1,16 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: iam.proto package iam_pb 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 @@ -15,10 +18,45 @@ import ( // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 +const ( + SeaweedIdentityAccessManagement_GetConfiguration_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/GetConfiguration" + SeaweedIdentityAccessManagement_PutConfiguration_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/PutConfiguration" + SeaweedIdentityAccessManagement_CreateUser_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/CreateUser" + SeaweedIdentityAccessManagement_GetUser_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/GetUser" + SeaweedIdentityAccessManagement_UpdateUser_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/UpdateUser" + SeaweedIdentityAccessManagement_DeleteUser_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/DeleteUser" + SeaweedIdentityAccessManagement_ListUsers_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/ListUsers" + SeaweedIdentityAccessManagement_CreateAccessKey_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/CreateAccessKey" + SeaweedIdentityAccessManagement_DeleteAccessKey_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/DeleteAccessKey" + SeaweedIdentityAccessManagement_GetUserByAccessKey_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/GetUserByAccessKey" + SeaweedIdentityAccessManagement_PutPolicy_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/PutPolicy" + SeaweedIdentityAccessManagement_GetPolicy_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/GetPolicy" + SeaweedIdentityAccessManagement_ListPolicies_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/ListPolicies" + SeaweedIdentityAccessManagement_DeletePolicy_FullMethodName = "/iam_pb.SeaweedIdentityAccessManagement/DeletePolicy" +) + // SeaweedIdentityAccessManagementClient is the client API for SeaweedIdentityAccessManagement 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 SeaweedIdentityAccessManagementClient interface { + // Configuration Management + GetConfiguration(ctx context.Context, in *GetConfigurationRequest, opts ...grpc.CallOption) (*GetConfigurationResponse, error) + PutConfiguration(ctx context.Context, in *PutConfigurationRequest, opts ...grpc.CallOption) (*PutConfigurationResponse, error) + // User Management + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) + GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) + UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) + DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) + ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) + // Access Key Management + CreateAccessKey(ctx context.Context, in *CreateAccessKeyRequest, opts ...grpc.CallOption) (*CreateAccessKeyResponse, error) + DeleteAccessKey(ctx context.Context, in *DeleteAccessKeyRequest, opts ...grpc.CallOption) (*DeleteAccessKeyResponse, error) + GetUserByAccessKey(ctx context.Context, in *GetUserByAccessKeyRequest, opts ...grpc.CallOption) (*GetUserByAccessKeyResponse, error) + // Policy Management + PutPolicy(ctx context.Context, in *PutPolicyRequest, opts ...grpc.CallOption) (*PutPolicyResponse, error) + GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error) + ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error) + DeletePolicy(ctx context.Context, in *DeletePolicyRequest, opts ...grpc.CallOption) (*DeletePolicyResponse, error) } type seaweedIdentityAccessManagementClient struct { @@ -29,10 +67,168 @@ func NewSeaweedIdentityAccessManagementClient(cc grpc.ClientConnInterface) Seawe return &seaweedIdentityAccessManagementClient{cc} } +func (c *seaweedIdentityAccessManagementClient) GetConfiguration(ctx context.Context, in *GetConfigurationRequest, opts ...grpc.CallOption) (*GetConfigurationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetConfigurationResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_GetConfiguration_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) PutConfiguration(ctx context.Context, in *PutConfigurationRequest, opts ...grpc.CallOption) (*PutConfigurationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutConfigurationResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_PutConfiguration_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateUserResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_CreateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_GetUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateUserResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_UpdateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteUserResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_DeleteUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListUsersResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_ListUsers_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) CreateAccessKey(ctx context.Context, in *CreateAccessKeyRequest, opts ...grpc.CallOption) (*CreateAccessKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateAccessKeyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_CreateAccessKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) DeleteAccessKey(ctx context.Context, in *DeleteAccessKeyRequest, opts ...grpc.CallOption) (*DeleteAccessKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteAccessKeyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_DeleteAccessKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) GetUserByAccessKey(ctx context.Context, in *GetUserByAccessKeyRequest, opts ...grpc.CallOption) (*GetUserByAccessKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserByAccessKeyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_GetUserByAccessKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) PutPolicy(ctx context.Context, in *PutPolicyRequest, opts ...grpc.CallOption) (*PutPolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutPolicyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_PutPolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPolicyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_GetPolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListPoliciesResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_ListPolicies_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seaweedIdentityAccessManagementClient) DeletePolicy(ctx context.Context, in *DeletePolicyRequest, opts ...grpc.CallOption) (*DeletePolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeletePolicyResponse) + err := c.cc.Invoke(ctx, SeaweedIdentityAccessManagement_DeletePolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // SeaweedIdentityAccessManagementServer is the server API for SeaweedIdentityAccessManagement service. // All implementations must embed UnimplementedSeaweedIdentityAccessManagementServer // for forward compatibility. type SeaweedIdentityAccessManagementServer interface { + // Configuration Management + GetConfiguration(context.Context, *GetConfigurationRequest) (*GetConfigurationResponse, error) + PutConfiguration(context.Context, *PutConfigurationRequest) (*PutConfigurationResponse, error) + // User Management + CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) + UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) + DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) + ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) + // Access Key Management + CreateAccessKey(context.Context, *CreateAccessKeyRequest) (*CreateAccessKeyResponse, error) + DeleteAccessKey(context.Context, *DeleteAccessKeyRequest) (*DeleteAccessKeyResponse, error) + GetUserByAccessKey(context.Context, *GetUserByAccessKeyRequest) (*GetUserByAccessKeyResponse, error) + // Policy Management + PutPolicy(context.Context, *PutPolicyRequest) (*PutPolicyResponse, error) + GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error) + ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error) + DeletePolicy(context.Context, *DeletePolicyRequest) (*DeletePolicyResponse, error) mustEmbedUnimplementedSeaweedIdentityAccessManagementServer() } @@ -43,6 +239,48 @@ type SeaweedIdentityAccessManagementServer interface { // pointer dereference when methods are called. type UnimplementedSeaweedIdentityAccessManagementServer struct{} +func (UnimplementedSeaweedIdentityAccessManagementServer) GetConfiguration(context.Context, *GetConfigurationRequest) (*GetConfigurationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetConfiguration not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) PutConfiguration(context.Context, *PutConfigurationRequest) (*PutConfigurationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutConfiguration not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) CreateAccessKey(context.Context, *CreateAccessKeyRequest) (*CreateAccessKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAccessKey not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) DeleteAccessKey(context.Context, *DeleteAccessKeyRequest) (*DeleteAccessKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteAccessKey not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) GetUserByAccessKey(context.Context, *GetUserByAccessKeyRequest) (*GetUserByAccessKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserByAccessKey not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) PutPolicy(context.Context, *PutPolicyRequest) (*PutPolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutPolicy not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPolicy not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPolicies not implemented") +} +func (UnimplementedSeaweedIdentityAccessManagementServer) DeletePolicy(context.Context, *DeletePolicyRequest) (*DeletePolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePolicy not implemented") +} func (UnimplementedSeaweedIdentityAccessManagementServer) mustEmbedUnimplementedSeaweedIdentityAccessManagementServer() { } func (UnimplementedSeaweedIdentityAccessManagementServer) testEmbeddedByValue() {} @@ -65,13 +303,322 @@ func RegisterSeaweedIdentityAccessManagementServer(s grpc.ServiceRegistrar, srv s.RegisterService(&SeaweedIdentityAccessManagement_ServiceDesc, srv) } +func _SeaweedIdentityAccessManagement_GetConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetConfigurationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).GetConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_GetConfiguration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).GetConfiguration(ctx, req.(*GetConfigurationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_PutConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutConfigurationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).PutConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_PutConfiguration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).PutConfiguration(ctx, req.(*PutConfigurationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).CreateUser(ctx, req.(*CreateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_GetUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).GetUser(ctx, req.(*GetUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_UpdateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).UpdateUser(ctx, req.(*UpdateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_DeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).DeleteUser(ctx, req.(*DeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).ListUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_ListUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).ListUsers(ctx, req.(*ListUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_CreateAccessKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateAccessKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).CreateAccessKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_CreateAccessKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).CreateAccessKey(ctx, req.(*CreateAccessKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_DeleteAccessKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteAccessKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).DeleteAccessKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_DeleteAccessKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).DeleteAccessKey(ctx, req.(*DeleteAccessKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_GetUserByAccessKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByAccessKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).GetUserByAccessKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_GetUserByAccessKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).GetUserByAccessKey(ctx, req.(*GetUserByAccessKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_PutPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).PutPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_PutPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).PutPolicy(ctx, req.(*PutPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_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.(SeaweedIdentityAccessManagementServer).GetPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_GetPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).GetPolicy(ctx, req.(*GetPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_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.(SeaweedIdentityAccessManagementServer).ListPolicies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_ListPolicies_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).ListPolicies(ctx, req.(*ListPoliciesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SeaweedIdentityAccessManagement_DeletePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeaweedIdentityAccessManagementServer).DeletePolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SeaweedIdentityAccessManagement_DeletePolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeaweedIdentityAccessManagementServer).DeletePolicy(ctx, req.(*DeletePolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + // SeaweedIdentityAccessManagement_ServiceDesc is the grpc.ServiceDesc for SeaweedIdentityAccessManagement service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SeaweedIdentityAccessManagement_ServiceDesc = grpc.ServiceDesc{ ServiceName: "iam_pb.SeaweedIdentityAccessManagement", HandlerType: (*SeaweedIdentityAccessManagementServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "iam.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "GetConfiguration", + Handler: _SeaweedIdentityAccessManagement_GetConfiguration_Handler, + }, + { + MethodName: "PutConfiguration", + Handler: _SeaweedIdentityAccessManagement_PutConfiguration_Handler, + }, + { + MethodName: "CreateUser", + Handler: _SeaweedIdentityAccessManagement_CreateUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _SeaweedIdentityAccessManagement_GetUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _SeaweedIdentityAccessManagement_UpdateUser_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _SeaweedIdentityAccessManagement_DeleteUser_Handler, + }, + { + MethodName: "ListUsers", + Handler: _SeaweedIdentityAccessManagement_ListUsers_Handler, + }, + { + MethodName: "CreateAccessKey", + Handler: _SeaweedIdentityAccessManagement_CreateAccessKey_Handler, + }, + { + MethodName: "DeleteAccessKey", + Handler: _SeaweedIdentityAccessManagement_DeleteAccessKey_Handler, + }, + { + MethodName: "GetUserByAccessKey", + Handler: _SeaweedIdentityAccessManagement_GetUserByAccessKey_Handler, + }, + { + MethodName: "PutPolicy", + Handler: _SeaweedIdentityAccessManagement_PutPolicy_Handler, + }, + { + MethodName: "GetPolicy", + Handler: _SeaweedIdentityAccessManagement_GetPolicy_Handler, + }, + { + MethodName: "ListPolicies", + Handler: _SeaweedIdentityAccessManagement_ListPolicies_Handler, + }, + { + MethodName: "DeletePolicy", + Handler: _SeaweedIdentityAccessManagement_DeletePolicy_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "iam.proto", } diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go index 8e271f9ea..27501ee8b 100644 --- a/weed/pb/master_pb/master.pb.go +++ b/weed/pb/master_pb/master.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: master.proto package master_pb diff --git a/weed/pb/master_pb/master_grpc.pb.go b/weed/pb/master_pb/master_grpc.pb.go index 441c2ffb1..f13d53bca 100644 --- a/weed/pb/master_pb/master_grpc.pb.go +++ b/weed/pb/master_pb/master_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: master.proto package master_pb diff --git a/weed/pb/mount_pb/mount.pb.go b/weed/pb/mount_pb/mount.pb.go index f5420f567..caae49674 100644 --- a/weed/pb/mount_pb/mount.pb.go +++ b/weed/pb/mount_pb/mount.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: mount.proto package mount_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/mount_pb/mount_grpc.pb.go b/weed/pb/mount_pb/mount_grpc.pb.go index b4a9d7e29..61a782d3b 100644 --- a/weed/pb/mount_pb/mount_grpc.pb.go +++ b/weed/pb/mount_pb/mount_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: mount.proto package mount_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/pb/mq_agent_pb/mq_agent.pb.go b/weed/pb/mq_agent_pb/mq_agent.pb.go index 3a89495cb..7f59a6252 100644 --- a/weed/pb/mq_agent_pb/mq_agent.pb.go +++ b/weed/pb/mq_agent_pb/mq_agent.pb.go @@ -1,19 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: mq_agent.proto package mq_agent_pb import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - schema_pb "github.com/seaweedfs/seaweedfs/weed/pb/schema_pb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( diff --git a/weed/pb/mq_agent_pb/mq_agent_grpc.pb.go b/weed/pb/mq_agent_pb/mq_agent_grpc.pb.go index 7135ced0c..e2220c6f0 100644 --- a/weed/pb/mq_agent_pb/mq_agent_grpc.pb.go +++ b/weed/pb/mq_agent_pb/mq_agent_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: mq_agent.proto package mq_agent_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/pb/mq_pb/mq_broker.pb.go b/weed/pb/mq_pb/mq_broker.pb.go index 58672cb98..6b5cf3c7f 100644 --- a/weed/pb/mq_pb/mq_broker.pb.go +++ b/weed/pb/mq_pb/mq_broker.pb.go @@ -1,20 +1,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: mq_broker.proto package mq_pb import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - filer_pb "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" schema_pb "github.com/seaweedfs/seaweedfs/weed/pb/schema_pb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( diff --git a/weed/pb/mq_pb/mq_broker_grpc.pb.go b/weed/pb/mq_pb/mq_broker_grpc.pb.go index ea972974e..063413308 100644 --- a/weed/pb/mq_pb/mq_broker_grpc.pb.go +++ b/weed/pb/mq_pb/mq_broker_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: mq_broker.proto package mq_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/pb/remote_pb/remote.pb.go b/weed/pb/remote_pb/remote.pb.go index 2c9e2389b..877188ffa 100644 --- a/weed/pb/remote_pb/remote.pb.go +++ b/weed/pb/remote_pb/remote.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: remote.proto package remote_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/s3_pb/s3.pb.go b/weed/pb/s3_pb/s3.pb.go index c44071594..312210f84 100644 --- a/weed/pb/s3_pb/s3.pb.go +++ b/weed/pb/s3_pb/s3.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: s3.proto package s3_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/s3_pb/s3_grpc.pb.go b/weed/pb/s3_pb/s3_grpc.pb.go index daef9cf30..7d76b004a 100644 --- a/weed/pb/s3_pb/s3_grpc.pb.go +++ b/weed/pb/s3_pb/s3_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: s3.proto package s3_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/pb/schema_pb/mq_schema.pb.go b/weed/pb/schema_pb/mq_schema.pb.go index 246615daf..8f8eadd46 100644 --- a/weed/pb/schema_pb/mq_schema.pb.go +++ b/weed/pb/schema_pb/mq_schema.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: mq_schema.proto package schema_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go index c944264dd..9cfc43765 100644 --- a/weed/pb/volume_server_pb/volume_server.pb.go +++ b/weed/pb/volume_server_pb/volume_server.pb.go @@ -1,19 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: volume_server.proto package volume_server_pb import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - remote_pb "github.com/seaweedfs/seaweedfs/weed/pb/remote_pb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( diff --git a/weed/pb/volume_server_pb/volume_server_grpc.pb.go b/weed/pb/volume_server_pb/volume_server_grpc.pb.go index 85ff1ce57..df8cb02ae 100644 --- a/weed/pb/volume_server_pb/volume_server_grpc.pb.go +++ b/weed/pb/volume_server_pb/volume_server_grpc.pb.go @@ -1,10 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.33.4 +// source: volume_server.proto package volume_server_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -12,7 +15,55 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + VolumeServer_BatchDelete_FullMethodName = "/volume_server_pb.VolumeServer/BatchDelete" + VolumeServer_VacuumVolumeCheck_FullMethodName = "/volume_server_pb.VolumeServer/VacuumVolumeCheck" + VolumeServer_VacuumVolumeCompact_FullMethodName = "/volume_server_pb.VolumeServer/VacuumVolumeCompact" + VolumeServer_VacuumVolumeCommit_FullMethodName = "/volume_server_pb.VolumeServer/VacuumVolumeCommit" + VolumeServer_VacuumVolumeCleanup_FullMethodName = "/volume_server_pb.VolumeServer/VacuumVolumeCleanup" + VolumeServer_DeleteCollection_FullMethodName = "/volume_server_pb.VolumeServer/DeleteCollection" + VolumeServer_AllocateVolume_FullMethodName = "/volume_server_pb.VolumeServer/AllocateVolume" + VolumeServer_VolumeSyncStatus_FullMethodName = "/volume_server_pb.VolumeServer/VolumeSyncStatus" + VolumeServer_VolumeIncrementalCopy_FullMethodName = "/volume_server_pb.VolumeServer/VolumeIncrementalCopy" + VolumeServer_VolumeMount_FullMethodName = "/volume_server_pb.VolumeServer/VolumeMount" + VolumeServer_VolumeUnmount_FullMethodName = "/volume_server_pb.VolumeServer/VolumeUnmount" + VolumeServer_VolumeDelete_FullMethodName = "/volume_server_pb.VolumeServer/VolumeDelete" + VolumeServer_VolumeMarkReadonly_FullMethodName = "/volume_server_pb.VolumeServer/VolumeMarkReadonly" + VolumeServer_VolumeMarkWritable_FullMethodName = "/volume_server_pb.VolumeServer/VolumeMarkWritable" + VolumeServer_VolumeConfigure_FullMethodName = "/volume_server_pb.VolumeServer/VolumeConfigure" + VolumeServer_VolumeStatus_FullMethodName = "/volume_server_pb.VolumeServer/VolumeStatus" + VolumeServer_VolumeCopy_FullMethodName = "/volume_server_pb.VolumeServer/VolumeCopy" + VolumeServer_ReadVolumeFileStatus_FullMethodName = "/volume_server_pb.VolumeServer/ReadVolumeFileStatus" + VolumeServer_CopyFile_FullMethodName = "/volume_server_pb.VolumeServer/CopyFile" + VolumeServer_ReceiveFile_FullMethodName = "/volume_server_pb.VolumeServer/ReceiveFile" + VolumeServer_ReadNeedleBlob_FullMethodName = "/volume_server_pb.VolumeServer/ReadNeedleBlob" + VolumeServer_ReadNeedleMeta_FullMethodName = "/volume_server_pb.VolumeServer/ReadNeedleMeta" + VolumeServer_WriteNeedleBlob_FullMethodName = "/volume_server_pb.VolumeServer/WriteNeedleBlob" + VolumeServer_ReadAllNeedles_FullMethodName = "/volume_server_pb.VolumeServer/ReadAllNeedles" + VolumeServer_VolumeTailSender_FullMethodName = "/volume_server_pb.VolumeServer/VolumeTailSender" + VolumeServer_VolumeTailReceiver_FullMethodName = "/volume_server_pb.VolumeServer/VolumeTailReceiver" + VolumeServer_VolumeEcShardsGenerate_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsGenerate" + VolumeServer_VolumeEcShardsRebuild_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsRebuild" + VolumeServer_VolumeEcShardsCopy_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsCopy" + VolumeServer_VolumeEcShardsDelete_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsDelete" + VolumeServer_VolumeEcShardsMount_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsMount" + VolumeServer_VolumeEcShardsUnmount_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsUnmount" + VolumeServer_VolumeEcShardRead_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardRead" + VolumeServer_VolumeEcBlobDelete_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcBlobDelete" + VolumeServer_VolumeEcShardsToVolume_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsToVolume" + VolumeServer_VolumeEcShardsInfo_FullMethodName = "/volume_server_pb.VolumeServer/VolumeEcShardsInfo" + VolumeServer_VolumeTierMoveDatToRemote_FullMethodName = "/volume_server_pb.VolumeServer/VolumeTierMoveDatToRemote" + VolumeServer_VolumeTierMoveDatFromRemote_FullMethodName = "/volume_server_pb.VolumeServer/VolumeTierMoveDatFromRemote" + VolumeServer_VolumeServerStatus_FullMethodName = "/volume_server_pb.VolumeServer/VolumeServerStatus" + VolumeServer_VolumeServerLeave_FullMethodName = "/volume_server_pb.VolumeServer/VolumeServerLeave" + VolumeServer_FetchAndWriteNeedle_FullMethodName = "/volume_server_pb.VolumeServer/FetchAndWriteNeedle" + VolumeServer_Query_FullMethodName = "/volume_server_pb.VolumeServer/Query" + VolumeServer_VolumeNeedleStatus_FullMethodName = "/volume_server_pb.VolumeServer/VolumeNeedleStatus" + VolumeServer_Ping_FullMethodName = "/volume_server_pb.VolumeServer/Ping" +) // VolumeServerClient is the client API for VolumeServer service. // @@ -21,13 +72,13 @@ type VolumeServerClient interface { // Experts only: takes multiple fid parameters. This function does not propagate deletes to replicas. BatchDelete(ctx context.Context, in *BatchDeleteRequest, opts ...grpc.CallOption) (*BatchDeleteResponse, error) VacuumVolumeCheck(ctx context.Context, in *VacuumVolumeCheckRequest, opts ...grpc.CallOption) (*VacuumVolumeCheckResponse, error) - VacuumVolumeCompact(ctx context.Context, in *VacuumVolumeCompactRequest, opts ...grpc.CallOption) (VolumeServer_VacuumVolumeCompactClient, error) + VacuumVolumeCompact(ctx context.Context, in *VacuumVolumeCompactRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VacuumVolumeCompactResponse], error) VacuumVolumeCommit(ctx context.Context, in *VacuumVolumeCommitRequest, opts ...grpc.CallOption) (*VacuumVolumeCommitResponse, error) VacuumVolumeCleanup(ctx context.Context, in *VacuumVolumeCleanupRequest, opts ...grpc.CallOption) (*VacuumVolumeCleanupResponse, error) DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error) AllocateVolume(ctx context.Context, in *AllocateVolumeRequest, opts ...grpc.CallOption) (*AllocateVolumeResponse, error) VolumeSyncStatus(ctx context.Context, in *VolumeSyncStatusRequest, opts ...grpc.CallOption) (*VolumeSyncStatusResponse, error) - VolumeIncrementalCopy(ctx context.Context, in *VolumeIncrementalCopyRequest, opts ...grpc.CallOption) (VolumeServer_VolumeIncrementalCopyClient, error) + VolumeIncrementalCopy(ctx context.Context, in *VolumeIncrementalCopyRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeIncrementalCopyResponse], error) VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error) VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error) VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error) @@ -36,15 +87,15 @@ type VolumeServerClient interface { VolumeConfigure(ctx context.Context, in *VolumeConfigureRequest, opts ...grpc.CallOption) (*VolumeConfigureResponse, error) VolumeStatus(ctx context.Context, in *VolumeStatusRequest, opts ...grpc.CallOption) (*VolumeStatusResponse, error) // copy the .idx .dat files, and mount this volume - VolumeCopy(ctx context.Context, in *VolumeCopyRequest, opts ...grpc.CallOption) (VolumeServer_VolumeCopyClient, error) + VolumeCopy(ctx context.Context, in *VolumeCopyRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeCopyResponse], error) ReadVolumeFileStatus(ctx context.Context, in *ReadVolumeFileStatusRequest, opts ...grpc.CallOption) (*ReadVolumeFileStatusResponse, error) - CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (VolumeServer_CopyFileClient, error) - ReceiveFile(ctx context.Context, opts ...grpc.CallOption) (VolumeServer_ReceiveFileClient, error) + CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CopyFileResponse], error) + ReceiveFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReceiveFileRequest, ReceiveFileResponse], error) ReadNeedleBlob(ctx context.Context, in *ReadNeedleBlobRequest, opts ...grpc.CallOption) (*ReadNeedleBlobResponse, error) ReadNeedleMeta(ctx context.Context, in *ReadNeedleMetaRequest, opts ...grpc.CallOption) (*ReadNeedleMetaResponse, error) WriteNeedleBlob(ctx context.Context, in *WriteNeedleBlobRequest, opts ...grpc.CallOption) (*WriteNeedleBlobResponse, error) - ReadAllNeedles(ctx context.Context, in *ReadAllNeedlesRequest, opts ...grpc.CallOption) (VolumeServer_ReadAllNeedlesClient, error) - VolumeTailSender(ctx context.Context, in *VolumeTailSenderRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTailSenderClient, error) + ReadAllNeedles(ctx context.Context, in *ReadAllNeedlesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadAllNeedlesResponse], error) + VolumeTailSender(ctx context.Context, in *VolumeTailSenderRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTailSenderResponse], error) VolumeTailReceiver(ctx context.Context, in *VolumeTailReceiverRequest, opts ...grpc.CallOption) (*VolumeTailReceiverResponse, error) // erasure coding VolumeEcShardsGenerate(ctx context.Context, in *VolumeEcShardsGenerateRequest, opts ...grpc.CallOption) (*VolumeEcShardsGenerateResponse, error) @@ -53,19 +104,19 @@ type VolumeServerClient interface { VolumeEcShardsDelete(ctx context.Context, in *VolumeEcShardsDeleteRequest, opts ...grpc.CallOption) (*VolumeEcShardsDeleteResponse, error) VolumeEcShardsMount(ctx context.Context, in *VolumeEcShardsMountRequest, opts ...grpc.CallOption) (*VolumeEcShardsMountResponse, error) VolumeEcShardsUnmount(ctx context.Context, in *VolumeEcShardsUnmountRequest, opts ...grpc.CallOption) (*VolumeEcShardsUnmountResponse, error) - VolumeEcShardRead(ctx context.Context, in *VolumeEcShardReadRequest, opts ...grpc.CallOption) (VolumeServer_VolumeEcShardReadClient, error) + VolumeEcShardRead(ctx context.Context, in *VolumeEcShardReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeEcShardReadResponse], error) VolumeEcBlobDelete(ctx context.Context, in *VolumeEcBlobDeleteRequest, opts ...grpc.CallOption) (*VolumeEcBlobDeleteResponse, error) VolumeEcShardsToVolume(ctx context.Context, in *VolumeEcShardsToVolumeRequest, opts ...grpc.CallOption) (*VolumeEcShardsToVolumeResponse, error) VolumeEcShardsInfo(ctx context.Context, in *VolumeEcShardsInfoRequest, opts ...grpc.CallOption) (*VolumeEcShardsInfoResponse, error) // tiered storage - VolumeTierMoveDatToRemote(ctx context.Context, in *VolumeTierMoveDatToRemoteRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTierMoveDatToRemoteClient, error) - VolumeTierMoveDatFromRemote(ctx context.Context, in *VolumeTierMoveDatFromRemoteRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTierMoveDatFromRemoteClient, error) + VolumeTierMoveDatToRemote(ctx context.Context, in *VolumeTierMoveDatToRemoteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTierMoveDatToRemoteResponse], error) + VolumeTierMoveDatFromRemote(ctx context.Context, in *VolumeTierMoveDatFromRemoteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTierMoveDatFromRemoteResponse], error) VolumeServerStatus(ctx context.Context, in *VolumeServerStatusRequest, opts ...grpc.CallOption) (*VolumeServerStatusResponse, error) VolumeServerLeave(ctx context.Context, in *VolumeServerLeaveRequest, opts ...grpc.CallOption) (*VolumeServerLeaveResponse, error) // remote storage FetchAndWriteNeedle(ctx context.Context, in *FetchAndWriteNeedleRequest, opts ...grpc.CallOption) (*FetchAndWriteNeedleResponse, error) // query - Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (VolumeServer_QueryClient, error) + Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[QueriedStripe], error) VolumeNeedleStatus(ctx context.Context, in *VolumeNeedleStatusRequest, opts ...grpc.CallOption) (*VolumeNeedleStatusResponse, error) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) } @@ -79,8 +130,9 @@ func NewVolumeServerClient(cc grpc.ClientConnInterface) VolumeServerClient { } func (c *volumeServerClient) BatchDelete(ctx context.Context, in *BatchDeleteRequest, opts ...grpc.CallOption) (*BatchDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(BatchDeleteResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/BatchDelete", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_BatchDelete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -88,20 +140,22 @@ func (c *volumeServerClient) BatchDelete(ctx context.Context, in *BatchDeleteReq } func (c *volumeServerClient) VacuumVolumeCheck(ctx context.Context, in *VacuumVolumeCheckRequest, opts ...grpc.CallOption) (*VacuumVolumeCheckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VacuumVolumeCheckResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VacuumVolumeCheck", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VacuumVolumeCheck_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) VacuumVolumeCompact(ctx context.Context, in *VacuumVolumeCompactRequest, opts ...grpc.CallOption) (VolumeServer_VacuumVolumeCompactClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[0], "/volume_server_pb.VolumeServer/VacuumVolumeCompact", opts...) +func (c *volumeServerClient) VacuumVolumeCompact(ctx context.Context, in *VacuumVolumeCompactRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VacuumVolumeCompactResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[0], VolumeServer_VacuumVolumeCompact_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVacuumVolumeCompactClient{stream} + x := &grpc.GenericClientStream[VacuumVolumeCompactRequest, VacuumVolumeCompactResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -111,26 +165,13 @@ func (c *volumeServerClient) VacuumVolumeCompact(ctx context.Context, in *Vacuum return x, nil } -type VolumeServer_VacuumVolumeCompactClient interface { - Recv() (*VacuumVolumeCompactResponse, error) - grpc.ClientStream -} - -type volumeServerVacuumVolumeCompactClient struct { - grpc.ClientStream -} - -func (x *volumeServerVacuumVolumeCompactClient) Recv() (*VacuumVolumeCompactResponse, error) { - m := new(VacuumVolumeCompactResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VacuumVolumeCompactClient = grpc.ServerStreamingClient[VacuumVolumeCompactResponse] func (c *volumeServerClient) VacuumVolumeCommit(ctx context.Context, in *VacuumVolumeCommitRequest, opts ...grpc.CallOption) (*VacuumVolumeCommitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VacuumVolumeCommitResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VacuumVolumeCommit", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VacuumVolumeCommit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -138,8 +179,9 @@ func (c *volumeServerClient) VacuumVolumeCommit(ctx context.Context, in *VacuumV } func (c *volumeServerClient) VacuumVolumeCleanup(ctx context.Context, in *VacuumVolumeCleanupRequest, opts ...grpc.CallOption) (*VacuumVolumeCleanupResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VacuumVolumeCleanupResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VacuumVolumeCleanup", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VacuumVolumeCleanup_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -147,8 +189,9 @@ func (c *volumeServerClient) VacuumVolumeCleanup(ctx context.Context, in *Vacuum } func (c *volumeServerClient) DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeleteCollectionResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/DeleteCollection", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_DeleteCollection_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -156,8 +199,9 @@ func (c *volumeServerClient) DeleteCollection(ctx context.Context, in *DeleteCol } func (c *volumeServerClient) AllocateVolume(ctx context.Context, in *AllocateVolumeRequest, opts ...grpc.CallOption) (*AllocateVolumeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AllocateVolumeResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/AllocateVolume", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_AllocateVolume_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -165,20 +209,22 @@ func (c *volumeServerClient) AllocateVolume(ctx context.Context, in *AllocateVol } func (c *volumeServerClient) VolumeSyncStatus(ctx context.Context, in *VolumeSyncStatusRequest, opts ...grpc.CallOption) (*VolumeSyncStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeSyncStatusResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeSyncStatus", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeSyncStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) VolumeIncrementalCopy(ctx context.Context, in *VolumeIncrementalCopyRequest, opts ...grpc.CallOption) (VolumeServer_VolumeIncrementalCopyClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[1], "/volume_server_pb.VolumeServer/VolumeIncrementalCopy", opts...) +func (c *volumeServerClient) VolumeIncrementalCopy(ctx context.Context, in *VolumeIncrementalCopyRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeIncrementalCopyResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[1], VolumeServer_VolumeIncrementalCopy_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeIncrementalCopyClient{stream} + x := &grpc.GenericClientStream[VolumeIncrementalCopyRequest, VolumeIncrementalCopyResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -188,26 +234,13 @@ func (c *volumeServerClient) VolumeIncrementalCopy(ctx context.Context, in *Volu return x, nil } -type VolumeServer_VolumeIncrementalCopyClient interface { - Recv() (*VolumeIncrementalCopyResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeIncrementalCopyClient struct { - grpc.ClientStream -} - -func (x *volumeServerVolumeIncrementalCopyClient) Recv() (*VolumeIncrementalCopyResponse, error) { - m := new(VolumeIncrementalCopyResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeIncrementalCopyClient = grpc.ServerStreamingClient[VolumeIncrementalCopyResponse] func (c *volumeServerClient) VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeMountResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeMount", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeMount_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -215,8 +248,9 @@ func (c *volumeServerClient) VolumeMount(ctx context.Context, in *VolumeMountReq } func (c *volumeServerClient) VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeUnmountResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeUnmount", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeUnmount_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -224,8 +258,9 @@ func (c *volumeServerClient) VolumeUnmount(ctx context.Context, in *VolumeUnmoun } func (c *volumeServerClient) VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeDeleteResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeDelete", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeDelete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -233,8 +268,9 @@ func (c *volumeServerClient) VolumeDelete(ctx context.Context, in *VolumeDeleteR } func (c *volumeServerClient) VolumeMarkReadonly(ctx context.Context, in *VolumeMarkReadonlyRequest, opts ...grpc.CallOption) (*VolumeMarkReadonlyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeMarkReadonlyResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeMarkReadonly", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeMarkReadonly_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -242,8 +278,9 @@ func (c *volumeServerClient) VolumeMarkReadonly(ctx context.Context, in *VolumeM } func (c *volumeServerClient) VolumeMarkWritable(ctx context.Context, in *VolumeMarkWritableRequest, opts ...grpc.CallOption) (*VolumeMarkWritableResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeMarkWritableResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeMarkWritable", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeMarkWritable_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -251,8 +288,9 @@ func (c *volumeServerClient) VolumeMarkWritable(ctx context.Context, in *VolumeM } func (c *volumeServerClient) VolumeConfigure(ctx context.Context, in *VolumeConfigureRequest, opts ...grpc.CallOption) (*VolumeConfigureResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeConfigureResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeConfigure", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeConfigure_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -260,20 +298,22 @@ func (c *volumeServerClient) VolumeConfigure(ctx context.Context, in *VolumeConf } func (c *volumeServerClient) VolumeStatus(ctx context.Context, in *VolumeStatusRequest, opts ...grpc.CallOption) (*VolumeStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeStatusResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeStatus", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) VolumeCopy(ctx context.Context, in *VolumeCopyRequest, opts ...grpc.CallOption) (VolumeServer_VolumeCopyClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[2], "/volume_server_pb.VolumeServer/VolumeCopy", opts...) +func (c *volumeServerClient) VolumeCopy(ctx context.Context, in *VolumeCopyRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeCopyResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[2], VolumeServer_VolumeCopy_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeCopyClient{stream} + x := &grpc.GenericClientStream[VolumeCopyRequest, VolumeCopyResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -283,38 +323,26 @@ func (c *volumeServerClient) VolumeCopy(ctx context.Context, in *VolumeCopyReque return x, nil } -type VolumeServer_VolumeCopyClient interface { - Recv() (*VolumeCopyResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeCopyClient struct { - grpc.ClientStream -} - -func (x *volumeServerVolumeCopyClient) Recv() (*VolumeCopyResponse, error) { - m := new(VolumeCopyResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeCopyClient = grpc.ServerStreamingClient[VolumeCopyResponse] func (c *volumeServerClient) ReadVolumeFileStatus(ctx context.Context, in *ReadVolumeFileStatusRequest, opts ...grpc.CallOption) (*ReadVolumeFileStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReadVolumeFileStatusResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/ReadVolumeFileStatus", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_ReadVolumeFileStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (VolumeServer_CopyFileClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[3], "/volume_server_pb.VolumeServer/CopyFile", opts...) +func (c *volumeServerClient) CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CopyFileResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[3], VolumeServer_CopyFile_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerCopyFileClient{stream} + x := &grpc.GenericClientStream[CopyFileRequest, CopyFileResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -324,60 +352,26 @@ func (c *volumeServerClient) CopyFile(ctx context.Context, in *CopyFileRequest, return x, nil } -type VolumeServer_CopyFileClient interface { - Recv() (*CopyFileResponse, error) - grpc.ClientStream -} - -type volumeServerCopyFileClient struct { - grpc.ClientStream -} - -func (x *volumeServerCopyFileClient) Recv() (*CopyFileResponse, error) { - m := new(CopyFileResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_CopyFileClient = grpc.ServerStreamingClient[CopyFileResponse] -func (c *volumeServerClient) ReceiveFile(ctx context.Context, opts ...grpc.CallOption) (VolumeServer_ReceiveFileClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[4], "/volume_server_pb.VolumeServer/ReceiveFile", opts...) +func (c *volumeServerClient) ReceiveFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReceiveFileRequest, ReceiveFileResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[4], VolumeServer_ReceiveFile_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerReceiveFileClient{stream} + x := &grpc.GenericClientStream[ReceiveFileRequest, ReceiveFileResponse]{ClientStream: stream} return x, nil } -type VolumeServer_ReceiveFileClient interface { - Send(*ReceiveFileRequest) error - CloseAndRecv() (*ReceiveFileResponse, error) - grpc.ClientStream -} - -type volumeServerReceiveFileClient struct { - grpc.ClientStream -} - -func (x *volumeServerReceiveFileClient) Send(m *ReceiveFileRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *volumeServerReceiveFileClient) CloseAndRecv() (*ReceiveFileResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(ReceiveFileResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_ReceiveFileClient = grpc.ClientStreamingClient[ReceiveFileRequest, ReceiveFileResponse] func (c *volumeServerClient) ReadNeedleBlob(ctx context.Context, in *ReadNeedleBlobRequest, opts ...grpc.CallOption) (*ReadNeedleBlobResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReadNeedleBlobResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/ReadNeedleBlob", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_ReadNeedleBlob_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -385,8 +379,9 @@ func (c *volumeServerClient) ReadNeedleBlob(ctx context.Context, in *ReadNeedleB } func (c *volumeServerClient) ReadNeedleMeta(ctx context.Context, in *ReadNeedleMetaRequest, opts ...grpc.CallOption) (*ReadNeedleMetaResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReadNeedleMetaResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/ReadNeedleMeta", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_ReadNeedleMeta_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -394,20 +389,22 @@ func (c *volumeServerClient) ReadNeedleMeta(ctx context.Context, in *ReadNeedleM } func (c *volumeServerClient) WriteNeedleBlob(ctx context.Context, in *WriteNeedleBlobRequest, opts ...grpc.CallOption) (*WriteNeedleBlobResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WriteNeedleBlobResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/WriteNeedleBlob", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_WriteNeedleBlob_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) ReadAllNeedles(ctx context.Context, in *ReadAllNeedlesRequest, opts ...grpc.CallOption) (VolumeServer_ReadAllNeedlesClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[5], "/volume_server_pb.VolumeServer/ReadAllNeedles", opts...) +func (c *volumeServerClient) ReadAllNeedles(ctx context.Context, in *ReadAllNeedlesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadAllNeedlesResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[5], VolumeServer_ReadAllNeedles_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerReadAllNeedlesClient{stream} + x := &grpc.GenericClientStream[ReadAllNeedlesRequest, ReadAllNeedlesResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -417,29 +414,16 @@ func (c *volumeServerClient) ReadAllNeedles(ctx context.Context, in *ReadAllNeed return x, nil } -type VolumeServer_ReadAllNeedlesClient interface { - Recv() (*ReadAllNeedlesResponse, error) - grpc.ClientStream -} - -type volumeServerReadAllNeedlesClient struct { - grpc.ClientStream -} - -func (x *volumeServerReadAllNeedlesClient) Recv() (*ReadAllNeedlesResponse, error) { - m := new(ReadAllNeedlesResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_ReadAllNeedlesClient = grpc.ServerStreamingClient[ReadAllNeedlesResponse] -func (c *volumeServerClient) VolumeTailSender(ctx context.Context, in *VolumeTailSenderRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTailSenderClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[6], "/volume_server_pb.VolumeServer/VolumeTailSender", opts...) +func (c *volumeServerClient) VolumeTailSender(ctx context.Context, in *VolumeTailSenderRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTailSenderResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[6], VolumeServer_VolumeTailSender_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeTailSenderClient{stream} + x := &grpc.GenericClientStream[VolumeTailSenderRequest, VolumeTailSenderResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -449,26 +433,13 @@ func (c *volumeServerClient) VolumeTailSender(ctx context.Context, in *VolumeTai return x, nil } -type VolumeServer_VolumeTailSenderClient interface { - Recv() (*VolumeTailSenderResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeTailSenderClient struct { - grpc.ClientStream -} - -func (x *volumeServerVolumeTailSenderClient) Recv() (*VolumeTailSenderResponse, error) { - m := new(VolumeTailSenderResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTailSenderClient = grpc.ServerStreamingClient[VolumeTailSenderResponse] func (c *volumeServerClient) VolumeTailReceiver(ctx context.Context, in *VolumeTailReceiverRequest, opts ...grpc.CallOption) (*VolumeTailReceiverResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeTailReceiverResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeTailReceiver", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeTailReceiver_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -476,8 +447,9 @@ func (c *volumeServerClient) VolumeTailReceiver(ctx context.Context, in *VolumeT } func (c *volumeServerClient) VolumeEcShardsGenerate(ctx context.Context, in *VolumeEcShardsGenerateRequest, opts ...grpc.CallOption) (*VolumeEcShardsGenerateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsGenerateResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsGenerate", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsGenerate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -485,8 +457,9 @@ func (c *volumeServerClient) VolumeEcShardsGenerate(ctx context.Context, in *Vol } func (c *volumeServerClient) VolumeEcShardsRebuild(ctx context.Context, in *VolumeEcShardsRebuildRequest, opts ...grpc.CallOption) (*VolumeEcShardsRebuildResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsRebuildResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsRebuild", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsRebuild_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -494,8 +467,9 @@ func (c *volumeServerClient) VolumeEcShardsRebuild(ctx context.Context, in *Volu } func (c *volumeServerClient) VolumeEcShardsCopy(ctx context.Context, in *VolumeEcShardsCopyRequest, opts ...grpc.CallOption) (*VolumeEcShardsCopyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsCopyResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsCopy", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsCopy_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -503,8 +477,9 @@ func (c *volumeServerClient) VolumeEcShardsCopy(ctx context.Context, in *VolumeE } func (c *volumeServerClient) VolumeEcShardsDelete(ctx context.Context, in *VolumeEcShardsDeleteRequest, opts ...grpc.CallOption) (*VolumeEcShardsDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsDeleteResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsDelete", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsDelete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -512,8 +487,9 @@ func (c *volumeServerClient) VolumeEcShardsDelete(ctx context.Context, in *Volum } func (c *volumeServerClient) VolumeEcShardsMount(ctx context.Context, in *VolumeEcShardsMountRequest, opts ...grpc.CallOption) (*VolumeEcShardsMountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsMountResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsMount", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsMount_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -521,20 +497,22 @@ func (c *volumeServerClient) VolumeEcShardsMount(ctx context.Context, in *Volume } func (c *volumeServerClient) VolumeEcShardsUnmount(ctx context.Context, in *VolumeEcShardsUnmountRequest, opts ...grpc.CallOption) (*VolumeEcShardsUnmountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsUnmountResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsUnmount", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsUnmount_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) VolumeEcShardRead(ctx context.Context, in *VolumeEcShardReadRequest, opts ...grpc.CallOption) (VolumeServer_VolumeEcShardReadClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[7], "/volume_server_pb.VolumeServer/VolumeEcShardRead", opts...) +func (c *volumeServerClient) VolumeEcShardRead(ctx context.Context, in *VolumeEcShardReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeEcShardReadResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[7], VolumeServer_VolumeEcShardRead_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeEcShardReadClient{stream} + x := &grpc.GenericClientStream[VolumeEcShardReadRequest, VolumeEcShardReadResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -544,26 +522,13 @@ func (c *volumeServerClient) VolumeEcShardRead(ctx context.Context, in *VolumeEc return x, nil } -type VolumeServer_VolumeEcShardReadClient interface { - Recv() (*VolumeEcShardReadResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeEcShardReadClient struct { - grpc.ClientStream -} - -func (x *volumeServerVolumeEcShardReadClient) Recv() (*VolumeEcShardReadResponse, error) { - m := new(VolumeEcShardReadResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeEcShardReadClient = grpc.ServerStreamingClient[VolumeEcShardReadResponse] func (c *volumeServerClient) VolumeEcBlobDelete(ctx context.Context, in *VolumeEcBlobDeleteRequest, opts ...grpc.CallOption) (*VolumeEcBlobDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcBlobDeleteResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcBlobDelete", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcBlobDelete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -571,8 +536,9 @@ func (c *volumeServerClient) VolumeEcBlobDelete(ctx context.Context, in *VolumeE } func (c *volumeServerClient) VolumeEcShardsToVolume(ctx context.Context, in *VolumeEcShardsToVolumeRequest, opts ...grpc.CallOption) (*VolumeEcShardsToVolumeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsToVolumeResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsToVolume", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsToVolume_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -580,20 +546,22 @@ func (c *volumeServerClient) VolumeEcShardsToVolume(ctx context.Context, in *Vol } func (c *volumeServerClient) VolumeEcShardsInfo(ctx context.Context, in *VolumeEcShardsInfoRequest, opts ...grpc.CallOption) (*VolumeEcShardsInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeEcShardsInfoResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeEcShardsInfo", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeEcShardsInfo_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) VolumeTierMoveDatToRemote(ctx context.Context, in *VolumeTierMoveDatToRemoteRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTierMoveDatToRemoteClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[8], "/volume_server_pb.VolumeServer/VolumeTierMoveDatToRemote", opts...) +func (c *volumeServerClient) VolumeTierMoveDatToRemote(ctx context.Context, in *VolumeTierMoveDatToRemoteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTierMoveDatToRemoteResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[8], VolumeServer_VolumeTierMoveDatToRemote_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeTierMoveDatToRemoteClient{stream} + x := &grpc.GenericClientStream[VolumeTierMoveDatToRemoteRequest, VolumeTierMoveDatToRemoteResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -603,29 +571,16 @@ func (c *volumeServerClient) VolumeTierMoveDatToRemote(ctx context.Context, in * return x, nil } -type VolumeServer_VolumeTierMoveDatToRemoteClient interface { - Recv() (*VolumeTierMoveDatToRemoteResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeTierMoveDatToRemoteClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTierMoveDatToRemoteClient = grpc.ServerStreamingClient[VolumeTierMoveDatToRemoteResponse] -func (x *volumeServerVolumeTierMoveDatToRemoteClient) Recv() (*VolumeTierMoveDatToRemoteResponse, error) { - m := new(VolumeTierMoveDatToRemoteResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *volumeServerClient) VolumeTierMoveDatFromRemote(ctx context.Context, in *VolumeTierMoveDatFromRemoteRequest, opts ...grpc.CallOption) (VolumeServer_VolumeTierMoveDatFromRemoteClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[9], "/volume_server_pb.VolumeServer/VolumeTierMoveDatFromRemote", opts...) +func (c *volumeServerClient) VolumeTierMoveDatFromRemote(ctx context.Context, in *VolumeTierMoveDatFromRemoteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[VolumeTierMoveDatFromRemoteResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[9], VolumeServer_VolumeTierMoveDatFromRemote_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerVolumeTierMoveDatFromRemoteClient{stream} + x := &grpc.GenericClientStream[VolumeTierMoveDatFromRemoteRequest, VolumeTierMoveDatFromRemoteResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -635,26 +590,13 @@ func (c *volumeServerClient) VolumeTierMoveDatFromRemote(ctx context.Context, in return x, nil } -type VolumeServer_VolumeTierMoveDatFromRemoteClient interface { - Recv() (*VolumeTierMoveDatFromRemoteResponse, error) - grpc.ClientStream -} - -type volumeServerVolumeTierMoveDatFromRemoteClient struct { - grpc.ClientStream -} - -func (x *volumeServerVolumeTierMoveDatFromRemoteClient) Recv() (*VolumeTierMoveDatFromRemoteResponse, error) { - m := new(VolumeTierMoveDatFromRemoteResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTierMoveDatFromRemoteClient = grpc.ServerStreamingClient[VolumeTierMoveDatFromRemoteResponse] func (c *volumeServerClient) VolumeServerStatus(ctx context.Context, in *VolumeServerStatusRequest, opts ...grpc.CallOption) (*VolumeServerStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeServerStatusResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeServerStatus", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeServerStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -662,8 +604,9 @@ func (c *volumeServerClient) VolumeServerStatus(ctx context.Context, in *VolumeS } func (c *volumeServerClient) VolumeServerLeave(ctx context.Context, in *VolumeServerLeaveRequest, opts ...grpc.CallOption) (*VolumeServerLeaveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeServerLeaveResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeServerLeave", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeServerLeave_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -671,20 +614,22 @@ func (c *volumeServerClient) VolumeServerLeave(ctx context.Context, in *VolumeSe } func (c *volumeServerClient) FetchAndWriteNeedle(ctx context.Context, in *FetchAndWriteNeedleRequest, opts ...grpc.CallOption) (*FetchAndWriteNeedleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(FetchAndWriteNeedleResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/FetchAndWriteNeedle", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_FetchAndWriteNeedle_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *volumeServerClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (VolumeServer_QueryClient, error) { - stream, err := c.cc.NewStream(ctx, &_VolumeServer_serviceDesc.Streams[10], "/volume_server_pb.VolumeServer/Query", opts...) +func (c *volumeServerClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[QueriedStripe], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &VolumeServer_ServiceDesc.Streams[10], VolumeServer_Query_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &volumeServerQueryClient{stream} + x := &grpc.GenericClientStream[QueryRequest, QueriedStripe]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -694,26 +639,13 @@ func (c *volumeServerClient) Query(ctx context.Context, in *QueryRequest, opts . return x, nil } -type VolumeServer_QueryClient interface { - Recv() (*QueriedStripe, error) - grpc.ClientStream -} - -type volumeServerQueryClient struct { - grpc.ClientStream -} - -func (x *volumeServerQueryClient) Recv() (*QueriedStripe, error) { - m := new(QueriedStripe) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_QueryClient = grpc.ServerStreamingClient[QueriedStripe] func (c *volumeServerClient) VolumeNeedleStatus(ctx context.Context, in *VolumeNeedleStatusRequest, opts ...grpc.CallOption) (*VolumeNeedleStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VolumeNeedleStatusResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeNeedleStatus", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_VolumeNeedleStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -721,8 +653,9 @@ func (c *volumeServerClient) VolumeNeedleStatus(ctx context.Context, in *VolumeN } func (c *volumeServerClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PingResponse) - err := c.cc.Invoke(ctx, "/volume_server_pb.VolumeServer/Ping", in, out, opts...) + err := c.cc.Invoke(ctx, VolumeServer_Ping_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -731,18 +664,18 @@ func (c *volumeServerClient) Ping(ctx context.Context, in *PingRequest, opts ... // VolumeServerServer is the server API for VolumeServer service. // All implementations must embed UnimplementedVolumeServerServer -// for forward compatibility +// for forward compatibility. type VolumeServerServer interface { // Experts only: takes multiple fid parameters. This function does not propagate deletes to replicas. BatchDelete(context.Context, *BatchDeleteRequest) (*BatchDeleteResponse, error) VacuumVolumeCheck(context.Context, *VacuumVolumeCheckRequest) (*VacuumVolumeCheckResponse, error) - VacuumVolumeCompact(*VacuumVolumeCompactRequest, VolumeServer_VacuumVolumeCompactServer) error + VacuumVolumeCompact(*VacuumVolumeCompactRequest, grpc.ServerStreamingServer[VacuumVolumeCompactResponse]) error VacuumVolumeCommit(context.Context, *VacuumVolumeCommitRequest) (*VacuumVolumeCommitResponse, error) VacuumVolumeCleanup(context.Context, *VacuumVolumeCleanupRequest) (*VacuumVolumeCleanupResponse, error) DeleteCollection(context.Context, *DeleteCollectionRequest) (*DeleteCollectionResponse, error) AllocateVolume(context.Context, *AllocateVolumeRequest) (*AllocateVolumeResponse, error) VolumeSyncStatus(context.Context, *VolumeSyncStatusRequest) (*VolumeSyncStatusResponse, error) - VolumeIncrementalCopy(*VolumeIncrementalCopyRequest, VolumeServer_VolumeIncrementalCopyServer) error + VolumeIncrementalCopy(*VolumeIncrementalCopyRequest, grpc.ServerStreamingServer[VolumeIncrementalCopyResponse]) error VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error) VolumeUnmount(context.Context, *VolumeUnmountRequest) (*VolumeUnmountResponse, error) VolumeDelete(context.Context, *VolumeDeleteRequest) (*VolumeDeleteResponse, error) @@ -751,15 +684,15 @@ type VolumeServerServer interface { VolumeConfigure(context.Context, *VolumeConfigureRequest) (*VolumeConfigureResponse, error) VolumeStatus(context.Context, *VolumeStatusRequest) (*VolumeStatusResponse, error) // copy the .idx .dat files, and mount this volume - VolumeCopy(*VolumeCopyRequest, VolumeServer_VolumeCopyServer) error + VolumeCopy(*VolumeCopyRequest, grpc.ServerStreamingServer[VolumeCopyResponse]) error ReadVolumeFileStatus(context.Context, *ReadVolumeFileStatusRequest) (*ReadVolumeFileStatusResponse, error) - CopyFile(*CopyFileRequest, VolumeServer_CopyFileServer) error - ReceiveFile(VolumeServer_ReceiveFileServer) error + CopyFile(*CopyFileRequest, grpc.ServerStreamingServer[CopyFileResponse]) error + ReceiveFile(grpc.ClientStreamingServer[ReceiveFileRequest, ReceiveFileResponse]) error ReadNeedleBlob(context.Context, *ReadNeedleBlobRequest) (*ReadNeedleBlobResponse, error) ReadNeedleMeta(context.Context, *ReadNeedleMetaRequest) (*ReadNeedleMetaResponse, error) WriteNeedleBlob(context.Context, *WriteNeedleBlobRequest) (*WriteNeedleBlobResponse, error) - ReadAllNeedles(*ReadAllNeedlesRequest, VolumeServer_ReadAllNeedlesServer) error - VolumeTailSender(*VolumeTailSenderRequest, VolumeServer_VolumeTailSenderServer) error + ReadAllNeedles(*ReadAllNeedlesRequest, grpc.ServerStreamingServer[ReadAllNeedlesResponse]) error + VolumeTailSender(*VolumeTailSenderRequest, grpc.ServerStreamingServer[VolumeTailSenderResponse]) error VolumeTailReceiver(context.Context, *VolumeTailReceiverRequest) (*VolumeTailReceiverResponse, error) // erasure coding VolumeEcShardsGenerate(context.Context, *VolumeEcShardsGenerateRequest) (*VolumeEcShardsGenerateResponse, error) @@ -768,27 +701,30 @@ type VolumeServerServer interface { VolumeEcShardsDelete(context.Context, *VolumeEcShardsDeleteRequest) (*VolumeEcShardsDeleteResponse, error) VolumeEcShardsMount(context.Context, *VolumeEcShardsMountRequest) (*VolumeEcShardsMountResponse, error) VolumeEcShardsUnmount(context.Context, *VolumeEcShardsUnmountRequest) (*VolumeEcShardsUnmountResponse, error) - VolumeEcShardRead(*VolumeEcShardReadRequest, VolumeServer_VolumeEcShardReadServer) error + VolumeEcShardRead(*VolumeEcShardReadRequest, grpc.ServerStreamingServer[VolumeEcShardReadResponse]) error VolumeEcBlobDelete(context.Context, *VolumeEcBlobDeleteRequest) (*VolumeEcBlobDeleteResponse, error) VolumeEcShardsToVolume(context.Context, *VolumeEcShardsToVolumeRequest) (*VolumeEcShardsToVolumeResponse, error) VolumeEcShardsInfo(context.Context, *VolumeEcShardsInfoRequest) (*VolumeEcShardsInfoResponse, error) // tiered storage - VolumeTierMoveDatToRemote(*VolumeTierMoveDatToRemoteRequest, VolumeServer_VolumeTierMoveDatToRemoteServer) error - VolumeTierMoveDatFromRemote(*VolumeTierMoveDatFromRemoteRequest, VolumeServer_VolumeTierMoveDatFromRemoteServer) error + VolumeTierMoveDatToRemote(*VolumeTierMoveDatToRemoteRequest, grpc.ServerStreamingServer[VolumeTierMoveDatToRemoteResponse]) error + VolumeTierMoveDatFromRemote(*VolumeTierMoveDatFromRemoteRequest, grpc.ServerStreamingServer[VolumeTierMoveDatFromRemoteResponse]) error VolumeServerStatus(context.Context, *VolumeServerStatusRequest) (*VolumeServerStatusResponse, error) VolumeServerLeave(context.Context, *VolumeServerLeaveRequest) (*VolumeServerLeaveResponse, error) // remote storage FetchAndWriteNeedle(context.Context, *FetchAndWriteNeedleRequest) (*FetchAndWriteNeedleResponse, error) // query - Query(*QueryRequest, VolumeServer_QueryServer) error + Query(*QueryRequest, grpc.ServerStreamingServer[QueriedStripe]) error VolumeNeedleStatus(context.Context, *VolumeNeedleStatusRequest) (*VolumeNeedleStatusResponse, error) Ping(context.Context, *PingRequest) (*PingResponse, error) mustEmbedUnimplementedVolumeServerServer() } -// UnimplementedVolumeServerServer must be embedded to have forward compatible implementations. -type UnimplementedVolumeServerServer struct { -} +// UnimplementedVolumeServerServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedVolumeServerServer struct{} func (UnimplementedVolumeServerServer) BatchDelete(context.Context, *BatchDeleteRequest) (*BatchDeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BatchDelete not implemented") @@ -796,7 +732,7 @@ func (UnimplementedVolumeServerServer) BatchDelete(context.Context, *BatchDelete func (UnimplementedVolumeServerServer) VacuumVolumeCheck(context.Context, *VacuumVolumeCheckRequest) (*VacuumVolumeCheckResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VacuumVolumeCheck not implemented") } -func (UnimplementedVolumeServerServer) VacuumVolumeCompact(*VacuumVolumeCompactRequest, VolumeServer_VacuumVolumeCompactServer) error { +func (UnimplementedVolumeServerServer) VacuumVolumeCompact(*VacuumVolumeCompactRequest, grpc.ServerStreamingServer[VacuumVolumeCompactResponse]) error { return status.Errorf(codes.Unimplemented, "method VacuumVolumeCompact not implemented") } func (UnimplementedVolumeServerServer) VacuumVolumeCommit(context.Context, *VacuumVolumeCommitRequest) (*VacuumVolumeCommitResponse, error) { @@ -814,7 +750,7 @@ func (UnimplementedVolumeServerServer) AllocateVolume(context.Context, *Allocate func (UnimplementedVolumeServerServer) VolumeSyncStatus(context.Context, *VolumeSyncStatusRequest) (*VolumeSyncStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VolumeSyncStatus not implemented") } -func (UnimplementedVolumeServerServer) VolumeIncrementalCopy(*VolumeIncrementalCopyRequest, VolumeServer_VolumeIncrementalCopyServer) error { +func (UnimplementedVolumeServerServer) VolumeIncrementalCopy(*VolumeIncrementalCopyRequest, grpc.ServerStreamingServer[VolumeIncrementalCopyResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeIncrementalCopy not implemented") } func (UnimplementedVolumeServerServer) VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error) { @@ -838,16 +774,16 @@ func (UnimplementedVolumeServerServer) VolumeConfigure(context.Context, *VolumeC func (UnimplementedVolumeServerServer) VolumeStatus(context.Context, *VolumeStatusRequest) (*VolumeStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VolumeStatus not implemented") } -func (UnimplementedVolumeServerServer) VolumeCopy(*VolumeCopyRequest, VolumeServer_VolumeCopyServer) error { +func (UnimplementedVolumeServerServer) VolumeCopy(*VolumeCopyRequest, grpc.ServerStreamingServer[VolumeCopyResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeCopy not implemented") } func (UnimplementedVolumeServerServer) ReadVolumeFileStatus(context.Context, *ReadVolumeFileStatusRequest) (*ReadVolumeFileStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReadVolumeFileStatus not implemented") } -func (UnimplementedVolumeServerServer) CopyFile(*CopyFileRequest, VolumeServer_CopyFileServer) error { +func (UnimplementedVolumeServerServer) CopyFile(*CopyFileRequest, grpc.ServerStreamingServer[CopyFileResponse]) error { return status.Errorf(codes.Unimplemented, "method CopyFile not implemented") } -func (UnimplementedVolumeServerServer) ReceiveFile(VolumeServer_ReceiveFileServer) error { +func (UnimplementedVolumeServerServer) ReceiveFile(grpc.ClientStreamingServer[ReceiveFileRequest, ReceiveFileResponse]) error { return status.Errorf(codes.Unimplemented, "method ReceiveFile not implemented") } func (UnimplementedVolumeServerServer) ReadNeedleBlob(context.Context, *ReadNeedleBlobRequest) (*ReadNeedleBlobResponse, error) { @@ -859,10 +795,10 @@ func (UnimplementedVolumeServerServer) ReadNeedleMeta(context.Context, *ReadNeed func (UnimplementedVolumeServerServer) WriteNeedleBlob(context.Context, *WriteNeedleBlobRequest) (*WriteNeedleBlobResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WriteNeedleBlob not implemented") } -func (UnimplementedVolumeServerServer) ReadAllNeedles(*ReadAllNeedlesRequest, VolumeServer_ReadAllNeedlesServer) error { +func (UnimplementedVolumeServerServer) ReadAllNeedles(*ReadAllNeedlesRequest, grpc.ServerStreamingServer[ReadAllNeedlesResponse]) error { return status.Errorf(codes.Unimplemented, "method ReadAllNeedles not implemented") } -func (UnimplementedVolumeServerServer) VolumeTailSender(*VolumeTailSenderRequest, VolumeServer_VolumeTailSenderServer) error { +func (UnimplementedVolumeServerServer) VolumeTailSender(*VolumeTailSenderRequest, grpc.ServerStreamingServer[VolumeTailSenderResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeTailSender not implemented") } func (UnimplementedVolumeServerServer) VolumeTailReceiver(context.Context, *VolumeTailReceiverRequest) (*VolumeTailReceiverResponse, error) { @@ -886,7 +822,7 @@ func (UnimplementedVolumeServerServer) VolumeEcShardsMount(context.Context, *Vol func (UnimplementedVolumeServerServer) VolumeEcShardsUnmount(context.Context, *VolumeEcShardsUnmountRequest) (*VolumeEcShardsUnmountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VolumeEcShardsUnmount not implemented") } -func (UnimplementedVolumeServerServer) VolumeEcShardRead(*VolumeEcShardReadRequest, VolumeServer_VolumeEcShardReadServer) error { +func (UnimplementedVolumeServerServer) VolumeEcShardRead(*VolumeEcShardReadRequest, grpc.ServerStreamingServer[VolumeEcShardReadResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeEcShardRead not implemented") } func (UnimplementedVolumeServerServer) VolumeEcBlobDelete(context.Context, *VolumeEcBlobDeleteRequest) (*VolumeEcBlobDeleteResponse, error) { @@ -898,10 +834,10 @@ func (UnimplementedVolumeServerServer) VolumeEcShardsToVolume(context.Context, * func (UnimplementedVolumeServerServer) VolumeEcShardsInfo(context.Context, *VolumeEcShardsInfoRequest) (*VolumeEcShardsInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VolumeEcShardsInfo not implemented") } -func (UnimplementedVolumeServerServer) VolumeTierMoveDatToRemote(*VolumeTierMoveDatToRemoteRequest, VolumeServer_VolumeTierMoveDatToRemoteServer) error { +func (UnimplementedVolumeServerServer) VolumeTierMoveDatToRemote(*VolumeTierMoveDatToRemoteRequest, grpc.ServerStreamingServer[VolumeTierMoveDatToRemoteResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeTierMoveDatToRemote not implemented") } -func (UnimplementedVolumeServerServer) VolumeTierMoveDatFromRemote(*VolumeTierMoveDatFromRemoteRequest, VolumeServer_VolumeTierMoveDatFromRemoteServer) error { +func (UnimplementedVolumeServerServer) VolumeTierMoveDatFromRemote(*VolumeTierMoveDatFromRemoteRequest, grpc.ServerStreamingServer[VolumeTierMoveDatFromRemoteResponse]) error { return status.Errorf(codes.Unimplemented, "method VolumeTierMoveDatFromRemote not implemented") } func (UnimplementedVolumeServerServer) VolumeServerStatus(context.Context, *VolumeServerStatusRequest) (*VolumeServerStatusResponse, error) { @@ -913,7 +849,7 @@ func (UnimplementedVolumeServerServer) VolumeServerLeave(context.Context, *Volum func (UnimplementedVolumeServerServer) FetchAndWriteNeedle(context.Context, *FetchAndWriteNeedleRequest) (*FetchAndWriteNeedleResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FetchAndWriteNeedle not implemented") } -func (UnimplementedVolumeServerServer) Query(*QueryRequest, VolumeServer_QueryServer) error { +func (UnimplementedVolumeServerServer) Query(*QueryRequest, grpc.ServerStreamingServer[QueriedStripe]) error { return status.Errorf(codes.Unimplemented, "method Query not implemented") } func (UnimplementedVolumeServerServer) VolumeNeedleStatus(context.Context, *VolumeNeedleStatusRequest) (*VolumeNeedleStatusResponse, error) { @@ -923,6 +859,7 @@ func (UnimplementedVolumeServerServer) Ping(context.Context, *PingRequest) (*Pin return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } func (UnimplementedVolumeServerServer) mustEmbedUnimplementedVolumeServerServer() {} +func (UnimplementedVolumeServerServer) testEmbeddedByValue() {} // UnsafeVolumeServerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VolumeServerServer will @@ -931,8 +868,15 @@ type UnsafeVolumeServerServer interface { mustEmbedUnimplementedVolumeServerServer() } -func RegisterVolumeServerServer(s *grpc.Server, srv VolumeServerServer) { - s.RegisterService(&_VolumeServer_serviceDesc, srv) +func RegisterVolumeServerServer(s grpc.ServiceRegistrar, srv VolumeServerServer) { + // If the following call pancis, it indicates UnimplementedVolumeServerServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&VolumeServer_ServiceDesc, srv) } func _VolumeServer_BatchDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -945,7 +889,7 @@ func _VolumeServer_BatchDelete_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/BatchDelete", + FullMethod: VolumeServer_BatchDelete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).BatchDelete(ctx, req.(*BatchDeleteRequest)) @@ -963,7 +907,7 @@ func _VolumeServer_VacuumVolumeCheck_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VacuumVolumeCheck", + FullMethod: VolumeServer_VacuumVolumeCheck_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VacuumVolumeCheck(ctx, req.(*VacuumVolumeCheckRequest)) @@ -976,21 +920,11 @@ func _VolumeServer_VacuumVolumeCompact_Handler(srv interface{}, stream grpc.Serv if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VacuumVolumeCompact(m, &volumeServerVacuumVolumeCompactServer{stream}) + return srv.(VolumeServerServer).VacuumVolumeCompact(m, &grpc.GenericServerStream[VacuumVolumeCompactRequest, VacuumVolumeCompactResponse]{ServerStream: stream}) } -type VolumeServer_VacuumVolumeCompactServer interface { - Send(*VacuumVolumeCompactResponse) error - grpc.ServerStream -} - -type volumeServerVacuumVolumeCompactServer struct { - grpc.ServerStream -} - -func (x *volumeServerVacuumVolumeCompactServer) Send(m *VacuumVolumeCompactResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VacuumVolumeCompactServer = grpc.ServerStreamingServer[VacuumVolumeCompactResponse] func _VolumeServer_VacuumVolumeCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VacuumVolumeCommitRequest) @@ -1002,7 +936,7 @@ func _VolumeServer_VacuumVolumeCommit_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VacuumVolumeCommit", + FullMethod: VolumeServer_VacuumVolumeCommit_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VacuumVolumeCommit(ctx, req.(*VacuumVolumeCommitRequest)) @@ -1020,7 +954,7 @@ func _VolumeServer_VacuumVolumeCleanup_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VacuumVolumeCleanup", + FullMethod: VolumeServer_VacuumVolumeCleanup_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VacuumVolumeCleanup(ctx, req.(*VacuumVolumeCleanupRequest)) @@ -1038,7 +972,7 @@ func _VolumeServer_DeleteCollection_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/DeleteCollection", + FullMethod: VolumeServer_DeleteCollection_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).DeleteCollection(ctx, req.(*DeleteCollectionRequest)) @@ -1056,7 +990,7 @@ func _VolumeServer_AllocateVolume_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/AllocateVolume", + FullMethod: VolumeServer_AllocateVolume_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).AllocateVolume(ctx, req.(*AllocateVolumeRequest)) @@ -1074,7 +1008,7 @@ func _VolumeServer_VolumeSyncStatus_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeSyncStatus", + FullMethod: VolumeServer_VolumeSyncStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeSyncStatus(ctx, req.(*VolumeSyncStatusRequest)) @@ -1087,21 +1021,11 @@ func _VolumeServer_VolumeIncrementalCopy_Handler(srv interface{}, stream grpc.Se if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeIncrementalCopy(m, &volumeServerVolumeIncrementalCopyServer{stream}) + return srv.(VolumeServerServer).VolumeIncrementalCopy(m, &grpc.GenericServerStream[VolumeIncrementalCopyRequest, VolumeIncrementalCopyResponse]{ServerStream: stream}) } -type VolumeServer_VolumeIncrementalCopyServer interface { - Send(*VolumeIncrementalCopyResponse) error - grpc.ServerStream -} - -type volumeServerVolumeIncrementalCopyServer struct { - grpc.ServerStream -} - -func (x *volumeServerVolumeIncrementalCopyServer) Send(m *VolumeIncrementalCopyResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeIncrementalCopyServer = grpc.ServerStreamingServer[VolumeIncrementalCopyResponse] func _VolumeServer_VolumeMount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VolumeMountRequest) @@ -1113,7 +1037,7 @@ func _VolumeServer_VolumeMount_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeMount", + FullMethod: VolumeServer_VolumeMount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeMount(ctx, req.(*VolumeMountRequest)) @@ -1131,7 +1055,7 @@ func _VolumeServer_VolumeUnmount_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeUnmount", + FullMethod: VolumeServer_VolumeUnmount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeUnmount(ctx, req.(*VolumeUnmountRequest)) @@ -1149,7 +1073,7 @@ func _VolumeServer_VolumeDelete_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeDelete", + FullMethod: VolumeServer_VolumeDelete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeDelete(ctx, req.(*VolumeDeleteRequest)) @@ -1167,7 +1091,7 @@ func _VolumeServer_VolumeMarkReadonly_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeMarkReadonly", + FullMethod: VolumeServer_VolumeMarkReadonly_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeMarkReadonly(ctx, req.(*VolumeMarkReadonlyRequest)) @@ -1185,7 +1109,7 @@ func _VolumeServer_VolumeMarkWritable_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeMarkWritable", + FullMethod: VolumeServer_VolumeMarkWritable_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeMarkWritable(ctx, req.(*VolumeMarkWritableRequest)) @@ -1203,7 +1127,7 @@ func _VolumeServer_VolumeConfigure_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeConfigure", + FullMethod: VolumeServer_VolumeConfigure_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeConfigure(ctx, req.(*VolumeConfigureRequest)) @@ -1221,7 +1145,7 @@ func _VolumeServer_VolumeStatus_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeStatus", + FullMethod: VolumeServer_VolumeStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeStatus(ctx, req.(*VolumeStatusRequest)) @@ -1234,21 +1158,11 @@ func _VolumeServer_VolumeCopy_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeCopy(m, &volumeServerVolumeCopyServer{stream}) -} - -type VolumeServer_VolumeCopyServer interface { - Send(*VolumeCopyResponse) error - grpc.ServerStream -} - -type volumeServerVolumeCopyServer struct { - grpc.ServerStream + return srv.(VolumeServerServer).VolumeCopy(m, &grpc.GenericServerStream[VolumeCopyRequest, VolumeCopyResponse]{ServerStream: stream}) } -func (x *volumeServerVolumeCopyServer) Send(m *VolumeCopyResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeCopyServer = grpc.ServerStreamingServer[VolumeCopyResponse] func _VolumeServer_ReadVolumeFileStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReadVolumeFileStatusRequest) @@ -1260,7 +1174,7 @@ func _VolumeServer_ReadVolumeFileStatus_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/ReadVolumeFileStatus", + FullMethod: VolumeServer_ReadVolumeFileStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).ReadVolumeFileStatus(ctx, req.(*ReadVolumeFileStatusRequest)) @@ -1273,47 +1187,18 @@ func _VolumeServer_CopyFile_Handler(srv interface{}, stream grpc.ServerStream) e if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).CopyFile(m, &volumeServerCopyFileServer{stream}) + return srv.(VolumeServerServer).CopyFile(m, &grpc.GenericServerStream[CopyFileRequest, CopyFileResponse]{ServerStream: stream}) } -type VolumeServer_CopyFileServer interface { - Send(*CopyFileResponse) error - grpc.ServerStream -} - -type volumeServerCopyFileServer struct { - grpc.ServerStream -} - -func (x *volumeServerCopyFileServer) Send(m *CopyFileResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_CopyFileServer = grpc.ServerStreamingServer[CopyFileResponse] func _VolumeServer_ReceiveFile_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(VolumeServerServer).ReceiveFile(&volumeServerReceiveFileServer{stream}) -} - -type VolumeServer_ReceiveFileServer interface { - SendAndClose(*ReceiveFileResponse) error - Recv() (*ReceiveFileRequest, error) - grpc.ServerStream + return srv.(VolumeServerServer).ReceiveFile(&grpc.GenericServerStream[ReceiveFileRequest, ReceiveFileResponse]{ServerStream: stream}) } -type volumeServerReceiveFileServer struct { - grpc.ServerStream -} - -func (x *volumeServerReceiveFileServer) SendAndClose(m *ReceiveFileResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *volumeServerReceiveFileServer) Recv() (*ReceiveFileRequest, error) { - m := new(ReceiveFileRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_ReceiveFileServer = grpc.ClientStreamingServer[ReceiveFileRequest, ReceiveFileResponse] func _VolumeServer_ReadNeedleBlob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReadNeedleBlobRequest) @@ -1325,7 +1210,7 @@ func _VolumeServer_ReadNeedleBlob_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/ReadNeedleBlob", + FullMethod: VolumeServer_ReadNeedleBlob_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).ReadNeedleBlob(ctx, req.(*ReadNeedleBlobRequest)) @@ -1343,7 +1228,7 @@ func _VolumeServer_ReadNeedleMeta_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/ReadNeedleMeta", + FullMethod: VolumeServer_ReadNeedleMeta_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).ReadNeedleMeta(ctx, req.(*ReadNeedleMetaRequest)) @@ -1361,7 +1246,7 @@ func _VolumeServer_WriteNeedleBlob_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/WriteNeedleBlob", + FullMethod: VolumeServer_WriteNeedleBlob_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).WriteNeedleBlob(ctx, req.(*WriteNeedleBlobRequest)) @@ -1374,42 +1259,22 @@ func _VolumeServer_ReadAllNeedles_Handler(srv interface{}, stream grpc.ServerStr if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).ReadAllNeedles(m, &volumeServerReadAllNeedlesServer{stream}) -} - -type VolumeServer_ReadAllNeedlesServer interface { - Send(*ReadAllNeedlesResponse) error - grpc.ServerStream -} - -type volumeServerReadAllNeedlesServer struct { - grpc.ServerStream + return srv.(VolumeServerServer).ReadAllNeedles(m, &grpc.GenericServerStream[ReadAllNeedlesRequest, ReadAllNeedlesResponse]{ServerStream: stream}) } -func (x *volumeServerReadAllNeedlesServer) Send(m *ReadAllNeedlesResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_ReadAllNeedlesServer = grpc.ServerStreamingServer[ReadAllNeedlesResponse] func _VolumeServer_VolumeTailSender_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(VolumeTailSenderRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeTailSender(m, &volumeServerVolumeTailSenderServer{stream}) + return srv.(VolumeServerServer).VolumeTailSender(m, &grpc.GenericServerStream[VolumeTailSenderRequest, VolumeTailSenderResponse]{ServerStream: stream}) } -type VolumeServer_VolumeTailSenderServer interface { - Send(*VolumeTailSenderResponse) error - grpc.ServerStream -} - -type volumeServerVolumeTailSenderServer struct { - grpc.ServerStream -} - -func (x *volumeServerVolumeTailSenderServer) Send(m *VolumeTailSenderResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTailSenderServer = grpc.ServerStreamingServer[VolumeTailSenderResponse] func _VolumeServer_VolumeTailReceiver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VolumeTailReceiverRequest) @@ -1421,7 +1286,7 @@ func _VolumeServer_VolumeTailReceiver_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeTailReceiver", + FullMethod: VolumeServer_VolumeTailReceiver_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeTailReceiver(ctx, req.(*VolumeTailReceiverRequest)) @@ -1439,7 +1304,7 @@ func _VolumeServer_VolumeEcShardsGenerate_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsGenerate", + FullMethod: VolumeServer_VolumeEcShardsGenerate_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsGenerate(ctx, req.(*VolumeEcShardsGenerateRequest)) @@ -1457,7 +1322,7 @@ func _VolumeServer_VolumeEcShardsRebuild_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsRebuild", + FullMethod: VolumeServer_VolumeEcShardsRebuild_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsRebuild(ctx, req.(*VolumeEcShardsRebuildRequest)) @@ -1475,7 +1340,7 @@ func _VolumeServer_VolumeEcShardsCopy_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsCopy", + FullMethod: VolumeServer_VolumeEcShardsCopy_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsCopy(ctx, req.(*VolumeEcShardsCopyRequest)) @@ -1493,7 +1358,7 @@ func _VolumeServer_VolumeEcShardsDelete_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsDelete", + FullMethod: VolumeServer_VolumeEcShardsDelete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsDelete(ctx, req.(*VolumeEcShardsDeleteRequest)) @@ -1511,7 +1376,7 @@ func _VolumeServer_VolumeEcShardsMount_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsMount", + FullMethod: VolumeServer_VolumeEcShardsMount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsMount(ctx, req.(*VolumeEcShardsMountRequest)) @@ -1529,7 +1394,7 @@ func _VolumeServer_VolumeEcShardsUnmount_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsUnmount", + FullMethod: VolumeServer_VolumeEcShardsUnmount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsUnmount(ctx, req.(*VolumeEcShardsUnmountRequest)) @@ -1542,21 +1407,11 @@ func _VolumeServer_VolumeEcShardRead_Handler(srv interface{}, stream grpc.Server if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeEcShardRead(m, &volumeServerVolumeEcShardReadServer{stream}) -} - -type VolumeServer_VolumeEcShardReadServer interface { - Send(*VolumeEcShardReadResponse) error - grpc.ServerStream + return srv.(VolumeServerServer).VolumeEcShardRead(m, &grpc.GenericServerStream[VolumeEcShardReadRequest, VolumeEcShardReadResponse]{ServerStream: stream}) } -type volumeServerVolumeEcShardReadServer struct { - grpc.ServerStream -} - -func (x *volumeServerVolumeEcShardReadServer) Send(m *VolumeEcShardReadResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeEcShardReadServer = grpc.ServerStreamingServer[VolumeEcShardReadResponse] func _VolumeServer_VolumeEcBlobDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VolumeEcBlobDeleteRequest) @@ -1568,7 +1423,7 @@ func _VolumeServer_VolumeEcBlobDelete_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcBlobDelete", + FullMethod: VolumeServer_VolumeEcBlobDelete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcBlobDelete(ctx, req.(*VolumeEcBlobDeleteRequest)) @@ -1586,7 +1441,7 @@ func _VolumeServer_VolumeEcShardsToVolume_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsToVolume", + FullMethod: VolumeServer_VolumeEcShardsToVolume_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsToVolume(ctx, req.(*VolumeEcShardsToVolumeRequest)) @@ -1604,7 +1459,7 @@ func _VolumeServer_VolumeEcShardsInfo_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeEcShardsInfo", + FullMethod: VolumeServer_VolumeEcShardsInfo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeEcShardsInfo(ctx, req.(*VolumeEcShardsInfoRequest)) @@ -1617,42 +1472,22 @@ func _VolumeServer_VolumeTierMoveDatToRemote_Handler(srv interface{}, stream grp if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeTierMoveDatToRemote(m, &volumeServerVolumeTierMoveDatToRemoteServer{stream}) + return srv.(VolumeServerServer).VolumeTierMoveDatToRemote(m, &grpc.GenericServerStream[VolumeTierMoveDatToRemoteRequest, VolumeTierMoveDatToRemoteResponse]{ServerStream: stream}) } -type VolumeServer_VolumeTierMoveDatToRemoteServer interface { - Send(*VolumeTierMoveDatToRemoteResponse) error - grpc.ServerStream -} - -type volumeServerVolumeTierMoveDatToRemoteServer struct { - grpc.ServerStream -} - -func (x *volumeServerVolumeTierMoveDatToRemoteServer) Send(m *VolumeTierMoveDatToRemoteResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTierMoveDatToRemoteServer = grpc.ServerStreamingServer[VolumeTierMoveDatToRemoteResponse] func _VolumeServer_VolumeTierMoveDatFromRemote_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(VolumeTierMoveDatFromRemoteRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).VolumeTierMoveDatFromRemote(m, &volumeServerVolumeTierMoveDatFromRemoteServer{stream}) -} - -type VolumeServer_VolumeTierMoveDatFromRemoteServer interface { - Send(*VolumeTierMoveDatFromRemoteResponse) error - grpc.ServerStream + return srv.(VolumeServerServer).VolumeTierMoveDatFromRemote(m, &grpc.GenericServerStream[VolumeTierMoveDatFromRemoteRequest, VolumeTierMoveDatFromRemoteResponse]{ServerStream: stream}) } -type volumeServerVolumeTierMoveDatFromRemoteServer struct { - grpc.ServerStream -} - -func (x *volumeServerVolumeTierMoveDatFromRemoteServer) Send(m *VolumeTierMoveDatFromRemoteResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_VolumeTierMoveDatFromRemoteServer = grpc.ServerStreamingServer[VolumeTierMoveDatFromRemoteResponse] func _VolumeServer_VolumeServerStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VolumeServerStatusRequest) @@ -1664,7 +1499,7 @@ func _VolumeServer_VolumeServerStatus_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeServerStatus", + FullMethod: VolumeServer_VolumeServerStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeServerStatus(ctx, req.(*VolumeServerStatusRequest)) @@ -1682,7 +1517,7 @@ func _VolumeServer_VolumeServerLeave_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeServerLeave", + FullMethod: VolumeServer_VolumeServerLeave_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeServerLeave(ctx, req.(*VolumeServerLeaveRequest)) @@ -1700,7 +1535,7 @@ func _VolumeServer_FetchAndWriteNeedle_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/FetchAndWriteNeedle", + FullMethod: VolumeServer_FetchAndWriteNeedle_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).FetchAndWriteNeedle(ctx, req.(*FetchAndWriteNeedleRequest)) @@ -1713,21 +1548,11 @@ func _VolumeServer_Query_Handler(srv interface{}, stream grpc.ServerStream) erro if err := stream.RecvMsg(m); err != nil { return err } - return srv.(VolumeServerServer).Query(m, &volumeServerQueryServer{stream}) + return srv.(VolumeServerServer).Query(m, &grpc.GenericServerStream[QueryRequest, QueriedStripe]{ServerStream: stream}) } -type VolumeServer_QueryServer interface { - Send(*QueriedStripe) error - grpc.ServerStream -} - -type volumeServerQueryServer struct { - grpc.ServerStream -} - -func (x *volumeServerQueryServer) Send(m *QueriedStripe) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type VolumeServer_QueryServer = grpc.ServerStreamingServer[QueriedStripe] func _VolumeServer_VolumeNeedleStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VolumeNeedleStatusRequest) @@ -1739,7 +1564,7 @@ func _VolumeServer_VolumeNeedleStatus_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/VolumeNeedleStatus", + FullMethod: VolumeServer_VolumeNeedleStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).VolumeNeedleStatus(ctx, req.(*VolumeNeedleStatusRequest)) @@ -1757,7 +1582,7 @@ func _VolumeServer_Ping_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/volume_server_pb.VolumeServer/Ping", + FullMethod: VolumeServer_Ping_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VolumeServerServer).Ping(ctx, req.(*PingRequest)) @@ -1765,7 +1590,10 @@ func _VolumeServer_Ping_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -var _VolumeServer_serviceDesc = grpc.ServiceDesc{ +// VolumeServer_ServiceDesc is the grpc.ServiceDesc for VolumeServer service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var VolumeServer_ServiceDesc = grpc.ServiceDesc{ ServiceName: "volume_server_pb.VolumeServer", HandlerType: (*VolumeServerServer)(nil), Methods: []grpc.MethodDesc{ diff --git a/weed/pb/worker_pb/worker.pb.go b/weed/pb/worker_pb/worker.pb.go index a24dd92b0..be2e877fc 100644 --- a/weed/pb/worker_pb/worker.pb.go +++ b/weed/pb/worker_pb/worker.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v6.33.1 +// protoc v6.33.4 // source: worker.proto package worker_pb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/weed/pb/worker_pb/worker_grpc.pb.go b/weed/pb/worker_pb/worker_grpc.pb.go index 4894e7d25..7e7aba748 100644 --- a/weed/pb/worker_pb/worker_grpc.pb.go +++ b/weed/pb/worker_pb/worker_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.1 +// - protoc v6.33.4 // source: worker.proto package worker_pb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 57fd7ab25..f76d215aa 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -10,6 +10,7 @@ import ( "sync/atomic" "time" + "github.com/seaweedfs/seaweedfs/weed/credential" "github.com/seaweedfs/seaweedfs/weed/stats" "golang.org/x/sync/singleflight" @@ -81,6 +82,7 @@ type FilerOption struct { AllowedOrigins []string ExposeDirectoryData bool TusBasePath string + CredentialManager *credential.CredentialManager } type FilerServer struct { @@ -112,6 +114,9 @@ type FilerServer struct { // deduplicates concurrent remote object caching operations remoteCacheGroup singleflight.Group + + // credential manager for IAM operations + CredentialManager *credential.CredentialManager } func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) (fs *FilerServer, err error) { @@ -148,6 +153,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.filer"), knownListeners: make(map[int32]int32), inFlightDataLimitCond: sync.NewCond(new(sync.Mutex)), + CredentialManager: option.CredentialManager, } fs.listenersCond = sync.NewCond(&fs.listenersLock) diff --git a/weed/server/filer_server_handlers_iam_grpc.go b/weed/server/filer_server_handlers_iam_grpc.go new file mode 100644 index 000000000..a2dc49b36 --- /dev/null +++ b/weed/server/filer_server_handlers_iam_grpc.go @@ -0,0 +1,351 @@ +package weed_server + +import ( + "context" + "encoding/json" + + "github.com/seaweedfs/seaweedfs/weed/credential" + "github.com/seaweedfs/seaweedfs/weed/glog" + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "github.com/seaweedfs/seaweedfs/weed/s3api/policy_engine" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// IamGrpcServer implements the IAM gRPC service on the filer +type IamGrpcServer struct { + iam_pb.UnimplementedSeaweedIdentityAccessManagementServer + credentialManager *credential.CredentialManager +} + +// NewIamGrpcServer creates a new IAM gRPC server +func NewIamGrpcServer(credentialManager *credential.CredentialManager) *IamGrpcServer { + return &IamGrpcServer{ + credentialManager: credentialManager, + } +} + +////////////////////////////////////////////////// +// Configuration Management + +func (s *IamGrpcServer) GetConfiguration(ctx context.Context, req *iam_pb.GetConfigurationRequest) (*iam_pb.GetConfigurationResponse, error) { + glog.V(4).Infof("GetConfiguration") + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + config, err := s.credentialManager.LoadConfiguration(ctx) + if err != nil { + glog.Errorf("Failed to load configuration: %v", err) + return nil, err + } + + return &iam_pb.GetConfigurationResponse{ + Configuration: config, + }, nil +} + +func (s *IamGrpcServer) PutConfiguration(ctx context.Context, req *iam_pb.PutConfigurationRequest) (*iam_pb.PutConfigurationResponse, error) { + glog.V(4).Infof("PutConfiguration") + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + if req.Configuration == nil { + return nil, status.Errorf(codes.InvalidArgument, "configuration is nil") + } + + err := s.credentialManager.SaveConfiguration(ctx, req.Configuration) + if err != nil { + glog.Errorf("Failed to save configuration: %v", err) + return nil, err + } + + return &iam_pb.PutConfigurationResponse{}, nil +} + +////////////////////////////////////////////////// +// User Management + +func (s *IamGrpcServer) CreateUser(ctx context.Context, req *iam_pb.CreateUserRequest) (*iam_pb.CreateUserResponse, error) { + if req == nil || req.Identity == nil { + return nil, status.Errorf(codes.InvalidArgument, "identity is required") + } + glog.V(4).Infof("CreateUser: %s", req.Identity.Name) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.CreateUser(ctx, req.Identity) + if err != nil { + if err == credential.ErrUserAlreadyExists { + return nil, status.Errorf(codes.AlreadyExists, "user %s already exists", req.Identity.Name) + } + glog.Errorf("Failed to create user %s: %v", req.Identity.Name, err) + return nil, status.Errorf(codes.Internal, "failed to create user: %v", err) + } + + return &iam_pb.CreateUserResponse{}, nil +} + +func (s *IamGrpcServer) GetUser(ctx context.Context, req *iam_pb.GetUserRequest) (*iam_pb.GetUserResponse, error) { + glog.V(4).Infof("GetUser: %s", req.Username) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + identity, err := s.credentialManager.GetUser(ctx, req.Username) + if err != nil { + if err == credential.ErrUserNotFound { + return nil, status.Errorf(codes.NotFound, "user %s not found", req.Username) + } + glog.Errorf("Failed to get user %s: %v", req.Username, err) + return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) + } + + return &iam_pb.GetUserResponse{ + Identity: identity, + }, nil +} + +func (s *IamGrpcServer) UpdateUser(ctx context.Context, req *iam_pb.UpdateUserRequest) (*iam_pb.UpdateUserResponse, error) { + glog.V(4).Infof("UpdateUser: %s", req.Username) + if req == nil || req.Identity == nil { + return nil, status.Errorf(codes.InvalidArgument, "identity is required") + } + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.UpdateUser(ctx, req.Username, req.Identity) + if err != nil { + if err == credential.ErrUserNotFound { + return nil, status.Errorf(codes.NotFound, "user %s not found", req.Username) + } + glog.Errorf("Failed to update user %s: %v", req.Username, err) + return nil, status.Errorf(codes.Internal, "failed to update user: %v", err) + } + + return &iam_pb.UpdateUserResponse{}, nil +} + +func (s *IamGrpcServer) DeleteUser(ctx context.Context, req *iam_pb.DeleteUserRequest) (*iam_pb.DeleteUserResponse, error) { + glog.V(4).Infof("DeleteUser: %s", req.Username) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.DeleteUser(ctx, req.Username) + if err != nil { + if err == credential.ErrUserNotFound { + // Deleting a non-existent user is generally considered a success or Not Found depending on semantics + // In S3 API, usually idempotent. But for Admin API, often 404. + // Here we return NotFound to let client decide, but traditionally delete is idempotent. + // However, if we want strict status codes: + return nil, status.Errorf(codes.NotFound, "user %s not found", req.Username) + } + glog.Errorf("Failed to delete user %s: %v", req.Username, err) + return nil, status.Errorf(codes.Internal, "failed to delete user: %v", err) + } + + return &iam_pb.DeleteUserResponse{}, nil +} + +func (s *IamGrpcServer) ListUsers(ctx context.Context, req *iam_pb.ListUsersRequest) (*iam_pb.ListUsersResponse, error) { + glog.V(4).Infof("ListUsers") + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + usernames, err := s.credentialManager.ListUsers(ctx) + if err != nil { + glog.Errorf("Failed to list users: %v", err) + return nil, err + } + + return &iam_pb.ListUsersResponse{ + Usernames: usernames, + }, nil +} + +////////////////////////////////////////////////// +// Access Key Management + +func (s *IamGrpcServer) CreateAccessKey(ctx context.Context, req *iam_pb.CreateAccessKeyRequest) (*iam_pb.CreateAccessKeyResponse, error) { + if req == nil || req.Credential == nil { + return nil, status.Errorf(codes.InvalidArgument, "credential is required") + } + glog.V(4).Infof("CreateAccessKey for user: %s", req.Username) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.CreateAccessKey(ctx, req.Username, req.Credential) + if err != nil { + if err == credential.ErrUserNotFound { + return nil, status.Errorf(codes.NotFound, "user %s not found", req.Username) + } + glog.Errorf("Failed to create access key for user %s: %v", req.Username, err) + return nil, status.Errorf(codes.Internal, "failed to create access key: %v", err) + } + + return &iam_pb.CreateAccessKeyResponse{}, nil +} + +func (s *IamGrpcServer) DeleteAccessKey(ctx context.Context, req *iam_pb.DeleteAccessKeyRequest) (*iam_pb.DeleteAccessKeyResponse, error) { + glog.V(4).Infof("DeleteAccessKey: %s for user: %s", req.AccessKey, req.Username) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.DeleteAccessKey(ctx, req.Username, req.AccessKey) + if err != nil { + if err == credential.ErrUserNotFound { + return nil, status.Errorf(codes.NotFound, "user %s not found", req.Username) + } + if err == credential.ErrAccessKeyNotFound { + return nil, status.Errorf(codes.NotFound, "access key %s not found", req.AccessKey) + } + glog.Errorf("Failed to delete access key %s for user %s: %v", req.AccessKey, req.Username, err) + return nil, status.Errorf(codes.Internal, "failed to delete access key: %v", err) + } + + return &iam_pb.DeleteAccessKeyResponse{}, nil +} + +func (s *IamGrpcServer) GetUserByAccessKey(ctx context.Context, req *iam_pb.GetUserByAccessKeyRequest) (*iam_pb.GetUserByAccessKeyResponse, error) { + glog.V(4).Infof("GetUserByAccessKey: %s", req.AccessKey) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + identity, err := s.credentialManager.GetUserByAccessKey(ctx, req.AccessKey) + if err != nil { + if err == credential.ErrAccessKeyNotFound { + return nil, status.Errorf(codes.NotFound, "access key %s not found", req.AccessKey) + } + glog.Errorf("Failed to get user by access key %s: %v", req.AccessKey, err) + return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) + } + + return &iam_pb.GetUserByAccessKeyResponse{ + Identity: identity, + }, nil +} + +////////////////////////////////////////////////// +// Policy Management + +func (s *IamGrpcServer) PutPolicy(ctx context.Context, req *iam_pb.PutPolicyRequest) (*iam_pb.PutPolicyResponse, error) { + glog.V(4).Infof("PutPolicy: %s", req.Name) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "policy name is required") + } + if req.Content == "" { + return nil, status.Errorf(codes.InvalidArgument, "policy content is required") + } + + var policy policy_engine.PolicyDocument + if err := json.Unmarshal([]byte(req.Content), &policy); err != nil { + glog.Errorf("Failed to unmarshal policy %s: %v", req.Name, err) + return nil, err + } + + err := s.credentialManager.PutPolicy(ctx, req.Name, policy) + if err != nil { + glog.Errorf("Failed to put policy %s: %v", req.Name, err) + return nil, err + } + + return &iam_pb.PutPolicyResponse{}, nil +} + +func (s *IamGrpcServer) GetPolicy(ctx context.Context, req *iam_pb.GetPolicyRequest) (*iam_pb.GetPolicyResponse, error) { + glog.V(4).Infof("GetPolicy: %s", req.Name) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + policy, err := s.credentialManager.GetPolicy(ctx, req.Name) + if err != nil { + glog.Errorf("Failed to get policy %s: %v", req.Name, err) + return nil, err + } + + if policy == nil { + return nil, status.Errorf(codes.NotFound, "policy %s not found", req.Name) + } + + jsonBytes, err := json.Marshal(policy) + if err != nil { + glog.Errorf("Failed to marshal policy %s: %v", req.Name, err) + return nil, err + } + + return &iam_pb.GetPolicyResponse{ + Name: req.Name, + Content: string(jsonBytes), + }, nil +} + +func (s *IamGrpcServer) ListPolicies(ctx context.Context, req *iam_pb.ListPoliciesRequest) (*iam_pb.ListPoliciesResponse, error) { + glog.V(4).Infof("ListPolicies") + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + policiesData, err := s.credentialManager.GetPolicies(ctx) + if err != nil { + glog.Errorf("Failed to list policies: %v", err) + return nil, err + } + + var policies []*iam_pb.Policy + for name, policy := range policiesData { + jsonBytes, err := json.Marshal(policy) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to marshal policy %s: %v", name, err) + } + policies = append(policies, &iam_pb.Policy{ + Name: name, + Content: string(jsonBytes), + }) + } + + return &iam_pb.ListPoliciesResponse{ + Policies: policies, + }, nil +} + +func (s *IamGrpcServer) DeletePolicy(ctx context.Context, req *iam_pb.DeletePolicyRequest) (*iam_pb.DeletePolicyResponse, error) { + glog.V(4).Infof("DeletePolicy: %s", req.Name) + + if s.credentialManager == nil { + return nil, status.Errorf(codes.FailedPrecondition, "credential manager is not configured") + } + + err := s.credentialManager.DeletePolicy(ctx, req.Name) + if err != nil { + glog.Errorf("Failed to delete policy %s: %v", req.Name, err) + return nil, err + } + + return &iam_pb.DeletePolicyResponse{}, nil +} diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.go index eb5e15109..07af85db3 100644 --- a/weed/shell/command_s3_configure.go +++ b/weed/shell/command_s3_configure.go @@ -2,16 +2,18 @@ package shell import ( "bytes" + "context" "flag" "fmt" "io" - "sort" "strings" "github.com/seaweedfs/seaweedfs/weed/filer" - - "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" + "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func init() { @@ -32,7 +34,7 @@ func (c *commandS3Configure) Help() string { s3.configure # create a new identity with account information - s3.configure -user=username -actions=Read,Write,List,Tagging -buckets=bucket-name -access_key=key -secret_key=secret -account_id=id -account_display_name=name -account_email=email@example.com -apply + s3.configure -user=username -actions=Read,Write,List,Tagging -buckets=bucket-name -policies=policy1,policy2 -access_key=key -secret_key=secret -account_id=id -account_display_name=name -account_email=email@example.com -apply ` } @@ -51,178 +53,229 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io accountId := s3ConfigureCommand.String("account_id", "", "specify the account id") accountDisplayName := s3ConfigureCommand.String("account_display_name", "", "specify the account display name") accountEmail := s3ConfigureCommand.String("account_email", "", "specify the account email address") - isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions or access keys") + policies := s3ConfigureCommand.String("policies", "", "comma separated policy names") + isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions, access keys or policies") apply := s3ConfigureCommand.Bool("apply", false, "update and apply s3 configuration") if err = s3ConfigureCommand.Parse(args); err != nil { return nil } - // Check which account flags were provided and build update functions - var accountUpdates []func(*iam_pb.Account) - s3ConfigureCommand.Visit(func(f *flag.Flag) { - switch f.Name { - case "account_id": - accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.Id = *accountId }) - case "account_display_name": - accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.DisplayName = *accountDisplayName }) - case "account_email": - accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.EmailAddress = *accountEmail }) - } - }) - - // Helper function to update account information on an identity - updateAccountInfo := func(account **iam_pb.Account) { - if len(accountUpdates) > 0 { - if *account == nil { - *account = &iam_pb.Account{} + // Case 1: List configuration (no user specified) + if *user == "" { + return c.listConfiguration(commandEnv, writer) + } + + // Case 2: Modify specific user + var identity *iam_pb.Identity + var isNewUser bool + + err = pb.WithGrpcClient(false, 0, func(conn *grpc.ClientConn) error { + client := iam_pb.NewSeaweedIdentityAccessManagementClient(conn) + + // Try to get existing user + resp, getErr := client.GetUser(context.Background(), &iam_pb.GetUserRequest{ + Username: *user, + }) + + if getErr == nil { + identity = resp.Identity + if identity == nil { + // Should not happen if err is nil, but handle defensively + isNewUser = true + identity = &iam_pb.Identity{Name: *user} } - for _, update := range accountUpdates { - update(*account) + } else { + st, ok := status.FromError(getErr) + if ok && st.Code() == codes.NotFound { + isNewUser = true + identity = &iam_pb.Identity{ + Name: *user, + Credentials: []*iam_pb.Credential{}, + Actions: []string{}, + PolicyNames: []string{}, + } + } else { + return fmt.Errorf("failed to get user %s: %v", *user, getErr) } } - } - var buf bytes.Buffer - if err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - return filer.ReadEntry(commandEnv.MasterClient, client, filer.IamConfigDirectory, filer.IamIdentityFile, &buf) - }); err != nil && err != filer_pb.ErrNotFound { - return err - } + // Apply changes to identity object + if err := c.applyChanges(identity, isNewUser, actions, buckets, accessKey, secretKey, policies, isDelete, accountId, accountDisplayName, accountEmail); err != nil { + return err + } - s3cfg := &iam_pb.S3ApiConfiguration{} - if buf.Len() > 0 { - if err = filer.ParseS3ConfigurationFromBytes(buf.Bytes(), s3cfg); err != nil { + // Print changes (Simulation) + var buf bytes.Buffer + filer.ProtoToText(&buf, identity) + fmt.Fprint(writer, buf.String()) + fmt.Fprintln(writer) + + if !*apply { + infoAboutSimulationMode(writer, *apply, "-apply") + return nil + } + + // Apply changes + if *isDelete && *actions == "" && *accessKey == "" && *buckets == "" && *policies == "" { + // Delete User + _, err := client.DeleteUser(context.Background(), &iam_pb.DeleteUserRequest{Username: *user}) return err + } else { + // Create or Update User + if isNewUser { + _, err := client.CreateUser(context.Background(), &iam_pb.CreateUserRequest{Identity: identity}) + return err + } else { + _, err := client.UpdateUser(context.Background(), &iam_pb.UpdateUserRequest{Username: *user, Identity: identity}) + return err + } + } + }, commandEnv.option.FilerAddress.ToGrpcAddress(), false, commandEnv.option.GrpcDialOption) + + return err +} + +func (c *commandS3Configure) listConfiguration(commandEnv *CommandEnv, writer io.Writer) error { + return pb.WithGrpcClient(false, 0, func(conn *grpc.ClientConn) error { + client := iam_pb.NewSeaweedIdentityAccessManagementClient(conn) + resp, err := client.GetConfiguration(context.Background(), &iam_pb.GetConfigurationRequest{}) + if err != nil { + return err + } + var buf bytes.Buffer + filer.ProtoToText(&buf, resp.Configuration) + fmt.Fprint(writer, buf.String()) + fmt.Fprintln(writer) + return nil + }, commandEnv.option.FilerAddress.ToGrpcAddress(), false, commandEnv.option.GrpcDialOption) +} + +func (c *commandS3Configure) applyChanges(identity *iam_pb.Identity, isNewUser bool, actions, buckets, accessKey, secretKey, policies *string, isDelete *bool, accountId, accountDisplayName, accountEmail *string) error { + + // Helper to update account info + if *accountId != "" || *accountDisplayName != "" || *accountEmail != "" { + if identity.Account == nil { + identity.Account = &iam_pb.Account{} + } + if *accountId != "" { + identity.Account.Id = *accountId + } + if *accountDisplayName != "" { + identity.Account.DisplayName = *accountDisplayName + } + if *accountEmail != "" { + identity.Account.EmailAddress = *accountEmail } } - idx := 0 - changed := false - if *user != "" { - for i, identity := range s3cfg.Identities { - if *user == identity.Name { - idx = i - changed = true - break + // Prepare lists + var cmdActions []string + if *actions != "" { + for _, action := range strings.Split(*actions, ",") { + if *buckets == "" { + cmdActions = append(cmdActions, action) + } else { + for _, bucket := range strings.Split(*buckets, ",") { + cmdActions = append(cmdActions, fmt.Sprintf("%s:%s", action, bucket)) + } } } } - var cmdActions []string - for _, action := range strings.Split(*actions, ",") { - if *buckets == "" { - cmdActions = append(cmdActions, action) - } else { - for _, bucket := range strings.Split(*buckets, ",") { - cmdActions = append(cmdActions, fmt.Sprintf("%s:%s", action, bucket)) + + var cmdPolicies []string + if *policies != "" { + for _, policy := range strings.Split(*policies, ",") { + if policy != "" { + cmdPolicies = append(cmdPolicies, policy) } } } - if changed { - infoAboutSimulationMode(writer, *apply, "-apply") - if *isDelete { - var exists []int - for _, cmdAction := range cmdActions { - for i, currentAction := range s3cfg.Identities[idx].Actions { - if cmdAction == currentAction { - exists = append(exists, i) - } + + if *isDelete { + // DELETE LOGIC + + // Remove Actions + if len(cmdActions) > 0 { + identity.Actions = removeFromSlice(identity.Actions, cmdActions) + } + + // Remove Credentials + if *accessKey != "" { + var keepCredentials []*iam_pb.Credential + for _, cred := range identity.Credentials { + if cred.AccessKey != *accessKey { + keepCredentials = append(keepCredentials, cred) } } - sort.Sort(sort.Reverse(sort.IntSlice(exists))) - for _, i := range exists { - s3cfg.Identities[idx].Actions = append( - s3cfg.Identities[idx].Actions[:i], - s3cfg.Identities[idx].Actions[i+1:]..., - ) - } - if *accessKey != "" { - exists = []int{} - for i, credential := range s3cfg.Identities[idx].Credentials { - if credential.AccessKey == *accessKey { - exists = append(exists, i) - } - } - sort.Sort(sort.Reverse(sort.IntSlice(exists))) - for _, i := range exists { - s3cfg.Identities[idx].Credentials = append( - s3cfg.Identities[idx].Credentials[:i], - s3cfg.Identities[idx].Credentials[i+1:]..., - ) - } + identity.Credentials = keepCredentials + } - } - if *actions == "" && *accessKey == "" && *buckets == "" { - s3cfg.Identities = append(s3cfg.Identities[:idx], s3cfg.Identities[idx+1:]...) - } - } else { - if *actions != "" { - for _, cmdAction := range cmdActions { - found := false - for _, action := range s3cfg.Identities[idx].Actions { - if cmdAction == action { - found = true - break - } - } - if !found { - s3cfg.Identities[idx].Actions = append(s3cfg.Identities[idx].Actions, cmdAction) + // Remove Policies + if len(cmdPolicies) > 0 { + identity.PolicyNames = removeFromSlice(identity.PolicyNames, cmdPolicies) + } + + } else { + // ADD/UPDATE LOGIC + + // Add Actions + identity.Actions = addUniqueToSlice(identity.Actions, cmdActions) + + // Add/Update Credentials + if *accessKey != "" && identity.Name != "anonymous" { + found := false + for _, cred := range identity.Credentials { + if cred.AccessKey == *accessKey { + found = true + if *secretKey != "" { + cred.SecretKey = *secretKey } + break } } - if *accessKey != "" && *user != "anonymous" { - found := false - for _, credential := range s3cfg.Identities[idx].Credentials { - if credential.AccessKey == *accessKey { - found = true - credential.SecretKey = *secretKey - break - } - } - if !found { - s3cfg.Identities[idx].Credentials = append(s3cfg.Identities[idx].Credentials, &iam_pb.Credential{ - AccessKey: *accessKey, - SecretKey: *secretKey, - }) + if !found { + if *secretKey == "" { + return fmt.Errorf("secret_key is required when adding a new access_key") } + identity.Credentials = append(identity.Credentials, &iam_pb.Credential{ + AccessKey: *accessKey, + SecretKey: *secretKey, + }) } - // Update account information if provided - updateAccountInfo(&s3cfg.Identities[idx].Account) - } - } else if *user != "" && *actions != "" { - infoAboutSimulationMode(writer, *apply, "-apply") - identity := iam_pb.Identity{ - Name: *user, - Actions: cmdActions, - Credentials: []*iam_pb.Credential{}, - } - if *user != "anonymous" { - identity.Credentials = append(identity.Credentials, - &iam_pb.Credential{AccessKey: *accessKey, SecretKey: *secretKey}) - } - // Add account information if provided - updateAccountInfo(&identity.Account) - s3cfg.Identities = append(s3cfg.Identities, &identity) - } + } - if err = filer.CheckDuplicateAccessKey(s3cfg); err != nil { - return err + // Add Policies + identity.PolicyNames = addUniqueToSlice(identity.PolicyNames, cmdPolicies) } - buf.Reset() - filer.ProtoToText(&buf, s3cfg) - - fmt.Fprint(writer, buf.String()) - fmt.Fprintln(writer) - - if *apply { + return nil +} - if err := commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - return filer.SaveInsideFiler(client, filer.IamConfigDirectory, filer.IamIdentityFile, buf.Bytes()) - }); err != nil { - return err +// Helper to remove items from a slice +func removeFromSlice(current []string, toRemove []string) []string { + removeSet := make(map[string]struct{}, len(toRemove)) + for _, item := range toRemove { + removeSet[item] = struct{}{} + } + var result []string + for _, item := range current { + if _, found := removeSet[item]; !found { + result = append(result, item) } - } + return result +} - return nil +// Helper to add unique items to a slice +func addUniqueToSlice(current []string, toAdd []string) []string { + existingSet := make(map[string]struct{}, len(current)) + for _, item := range current { + existingSet[item] = struct{}{} + } + for _, item := range toAdd { + if _, found := existingSet[item]; !found { + current = append(current, item) + } + } + return current } diff --git a/weed/shell/command_s3_policy.go b/weed/shell/command_s3_policy.go new file mode 100644 index 000000000..1cd30b187 --- /dev/null +++ b/weed/shell/command_s3_policy.go @@ -0,0 +1,150 @@ +package shell + +import ( + "context" + "encoding/json" + "flag" + "fmt" + "io" + "os" + "time" + + "github.com/seaweedfs/seaweedfs/weed/pb" + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" + "github.com/seaweedfs/seaweedfs/weed/s3api/policy_engine" + "google.golang.org/grpc" +) + +func init() { + Commands = append(Commands, &commandS3Policy{}) +} + +type commandS3Policy struct { +} + +func (c *commandS3Policy) Name() string { + return "s3.policy" +} + +func (c *commandS3Policy) Help() string { + return `manage s3 policies + + # create or update a policy + s3.policy -put -name=mypolicy -file=policy.json + + # list all policies + s3.policy -list + + # get a policy + s3.policy -get -name=mypolicy + + # delete a policy + s3.policy -delete -name=mypolicy + ` +} + +func (c *commandS3Policy) HasTag(CommandTag) bool { + return false +} + +func (c *commandS3Policy) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) { + + s3PolicyCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + put := s3PolicyCommand.Bool("put", false, "create or update a policy") + get := s3PolicyCommand.Bool("get", false, "get a policy") + list := s3PolicyCommand.Bool("list", false, "list all policies") + del := s3PolicyCommand.Bool("delete", false, "delete a policy") + name := s3PolicyCommand.String("name", "", "policy name") + file := s3PolicyCommand.String("file", "", "policy file (json)") + + if err = s3PolicyCommand.Parse(args); err != nil { + return err + } + + actionCount := 0 + for _, v := range []bool{*put, *get, *list, *del} { + if v { + actionCount++ + } + } + if actionCount == 0 { + return fmt.Errorf("one of -put, -get, -list, -delete must be specified") + } + if actionCount > 1 { + return fmt.Errorf("only one of -put, -get, -list, -delete can be specified") + } + + return pb.WithGrpcClient(false, 0, func(conn *grpc.ClientConn) error { + client := iam_pb.NewSeaweedIdentityAccessManagementClient(conn) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + if *put { + if *name == "" { + return fmt.Errorf("-name is required") + } + if *file == "" { + return fmt.Errorf("-file is required") + } + data, err := os.ReadFile(*file) + if err != nil { + return fmt.Errorf("failed to read policy file: %v", err) + } + + // Validate JSON + var policy policy_engine.PolicyDocument + if err := json.Unmarshal(data, &policy); err != nil { + return fmt.Errorf("invalid policy json: %v", err) + } + + _, err = client.PutPolicy(ctx, &iam_pb.PutPolicyRequest{ + Name: *name, + Content: string(data), + }) + return err + } + + if *get { + if *name == "" { + return fmt.Errorf("-name is required") + } + resp, err := client.GetPolicy(ctx, &iam_pb.GetPolicyRequest{ + Name: *name, + }) + if err != nil { + return err + } + if resp.Content == "" { + return fmt.Errorf("policy not found") + } + fmt.Fprintf(writer, "%s\n", resp.Content) + return nil + } + + if *list { + resp, err := client.ListPolicies(ctx, &iam_pb.ListPoliciesRequest{}) + if err != nil { + return err + } + for _, policy := range resp.Policies { + fmt.Fprintf(writer, "Name: %s\n", policy.Name) + fmt.Fprintf(writer, "Content: %s\n", policy.Content) + fmt.Fprintf(writer, "---\n") + } + return nil + } + + if *del { + if *name == "" { + return fmt.Errorf("-name is required") + } + _, err := client.DeletePolicy(ctx, &iam_pb.DeletePolicyRequest{ + Name: *name, + }) + return err + } + + return nil + }, commandEnv.option.FilerAddress.ToGrpcAddress(), false, commandEnv.option.GrpcDialOption) + +}