github.com/aavshr/aws-sdk-go@v1.41.3/service/s3/s3crypto/mat_desc.go (about)

     1  package s3crypto
     2  
     3  import (
     4  	"encoding/json"
     5  )
     6  
     7  // MaterialDescription is used to identify how and what master
     8  // key has been used.
     9  type MaterialDescription map[string]*string
    10  
    11  // Clone returns a copy of the MaterialDescription
    12  func (md MaterialDescription) Clone() (clone MaterialDescription) {
    13  	if md == nil {
    14  		return nil
    15  	}
    16  	clone = make(MaterialDescription, len(md))
    17  	for k, v := range md {
    18  		clone[k] = copyPtrString(v)
    19  	}
    20  	return clone
    21  }
    22  
    23  func (md *MaterialDescription) encodeDescription() ([]byte, error) {
    24  	v, err := json.Marshal(&md)
    25  	return v, err
    26  }
    27  
    28  func (md *MaterialDescription) decodeDescription(b []byte) error {
    29  	return json.Unmarshal(b, &md)
    30  }
    31  
    32  func copyPtrString(v *string) *string {
    33  	if v == nil {
    34  		return nil
    35  	}
    36  	ns := *v
    37  	return &ns
    38  }