
com.ovhcloud.pulumi.ovh.CloudProject.S3Policy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-ovh Show documentation
Show all versions of pulumi-ovh Show documentation
A Pulumi package for creating and managing OVH resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.ovhcloud.pulumi.ovh.CloudProject;
import com.ovhcloud.pulumi.ovh.CloudProject.S3PolicyArgs;
import com.ovhcloud.pulumi.ovh.CloudProject.inputs.S3PolicyState;
import com.ovhcloud.pulumi.ovh.Utilities;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;
/**
* Set the S3 Policy of a public cloud project user.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.ovh.CloudProject.User;
* import com.pulumi.ovh.CloudProject.UserArgs;
* import com.pulumi.ovh.CloudProject.S3Credential;
* import com.pulumi.ovh.CloudProject.S3CredentialArgs;
* import com.pulumi.ovh.CloudProject.S3Policy;
* import com.pulumi.ovh.CloudProject.S3PolicyArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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) {
* var user = new User("user", UserArgs.builder()
* .serviceName("XXX")
* .description("my user")
* .roleNames("objectstore_operator")
* .build());
*
* var myS3Credentials = new S3Credential("myS3Credentials", S3CredentialArgs.builder()
* .serviceName(user.serviceName())
* .userId(user.id())
* .build());
*
* var policy = new S3Policy("policy", S3PolicyArgs.builder()
* .serviceName(user.serviceName())
* .userId(user.id())
* .policy(serializeJson(
* jsonObject(
* jsonProperty("Statement", jsonArray(jsonObject(
* jsonProperty("Sid", "RWContainer"),
* jsonProperty("Effect", "Allow"),
* jsonProperty("Action", jsonArray(
* "s3:GetObject",
* "s3:PutObject",
* "s3:DeleteObject",
* "s3:ListBucket",
* "s3:ListMultipartUploadParts",
* "s3:ListBucketMultipartUploads",
* "s3:AbortMultipartUpload",
* "s3:GetBucketLocation"
* )),
* jsonProperty("Resource", jsonArray(
* "arn:aws:s3:::hp-bucket",
* "arn:aws:s3:::hp-bucket/*"
* ))
* )))
* )))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* OVHcloud User S3 Policy can be imported using the `service_name`, `user_id` of the policy, separated by "/" E.g.,
*
* bash
*
* ```sh
* $ pulumi import ovh:CloudProject/s3Policy:S3Policy policy service_name/user_id
* ```
*
*/
@ResourceType(type="ovh:CloudProject/s3Policy:S3Policy")
public class S3Policy extends com.pulumi.resources.CustomResource {
/**
* The policy document. This is a JSON formatted string. See examples of policies on [public documentation](https://docs.ovh.com/gb/en/storage/s3/identity-and-access-management/).
*
*/
@Export(name="policy", refs={String.class}, tree="[0]")
private Output policy;
/**
* @return The policy document. This is a JSON formatted string. See examples of policies on [public documentation](https://docs.ovh.com/gb/en/storage/s3/identity-and-access-management/).
*
*/
public Output policy() {
return this.policy;
}
/**
* The ID of the public cloud project. If omitted,
* the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
*
*/
@Export(name="serviceName", refs={String.class}, tree="[0]")
private Output serviceName;
/**
* @return The ID of the public cloud project. If omitted,
* the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
*
*/
public Output serviceName() {
return this.serviceName;
}
/**
* The ID of a public cloud project's user.
*
*/
@Export(name="userId", refs={String.class}, tree="[0]")
private Output userId;
/**
* @return The ID of a public cloud project's user.
*
*/
public Output userId() {
return this.userId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public S3Policy(java.lang.String name) {
this(name, S3PolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public S3Policy(java.lang.String name, S3PolicyArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public S3Policy(java.lang.String name, S3PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("ovh:CloudProject/s3Policy:S3Policy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private S3Policy(java.lang.String name, Output id, @Nullable S3PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("ovh:CloudProject/s3Policy:S3Policy", name, state, makeResourceOptions(options, id), false);
}
private static S3PolicyArgs makeArgs(S3PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? S3PolicyArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static S3Policy get(java.lang.String name, Output id, @Nullable S3PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new S3Policy(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy