Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getGatewaySmbUsers

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

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var defaultNetworks = Output.Create(AliCloud.Vpc.GetNetworks.InvokeAsync(new AliCloud.Vpc.GetNetworksArgs
        {
            NameRegex = "default-NODELETING",
        }));
        var defaultSwitches = defaultNetworks.Apply(defaultNetworks => Output.Create(AliCloud.Vpc.GetSwitches.InvokeAsync(new AliCloud.Vpc.GetSwitchesArgs
        {
            VpcId = defaultNetworks.Ids?[0],
        })));
        var example = new AliCloud.CloudStorageGateway.StorageBundle("example", new AliCloud.CloudStorageGateway.StorageBundleArgs
        {
            StorageBundleName = "example_value",
        });
        var defaultGateway = new AliCloud.CloudStorageGateway.Gateway("defaultGateway", new AliCloud.CloudStorageGateway.GatewayArgs
        {
            Description = "tf-acctestDesalone",
            GatewayClass = "Standard",
            Type = "File",
            PaymentType = "PayAsYouGo",
            VswitchId = defaultSwitches.Apply(defaultSwitches => defaultSwitches.Ids?[0]),
            ReleaseAfterExpiration = false,
            PublicNetworkBandwidth = 40,
            StorageBundleId = example.Id,
            Location = "Cloud",
            GatewayName = "example_value",
        });
        var defaultGatewaySmbUser = new AliCloud.CloudStorageGateway.GatewaySmbUser("defaultGatewaySmbUser", new AliCloud.CloudStorageGateway.GatewaySmbUserArgs
        {
            Username = "your_username",
            Password = "password",
            GatewayId = defaultGateway.Id,
        });
        var ids = AliCloud.CloudStorageGateway.GetGatewaySmbUsers.Invoke(new AliCloud.CloudStorageGateway.GetGatewaySmbUsersInvokeArgs
        {
            GatewayId = defaultGateway.Id,
            Ids = 
            {
                defaultGatewaySmbUser.Id,
            },
        });
        this.CloudStorageGatewayGatewaySmbUserId1 = ids.Apply(ids => ids.Users?[0]?.Id);
    }

    [Output("cloudStorageGatewayGatewaySmbUserId1")]
    public Output<string> CloudStorageGatewayGatewaySmbUserId1 { get; set; }
}
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 {
		defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
			NameRegex: pulumi.StringRef("default-NODELETING"),
		}, nil)
		if err != nil {
			return err
		}
		defaultSwitches, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
			VpcId: pulumi.StringRef(defaultNetworks.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, "defaultGateway", &cloudstoragegateway.GatewayArgs{
			Description:            pulumi.String("tf-acctestDesalone"),
			GatewayClass:           pulumi.String("Standard"),
			Type:                   pulumi.String("File"),
			PaymentType:            pulumi.String("PayAsYouGo"),
			VswitchId:              pulumi.String(defaultSwitches.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, "defaultGatewaySmbUser", &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.StringOutput))
		return nil
	})
}
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.cloudconnect.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 defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
            .nameRegex("default-NODELETING")
            .build());

        final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
            .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.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(defaultSwitches.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())));
    }
}
import pulumi
import pulumi_alicloud as alicloud

default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0])
example = alicloud.cloudstoragegateway.StorageBundle("example", storage_bundle_name="example_value")
default_gateway = alicloud.cloudstoragegateway.Gateway("defaultGateway",
    description="tf-acctestDesalone",
    gateway_class="Standard",
    type="File",
    payment_type="PayAsYouGo",
    vswitch_id=default_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("defaultGatewaySmbUser",
    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)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultNetworks = alicloud.vpc.getNetworks({
    nameRegex: "default-NODELETING",
});
const defaultSwitches = defaultNetworks.then(defaultNetworks => alicloud.vpc.getSwitches({
    vpcId: defaultNetworks.ids?[0],
}));
const example = new alicloud.cloudstoragegateway.StorageBundle("example", {storageBundleName: "example_value"});
const defaultGateway = new alicloud.cloudstoragegateway.Gateway("defaultGateway", {
    description: "tf-acctestDesalone",
    gatewayClass: "Standard",
    type: "File",
    paymentType: "PayAsYouGo",
    vswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.ids?[0]),
    releaseAfterExpiration: false,
    publicNetworkBandwidth: 40,
    storageBundleId: example.id,
    location: "Cloud",
    gatewayName: "example_value",
});
const defaultGatewaySmbUser = new alicloud.cloudstoragegateway.GatewaySmbUser("defaultGatewaySmbUser", {
    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);
resources:
  example:
    type: alicloud:cloudstoragegateway:StorageBundle
    properties:
      storageBundleName: example_value
  defaultGateway:
    type: alicloud:cloudstoragegateway:Gateway
    properties:
      description: tf-acctestDesalone
      gatewayClass: Standard
      type: File
      paymentType: PayAsYouGo
      vswitchId: ${defaultSwitches.ids[0]}
      releaseAfterExpiration: false
      publicNetworkBandwidth: 40
      storageBundleId: ${example.id}
      location: Cloud
      gatewayName: example_value
  defaultGatewaySmbUser:
    type: alicloud:cloudstoragegateway:GatewaySmbUser
    properties:
      username: your_username
      password: password
      gatewayId: ${defaultGateway.id}
variables:
  defaultNetworks:
    Fn::Invoke:
      Function: alicloud:vpc:getNetworks
      Arguments:
        nameRegex: default-NODELETING
  defaultSwitches:
    Fn::Invoke:
      Function: alicloud:vpc:getSwitches
      Arguments:
        vpcId: ${defaultNetworks.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
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
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
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
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
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

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
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.