Documentation ¶
Index ¶
- Constants
- func BuildUserAgent(params UserAgentBuilderParams) string
- func FindGoModuleVersion(modulePath string) *string
- func GenerateRandomResourceName() string
- func GetDefaultFromEnv(key, fallback string) string
- func RandIntRange(min int, max int) int
- func RandString(strlen int) string
- func RandStringFromCharSet(strlen int, charSet string) string
- func RenderAvailableDocumentationValuesIntSlice(s []int) string
- func RenderAvailableDocumentationValuesStringSlice(s []string) string
- func RenderMustProviderOnlyOneOfDocumentationValuesStringSlice(s []string) string
- type UserAgentBuilderParams
Constants ¶
const ( // CharSetAlphaNum is the alphanumeric character set for use with // RandStringFromCharSet. CharSetAlphaNum = "abcdefghijklmnopqrstuvwxyz012346789" // CharSetAlpha is the alphabetical character set for use with // RandStringFromCharSet. CharSetAlpha = "abcdefghijklmnopqrstuvwxyz" // Length of the resource name we wish to generate. ResourceNameLength = 10 )
Variables ¶
This section is empty.
Functions ¶
func BuildUserAgent ¶
func BuildUserAgent(params UserAgentBuilderParams) string
BuildUserAgent takes the `UserAgentBuilderParams` and contextually builds a HTTP user agent for making API calls.
func FindGoModuleVersion ¶
FindGoModuleVersion digs into the build information and extracts the version of a module for use without the prefixed `v` (should it exist).
func GenerateRandomResourceName ¶
func GenerateRandomResourceName() string
GenerateRandomResourceName builds a unique-ish resource identifier to use in tests.
func GetDefaultFromEnv ¶
func RandIntRange ¶
RandIntRange returns a random integer between min (inclusive) and max (exclusive).
func RandString ¶
RandString generates a random alphanumeric string of the length specified.
func RandStringFromCharSet ¶
RandStringFromCharSet generates a random string by selecting characters from the charset provided.
func RenderAvailableDocumentationValuesIntSlice ¶
RenderAvailableDocumentationValuesIntSlice takes a slice of ints and formats it for documentation output use.
Example: [1, 2, 3] -> `1`, `2`, `3`.
func RenderAvailableDocumentationValuesStringSlice ¶
RenderAvailableDocumentationValuesStringSlice takes a slice of strings and formats it for documentation output use.
Example: ["foo", "bar", "baz"] -> `foo`, `bar`, `baz`.
Types ¶
type UserAgentBuilderParams ¶
type UserAgentBuilderParams struct { // Version of `terraform-provider-cloudflare`. ProviderVersion *string // Version of `terraform-plugin-*` libraries that we rely on for the internal // operations. PluginVersion *string // Which plugin is in use. Currently only available options are // `terraform-plugin-sdk` and `terraform-plugin-framework`. PluginType *string // Version of Terraform that is initiating the operation. Mutually exclusive // with `OperatorSuffix`. TerraformVersion *string // Customised operation suffix to append to the user agent for identifying // traffic. Mutually exclusive with `TerraformVersion`. OperatorSuffix *string }
func (*UserAgentBuilderParams) String ¶
func (p *UserAgentBuilderParams) String() string