MCPcopy
hub / github.com/getsops/sops / getRotateOpts

Function getRotateOpts

cmd/sops/main.go:2280–2301  ·  view source on GitHub ↗
(c *cli.Context, fileName string, inputStore common.Store, outputStore common.Store, svcs []keyservice.KeyServiceClient, decryptionOrder []string)

Source from the content-addressed store, hash-verified

2278}
2279
2280func getRotateOpts(c *cli.Context, fileName string, inputStore common.Store, outputStore common.Store, svcs []keyservice.KeyServiceClient, decryptionOrder []string) (rotateOpts, error) {
2281 kmsEncryptionContext := kms.ParseKMSContext(c.String("encryption-context"))
2282 addMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "add-kms", "add-pgp", "add-gcp-kms", "add-hckms", "add-azure-kv", "add-hc-vault-transit", "add-age")
2283 if err != nil {
2284 return rotateOpts{}, err
2285 }
2286 rmMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "rm-kms", "rm-pgp", "rm-gcp-kms", "rm-hckms", "rm-azure-kv", "rm-hc-vault-transit", "rm-age")
2287 if err != nil {
2288 return rotateOpts{}, err
2289 }
2290 return rotateOpts{
2291 OutputStore: outputStore,
2292 InputStore: inputStore,
2293 InputPath: fileName,
2294 Cipher: aes.NewCipher(),
2295 KeyServices: svcs,
2296 DecryptionOrder: decryptionOrder,
2297 IgnoreMAC: c.Bool("ignore-mac"),
2298 AddMasterKeys: addMasterKeys,
2299 RemoveMasterKeys: rmMasterKeys,
2300 }, nil
2301}
2302
2303func toExitError(err error) error {
2304 if cliErr, ok := err.(*cli.ExitError); ok && cliErr != nil {

Callers 1

mainFunction · 0.85

Calls 4

ParseKMSContextFunction · 0.92
NewCipherFunction · 0.92
getMasterKeysFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected