sdk

package
v10.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2019 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2019 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2018 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (

	// ContextDriverKey is the driver key passed in context's metadata
	ContextDriverKey = "driver"
	// DefaultDriverName is the default driver to be used
	DefaultDriverName = "default"
)
View Source
const (
	// Metedata context key where the token is found.
	// This key must be used by the caller as the key for the token in
	// the metedata of the context. The generated Rest Gateway also uses this
	// key as the location of the raw token coming from the standard REST
	// header: Authorization: bearer <adaf0sdfsd...token>
	ContextMetadataTokenKey = "bearer"
)

Variables

This section is empty.

Functions

func FromError

func FromError(err error) *status.Status

func GetDefaultVolSpecs

func GetDefaultVolSpecs(
	ctx context.Context,
	spec *api.VolumeSpec,
	isUpdate bool,
) (*api.VolumeSpec, error)

GetDefaultVolSpecs returns volume spec merged with default storage policy applied if any

func HTTPStatusFromSdkError

func HTTPStatusFromSdkError(err error) int

func IsErrorNotFound

func IsErrorNotFound(err error) bool

IsErrorNotFound returns if the given error is due to not found

func NewAlertsServer

func NewAlertsServer(filterDeleter alerts.FilterDeleter) api.OpenStorageAlertsServer

NewAlertsServer provides an instance of alerts server interface.

Types

type CloudBackupServer

type CloudBackupServer struct {
	// contains filtered or unexported fields
}

CloudBackupServer is an implementation of the gRPC OpenStorageCloudBackup interface

func (*CloudBackupServer) Catalog

Catalog

func (*CloudBackupServer) Create

Create creates a backup for a volume

func (*CloudBackupServer) Delete

Delete deletes a backup

func (*CloudBackupServer) DeleteAll

DeleteAll deletes all backups for a certain volume

func (*CloudBackupServer) EnumerateWithFilters

Enumerate returns information about the backups

func (*CloudBackupServer) GroupCreate

GroupCreate creates a backup for a list of volume or group

func (*CloudBackupServer) History

History returns ??

func (*CloudBackupServer) Restore

Restore a backup

func (*CloudBackupServer) SchedCreate

SchedCreate new schedule for cloud backup

func (*CloudBackupServer) SchedDelete

SchedDelete cloud backup schedule

func (*CloudBackupServer) SchedEnumerate

SchedEnumerate cloud backup schedule

func (*CloudBackupServer) SchedInspect

func (s *CloudBackupServer) SchedInspect(
	ctx context.Context,
	schedUUID string,
) error

func (*CloudBackupServer) SchedUpdate

Schedupdate updates the existing schedule for cloud backup. Callers must do read-modify-write op

func (*CloudBackupServer) Size

Size returns size of a cloud backup

func (*CloudBackupServer) StateChange

StateChange pauses and resumes backups

func (*CloudBackupServer) Status

Status provides status on a backup

type ClusterDomainsServer

type ClusterDomainsServer struct {
	// contains filtered or unexported fields
}

ClusterDomainsServer is an implementation of the gRPC OpenStorageClusterDomains interface

type ClusterPairServer

type ClusterPairServer struct {
	// contains filtered or unexported fields
}

ClusterPairServer is an implementation of the gRPC OpenStorageClusterServer interface

func (*ClusterPairServer) Create

Create a new cluster with remote pair

func (*ClusterPairServer) Delete

Delete removes the cluster pairing

func (*ClusterPairServer) Enumerate

Enumerate returns list of cluster pairs

func (*ClusterPairServer) GetToken

GetToken gets the authentication token for this cluster

func (*ClusterPairServer) Inspect

Inspect information about a cluster pair

func (*ClusterPairServer) ResetToken

ResetToken gets the authentication token for this cluster

type ClusterServer

type ClusterServer struct {
	// contains filtered or unexported fields
}

ClusterServer is an implementation of the gRPC OpenStorageClusterServer interface

func (*ClusterServer) InspectCurrent

InspectCurrent returns information about the current cluster

type CredentialServer

type CredentialServer struct {
	// contains filtered or unexported fields
}

CredentialServer is an implementation of the gRPC OpenStorageCredential interface

func (*CredentialServer) Create

Create method creates credentials

func (*CredentialServer) Delete

Delete deletes a specified credential

func (*CredentialServer) DeleteReferences

DeleteReferences removes all references to a specified Credential.

func (*CredentialServer) Enumerate

Enumerate returns a list credentials ids

func (*CredentialServer) Inspect

Inspect returns information about credential id

func (*CredentialServer) Update

Update method modifies previously created credentials

func (*CredentialServer) Validate

Validate validates a specified Credential.

type DiagsServer

type DiagsServer struct {
	// contains filtered or unexported fields
}

DiagsServer is an implementation of the OpenStorageDiags SDK

func (*DiagsServer) Collect

type FilesystemCheckServer

type FilesystemCheckServer struct {
	// contains filtered or unexported fields
}

FilesystemCheckServer is an implementation of the gRPC OpenStorageFilesystemCheck interface

func (*FilesystemCheckServer) Start

Start a filesystem check operation on a unmounted volume

func (*FilesystemCheckServer) Status

GetStatus of a filesystem check operation

func (*FilesystemCheckServer) Stop

Stop the background filesystem check (CheckHealth or FixSafe or Fixall) operation on a volume, if any

type FilesystemTrimServer

type FilesystemTrimServer struct {
	// contains filtered or unexported fields
}

FilesystemTrimServer is an implementation of the gRPC OpenStorageFilesystemTrim interface

func (*FilesystemTrimServer) AutoFSTrimStatus

Status of auto fs trim operation

func (*FilesystemTrimServer) AutoFSTrimUsage

Usage of auto fs trim

func (*FilesystemTrimServer) Start

Start a filesystem trim operation on a mounted volume

func (*FilesystemTrimServer) Status

Status of a filesystem trim operation

func (*FilesystemTrimServer) Stop

Stop the background filesystem trim operation on a volume, if any

type IdentityServer

type IdentityServer struct {
	// contains filtered or unexported fields
}

IdentityServer is an implementation of the gRPC OpenStorageIdentityServer interface

func (*IdentityServer) Capabilities

Capabilities returns the capabilities of the SDK server

func (*IdentityServer) Version

Version returns version of the storage system

type JobServer

type JobServer struct {
	// contains filtered or unexported fields
}

func (*JobServer) Enumerate

func (*JobServer) GetStatus

func (*JobServer) Update

type NodeServer

type NodeServer struct {
	// contains filtered or unexported fields
}

NodeServer is an implementation of the gRPC OpenStorageNodeServer interface

func (*NodeServer) DrainAttachments

func (s *NodeServer) DrainAttachments(
	ctx context.Context,
	req *api.SdkNodeDrainAttachmentsRequest,
) (*api.SdkJobResponse, error)

func (*NodeServer) Enumerate

Enumerate returns the ids of all the nodes in the cluster

func (*NodeServer) EnumerateWithFilters

EnumerateWithFilters returns all the nodes in the cluster

func (*NodeServer) Inspect

Inspect returns information about a specific node

func (*NodeServer) InspectCurrent

type ObjectstoreServer

type ObjectstoreServer struct {
	// contains filtered or unexported fields
}

Objectstoreserver is an implementation of the gRPC OpenStorageObjectstore interface

func (*ObjectstoreServer) Create

CreateObjectstore creates objectstore for given volume

func (*ObjectstoreServer) Delete

DeleteObjectstore delete objectstore from cluster

func (*ObjectstoreServer) Inspect

Inspect Objectstore return status of provided objectstore

func (*ObjectstoreServer) Update

UpdateObjectstore updates given objectstore state

type SchedulePolicyServer

type SchedulePolicyServer struct {
	// contains filtered or unexported fields
}

SchedulePolicyServer is an implementation of the gRPC OpenStorageSchedulePolicy interface

func (*SchedulePolicyServer) Create

Create method creates schedule policy

func (*SchedulePolicyServer) Delete

Delete method deletes schedule policy

func (*SchedulePolicyServer) Enumerate

Enumerate method enumerates schedule policies

func (*SchedulePolicyServer) Inspect

Inspect method inspects schedule policy

func (*SchedulePolicyServer) Update

Update method updates schedule policy

type SecurityConfig

type SecurityConfig struct {
	// Role implementation
	Role role.RoleManager
	// Tls configuration
	Tls *TLSConfig
	// Authenticators per issuer. You can register multple authenticators
	// based on the "iss" string in the string. For example:
	// map[string]auth.Authenticator {
	//     "https://accounts.google.com": googleOidc,
	//     "openstorage-sdk-auth: selfSigned,
	// }
	Authenticators map[string]auth.Authenticator
}

SecurityConfig provides configuration for SDK auth

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an implementation of the gRPC SDK interface

func New

func New(config *ServerConfig) (*Server, error)

New creates a new SDK server

func (*Server) Address

func (s *Server) Address() string

func (*Server) Start

func (s *Server) Start() error

Start all servers

func (*Server) Stop

func (s *Server) Stop()

func (*Server) UdsAddress

func (s *Server) UdsAddress() string

func (*Server) UseAlert

func (s *Server) UseAlert(a alerts.FilterDeleter)

UseAlert will setup a new alert object for the gRPC handlers

func (*Server) UseCluster

func (s *Server) UseCluster(c cluster.Cluster)

UseCluster will setup a new cluster object for the gRPC handlers

func (*Server) UseVolumeDrivers

func (s *Server) UseVolumeDrivers(d map[string]volume.VolumeDriver)

UseVolumeDrivers will setup a new driver object for the gRPC handlers

type ServerConfig

type ServerConfig struct {
	// Net is the transport for gRPC: unix, tcp, etc.
	// For the gRPC Server. This value goes together with `Address`.
	Net string
	// Address is the port number or the unix domain socket path.
	// For the gRPC Server. This value goes together with `Net`.
	Address string

	// RestAdress is the port number. Example: 9110
	// For the gRPC REST Gateway.
	RestPort string
	// Unix domain socket for local communication. This socket
	// will be used by the REST Gateway to communicate with the gRPC server.
	// Only set for testing. Having a '%s' can be supported to use the
	// name of the driver as the driver name.
	Socket string
	// (optional) Location for audit log.
	// If not provided, it will go to /var/log/openstorage-audit.log
	AuditOutput io.Writer
	// (optional) Location of access log.
	// This is useful when authorization is not running.
	// If not provided, it will go to /var/log/openstorage-access.log
	AccessOutput io.Writer
	// (optional) The OpenStorage driver to use
	DriverName string
	// (optional) Cluster interface
	Cluster cluster.Cluster
	// AlertsFilterDeleter
	AlertsFilterDeleter alerts.FilterDeleter
	// StoragePolicy Manager
	StoragePolicy policy.PolicyManager
	// Security configuration
	Security *SecurityConfig
	// ServerExtensions allows you to extend the SDK gRPC server
	// with callback functions that are sequentially executed
	// at the end of Server.Start()
	//
	// To add your own service to the SDK gRPC server,
	// just append a function callback that registers it:
	//
	// s.config.ServerExtensions = append(s.config.ServerExtensions,
	// 		func(gs *grpc.Server) {
	//			api.RegisterCustomService(gs, customHandler)
	//		})
	GrpcServerExtensions []func(grpcServer *grpc.Server)

	// RestServerExtensions allows for extensions to be added
	// to the SDK Rest Gateway server.
	//
	// To add your own service to the SDK REST Server, simply add your handlers
	// to the RestSererExtensions slice. These handlers will be registered on the
	// REST Gateway http server.
	RestServerExtensions []func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error
	// contains filtered or unexported fields
}

ServerConfig provides the configuration to the SDK server

type StoragePoolServer

type StoragePoolServer struct {
	// contains filtered or unexported fields
}

func (*StoragePoolServer) Rebalance

func (*StoragePoolServer) UpdateRebalanceJobState

type TLSConfig

type TLSConfig struct {
	// CertFile is the path to the cert file
	CertFile string
	// KeyFile is the path to the key file
	KeyFile string
}

TLSConfig points to the cert files needed for HTTPS

type VolumeServer

type VolumeServer struct {
	// contains filtered or unexported fields
}

VolumeServer is an implementation of the gRPC OpenStorageVolume interface

func (*VolumeServer) Attach

Attach volume to given node

func (*VolumeServer) Cancel

Cancel or stop a ongoing migration

func (*VolumeServer) CapacityUsage

func (*VolumeServer) Clone

Clone creates a new volume from an existing volume

func (*VolumeServer) Create

Create creates a new volume

func (*VolumeServer) Delete

Delete deletes a volume

func (*VolumeServer) Detach

Detach function for volume node detach

func (*VolumeServer) Enumerate

Enumerate returns a list of volumes

func (*VolumeServer) EnumerateWithFilters

EnumerateWithFilters returns a list of volumes for the provided filters

func (*VolumeServer) Inspect

Inspect returns information about a volume

func (*VolumeServer) InspectWithFilters

InspectWithFilters is a helper function returning information about volumes which match a filter

func (*VolumeServer) Mount

Mount function for volume node detach

func (*VolumeServer) SnapshotCreate

SnapshotCreate creates a read-only snapshot of a volume

func (*VolumeServer) SnapshotEnumerate

SnapshotEnumerate returns a list of snapshots for the specified volume

func (*VolumeServer) SnapshotEnumerateWithFilters

SnapshotEnumerateWithFilters returns a list of snapshots for the specified volume and labels

func (*VolumeServer) SnapshotRestore

SnapshotRestore restores a volume to the specified snapshot id

func (*VolumeServer) SnapshotScheduleUpdate

SnapshotScheduleUpdate updates the snapshot schedule in the volume. It only manages the PolicyTags

func (*VolumeServer) Start

Start a volume migration

func (*VolumeServer) Stats

Stats returns volume statistics

func (*VolumeServer) Status

Status of ongoing migration

func (*VolumeServer) Unmount

Unmount volume from given node

func (*VolumeServer) Update

Update allows the caller to change values in the volume specification

func (*VolumeServer) VolumeCatalog

VolumeCatalog returns a list of volumes for the provided filters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL