public abstract class AbstractBucketLifecycleManager extends AbstractUpload
checkBucket
: Validated the annotations on a pre-existing
bucket, returning it if they are satisfactory, and throwing a
InvalidAnnotationException if we must update it.
decorateBucket
: Annotates either a new or existing bucket
with the lifecycle features of the plugin.
AbstractUpload
, but isn't really an upload. You
could reason about it as an empty upload to a bucket with special bucket
annotation properties.
TODO(mattmoor): We should factor out a common AbstractStorageOperation base
class that this and AbstractUpload can share. The current entrypoint is
benign enough (see "perform").ExpiringBucketLifecycleManager
,
Serialized FormAbstractUpload.UploadSpec
MAX_REMOTE_CREDENTIAL_EXPIRED_RETRIES, module
Constructor and Description |
---|
AbstractBucketLifecycleManager(String bucket,
UploadModule module)
Constructs the base bucket OLM plugin from the bucket name and module.
|
Modifier and Type | Method and Description |
---|---|
protected abstract com.google.api.services.storage.model.Bucket |
checkBucket(com.google.api.services.storage.model.Bucket bucket)
This is intended to be an identity function that throws when the input
is not adequately annotated.
|
protected abstract com.google.api.services.storage.model.Bucket |
decorateBucket(com.google.api.services.storage.model.Bucket bucket)
A hook by which extensions may annotate a new or existing bucket.
|
AbstractBucketLifecycleManagerDescriptor |
getDescriptor()
Boilerplate, see:
https://wiki.jenkins-ci.org/display/JENKINS/Defining+a+new+extension+point
|
protected AbstractUpload.UploadSpec |
getInclusions(hudson.model.AbstractBuild<?,?> build,
hudson.FilePath workspace,
hudson.model.TaskListener listener)
Implementations override this interface in order to surface the set of
FilePath s the core logic should upload. |
protected com.google.api.services.storage.model.Bucket |
getOrCreateBucket(com.google.api.services.storage.Storage service,
com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials credentials,
com.google.jenkins.plugins.util.Executor executor,
String bucketName)
This overrides the core implementation to provide additional hooks for
decorating storage objects with lifecycle annotations.
|
all, annotateObject, forResult, getBucket, getDetails, getMetadata, getPathPrefix, getRelative, getStrippedFilename, isForFailedJobs, isSharedPublicly, isShowInline, perform
public AbstractBucketLifecycleManager(String bucket, @Nullable UploadModule module)
@Nullable protected final AbstractUpload.UploadSpec getInclusions(hudson.model.AbstractBuild<?,?> build, hudson.FilePath workspace, hudson.model.TaskListener listener) throws UploadException
FilePath
s the core logic should upload.getInclusions
in class AbstractUpload
UploadException
for further details.
protected com.google.api.services.storage.model.Bucket getOrCreateBucket(com.google.api.services.storage.Storage service, com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials credentials, com.google.jenkins.plugins.util.Executor executor, String bucketName) throws UploadException
getOrCreateBucket
in class AbstractUpload
credentials
- The credentials with which to fetch/create the bucketbucketName
- The top-level bucket name to ensure existsUploadException
- if any issues are encounteredprotected abstract com.google.api.services.storage.model.Bucket checkBucket(com.google.api.services.storage.model.Bucket bucket) throws InvalidAnnotationException
bucket
- the pre-existing bucket whose annotations to validateInvalidAnnotationException
- if not annotated properlyprotected abstract com.google.api.services.storage.model.Bucket decorateBucket(com.google.api.services.storage.model.Bucket bucket)
bucket
- the bucket to annotate and returnpublic AbstractBucketLifecycleManagerDescriptor getDescriptor()
getDescriptor
in interface hudson.model.Describable<AbstractUpload>
getDescriptor
in class AbstractUpload
Copyright © 2016–2017. All rights reserved.