public abstract class AbstractCloudDeployment extends Object implements hudson.model.Describable<AbstractCloudDeployment>, hudson.ExtensionPoint
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractCloudDeployment.ResolvedPath
Helper type for managing the resolution of the deployment path into its final form and managing
the pieces.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
verbose
Controls how verbose to make the logs
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractCloudDeployment(String credentialsId,
String deploymentName,
CloudDeploymentModule module)
Constructs the AbstractCloudDeployment from the provided information.
|
Modifier and Type | Method and Description |
---|---|
static hudson.DescriptorExtensionList<AbstractCloudDeployment,AbstractCloudDeploymentDescriptor> |
all()
Boilerplate, see: https://wiki.jenkins-ci.org/display/JENKINS/Defining+a+new+extension+point
|
protected com.google.api.services.deploymentmanager.model.Operation |
createDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager,
com.google.api.services.deploymentmanager.model.Deployment deployment)
Creates a new deployment.
|
void |
delete(hudson.EnvVars environment,
PrintStream logger)
NOTE: This should be treated as final, but is not to allow mocking.
|
protected com.google.api.services.deploymentmanager.model.Operation |
deleteDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager,
String userDeploymentName)
Deletes a deployment.
|
protected <T> T |
execute(com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest<T> request)
Pass the given request through the executor.
|
static List<AbstractCloudDeploymentDescriptor> |
getCompatibleCloudDeployments(hudson.model.Descriptor descriptor)
This method is called by plugins utilizing this extension point for managing deployments, such
as a
Publisher , BuildWrapper , or Cloud . |
protected com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials |
getCredentials()
Retrieve the credentials for this cloud deployment.
|
String |
getCredentialsId() |
protected com.google.api.services.deploymentmanager.model.Deployment |
getDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager,
String userDeploymentName)
Fetches a deployment.
|
String |
getDeploymentName() |
AbstractCloudDeploymentDescriptor |
getDescriptor()
Boilerplate, see: https://wiki.jenkins-ci.org/display/JENKINS/Defining+a+new+extension+point
|
protected CloudDeploymentModule |
getModule() |
protected String |
getProjectId()
Retrieve the project id for this cloud deployment.
|
abstract void |
insert(hudson.FilePath workspace,
hudson.EnvVars environment,
PrintStream logger) |
void |
insert(String configFileContents,
Iterable<hudson.FilePath> importPaths,
hudson.EnvVars environment,
PrintStream logger)
NOTE: This should be treated as final, but is not to allow mocking.
|
protected void |
log(String message)
This is a short-hand that issues the given message through our client's logging stream.
|
protected void |
waitUntilDeleted(com.google.api.services.deploymentmanager.DeploymentManager manager,
com.google.api.services.deploymentmanager.model.Operation operation)
Waits for the newly delete deployment operation to be done.
|
protected void |
waitUntilDeployed(com.google.api.services.deploymentmanager.DeploymentManager manager,
com.google.api.services.deploymentmanager.model.Operation operation)
Waits for the deployment insertion to terminate.
|
protected void |
waitUntilDone(com.google.api.services.deploymentmanager.DeploymentManager manager,
com.google.api.services.deploymentmanager.model.Operation operation,
boolean areDeploying)
Waits for the given operation to terminate.
|
protected static final boolean verbose
protected AbstractCloudDeployment(String credentialsId, String deploymentName, @Nullable CloudDeploymentModule module)
credentialsId
- The credentials to use for service interactions.deploymentName
- The unresolved deployment name to usemodule
- The module to use for allocating dependenciespublic static hudson.DescriptorExtensionList<AbstractCloudDeployment,AbstractCloudDeploymentDescriptor> all()
public static List<AbstractCloudDeploymentDescriptor> getCompatibleCloudDeployments(hudson.model.Descriptor descriptor)
Publisher
, BuildWrapper
, or Cloud
.descriptor
- The descriptor of the plugin wishing to consume a cloud deploymentpublic String getCredentialsId()
public String getDeploymentName()
protected CloudDeploymentModule getModule()
public abstract void insert(hudson.FilePath workspace, hudson.EnvVars environment, @Nullable PrintStream logger) throws CloudManagementException
CloudManagementException
public void insert(String configFileContents, Iterable<hudson.FilePath> importPaths, hudson.EnvVars environment, @Nullable PrintStream logger) throws CloudManagementException
NOTE: This should be treated as final, but is not to allow mocking.
Creates the given deployment.configFileContents
- The contents of the deployment config fileimportPaths
- The paths of the deployment import filesenvironment
- The environment under which to execute the insertionlogger
- The logger through which to surface messagingCloudManagementException
- if the operation fails or times outprotected com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials getCredentials()
protected String getProjectId()
protected <T> T execute(com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest<T> request) throws IOException, com.google.jenkins.plugins.util.ExecutorException
IOException
com.google.jenkins.plugins.util.ExecutorException
public AbstractCloudDeploymentDescriptor getDescriptor()
getDescriptor
in interface hudson.model.Describable<AbstractCloudDeployment>
public void delete(hudson.EnvVars environment, @Nullable PrintStream logger) throws CloudManagementException
NOTE: This should be treated as final, but is not to allow mocking.
Deletes user's deployment.environment
- The environment under which to execute the deletionlogger
- The logger through which to surface messagingCloudManagementException
- if the operation fails or times outprotected com.google.api.services.deploymentmanager.model.Operation createDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager, com.google.api.services.deploymentmanager.model.Deployment deployment) throws CloudManagementException
manager
- The connection the the Deployment Manager servicedeployment
- The deployment configuration informationCloudManagementException
- if anything goes wrong.protected com.google.api.services.deploymentmanager.model.Deployment getDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager, String userDeploymentName) throws CloudManagementException, com.google.jenkins.plugins.util.ExecutorException
manager
- The connection the the Cloud Manager serviceuserDeploymentName
- The resolved name of the user's deploymentCloudManagementException
- if anything goes wrong.com.google.jenkins.plugins.util.ExecutorException
protected com.google.api.services.deploymentmanager.model.Operation deleteDeployment(com.google.api.services.deploymentmanager.DeploymentManager manager, String userDeploymentName) throws CloudManagementException
manager
- The connection the the Deployment Manager serviceuserDeploymentName
- The resolved name of the user's deploymentCloudManagementException
- if anything goes wrong.protected void waitUntilDeployed(com.google.api.services.deploymentmanager.DeploymentManager manager, com.google.api.services.deploymentmanager.model.Operation operation) throws CloudManagementException
CloudManagementException
is thrown.manager
- The connection the the Deployment Manager service.operation
- The operation to wait for.CloudManagementException
- if anything goes wrong, the deployment fails, or we time out
waiting.protected void waitUntilDeleted(com.google.api.services.deploymentmanager.DeploymentManager manager, com.google.api.services.deploymentmanager.model.Operation operation) throws CloudManagementException
CloudManagementException
is thrown.manager
- The connection the the Cloud Manager serviceoperation
- The delete operation to wait for.CloudManagementException
- if anything goes wrong, the deployment fails, or we time out
waiting.protected void waitUntilDone(com.google.api.services.deploymentmanager.DeploymentManager manager, com.google.api.services.deploymentmanager.model.Operation operation, boolean areDeploying) throws CloudManagementException, com.google.jenkins.plugins.util.ExecutorException, IOException
CloudManagementException
is thrown.manager
- The connection the the Deployment Manager service.operation
- The operation to wait for.areDeploying
- whether we are currently deploying or deletingCloudManagementException
- if anything goes wrong, the deployment fails, or we time out
waiting.com.google.jenkins.plugins.util.ExecutorException
IOException
protected void log(String message)
message
- The message to be logged.Copyright © 2016. All rights reserved.