mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
4f0bb2315b
With Amazon STS and kubernetes cluster is configured with OIDC identity provider, credentials to access Amazon KMS can be fetched using oidc-token(serviceaccount token). Each tenant/namespace needs to create a secret with aws region, role and CMK ARN. Ceph-CSI will assume the given role with oidc token and access aws KMS, with given CMK to encrypt/decrypt DEK which will stored in the image metdata. Refer: https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html Resolves: #2879 Signed-off-by: Rakshith R <rar@redhat.com>
76 lines
2.2 KiB
Go
76 lines
2.2 KiB
Go
package document
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
)
|
|
|
|
// UnmarshalTypeError is an error type representing an error
|
|
// unmarshaling a Smithy document to a Go value type. This is different
|
|
// from UnmarshalError in that it does not wrap an underlying error type.
|
|
type UnmarshalTypeError struct {
|
|
Value string
|
|
Type reflect.Type
|
|
}
|
|
|
|
// Error returns the string representation of the error.
|
|
// Satisfying the error interface.
|
|
func (e *UnmarshalTypeError) Error() string {
|
|
return fmt.Sprintf("unmarshal failed, cannot unmarshal %s into Go value type %s",
|
|
e.Value, e.Type.String())
|
|
}
|
|
|
|
// An InvalidUnmarshalError is an error type representing an invalid type
|
|
// encountered while unmarshaling a Smithy document to a Go value type.
|
|
type InvalidUnmarshalError struct {
|
|
Type reflect.Type
|
|
}
|
|
|
|
// Error returns the string representation of the error.
|
|
// Satisfying the error interface.
|
|
func (e *InvalidUnmarshalError) Error() string {
|
|
var msg string
|
|
if e.Type == nil {
|
|
msg = "cannot unmarshal to nil value"
|
|
} else if e.Type.Kind() != reflect.Ptr {
|
|
msg = fmt.Sprintf("cannot unmarshal to non-pointer value, got %s", e.Type.String())
|
|
} else {
|
|
msg = fmt.Sprintf("cannot unmarshal to nil value, %s", e.Type.String())
|
|
}
|
|
|
|
return fmt.Sprintf("unmarshal failed, %s", msg)
|
|
}
|
|
|
|
// An UnmarshalError wraps an error that occurred while unmarshaling a
|
|
// Smithy document into a Go type. This is different from
|
|
// UnmarshalTypeError in that it wraps the underlying error that occurred.
|
|
type UnmarshalError struct {
|
|
Err error
|
|
Value string
|
|
Type reflect.Type
|
|
}
|
|
|
|
// Unwrap returns the underlying unmarshaling error
|
|
func (e *UnmarshalError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
// Error returns the string representation of the error.
|
|
// Satisfying the error interface.
|
|
func (e *UnmarshalError) Error() string {
|
|
return fmt.Sprintf("unmarshal failed, cannot unmarshal %q into %s, %v",
|
|
e.Value, e.Type.String(), e.Err)
|
|
}
|
|
|
|
// An InvalidMarshalError is an error type representing an error
|
|
// occurring when marshaling a Go value type.
|
|
type InvalidMarshalError struct {
|
|
Message string
|
|
}
|
|
|
|
// Error returns the string representation of the error.
|
|
// Satisfying the error interface.
|
|
func (e *InvalidMarshalError) Error() string {
|
|
return fmt.Sprintf("marshal failed, %s", e.Message)
|
|
}
|