get Spaces Bucket Object
The Spaces object data source allows access to the metadata and optionally (see below) content of an object stored inside a Spaces bucket.
Note: The content of an object (
body
field) is available only for objects which have a human-readableContent-Type
(text/*
andapplication/json
). This is to prevent printing unsafe characters and potentially downloading large amount of data which would be thrown away in favor of metadata.
Example Usage
The following example retrieves a text object (which must have a Content-Type
value starting with text/
) and uses it as the user_data
for a Droplet:
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetSpacesBucketObjectArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var bootstrapScript = DigitaloceanFunctions.getSpacesBucketObject(GetSpacesBucketObjectArgs.builder()
.bucket("ourcorp-deploy-config")
.region("nyc3")
.key("droplet-bootstrap-script.sh")
.build());
var web = new Droplet("web", DropletArgs.builder()
.image("ubuntu-18-04-x64")
.region("nyc2")
.size("s-1vcpu-1gb")
.userData(bootstrapScript.applyValue(getSpacesBucketObjectResult -> getSpacesBucketObjectResult.body()))
.build());
}
}
Return
A collection of values returned by getSpacesBucketObject. */
Parameters
A collection of arguments for invoking getSpacesBucketObject.
Return
A collection of values returned by getSpacesBucketObject.
See also
Parameters
The name of the bucket to read the object from.
The full path to the object inside the bucket
The slug of the region where the bucket is stored.
Specific version ID of the object returned (defaults to latest version)
Return
A collection of values returned by getSpacesBucketObject.
See also
Parameters
Builder for com.pulumi.digitalocean.kotlin.inputs.GetSpacesBucketObjectPlainArgs.