Using provider-specific APIs
It is not feasible or desirable for APIs like
blob.Bucket to encompass the
full functionality of every provider. Rather, we intend to provide a subset
of the most commonly used functionality. There will be cases where a
developer wants to access provider-specific functionality, such as unexposed
APIs or data fields, errors, or options. This can be accomplished using
As functions in the APIs provide the user a way to escape the Go CDK
abstraction to access provider-specific types. They might be used as an
interim solution until a feature request to the Go CDK is implemented. Or,
the Go CDK may choose not to support specific features, and the use of
will be permanent.
As implies that the resulting code is no longer portable; the
provider-specific code will need to be ported in order to switch providers.
Therefore, it should be avoided if possible.
Each API includes examples demonstrating how to use its various
functions, and each provider implementation documents what types it supports
- Declare a variable of the provider-specific type you want to access.
- Pass a pointer to it to
- If the type is supported,
trueand copy the provider-specific type into your variable. Otherwise, it will return
Provider-specific types that are intended to be mutable will be exposed as a pointer to the underlying type.