Package org.springframework.boot.cloud
Enum Class CloudPlatform
- All Implemented Interfaces:
Serializable
,Comparable<CloudPlatform>
,Constable
Simple detection for well known cloud platforms. Detection can be forced using the
"spring.main.cloud-platform"
configuration property.- Since:
- 1.3.0
- Author:
- Phillip Webb, Brian Clozel, Nguyen Sach
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAzure App Service platform.Cloud Foundry platform.Heroku platform.Kubernetes platform.Nomad platform.No Cloud platform.SAP Cloud platform. -
Method Summary
Modifier and TypeMethodDescriptionstatic CloudPlatform
getActive
(Environment environment) Returns the activeCloudPlatform
ornull
if one is not active.boolean
isActive
(Environment environment) Determines if the platform is active (i.e.abstract boolean
isDetected
(Environment environment) Determines if the platform is detected by looking for platform-specific environment variables.boolean
isEnforced
(Binder binder) Determines if the platform is enforced by looking at the"spring.main.cloud-platform"
configuration property.boolean
isEnforced
(Environment environment) Determines if the platform is enforced by looking at the"spring.main.cloud-platform"
configuration property.boolean
Returns if the platform is behind a load balancer and uses X-Forwarded-For headers.static CloudPlatform
Returns the enum constant of this class with the specified name.static CloudPlatform[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No Cloud platform. Useful when false-positives are detected. -
CLOUD_FOUNDRY
Cloud Foundry platform. -
HEROKU
Heroku platform. -
SAP
SAP Cloud platform. -
NOMAD
Nomad platform.- Since:
- 3.1.0
-
KUBERNETES
Kubernetes platform. -
AZURE_APP_SERVICE
Azure App Service platform.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
isActive
Determines if the platform is active (i.e. the application is running in it).- Parameters:
environment
- the environment- Returns:
- if the platform is active.
-
isEnforced
Determines if the platform is enforced by looking at the"spring.main.cloud-platform"
configuration property.- Parameters:
environment
- the environment- Returns:
- if the platform is enforced
- Since:
- 2.3.0
-
isEnforced
Determines if the platform is enforced by looking at the"spring.main.cloud-platform"
configuration property.- Parameters:
binder
- the binder- Returns:
- if the platform is enforced
- Since:
- 2.4.0
-
isDetected
Determines if the platform is detected by looking for platform-specific environment variables.- Parameters:
environment
- the environment- Returns:
- if the platform is auto-detected.
- Since:
- 2.3.0
-
isUsingForwardHeaders
public boolean isUsingForwardHeaders()Returns if the platform is behind a load balancer and uses X-Forwarded-For headers.- Returns:
- if X-Forwarded-For headers are used
-
getActive
Returns the activeCloudPlatform
ornull
if one is not active.- Parameters:
environment
- the environment- Returns:
- the
CloudPlatform
ornull
-