Api Key
Describes a checked Buildless API key, which also carries metadata with it about the key. The key itself can be accessed via the key getter.
Usage examples
Use this value class when constructing a well-typed API key during plugin configuration. For example:
import build.less.plugin.gradle.*
import build.less.plugin.gradle.settings.*
plugin {
id("build.less") version "..."
}
buildless {
apiKey(ApiKey.of("..."))
}
// or, to enforce only `ORG`-type API keys:
buildless {
apiKey(ApiKey.of("...", type = SubjectType.ORG))
}
About API keys in Buildless
API keys are issued at the org and user levels. When a user is added to a Buildless org, they gain permission to access that org tenant's data via their own personal keys.
When you use an org key, no specific user is attached to the request. This is useful for systems like CI which don't run as any specific developer.
Key types
There are two key types in Buildless: the main API key, and the events API key. Users and org tenants both get each kind of key. When configuring the Buildless plugin for Gradle, you should always use your main key.
API key checks
The API key is checked for basic structural validity, and enforced against the type provided by the user, if any. If the key fails these checks, an error is thrown which halts the build.
If it is preferable to only perform cursory checks at runtime and allow the build to proceed in most cases, use any of the environment variable, system/Gradle properties, or configuration file methods to specify your keys. In this case, merely withholding the keys will gracefully skip enabling the cache.
Types
Exception which is thrown when an API key (detected or provided) is found to be invalid. This is a configuration error which must be remedied by the user.
Enumerates the types of "subjects" (security principals) for which API keys are made available by the Buildless service.