Class SimulatorComputeSource
java.lang.Object
co.yellowdog.platform.model.SimulatorComputeSource
- All Implemented Interfaces:
ComputeSource
,Credentialed
,Identified
,Named
,Serializable
@JsonClassDescription("Details needed for simulating the provisioning of instances")
public class SimulatorComputeSource
extends Object
implements ComputeSource
Defines a simulated source of compute that can be used to test the YellowDog Compute system.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder that can be used to build a new SimulatorComputeSource that is automatically validated on build. -
Field Summary
Fields inherited from interface co.yellowdog.platform.model.ComputeSource
DEFAULT_ASSIGN_PUBLIC_IP
-
Constructor Summary
ConstructorsConstructorDescriptionSimulatorComputeSource
(String name, String region, String instanceType, String imageId, Map<String, String> instanceTags, int limit, int instanceStartupTimeSeconds, float instanceStartupTimeVariance, int instanceShutdownTimeSeconds, float instanceShutdownTimeVariance, float unexpectedInstanceTerminationProbability, boolean failOnRequestAllInstances, boolean failOnProvision, boolean reportSupportingResourcesExist) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
protected boolean
boolean
Gets the ID of the source template if this source was created from a template.Return the names of the credentials to be used for this Credentialed entity.If this source is associated with an exhausted allowance, gets the exhaustion state.getId()
Returns the IDGets the image ID to use for the instances that will be provisioned.The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.Gets the instance pricing for this source, e.g.int
The simulated shutdown time for an instance.float
A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.int
The simulated startup time for an instance.float
A variance multiplier (from 0 to 1) applied randomly to the instance startup time.A summary of instance counts according to instance statusGets the custom instance tags to be set on the provisioned instance at startup.Gets the provider-specific instance type of the instances that will be provisioned.int
getLimit()
Returns the limit in number of instances that can be provisioned from this source.getName()
Returns the name of this compute source (which must be unique within the containing ComputeRequirement).Gets the Cloud Provider for this source.Gets the provider-specific region where instances will be provisioned.Gets the current provisioning status of this source.Gets the message associated with the current provisioning status of this source.Gets the provider-specific subregion (aka Availability Domain, Availability Zone or Zone) where instances will be provisioned.Indicates if supporting resources have been created for this source.Returns an object describing behavioural traits specific to this compute source.float
The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.Gets the user-data script to be passed to the provisioned instance at startup.int
hashCode()
boolean
boolean
boolean
void
setCreatedFromId
(String createdFromId) Sets the source template IDvoid
setCredential
(String credential) void
setExhaustion
(ComputeSourceExhaustion exhaustion) void
setFailOnProvision
(boolean failOnProvision) void
setFailOnRequestAllInstances
(boolean failOnRequestAllInstances) void
Sets the IDvoid
setImageId
(String imageId) Sets the image ID to use for the instances that will be provisioned.void
setImplicitCapacity
(Integer implicitCapacity) The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.void
setInstanceShutdownTimeSeconds
(int instanceShutdownTimeSeconds) The simulated shutdown time for an instance.void
setInstanceShutdownTimeVariance
(float instanceShutdownTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.void
setInstanceStartupTimeSeconds
(int instanceStartupTimeSeconds) The simulated startup time for an instance.void
setInstanceStartupTimeVariance
(float instanceStartupTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance startup time.void
setInstanceSummary
(InstanceSummary instanceSummary) void
setInstanceTags
(Map<@SimulatorInstanceTagKey String, @SimulatorInstanceTagValue String> instanceTags) Sets the custom instance tags to be set on the provisioned instance at startup.void
setInstanceType
(String instanceType) Sets the provider-specific instance type of the instances that will be provisioned.void
setLimit
(int limit) Sets the limit in number of instances that can be provisioned from this source.void
Sets the name of this compute source (which must be unique within the containing ComputeRequirement).void
void
setReportSupportingResourcesExist
(boolean reportSupportingResourcesExist) void
setStatus
(ComputeSourceStatus status) Sets the current provisioning status of this source.void
setStatusMessage
(String statusMessage) Sets the message associated with the current provisioning status of this source.void
setUnexpectedInstanceTerminationProbability
(float unexpectedInstanceTerminationProbability) The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.void
setUserData
(String userData) Sets the user-data script to be passed to the provisioned instance at startup.toString()
-
Constructor Details
-
SimulatorComputeSource
public SimulatorComputeSource(String name, String region, String instanceType, String imageId, Map<String, String> instanceTags, int limit, int instanceStartupTimeSeconds, float instanceStartupTimeVariance, int instanceShutdownTimeSeconds, float instanceShutdownTimeVariance, float unexpectedInstanceTerminationProbability, boolean failOnRequestAllInstances, boolean failOnProvision, boolean reportSupportingResourcesExist)
-
-
Method Details
-
getTraits
Description copied from interface:ComputeSource
Returns an object describing behavioural traits specific to this compute source.- Specified by:
getTraits
in interfaceComputeSource
- Returns:
- an object describing behavioural traits specific to this compute source
-
getProvider
Description copied from interface:ComputeSource
Gets the Cloud Provider for this source.- Specified by:
getProvider
in interfaceComputeSource
- Returns:
- the Cloud Provider for this source
-
getInstancePricing
Description copied from interface:ComputeSource
Gets the instance pricing for this source, e.g. Spot- Specified by:
getInstancePricing
in interfaceComputeSource
- Returns:
- the instance pricing for this source
-
getSubregion
Description copied from interface:ComputeSource
Gets the provider-specific subregion (aka Availability Domain, Availability Zone or Zone) where instances will be provisioned.- Specified by:
getSubregion
in interfaceComputeSource
- Returns:
- the provider-specific subregion where instances will be provisioned
-
getUserData
Description copied from interface:ComputeSource
Gets the user-data script to be passed to the provisioned instance at startup.- Specified by:
getUserData
in interfaceComputeSource
- Returns:
- the user-data script
-
setUserData
Description copied from interface:ComputeSource
Sets the user-data script to be passed to the provisioned instance at startup.- Specified by:
setUserData
in interfaceComputeSource
- Parameters:
userData
- the user-data script
-
getSupportingResourceCreated
Description copied from interface:ComputeSource
Indicates if supporting resources have been created for this source.- Specified by:
getSupportingResourceCreated
in interfaceComputeSource
- Returns:
- true, if supporting resources have been created for this source; false, if no supporting resources have been created; null, if unknown
-
getCredentials
Description copied from interface:Credentialed
Return the names of the credentials to be used for this Credentialed entity.- Specified by:
getCredentials
in interfaceCredentialed
- Returns:
- the names of the credentials to be used
-
builder
-
toBuilder
-
getId
Description copied from interface:Identified
Returns the ID- Specified by:
getId
in interfaceComputeSource
- Specified by:
getId
in interfaceIdentified
- Returns:
- the ID
-
getCreatedFromId
Description copied from interface:ComputeSource
Gets the ID of the source template if this source was created from a template.- Specified by:
getCreatedFromId
in interfaceComputeSource
- Returns:
- the ID of the source template if this source was created from a template
-
getName
Description copied from interface:ComputeSource
Returns the name of this compute source (which must be unique within the containing ComputeRequirement).- Specified by:
getName
in interfaceComputeSource
- Specified by:
getName
in interfaceNamed
- Returns:
- the name of this compute source
-
getCredential
- Specified by:
getCredential
in interfaceComputeSource
-
getInstanceTags
Description copied from interface:ComputeSource
Gets the custom instance tags to be set on the provisioned instance at startup.- Specified by:
getInstanceTags
in interfaceComputeSource
- Returns:
- the custom instance tags
-
getImplicitCapacity
The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.- Returns:
- the implicit capacity of this source, independent of limit
-
getInstanceStartupTimeSeconds
public int getInstanceStartupTimeSeconds()The simulated startup time for an instance.- Returns:
- the simulated startup time for an instance
-
getInstanceStartupTimeVariance
public float getInstanceStartupTimeVariance()A variance multiplier (from 0 to 1) applied randomly to the instance startup time.- Returns:
- the instance startup time variance
-
getInstanceShutdownTimeSeconds
public int getInstanceShutdownTimeSeconds()The simulated shutdown time for an instance.- Returns:
- the simulated shutdown time for an instance
-
getInstanceShutdownTimeVariance
public float getInstanceShutdownTimeVariance()A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.- Returns:
- the instance shutdown time variance
-
getUnexpectedInstanceTerminationProbability
public float getUnexpectedInstanceTerminationProbability()The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.- Returns:
- the probability of unexpected instance termination
-
isFailOnRequestAllInstances
public boolean isFailOnRequestAllInstances() -
isFailOnProvision
public boolean isFailOnProvision() -
isReportSupportingResourcesExist
public boolean isReportSupportingResourcesExist() -
getLimit
public int getLimit()Description copied from interface:ComputeSource
Returns the limit in number of instances that can be provisioned from this source.- Specified by:
getLimit
in interfaceComputeSource
- Returns:
- the limit in number of instances that can be provisioned from this source
-
getInstanceSummary
Description copied from interface:ComputeSource
A summary of instance counts according to instance status- Specified by:
getInstanceSummary
in interfaceComputeSource
- Returns:
- a summary of instance counts according to instance status
-
getStatus
Description copied from interface:ComputeSource
Gets the current provisioning status of this source.- Specified by:
getStatus
in interfaceComputeSource
- Returns:
- the current provisioning status of this source
-
getStatusMessage
Description copied from interface:ComputeSource
Gets the message associated with the current provisioning status of this source. Returns null if no further detail is relevant to the status.- Specified by:
getStatusMessage
in interfaceComputeSource
- Returns:
- the message associated with the current provisioning status of this source
-
getExhaustion
Description copied from interface:ComputeSource
If this source is associated with an exhausted allowance, gets the exhaustion state.- Specified by:
getExhaustion
in interfaceComputeSource
- Returns:
- the exhaustion state, if the source is associated with an exhausted allowance; otherwise, null
-
setId
Description copied from interface:ComputeSource
Sets the ID- Specified by:
setId
in interfaceComputeSource
- Parameters:
id
- This should only be set by the YellowDog Platform
-
setCreatedFromId
Description copied from interface:ComputeSource
Sets the source template ID- Specified by:
setCreatedFromId
in interfaceComputeSource
- Parameters:
createdFromId
- This should only be set by the YellowDog Platform
-
setName
Description copied from interface:ComputeSource
Sets the name of this compute source (which must be unique within the containing ComputeRequirement).- Specified by:
setName
in interfaceComputeSource
- Parameters:
name
- the name of this compute source
-
setCredential
-
setRegion
-
setInstanceType
Description copied from interface:ComputeSource
Sets the provider-specific instance type of the instances that will be provisioned.- Specified by:
setInstanceType
in interfaceComputeSource
- Parameters:
instanceType
- the provider-specific instance type of the instances that will be provisioned
-
setImageId
Description copied from interface:ComputeSource
Sets the image ID to use for the instances that will be provisioned.- Specified by:
setImageId
in interfaceComputeSource
- Parameters:
imageId
- the image ID to use for the instances that will be provisioned
-
setInstanceTags
public void setInstanceTags(Map<@SimulatorInstanceTagKey String, @SimulatorInstanceTagValue String> instanceTags) Description copied from interface:ComputeSource
Sets the custom instance tags to be set on the provisioned instance at startup.- Specified by:
setInstanceTags
in interfaceComputeSource
- Parameters:
instanceTags
- the custom instance tags
-
setImplicitCapacity
The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.- Parameters:
implicitCapacity
- the implicit capacity of this source, independent of limit
-
setInstanceStartupTimeSeconds
public void setInstanceStartupTimeSeconds(int instanceStartupTimeSeconds) The simulated startup time for an instance.- Parameters:
instanceStartupTimeSeconds
- the simulated startup time for an instance
-
setInstanceStartupTimeVariance
public void setInstanceStartupTimeVariance(float instanceStartupTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance startup time.- Parameters:
instanceStartupTimeVariance
- the instance startup time variance
-
setInstanceShutdownTimeSeconds
public void setInstanceShutdownTimeSeconds(int instanceShutdownTimeSeconds) The simulated shutdown time for an instance.- Parameters:
instanceShutdownTimeSeconds
- the simulated shutdown time for an instance
-
setInstanceShutdownTimeVariance
public void setInstanceShutdownTimeVariance(float instanceShutdownTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.- Parameters:
instanceShutdownTimeVariance
- the instance shutdown time variance
-
setUnexpectedInstanceTerminationProbability
public void setUnexpectedInstanceTerminationProbability(float unexpectedInstanceTerminationProbability) The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.- Parameters:
unexpectedInstanceTerminationProbability
- the probability of unexpected instance termination
-
setFailOnRequestAllInstances
public void setFailOnRequestAllInstances(boolean failOnRequestAllInstances) -
setFailOnProvision
public void setFailOnProvision(boolean failOnProvision) -
setReportSupportingResourcesExist
public void setReportSupportingResourcesExist(boolean reportSupportingResourcesExist) -
setLimit
public void setLimit(int limit) Description copied from interface:ComputeSource
Sets the limit in number of instances that can be provisioned from this source.- Specified by:
setLimit
in interfaceComputeSource
- Parameters:
limit
- the limit in number of instances that can be provisioned from this source
-
setInstanceSummary
- Specified by:
setInstanceSummary
in interfaceComputeSource
-
setStatus
Description copied from interface:ComputeSource
Sets the current provisioning status of this source.- Specified by:
setStatus
in interfaceComputeSource
- Parameters:
status
- This should only be set by the YellowDog Platform
-
setStatusMessage
Description copied from interface:ComputeSource
Sets the message associated with the current provisioning status of this source.- Specified by:
setStatusMessage
in interfaceComputeSource
- Parameters:
statusMessage
- This should only be set by the YellowDog Platform
-
setExhaustion
- Specified by:
setExhaustion
in interfaceComputeSource
-
equals
-
canEqual
-
hashCode
-
toString
-
getRegion
@JsonPropertyDescription("The simulated region, can be set to any non-blank value") public String getRegion()Description copied from interface:ComputeSource
Gets the provider-specific region where instances will be provisioned.- Specified by:
getRegion
in interfaceComputeSource
- Returns:
- the provider-specific region where instances will be provisioned
-
getInstanceType
@JsonPropertyDescription("The simulated instanceType, can be set to any non-blank value") public String getInstanceType()Description copied from interface:ComputeSource
Gets the provider-specific instance type of the instances that will be provisioned.- Specified by:
getInstanceType
in interfaceComputeSource
- Returns:
- the provider-specific instance type of the instances that will be provisioned
-
getImageId
@JsonPropertyDescription("The simulated imageId, can be set to any non-blank value") public String getImageId()Description copied from interface:ComputeSource
Gets the image ID to use for the instances that will be provisioned.- Specified by:
getImageId
in interfaceComputeSource
- Returns:
- the image ID to use for the instances that will be provisioned
-