github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/environs/context/callcontext.go (about) 1 // Copyright 2020 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package context 5 6 import stdcontext "context" 7 8 // ModelCredentialInvalidator defines a point of use interface for invalidating 9 // a model credential. 10 type ModelCredentialInvalidator interface { 11 12 // InvalidateModelCredential invalidate cloud credential for the model. 13 InvalidateModelCredential(string) error 14 } 15 16 // CallContext creates a CloudCallContext for use when calling environ methods 17 // that may require invalidate a cloud credential. 18 func CallContext(ctx ModelCredentialInvalidator) *CloudCallContext { 19 // TODO(wallyworld) - pass in the stdcontext 20 callCtx := NewCloudCallContext(stdcontext.Background()) 21 callCtx.InvalidateCredentialFunc = ctx.InvalidateModelCredential 22 return callCtx 23 }