Package io.micronaut.gcp.credentials
Class GoogleCredentialsConfiguration
- java.lang.Object
-
- io.micronaut.gcp.credentials.GoogleCredentialsConfiguration
-
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
@ConfigurationProperties("gcp.credentials") @Context public class GoogleCredentialsConfiguration extends java.lang.Object implements io.micronaut.core.util.Toggleable
Configuration for the Google credentials.- Since:
- 1.0
- Author:
- graemerocher, Ray Tsang
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_ENABLED
Google credentials configuration is enabled by default.static java.util.List<java.net.URI>
DEFAULT_SCOPES
The default scopes.static java.lang.String
PREFIX
The prefix to use.
-
Constructor Summary
Constructors Constructor Description GoogleCredentialsConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
getEncodedKey()
The Base64 encoded service account key content.java.util.Optional<java.lang.String>
getLocation()
The location of the service account credential key file.java.util.List<java.net.URI>
getScopes()
The scopes to use.boolean
isEnabled()
Returns whether Google credentials configuration is enabled or not.void
setEnabled(boolean enabled)
Allows disabling Google credentials configuration.void
setEncodedKey(java.lang.String encodedKey)
Sets the Base64 encoded service account key content..void
setLocation(java.lang.String location)
Sets the location to the service account credential key file.void
setScopes(java.util.List<java.net.URI> scopes)
The default scopes to associate with the application to access specific APIs.
-
-
-
Field Detail
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
Google credentials configuration is enabled by default.
-
DEFAULT_SCOPES
public static final java.util.List<java.net.URI> DEFAULT_SCOPES
The default scopes.
-
PREFIX
public static final java.lang.String PREFIX
The prefix to use.- See Also:
- Constant Field Values
-
-
Method Detail
-
getScopes
@NonNull public java.util.List<java.net.URI> getScopes()
The scopes to use.- Returns:
- The scopes
-
setScopes
public void setScopes(@Nullable java.util.List<java.net.URI> scopes)
The default scopes to associate with the application to access specific APIs. See Google Scopes for a complete list. Leave this empty if you don't need additional API access.- Parameters:
scopes
- The scopes
-
getLocation
@NonNull public java.util.Optional<java.lang.String> getLocation()
The location of the service account credential key file. See Understanding Service Accounts for more information on generating a service account key file.- Returns:
- The location
-
setLocation
public void setLocation(@Nullable java.lang.String location)
Sets the location to the service account credential key file.- Parameters:
location
- The location
-
getEncodedKey
@NonNull public java.util.Optional<java.lang.String> getEncodedKey()
The Base64 encoded service account key content. This is not recommended except if you need to encode service account key via an environmental variable. For other use cases, configurelocation
instead.- Returns:
- The key
-
setEncodedKey
public void setEncodedKey(@Nullable java.lang.String encodedKey)
Sets the Base64 encoded service account key content..- Parameters:
encodedKey
- The key
-
isEnabled
public boolean isEnabled()
Returns whether Google credentials configuration is enabled or not.- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
- Since:
- 4.4.1
-
setEnabled
public void setEnabled(boolean enabled)
Allows disabling Google credentials configuration. This may be useful in situations where you don't want to authenticate despite having the Google Cloud SDK configured. Default value is true.- Parameters:
enabled
- whether to enable or disable Google credentials configuration.- Since:
- 4.4.1
-
-