# Packages

Copyright 2024 Google LLC.

# Functions

AddQueryParams adds the specified query parameters to the specified url.
AnySet returns true if any of the values provided is nonempty.
APIRequestID returns the RequestID for the API call.
Bool converts a bool to a *bool.
BoolCanonicalize checks canonicalization for booleans.
CaseInsensitiveString returns true if the arguments are considered equal ignoring case.
CaseInsensitiveStringArray returns true if the arguments are considered equal ignoring case, but including ordering.
CompareStringSets returns two slices of strings, one of strings in set a but not b, and one of strings in set b but not a.
ConstructLogPrefixFromContext constructs log prefix from info in context.
ContextWithRequestID adds APIRequestID to ctx if APIRequestID is not present.
ConvertToMap converts the specified object into the map[string]interface{} which can be serialized into the same json object as the input object.
Copy makes a deep copy of an interface.
CreateAPIRequestID creates a random APIRequestId.
DefaultLogger returns the default logger for the Declarative Client Library.
DeriveField deals with the outgoing portion of derived fields.
DeriveFieldArray calls DeriveField on each entry in the provided slice.
DeriveFromPattern attempts to achieve the same end goal as DeriveField but by using regular expressions rather than assumptions about the format of the inputs based on the number of `/`.
Diff takes in two interfaces and diffs them according to Info.
Do performs op as a retryable operation, using retry to determine when and if to retry.
EmptyValue returns an empty value to exclude PARAMETER-type values from being expanded.
ExpandProjectIDsToNumbers converts a project ID to a project number.
ExtractElementFromList takes in bytes corresponding to a json object of the structure { "listKey": [{"foo": "bar", ...}, {"foo": "baz", ...}] } and returns the first element for which isElement returns true.
FalseToNil returns nil if the pointed-to boolean is 'false' - otherwise returns the pass-in pointer.
FetchLifecycleParams returns the list of lifecycle params.
FetchProjectInfo returns a ProjectResponse from CloudResourceManager.
FetchStateHint returns either nil or a dcl.Resource representing the pre-apply state.
FindStringInArray returns true if value found in array of strings.
FlattenBool asserts that an interface is a bool and returns a pointer to it, or a pointer to false if the value is invalid.
FlattenDouble asserts that an interface is a float64 and returns a pointer to it, or to 0.0 if the value is invalid.
FlattenFloatSlice asserts that an interface is a []float64 and returns it.
FlattenInteger turns an interface pointing to an arbitary type into *in64, taking into account that it may have been represented as various types per https://developers.google.com/discovery/v1/type-format.
FlattenIntSlice asserts that an interface is a []int and returns it.
FlattenKeyValueInterface returns a pointer to an interface.
FlattenKeyValuePairs asserts that an interface is a map[string]string and returns it, or an empty map if the value is invalid.
FlattenProjectNumbersToIDs converts a project number to project ID.
FlattenSecretValue behaves the same way as FlattenString, except that it returns nil if the value is not present.
FlattenString asserts that an interface is a string and returns a pointer to it, or to the empty string if the value is invalid.
FlattenStringSlice asserts that an interface is a []string and returns it.
FlattenTime asserts that an interface is a time.Time and returns it.
Float64 converts a float64 to *float64.
Float64OrNil converts a float64 to *float64, returning nil if it's empty (0.0).
FloatSliceEquals takes in two slices of float64s and checks their equality.
GetMapEntry returns the value at `path` from `m`, following the same rules as `MoveMapEntry` except that a missing map or value is an error.
GetMTLSEndpoint returns the API endpoint used for mTLS authentication.
HandleLogArgs ensures that pointer arguments are dereferenced well.
HasCode returns true if the given error is an HTTP response with the given code.
HasLifecycleParam returns whether the given slice has the requested param.
Int64 converts an int64 to *int64.
Int64OrNil converts an int64 to *int64, returning nil if it's empty (0).
IntSliceEquals takes in two slices of int64s and checks their equality.
IsConflictError returns true if the error has conflict error code 409.
IsEmptyValueIndirect returns true if the value provided is "empty", according to the golang rules.
IsNonRetryableHTTPError returns true if we know that the error is not retryable - in GCP that's a 400, 403, 404, or 409.
IsNotFound returns true if the given error is a NotFoundError or is an HTTP 404.
IsNotFoundOrCode returns true if the given error is a NotFoundError, an HTTP 404, or an HTTP response with the given code.
IsPartialSelfLink returns true if this string represents a partial self link.
IsRegion returns true if this string refers to a GCP region.
IsRetryableGoogleError returns true if the error is retryable according to the given retryability.
IsRetryableHTTPError returns true if the error is retryable - in GCP that's a 500, 502, 503, or 429.
IsRetryableRequestError returns true if an error is determined to be a common retryable error based on heuristics about GCP API behaviours.
IsSelfLink returns true if this string represents a full self link.
IsZeroValue returns true if the argument is considered empty/unset.
IsZone returns true if this string refers to a GCP zone.
ListOfKeyValuesFromMap is the opposite of MapFromListOfKeyValues, used in marshalling instead of unmarshalling.
ListOfKeyValuesFromMapInStruct returns the opposite of MapFromListOfKeyValues, except nested inside an struct under the subfield name.
MapEquals returns if two maps are equal, while ignoring any keys with ignorePrefixes.
MapFromListOfKeyValues turns a [{"key": k, "value": v}, ...] format-map into a normal string-string map.
MatchingSemver returns whether the two strings should be considered equivalent according to semver rules.
MatchingSemverInterface matches two interfaces according to MatchingSemver.
MoveMapEntry moves the entry at `from` to `to`.
NameFromSelfLink takes in a self link string and returns the name.
NameToSelfLink returns true if left and right are equivalent for Names / SelfLinks.
NewBackoff returns a Backoff with sensible defaults set.
NewBackoffWithOptions returns a Backoff with caller-supplied parameters.
NewConfig creates a Config object.
Nprintf takes in a format string (with format {{key}} instead of %s) and a params map.
ParseResponse reads a JSON response into a Go struct.
PartialSelfLinkToSelfLink returns true if left and right are equivalent for SelfLinks and partial SelfLinks.
PartialSelfLinkToSelfLinkArray returns true if left and right are all equivalent for SelfLinks.
ProtoCamelCase converts a snake case name to a upper camel case name using the go protoc special rules: convert to camel case, except when the character following the underscore is a digit; e.g., foo_bar_2 -> FooBar_2.
ProtoToTime converts a string from a DCL proto time string to a time.Time.
PutMapEntry inserts `item` at `path` into `m` - the inverse of GetMapEntry.
QuoteAndCaseInsensitiveString returns true if the arguments are considered equal ignoring case and quotedness (e.g.
QuoteAndCaseInsensitiveStringArray returns true if the arguments are considered equal ignoring case and quotedness (e.g.
RandomString generates a random alpha-numeric string of input length.
Required takes in a DCL resource (represented as an interface) and a dot-notated path (with JSON names).
RequiredParameter takes in a value (typically one that's not exported in JSON) and returns an error if it is not set.
RequiresRecreate is for Operations that require recreating.
ResponseBodyAsJSON reads the response body from a *RetryDetails and returns it as unstructured JSON in a map[string]interface{}.
SelfLinkToName returns the element of a string after the last slash.
SelfLinkToNameArray returns a slice of the elements of a slice of strings after the last slash.
SelfLinkToNameArrayExpander returns the last element of each string in a slice after the last slash.
SelfLinkToNameExpander returns the element of a string after the last slash.
SelfLinkToNameWithPattern handles when the resource name can have `/` in it by matching the pattern.
SelfLinkToSelfLink returns true if left and right are equivalent for selflinks.
SendRequest applies the credentials in the provided Config to a request with the specified verb, url, and body.
ShouldLogRequest returns true if the request should be logged.
SliceEquals takes in two slices of strings and checks their equality.
SnakeCaseUpdateMask returns the update mask, but all fields are snake case.
SnakeToJSONCase converts a snake_case string to jsonCase / camelCase, for use in JSON serialization.
SnakeToTitleCase converts a snake_case string to TitleCase / Go struct case.
SnakeToTitleCasePath converts a resource path from snake to title case.
SnakeToTitleParts returns the parts of a snake_case string titlecased as an array, taking into account common initialisms.
SprintResource prints a struct into a multiline string to display to readers.
SprintResourceCompact prints a struct into a compact single line string.
String converts a string to a *string.
StringArrayCanonicalize checks canonicalization for arrays of strings.
StringCanonicalize checks canonicalization for strings.
StringEquals returns true if these two strings are equal.
StringEqualsWithSelfLink returns true if these two strings are equal.
StringOrNil converts a string to a *string, returning nil if it's empty ("").
StringSliceContains returns true if the slice ss contains string s.
StringSliceEquals returns true if v, q arrays of strings are equal according to StringEquals.
StringSliceEqualsWithSelfLink returns true if v, q arrays of strings are equal according to StringEqualsWithSelfLink.
StringWithError converts a string to a *string, returning a nil error to satisfy type signatures that expect one.
TimeToProto converts a time.Time to a proto time string.
TitleToCamelCasePath converts a resource path from title case to lower title case.
TitleToSnakeCase takes in a TitleCase string and returns a snake_case string.
TopLevelUpdateMask returns only the top-level fields.
TriggersOperation is used to tell the diff checker to trigger an operation.
UnorderedStringSliceEquals returns true if a, b contains same set of elements irrespective of their ordering.
UpdateMask creates a Update Mask string according to https://google.aip.dev/161.
UpdateMaskWithPrefix returns a Standard Update Mask with a prefix attached.
URL takes in a partial URL, default base path, optional user-specified base-path and a params map.
UserProjectOverride returns true if user project override should be used and the project that should be set.
ValidateAtLeastOneOfFieldsSet returns an error if none of the provided values is nonempty.
ValidateAtMostOneOfFieldsSet returns an error if more than one of the provided values is nonempty.
ValidateExactlyOneOfFieldsSet returns an error if 0 or 2+ of the provided values is nonempty.
ValueFromRegexOnField assigns val to the regex value on containerVal if val is unset.
ValueOrEmptyBool returns the value or the default value if the pointer is nil.
ValueOrEmptyDouble returns the value or the default value if the pointer is nil.
ValueOrEmptyInt64 returns the value or the default value if the pointer is nil.
ValueOrEmptyString takes a scalar or pointer to a scalar and returns either the empty string or its value.
ValueShouldBeSent returns if a value should be sent as part of the JSON request.
ValueType returns the reflect-style kind of an interface or the underlying type of a pointer.
WithAPIKey returns a ConfigOption that specifies an API key to be used as the basis for authentication.
WithBasePath allows a base path to be overridden.
WithBillingProject returns a ConfigOption that specifies the user override project.
WithClientCertSource returns a ConfigOption that specifies a callback function for obtaining a TLS client certificate.
WithCodeRetryability allows a user to add additional retryable or non-retryable error codes.
WithContentType allows a user to override the default Content-Type header.
WithContextLogger allows a user to specify a custom context logger.
WithCredentials returns a ConfigOption that authenticates API calls using a caller-supplier Credentials struct.
WithCredentialsFile returns a ConfigOption that authenticates API calls with the given service account or refresh token JSON credentials file.
WithCredentialsJSON returns a ConfigOption that authenticates API calls with the given service account or refresh token JSON credentials.
WithHeader allows aribitrary HTTP headers to be addded to requests.
WithHTTPClient returns a ConfigOption that specifies the HTTP client to use as the basis of communications.
WithLifecycleParam allows a user to specify the proper lifecycle params.
WithLogger allows a user to specify a custom logger.
WithoutTrailingDot returns true if the arguments are equivalent ignoring a final period.
WithoutTrailingDotArray returns true if WithoutTrailingDot returns true for each pair of elements in the lists.
No description provided by the author
WithQueryParams allows a user to override the default query parameters.
WithRetryProvider allows a user to override default exponential backoff retry behavior.
WithStateHint takes in a resource which will be used in place of the applied resource any time the current configuration of the resource is relevant.
WithTimeout allows a user to override default operation timeout.
WithUserAgent allows a user to specify a custom user-agent.
WithUserProjectOverride returns a ConfigOption that turns on WithUserProjectOverride.
WrapStringsWithKey returns a slice of maps with one key (the 'key' argument) and one value (each value in 'values').

# Constants

Keys used in context Value.
ArrayType refers to a Field that is an Array of any kind.
BackoffInitialInterval is the default InitialInterval value for Backoff.
BackoffMaxInterval is the default MaxInterval value for Backoff.
BlockAcquire will error if the resource already exists.
BlockCreation will error if the resource does not exist.
BlockDestruction blocks deleting the resource.
BlockModification will error if the resource is not in the desired state.
BooleanType refers to a Field that is a Boolean.
Keys used in context Value.
DoubleType refers to a Field that is a Double.
EnumType refers to a Field that is an Enum.
Error will print Error and all Fatal logs.
Fatal will print only Fatal logs.
IgnoreIfMissing does not create (and does not error) if the resource does not exist.
IntegerType refers to a Field that is an Integer.
LoggerInfo will print Info and all Warning logs.
MapType refers to a Field that is a Map (typically from string to string).
NoopOnDestroy does not destroy the resource, even if Delete() is called.
ObjectType refers to a Field that is a dictionary with set subfields.
ReferenceType refers to a Field that is referencing another GCP resource.
ReusedType refers to a Field that does not require additional generation because it is the same type as another field already being generated.
StatusType refers to a Field that is a Status.
Stop is a value that indicates that no more retries should be attempted.
StringType refers to a Field that is a String.
TimeType refers to a Field that is a Timestamp.
UnknownType refers to a Field that does not have a proper type defined.
UntypedType refers to a type that has no type (in Go-speak, that's an interface{}).
Warning will print Warning and all Error logs.

# Variables

Scopes defines the common OAuth scopes needed for clients making GCP API calls.

# Structs

ApplyInfeasibleError is returned when lifecycle directives prevent an Apply from proceeding.
ApplyOpts refers to options that are taken in the apply function.
AttemptToIndexNilArray is returned when GetMapEntry is called with a path that includes an array index and that array is unset in the map.
Backoff is a Retry implementation that uses exponential backoff with jitter.
BackoffRetryProvider is a default RetryProvider that returns a Backoff.
Component contains all the information for a component (resource or reused type).
Components maps a Component name to the Component.
Config is used to enclose the credentials and http client used to make requests to GCP APIs.
ContextLogger is the internal logger implementation.
DiffAfterApplyError is returned when there are differences between the desired state and the intended state after Apply completes.
DiffInfo is a struct that contains all information about the diff that's about to occur.
EnumInvalidError is returned when an enum is set (by a client) to a string value that is not valid for that enum.
FieldDiff contains all information about a diff that exists in the resource.
FieldName is used to add information about a field's name for logging purposes.
Info is the Info block for the OpenAPI schema.
Link is a URL plus text that should be displayed to an end user, usually in docs.
NoRetry is a Retry implementation that will never retry.
NotDeletedError is returned when the resource should be deleted but has not been.
NotFoundError is returned when a resource does not exist.
OperationNotDone is returned when an API operation hasn't completed.
Path is the Path used for a method.
PathParameters is the Parameters for a given Path.
PathParametersSchema is used to store the type.
Paths is the Paths block for the OpenAPI schema.
ProjectResponse is the response from Cloud Resource Manager.
Property contains all information for a field (i.e.
PropertyResourceReference contains all resource reference information.
Retryability holds the details for one error code to determine if it is retyable.
RetryDetails provides information about an operation that a Retry implementation can use to make decisions about when or if to perform further requests.
Schema is the Entire OpenAPI schema.
ServiceTypeVersion is a tuple that can uniquely identify a DCL resource type.

# Interfaces

ApplyOption is an option that is accepted by Apply() functions.
Logger is an interface for logging requests and responses.
No description provided by the author
Retry provides an interface for handling retryable operations in a flexible manner.
RetryProvider allows callers to provide custom retry behavior.

# Type aliases

ConfigOption is used to functionally configure Configs.
FieldType is an enum of all the types a field can be.
LifecycleParam is used to specify what operations are acceptable.
LoggerLevel is the most basic level that a logger should print.
Operation is a retryable function.
ReqCtxKey is the key type for storing values in the context.