NewMasterKey creates a new MasterKey from a region:key-id string, setting the creation date to the current date.
(keyID string)
| 62 | // NewMasterKey creates a new MasterKey from a region:key-id string, setting |
| 63 | // the creation date to the current date. |
| 64 | func NewMasterKey(keyID string) (*MasterKey, error) { |
| 65 | region, keyUUID, err := parseKeyID(keyID) |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | return &MasterKey{ |
| 70 | KeyID: keyID, |
| 71 | Region: region, |
| 72 | KeyUUID: keyUUID, |
| 73 | CreationDate: time.Now().UTC(), |
| 74 | }, nil |
| 75 | } |
| 76 | |
| 77 | // NewMasterKeyFromKeyIDString takes a comma separated list of HuaweiCloud KMS |
| 78 | // key IDs in format "region:key-uuid", and returns a slice of new MasterKeys. |