1. Packages
  2. OVH
  3. API Docs
  4. CloudProject
  5. getUserS3Policy
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

ovh.CloudProject.getUserS3Policy

Explore with Pulumi AI

ovh logo
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

    Get the S3 Policy of a public cloud project user. The policy can be set by using the ovh.CloudProject.S3Policy resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@pulumi/ovh";
    
    const projectUsers = ovh.CloudProject.getUsers({
        serviceName: "XXX",
    });
    // Get the user ID of a previously created user with the description "S3-User"
    const users = projectUsers.then(projectUsers => .filter(user => user.description == "S3-User").map(user => (user.userId)));
    const s3UserId = users[0];
    const policy = Promise.all([projectUsers, s3UserId]).then(([projectUsers, s3UserId]) => ovh.CloudProject.getUserS3Policy({
        serviceName: projectUsers.serviceName,
        userId: s3UserId,
    }));
    
    import pulumi
    import pulumi_ovh as ovh
    
    project_users = ovh.CloudProject.get_users(service_name="XXX")
    # Get the user ID of a previously created user with the description "S3-User"
    users = [user.user_id for user in project_users.users if user.description == "S3-User"]
    s3_user_id = users[0]
    policy = ovh.CloudProject.get_user_s3_policy(service_name=project_users.service_name,
        user_id=s3_user_id)
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/CloudProject"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		projectUsers, err := CloudProject.GetUsers(ctx, &cloudproject.GetUsersArgs{
    			ServiceName: "XXX",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Get the user ID of a previously created user with the description "S3-User"
    		users := "TODO: For expression"
    		s3UserId := users[0]
    		_, err = CloudProject.GetUserS3Policy(ctx, &cloudproject.GetUserS3PolicyArgs{
    			ServiceName: projectUsers.ServiceName,
    			UserId:      s3UserId,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var projectUsers = Ovh.CloudProject.GetUsers.Invoke(new()
        {
            ServiceName = "XXX",
        });
    
        // Get the user ID of a previously created user with the description "S3-User"
        var users = .Where(user => user.Description == "S3-User").Select(user => 
        {
            return user.UserId;
        }).ToList();
    
        var s3UserId = users[0];
    
        var policy = Ovh.CloudProject.GetUserS3Policy.Invoke(new()
        {
            ServiceName = projectUsers.Apply(getUsersResult => getUsersResult.ServiceName),
            UserId = s3UserId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.CloudProject.CloudProjectFunctions;
    import com.pulumi.ovh.CloudProject.inputs.GetUsersArgs;
    import com.pulumi.ovh.CloudProject.inputs.GetUserS3PolicyArgs;
    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 projectUsers = CloudProjectFunctions.getUsers(GetUsersArgs.builder()
                .serviceName("XXX")
                .build());
    
            // Get the user ID of a previously created user with the description "S3-User"
            final var users = "TODO: ForExpression";
    
            final var s3UserId = users[0];
    
            final var policy = CloudProjectFunctions.getUserS3Policy(GetUserS3PolicyArgs.builder()
                .serviceName(projectUsers.applyValue(getUsersResult -> getUsersResult.serviceName()))
                .userId(s3UserId)
                .build());
    
        }
    }
    
    Coming soon!
    

    Using getUserS3Policy

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getUserS3Policy(args: GetUserS3PolicyArgs, opts?: InvokeOptions): Promise<GetUserS3PolicyResult>
    function getUserS3PolicyOutput(args: GetUserS3PolicyOutputArgs, opts?: InvokeOptions): Output<GetUserS3PolicyResult>
    def get_user_s3_policy(service_name: Optional[str] = None,
                           user_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetUserS3PolicyResult
    def get_user_s3_policy_output(service_name: Optional[pulumi.Input[str]] = None,
                           user_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetUserS3PolicyResult]
    func GetUserS3Policy(ctx *Context, args *GetUserS3PolicyArgs, opts ...InvokeOption) (*GetUserS3PolicyResult, error)
    func GetUserS3PolicyOutput(ctx *Context, args *GetUserS3PolicyOutputArgs, opts ...InvokeOption) GetUserS3PolicyResultOutput

    > Note: This function is named GetUserS3Policy in the Go SDK.

    public static class GetUserS3Policy 
    {
        public static Task<GetUserS3PolicyResult> InvokeAsync(GetUserS3PolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetUserS3PolicyResult> Invoke(GetUserS3PolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserS3PolicyResult> getUserS3Policy(GetUserS3PolicyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: ovh:CloudProject/getUserS3Policy:getUserS3Policy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ServiceName string
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    UserId string
    The ID of a public cloud project's user.
    ServiceName string
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    UserId string
    The ID of a public cloud project's user.
    serviceName String
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    userId String
    The ID of a public cloud project's user.
    serviceName string
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    userId string
    The ID of a public cloud project's user.
    service_name str
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    user_id str
    The ID of a public cloud project's user.
    serviceName String
    The ID of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    userId String
    The ID of a public cloud project's user.

    getUserS3Policy Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Policy string
    (Required) The policy document. This is a JSON formatted string.
    ServiceName string
    UserId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Policy string
    (Required) The policy document. This is a JSON formatted string.
    ServiceName string
    UserId string
    id String
    The provider-assigned unique ID for this managed resource.
    policy String
    (Required) The policy document. This is a JSON formatted string.
    serviceName String
    userId String
    id string
    The provider-assigned unique ID for this managed resource.
    policy string
    (Required) The policy document. This is a JSON formatted string.
    serviceName string
    userId string
    id str
    The provider-assigned unique ID for this managed resource.
    policy str
    (Required) The policy document. This is a JSON formatted string.
    service_name str
    user_id str
    id String
    The provider-assigned unique ID for this managed resource.
    policy String
    (Required) The policy document. This is a JSON formatted string.
    serviceName String
    userId String

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud