class MU::Config::Bucket
Basket of Kittens config schema and parser logic. See modules/mu/providers/*/bucket.rb
Public Class Methods
schema()
click to toggle source
Base configuration schema for a Bucket
@return [Hash]
# File modules/mu/config/bucket.rb, line 22 def self.schema { "type" => "object", "additionalProperties" => false, "description" => "A simple storage bucket, like Google Cloud Storage or Amazon S3.", "properties" => { "name" => { "type" => "string" }, "region" => MU::Config.region_primitive, "credentials" => MU::Config.credentials_primitive, "versioning" => { "type" => "boolean", "default" => false, "description" => "Enable object versioning on this bucket." }, "web" => { "type" => "boolean", "default" => false, "description" => "Enable web service on this bucket." }, "web_error_object" => { "type" => "string", "default" => "error.html", "description" => "If +web_enabled+, return this object for error conditions (such as a +404+) supported by the cloud provider." }, "web_index_object" => { "type" => "string", "default" => "index.html", "description" => "If +web_enabled+, return this object when \"diretory\" (a path not ending in a key/object) is invoked." }, "upload" => { "type" => "array", "items" => { "type" => "object", "description" => "Upload objects to a bucket, where supported", "required" => ["source", "destination"], "properties" => { "source" => { "type" => "string", "description" => "A file or directory to upload. If a directory is specified, it will be recursively mirrored to the bucket +destination+." }, "destination" => { "type" => "string", "description" => "Path to which +source+ file(s) will be uploaded in the bucket, relative to +/+" } } } }, "policies" => { "type" => "array", "items" => MU::Config::Role.policy_primitive(subobjects: true, grant_to: true, permissions_optional: true, targets_optional: true) } } } end
validate(bucket, _configurator)
click to toggle source
Generic pre-processing of {MU::Config::BasketofKittens::buckets}, bare and unvalidated. @param bucket [Hash]: The resource to process and validate @param _configurator [MU::Config]: The overall deployment configurator of which this resource is a member @return [Boolean]: True if validation succeeded, False otherwise
# File modules/mu/config/bucket.rb, line 83 def self.validate(bucket, _configurator) ok = true if bucket['upload'] bucket['upload'].each { |batch| if !File.exists?(batch['source']) MU.log "Bucket '#{bucket['name']}' specifies upload for file/directory that does not exist", MU::ERR, details: batch ok = false next end batch['source'] = File.realpath(File.expand_path(batch['source'])) } end ok end