1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cloudstoragegateway
  5. getGatewaySmbUsers
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.cloudstoragegateway.getGatewaySmbUsers

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides the Cloud Storage Gateway Gateway SMB Users of the current Alibaba Cloud user.

    NOTE: Available in v1.142.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.vpc.getNetworks({
        nameRegex: "default-NODELETING",
    });
    const defaultGetSwitches = _default.then(_default => alicloud.vpc.getSwitches({
        vpcId: _default.ids?.[0],
    }));
    const example = new alicloud.cloudstoragegateway.StorageBundle("example", {storageBundleName: "example_value"});
    const defaultGateway = new alicloud.cloudstoragegateway.Gateway("default", {
        description: "tf-acctestDesalone",
        gatewayClass: "Standard",
        type: "File",
        paymentType: "PayAsYouGo",
        vswitchId: defaultGetSwitches.then(defaultGetSwitches => defaultGetSwitches.ids?.[0]),
        releaseAfterExpiration: false,
        publicNetworkBandwidth: 40,
        storageBundleId: example.id,
        location: "Cloud",
        gatewayName: "example_value",
    });
    const defaultGatewaySmbUser = new alicloud.cloudstoragegateway.GatewaySmbUser("default", {
        username: "your_username",
        password: "password",
        gatewayId: defaultGateway.id,
    });
    const ids = alicloud.cloudstoragegateway.getGatewaySmbUsersOutput({
        gatewayId: defaultGateway.id,
        ids: [defaultGatewaySmbUser.id],
    });
    export const cloudStorageGatewayGatewaySmbUserId1 = ids.apply(ids => ids.users?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.vpc.get_networks(name_regex="default-NODELETING")
    default_get_switches = alicloud.vpc.get_switches(vpc_id=default.ids[0])
    example = alicloud.cloudstoragegateway.StorageBundle("example", storage_bundle_name="example_value")
    default_gateway = alicloud.cloudstoragegateway.Gateway("default",
        description="tf-acctestDesalone",
        gateway_class="Standard",
        type="File",
        payment_type="PayAsYouGo",
        vswitch_id=default_get_switches.ids[0],
        release_after_expiration=False,
        public_network_bandwidth=40,
        storage_bundle_id=example.id,
        location="Cloud",
        gateway_name="example_value")
    default_gateway_smb_user = alicloud.cloudstoragegateway.GatewaySmbUser("default",
        username="your_username",
        password="password",
        gateway_id=default_gateway.id)
    ids = alicloud.cloudstoragegateway.get_gateway_smb_users_output(gateway_id=default_gateway.id,
        ids=[default_gateway_smb_user.id])
    pulumi.export("cloudStorageGatewayGatewaySmbUserId1", ids.users[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudstoragegateway"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
    			NameRegex: pulumi.StringRef("default-NODELETING"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultGetSwitches, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
    			VpcId: pulumi.StringRef(_default.Ids[0]),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := cloudstoragegateway.NewStorageBundle(ctx, "example", &cloudstoragegateway.StorageBundleArgs{
    			StorageBundleName: pulumi.String("example_value"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGateway, err := cloudstoragegateway.NewGateway(ctx, "default", &cloudstoragegateway.GatewayArgs{
    			Description:            pulumi.String("tf-acctestDesalone"),
    			GatewayClass:           pulumi.String("Standard"),
    			Type:                   pulumi.String("File"),
    			PaymentType:            pulumi.String("PayAsYouGo"),
    			VswitchId:              pulumi.String(defaultGetSwitches.Ids[0]),
    			ReleaseAfterExpiration: pulumi.Bool(false),
    			PublicNetworkBandwidth: pulumi.Int(40),
    			StorageBundleId:        example.ID(),
    			Location:               pulumi.String("Cloud"),
    			GatewayName:            pulumi.String("example_value"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGatewaySmbUser, err := cloudstoragegateway.NewGatewaySmbUser(ctx, "default", &cloudstoragegateway.GatewaySmbUserArgs{
    			Username:  pulumi.String("your_username"),
    			Password:  pulumi.String("password"),
    			GatewayId: defaultGateway.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		ids := cloudstoragegateway.GetGatewaySmbUsersOutput(ctx, cloudstoragegateway.GetGatewaySmbUsersOutputArgs{
    			GatewayId: defaultGateway.ID(),
    			Ids: pulumi.StringArray{
    				defaultGatewaySmbUser.ID(),
    			},
    		}, nil)
    		ctx.Export("cloudStorageGatewayGatewaySmbUserId1", ids.ApplyT(func(ids cloudstoragegateway.GetGatewaySmbUsersResult) (*string, error) {
    			return &ids.Users[0].Id, nil
    		}).(pulumi.StringPtrOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Vpc.GetNetworks.Invoke(new()
        {
            NameRegex = "default-NODELETING",
        });
    
        var defaultGetSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
        {
            VpcId = @default.Apply(getNetworksResult => getNetworksResult.Ids[0]),
        });
    
        var example = new AliCloud.CloudStorageGateway.StorageBundle("example", new()
        {
            StorageBundleName = "example_value",
        });
    
        var defaultGateway = new AliCloud.CloudStorageGateway.Gateway("default", new()
        {
            Description = "tf-acctestDesalone",
            GatewayClass = "Standard",
            Type = "File",
            PaymentType = "PayAsYouGo",
            VswitchId = defaultGetSwitches.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
            ReleaseAfterExpiration = false,
            PublicNetworkBandwidth = 40,
            StorageBundleId = example.Id,
            Location = "Cloud",
            GatewayName = "example_value",
        });
    
        var defaultGatewaySmbUser = new AliCloud.CloudStorageGateway.GatewaySmbUser("default", new()
        {
            Username = "your_username",
            Password = "password",
            GatewayId = defaultGateway.Id,
        });
    
        var ids = AliCloud.CloudStorageGateway.GetGatewaySmbUsers.Invoke(new()
        {
            GatewayId = defaultGateway.Id,
            Ids = new[]
            {
                defaultGatewaySmbUser.Id,
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["cloudStorageGatewayGatewaySmbUserId1"] = ids.Apply(getGatewaySmbUsersResult => getGatewaySmbUsersResult.Users[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.VpcFunctions;
    import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
    import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
    import com.pulumi.alicloud.cloudstoragegateway.StorageBundle;
    import com.pulumi.alicloud.cloudstoragegateway.StorageBundleArgs;
    import com.pulumi.alicloud.cloudstoragegateway.Gateway;
    import com.pulumi.alicloud.cloudstoragegateway.GatewayArgs;
    import com.pulumi.alicloud.cloudstoragegateway.GatewaySmbUser;
    import com.pulumi.alicloud.cloudstoragegateway.GatewaySmbUserArgs;
    import com.pulumi.alicloud.cloudstoragegateway.CloudstoragegatewayFunctions;
    import com.pulumi.alicloud.cloudstoragegateway.inputs.GetGatewaySmbUsersArgs;
    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 default = VpcFunctions.getNetworks(GetNetworksArgs.builder()
                .nameRegex("default-NODELETING")
                .build());
    
            final var defaultGetSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
                .vpcId(default_.ids()[0])
                .build());
    
            var example = new StorageBundle("example", StorageBundleArgs.builder()
                .storageBundleName("example_value")
                .build());
    
            var defaultGateway = new Gateway("defaultGateway", GatewayArgs.builder()
                .description("tf-acctestDesalone")
                .gatewayClass("Standard")
                .type("File")
                .paymentType("PayAsYouGo")
                .vswitchId(defaultGetSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
                .releaseAfterExpiration(false)
                .publicNetworkBandwidth(40)
                .storageBundleId(example.id())
                .location("Cloud")
                .gatewayName("example_value")
                .build());
    
            var defaultGatewaySmbUser = new GatewaySmbUser("defaultGatewaySmbUser", GatewaySmbUserArgs.builder()
                .username("your_username")
                .password("password")
                .gatewayId(defaultGateway.id())
                .build());
    
            final var ids = CloudstoragegatewayFunctions.getGatewaySmbUsers(GetGatewaySmbUsersArgs.builder()
                .gatewayId(defaultGateway.id())
                .ids(defaultGatewaySmbUser.id())
                .build());
    
            ctx.export("cloudStorageGatewayGatewaySmbUserId1", ids.applyValue(getGatewaySmbUsersResult -> getGatewaySmbUsersResult).applyValue(ids -> ids.applyValue(getGatewaySmbUsersResult -> getGatewaySmbUsersResult.users()[0].id())));
        }
    }
    
    resources:
      example:
        type: alicloud:cloudstoragegateway:StorageBundle
        properties:
          storageBundleName: example_value
      defaultGateway:
        type: alicloud:cloudstoragegateway:Gateway
        name: default
        properties:
          description: tf-acctestDesalone
          gatewayClass: Standard
          type: File
          paymentType: PayAsYouGo
          vswitchId: ${defaultGetSwitches.ids[0]}
          releaseAfterExpiration: false
          publicNetworkBandwidth: 40
          storageBundleId: ${example.id}
          location: Cloud
          gatewayName: example_value
      defaultGatewaySmbUser:
        type: alicloud:cloudstoragegateway:GatewaySmbUser
        name: default
        properties:
          username: your_username
          password: password
          gatewayId: ${defaultGateway.id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:vpc:getNetworks
          Arguments:
            nameRegex: default-NODELETING
      defaultGetSwitches:
        fn::invoke:
          Function: alicloud:vpc:getSwitches
          Arguments:
            vpcId: ${default.ids[0]}
      ids:
        fn::invoke:
          Function: alicloud:cloudstoragegateway:getGatewaySmbUsers
          Arguments:
            gatewayId: ${defaultGateway.id}
            ids:
              - ${defaultGatewaySmbUser.id}
    outputs:
      cloudStorageGatewayGatewaySmbUserId1: ${ids.users[0].id}
    

    Using getGatewaySmbUsers

    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 getGatewaySmbUsers(args: GetGatewaySmbUsersArgs, opts?: InvokeOptions): Promise<GetGatewaySmbUsersResult>
    function getGatewaySmbUsersOutput(args: GetGatewaySmbUsersOutputArgs, opts?: InvokeOptions): Output<GetGatewaySmbUsersResult>
    def get_gateway_smb_users(gateway_id: Optional[str] = None,
                              ids: Optional[Sequence[str]] = None,
                              name_regex: Optional[str] = None,
                              output_file: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetGatewaySmbUsersResult
    def get_gateway_smb_users_output(gateway_id: Optional[pulumi.Input[str]] = None,
                              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                              name_regex: Optional[pulumi.Input[str]] = None,
                              output_file: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetGatewaySmbUsersResult]
    func GetGatewaySmbUsers(ctx *Context, args *GetGatewaySmbUsersArgs, opts ...InvokeOption) (*GetGatewaySmbUsersResult, error)
    func GetGatewaySmbUsersOutput(ctx *Context, args *GetGatewaySmbUsersOutputArgs, opts ...InvokeOption) GetGatewaySmbUsersResultOutput

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

    public static class GetGatewaySmbUsers 
    {
        public static Task<GetGatewaySmbUsersResult> InvokeAsync(GetGatewaySmbUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetGatewaySmbUsersResult> Invoke(GetGatewaySmbUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetGatewaySmbUsersResult> getGatewaySmbUsers(GetGatewaySmbUsersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:cloudstoragegateway/getGatewaySmbUsers:getGatewaySmbUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    GatewayId string
    The Gateway ID.
    Ids List<string>
    A list of Gateway SMB User IDs.
    NameRegex string
    A regex string to filter results by Gateway SMB username.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    GatewayId string
    The Gateway ID.
    Ids []string
    A list of Gateway SMB User IDs.
    NameRegex string
    A regex string to filter results by Gateway SMB username.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    gatewayId String
    The Gateway ID.
    ids List<String>
    A list of Gateway SMB User IDs.
    nameRegex String
    A regex string to filter results by Gateway SMB username.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    gatewayId string
    The Gateway ID.
    ids string[]
    A list of Gateway SMB User IDs.
    nameRegex string
    A regex string to filter results by Gateway SMB username.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    gateway_id str
    The Gateway ID.
    ids Sequence[str]
    A list of Gateway SMB User IDs.
    name_regex str
    A regex string to filter results by Gateway SMB username.
    output_file str
    File name where to save data source results (after running pulumi preview).
    gatewayId String
    The Gateway ID.
    ids List<String>
    A list of Gateway SMB User IDs.
    nameRegex String
    A regex string to filter results by Gateway SMB username.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getGatewaySmbUsers Result

    The following output properties are available:

    GatewayId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Users List<Pulumi.AliCloud.CloudStorageGateway.Outputs.GetGatewaySmbUsersUser>
    NameRegex string
    OutputFile string
    GatewayId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Users []GetGatewaySmbUsersUser
    NameRegex string
    OutputFile string
    gatewayId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    users List<GetGatewaySmbUsersUser>
    nameRegex String
    outputFile String
    gatewayId string
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    users GetGatewaySmbUsersUser[]
    nameRegex string
    outputFile string
    gateway_id str
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    users Sequence[GetGatewaySmbUsersUser]
    name_regex str
    output_file str
    gatewayId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    users List<Property Map>
    nameRegex String
    outputFile String

    Supporting Types

    GetGatewaySmbUsersUser

    GatewayId string
    The Gateway ID.
    Id string
    The ID of the Gateway SMB User.
    Username string
    The username of the Gateway SMB User.
    GatewayId string
    The Gateway ID.
    Id string
    The ID of the Gateway SMB User.
    Username string
    The username of the Gateway SMB User.
    gatewayId String
    The Gateway ID.
    id String
    The ID of the Gateway SMB User.
    username String
    The username of the Gateway SMB User.
    gatewayId string
    The Gateway ID.
    id string
    The ID of the Gateway SMB User.
    username string
    The username of the Gateway SMB User.
    gateway_id str
    The Gateway ID.
    id str
    The ID of the Gateway SMB User.
    username str
    The username of the Gateway SMB User.
    gatewayId String
    The Gateway ID.
    id String
    The ID of the Gateway SMB User.
    username String
    The username of the Gateway SMB User.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi