ceph-csi/vendor/github.com/aws/smithy-go/encoding/xml/array.go
Rakshith R 4f0bb2315b rbd: add aws-sts-metdata encryption type
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>
2022-03-16 07:29:56 +00:00

50 lines
1.5 KiB
Go

package xml
// arrayMemberWrapper is the default member wrapper tag name for XML Array type
var arrayMemberWrapper = StartElement{
Name: Name{Local: "member"},
}
// Array represents the encoding of a XML array type
type Array struct {
w writer
scratch *[]byte
// member start element is the array member wrapper start element
memberStartElement StartElement
// isFlattened indicates if the array is a flattened array.
isFlattened bool
}
// newArray returns an array encoder.
// It also takes in the member start element, array start element.
// It takes in a isFlattened bool, indicating that an array is flattened array.
//
// A wrapped array ["value1", "value2"] is represented as
// `<List><member>value1</member><member>value2</member></List>`.
// A flattened array `someList: ["value1", "value2"]` is represented as
// `<someList>value1</someList><someList>value2</someList>`.
func newArray(w writer, scratch *[]byte, memberStartElement StartElement, arrayStartElement StartElement, isFlattened bool) *Array {
var memberWrapper = memberStartElement
if isFlattened {
memberWrapper = arrayStartElement
}
return &Array{
w: w,
scratch: scratch,
memberStartElement: memberWrapper,
isFlattened: isFlattened,
}
}
// Member adds a new member to the XML array.
// It returns a Value encoder.
func (a *Array) Member() Value {
v := newValue(a.w, a.scratch, a.memberStartElement)
v.isFlattened = a.isFlattened
return v
}