@Transactional public class DefaultStreamService extends Object implements StreamService
StreamDeploymentRequest
.
The StreamService
deployer is agnostic. For deploying streams on
Skipper use the DefaultStreamService
.
Modifier and Type | Field and Description |
---|---|
protected AuditRecordService |
auditRecordService |
protected AuditServiceUtils |
auditServiceUtils |
static String |
DEFAULT_SKIPPER_PACKAGE_VERSION |
protected StreamDefinitionRepository |
streamDefinitionRepository
The repository this controller will use for stream CRUD operations.
|
protected StreamValidationService |
streamValidationService |
Constructor and Description |
---|
DefaultStreamService(StreamDefinitionRepository streamDefinitionRepository,
SkipperStreamDeployer skipperStreamDeployer,
AppDeploymentRequestCreator appDeploymentRequestCreator,
StreamValidationService streamValidationService,
AuditRecordService auditRecordService) |
Modifier and Type | Method and Description |
---|---|
StreamDefinition |
createStream(String streamName,
String dsl,
boolean deploy)
Create a new stream.
|
StreamDefinition |
createStreamDefinition(String streamName,
String dsl) |
void |
deleteAll()
Delete all streams, including undeploying.
|
void |
deleteStream(String streamName)
Delete the stream, including undeloying.
|
void |
deployStream(String streamName,
Map<String,String> deploymentProperties)
Deploys the stream with the user provided deployment properties.
|
org.springframework.cloud.deployer.spi.app.DeploymentState |
doCalculateStreamState(String name) |
void |
doDeployStream(StreamDefinition streamDefinition,
Map<String,String> deploymentProperties)
Deploy a stream as defined by its stream name and optional deployment properties.
|
org.springframework.data.domain.Page<StreamDefinition> |
findDefinitionByNameContains(org.springframework.data.domain.Pageable pageable,
String search)
Find stream definitions where the findByTaskNameContains parameter
|
StreamDefinition |
findOne(String streamDefinitionName)
Find a stream definition by name.
|
List<StreamDefinition> |
findRelatedStreams(String streamName,
boolean nested)
Find streams related to the given stream name.
|
Collection<org.springframework.cloud.skipper.domain.Release> |
history(String releaseName)
Get stream's deployment history
|
StreamDeployment |
info(String streamName)
Get stream information including the deployment properties etc.
|
String |
manifest(String name,
int version)
Return a manifest info of a release version.
|
Collection<org.springframework.cloud.skipper.domain.Deployer> |
platformList() |
void |
rollbackStream(String streamName,
int releaseVersion)
Rollback the stream to the previous or a specific version of the stream.
|
Map<StreamDefinition,org.springframework.cloud.deployer.spi.app.DeploymentState> |
state(List<StreamDefinition> streamDefinitions)
Retrieve the deployment state for list of stream definitions.
|
void |
undeployStream(String streamName)
Un-deploys the stream identified by the given stream name.
|
void |
updateStream(String streamName,
String releaseName,
org.springframework.cloud.skipper.domain.PackageIdentifier packageIdentifier,
Map<String,String> updateProperties,
boolean force,
List<String> appNames) |
void |
updateStream(String streamName,
UpdateStreamRequest updateStreamRequest)
Update the stream using the UpdateStreamRequest.
|
ValidationStatus |
validateStream(String name)
Verifies that all apps in the stream are valid.
|
public static final String DEFAULT_SKIPPER_PACKAGE_VERSION
protected final StreamDefinitionRepository streamDefinitionRepository
protected final AuditRecordService auditRecordService
protected final AuditServiceUtils auditServiceUtils
protected final StreamValidationService streamValidationService
public DefaultStreamService(StreamDefinitionRepository streamDefinitionRepository, SkipperStreamDeployer skipperStreamDeployer, AppDeploymentRequestCreator appDeploymentRequestCreator, StreamValidationService streamValidationService, AuditRecordService auditRecordService)
public void doDeployStream(StreamDefinition streamDefinition, Map<String,String> deploymentProperties)
streamDefinition
- the stream definition to deploydeploymentProperties
- the deployment properties for the streampublic org.springframework.cloud.deployer.spi.app.DeploymentState doCalculateStreamState(String name)
public void undeployStream(String streamName)
StreamService
undeployStream
in interface StreamService
streamName
- the name of the stream to un-deploypublic void updateStream(String streamName, UpdateStreamRequest updateStreamRequest)
StreamService
updateStream
in interface StreamService
streamName
- the name of the stream to updateupdateStreamRequest
- the UpdateStreamRequest to use during the updatepublic void updateStream(String streamName, String releaseName, org.springframework.cloud.skipper.domain.PackageIdentifier packageIdentifier, Map<String,String> updateProperties, boolean force, List<String> appNames)
public void rollbackStream(String streamName, int releaseVersion)
StreamService
rollbackStream
in interface StreamService
streamName
- the name of the stream to rollbackreleaseVersion
- the version to rollback to (if not specified, rollback to the previous deleted/deployed
release version of the stream.public Map<StreamDefinition,org.springframework.cloud.deployer.spi.app.DeploymentState> state(List<StreamDefinition> streamDefinitions)
StreamService
state
in interface StreamService
streamDefinitions
- the list of Stream definitions to calculate the deployment states.public String manifest(String name, int version)
StreamService
manifest
in interface StreamService
name
- the release nameversion
- the release versionpublic Collection<org.springframework.cloud.skipper.domain.Release> history(String releaseName)
StreamService
history
in interface StreamService
releaseName
- Stream release namepublic Collection<org.springframework.cloud.skipper.domain.Deployer> platformList()
platformList
in interface StreamService
public StreamDeployment info(String streamName)
StreamService
info
in interface StreamService
streamName
- the name of the streampublic StreamDefinition createStream(String streamName, String dsl, boolean deploy)
createStream
in interface StreamService
streamName
- stream namedsl
- DSL definition for streamdeploy
- if true
, the stream is deployed upon creation (default is
false
)InvalidStreamDefinitionException
- if there are errors in parsing the stream DSL,
resolving the name, or type of applications in the streampublic StreamDefinition createStreamDefinition(String streamName, String dsl)
public void deployStream(String streamName, Map<String,String> deploymentProperties)
deployStream
in interface StreamService
streamName
- the name of the streamdeploymentProperties
- deployment properties to use as passed in from the client.public void deleteStream(String streamName)
deleteStream
in interface StreamService
streamName
- the name of the stream to deletepublic void deleteAll()
deleteAll
in interface StreamService
public List<StreamDefinition> findRelatedStreams(String streamName, boolean nested)
findRelatedStreams
in interface StreamService
streamName
- name of the streamnested
- if should recursively findByTaskNameContains for related stream definitionspublic org.springframework.data.domain.Page<StreamDefinition> findDefinitionByNameContains(org.springframework.data.domain.Pageable pageable, String search)
findDefinitionByNameContains
in interface StreamService
pageable
- Pagination informationsearch
- the findByTaskNameContains parameter to usepublic StreamDefinition findOne(String streamDefinitionName)
findOne
in interface StreamService
streamDefinitionName
- the name of the stream definitionNoSuchStreamDefinitionException
- if the definition can not be found.public ValidationStatus validateStream(String name)
validateStream
in interface StreamService
name
- the name of the definitionValidationStatus
for a stream.Copyright © 2019 Pivotal Software, Inc.. All rights reserved.