alicloud.cloudstoragegateway.GatewaySmbUser
Explore with Pulumi AI
Provides a Cloud Storage Gateway Gateway SMB User resource.
For information about Cloud Storage Gateway Gateway SMB User and how to use it, see What is Gateway SMB User.
NOTE: Available since v1.142.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
import * as std from "@pulumi/std";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const defaultUuid = new random.index.Uuid("default", {});
const defaultStorageBundle = new alicloud.cloudstoragegateway.StorageBundle("default", {storageBundleName: std.replace({
text: defaultUuid.result,
search: "-",
replace: "",
}).then(invoke => std.substr({
input: `tf-example-${invoke.result}`,
offset: 0,
length: 16,
})).then(invoke => invoke.result)});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "172.16.0.0/12",
});
const _default = alicloud.getZones({
availableResourceCreation: "VSwitch",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vpcId: defaultNetwork.id,
cidrBlock: "172.16.0.0/21",
zoneId: _default.then(_default => _default.zones?.[0]?.id),
vswitchName: name,
});
const defaultGateway = new alicloud.cloudstoragegateway.Gateway("default", {
gatewayName: name,
description: name,
gatewayClass: "Standard",
type: "File",
paymentType: "PayAsYouGo",
vswitchId: defaultSwitch.id,
releaseAfterExpiration: false,
publicNetworkBandwidth: 40,
storageBundleId: defaultStorageBundle.id,
location: "Cloud",
});
const defaultGatewaySmbUser = new alicloud.cloudstoragegateway.GatewaySmbUser("default", {
username: "example_username",
password: "password",
gatewayId: defaultGateway.id,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
import pulumi_std as std
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default_uuid = random.index.Uuid("default")
default_storage_bundle = alicloud.cloudstoragegateway.StorageBundle("default", storage_bundle_name=std.substr(input=f"tf-example-{std.replace(text=default_uuid['result'],
search='-',
replace='').result}",
offset=0,
length=16).result)
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="172.16.0.0/12")
default = alicloud.get_zones(available_resource_creation="VSwitch")
default_switch = alicloud.vpc.Switch("default",
vpc_id=default_network.id,
cidr_block="172.16.0.0/21",
zone_id=default.zones[0].id,
vswitch_name=name)
default_gateway = alicloud.cloudstoragegateway.Gateway("default",
gateway_name=name,
description=name,
gateway_class="Standard",
type="File",
payment_type="PayAsYouGo",
vswitch_id=default_switch.id,
release_after_expiration=False,
public_network_bandwidth=40,
storage_bundle_id=default_storage_bundle.id,
location="Cloud")
default_gateway_smb_user = alicloud.cloudstoragegateway.GatewaySmbUser("default",
username="example_username",
password="password",
gateway_id=default_gateway.id)
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudstoragegateway"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultUuid, err := random.NewUuid(ctx, "default", nil)
if err != nil {
return err
}
invokeSubstr, err := std.Substr(ctx, &std.SubstrArgs{
Input: fmt.Sprintf("tf-example-%v", std.Replace(ctx, &std.ReplaceArgs{
Text: defaultUuid.Result,
Search: "-",
Replace: "",
}, nil).Result),
Offset: 0,
Length: 16,
}, nil)
if err != nil {
return err
}
defaultStorageBundle, err := cloudstoragegateway.NewStorageBundle(ctx, "default", &cloudstoragegateway.StorageBundleArgs{
StorageBundleName: pulumi.String(invokeSubstr.Result),
})
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.16.0.0/12"),
})
if err != nil {
return err
}
_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil)
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/21"),
ZoneId: pulumi.String(_default.Zones[0].Id),
VswitchName: pulumi.String(name),
})
if err != nil {
return err
}
defaultGateway, err := cloudstoragegateway.NewGateway(ctx, "default", &cloudstoragegateway.GatewayArgs{
GatewayName: pulumi.String(name),
Description: pulumi.String(name),
GatewayClass: pulumi.String("Standard"),
Type: pulumi.String("File"),
PaymentType: pulumi.String("PayAsYouGo"),
VswitchId: defaultSwitch.ID(),
ReleaseAfterExpiration: pulumi.Bool(false),
PublicNetworkBandwidth: pulumi.Int(40),
StorageBundleId: defaultStorageBundle.ID(),
Location: pulumi.String("Cloud"),
})
if err != nil {
return err
}
_, err = cloudstoragegateway.NewGatewaySmbUser(ctx, "default", &cloudstoragegateway.GatewaySmbUserArgs{
Username: pulumi.String("example_username"),
Password: pulumi.String("password"),
GatewayId: defaultGateway.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var defaultUuid = new Random.Index.Uuid("default");
var defaultStorageBundle = new AliCloud.CloudStorageGateway.StorageBundle("default", new()
{
StorageBundleName = Std.Replace.Invoke(new()
{
Text = defaultUuid.Result,
Search = "-",
Replace = "",
}).Apply(invoke => Std.Substr.Invoke(new()
{
Input = $"tf-example-{invoke.Result}",
Offset = 0,
Length = 16,
})).Apply(invoke => invoke.Result),
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "172.16.0.0/12",
});
var @default = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "VSwitch",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/21",
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
VswitchName = name,
});
var defaultGateway = new AliCloud.CloudStorageGateway.Gateway("default", new()
{
GatewayName = name,
Description = name,
GatewayClass = "Standard",
Type = "File",
PaymentType = "PayAsYouGo",
VswitchId = defaultSwitch.Id,
ReleaseAfterExpiration = false,
PublicNetworkBandwidth = 40,
StorageBundleId = defaultStorageBundle.Id,
Location = "Cloud",
});
var defaultGatewaySmbUser = new AliCloud.CloudStorageGateway.GatewaySmbUser("default", new()
{
Username = "example_username",
Password = "password",
GatewayId = defaultGateway.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.Uuid;
import com.pulumi.alicloud.cloudstoragegateway.StorageBundle;
import com.pulumi.alicloud.cloudstoragegateway.StorageBundleArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.ReplaceArgs;
import com.pulumi.std.inputs.SubstrArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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 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 config = ctx.config();
final var name = config.get("name").orElse("tf-example");
var defaultUuid = new Uuid("defaultUuid");
var defaultStorageBundle = new StorageBundle("defaultStorageBundle", StorageBundleArgs.builder()
.storageBundleName(StdFunctions.substr(SubstrArgs.builder()
.input(String.format("tf-example-%s", StdFunctions.replace(ReplaceArgs.builder()
.text(defaultUuid.result())
.search("-")
.replace("")
.build()).result()))
.offset(0)
.length(16)
.build()).result())
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/12")
.build());
final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/21")
.zoneId(default_.zones()[0].id())
.vswitchName(name)
.build());
var defaultGateway = new Gateway("defaultGateway", GatewayArgs.builder()
.gatewayName(name)
.description(name)
.gatewayClass("Standard")
.type("File")
.paymentType("PayAsYouGo")
.vswitchId(defaultSwitch.id())
.releaseAfterExpiration(false)
.publicNetworkBandwidth(40)
.storageBundleId(defaultStorageBundle.id())
.location("Cloud")
.build());
var defaultGatewaySmbUser = new GatewaySmbUser("defaultGatewaySmbUser", GatewaySmbUserArgs.builder()
.username("example_username")
.password("password")
.gatewayId(defaultGateway.id())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
defaultUuid:
type: random:Uuid
name: default
defaultStorageBundle:
type: alicloud:cloudstoragegateway:StorageBundle
name: default
properties:
storageBundleName:
fn::invoke:
function: std:substr
arguments:
input:
fn::join:
- ""
- - tf-example-
- fn::invoke:
function: std:replace
arguments:
text: ${defaultUuid.result}
search: '-'
replace: ""
return: result
offset: 0
length: 16
return: result
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 172.16.0.0/12
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vpcId: ${defaultNetwork.id}
cidrBlock: 172.16.0.0/21
zoneId: ${default.zones[0].id}
vswitchName: ${name}
defaultGateway:
type: alicloud:cloudstoragegateway:Gateway
name: default
properties:
gatewayName: ${name}
description: ${name}
gatewayClass: Standard
type: File
paymentType: PayAsYouGo
vswitchId: ${defaultSwitch.id}
releaseAfterExpiration: false
publicNetworkBandwidth: 40
storageBundleId: ${defaultStorageBundle.id}
location: Cloud
defaultGatewaySmbUser:
type: alicloud:cloudstoragegateway:GatewaySmbUser
name: default
properties:
username: example_username
password: password
gatewayId: ${defaultGateway.id}
variables:
default:
fn::invoke:
function: alicloud:getZones
arguments:
availableResourceCreation: VSwitch
Create GatewaySmbUser Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GatewaySmbUser(name: string, args: GatewaySmbUserArgs, opts?: CustomResourceOptions);
@overload
def GatewaySmbUser(resource_name: str,
args: GatewaySmbUserArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GatewaySmbUser(resource_name: str,
opts: Optional[ResourceOptions] = None,
gateway_id: Optional[str] = None,
password: Optional[str] = None,
username: Optional[str] = None)
func NewGatewaySmbUser(ctx *Context, name string, args GatewaySmbUserArgs, opts ...ResourceOption) (*GatewaySmbUser, error)
public GatewaySmbUser(string name, GatewaySmbUserArgs args, CustomResourceOptions? opts = null)
public GatewaySmbUser(String name, GatewaySmbUserArgs args)
public GatewaySmbUser(String name, GatewaySmbUserArgs args, CustomResourceOptions options)
type: alicloud:cloudstoragegateway:GatewaySmbUser
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args GatewaySmbUserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args GatewaySmbUserArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args GatewaySmbUserArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GatewaySmbUserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GatewaySmbUserArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var gatewaySmbUserResource = new AliCloud.CloudStorageGateway.GatewaySmbUser("gatewaySmbUserResource", new()
{
GatewayId = "string",
Password = "string",
Username = "string",
});
example, err := cloudstoragegateway.NewGatewaySmbUser(ctx, "gatewaySmbUserResource", &cloudstoragegateway.GatewaySmbUserArgs{
GatewayId: pulumi.String("string"),
Password: pulumi.String("string"),
Username: pulumi.String("string"),
})
var gatewaySmbUserResource = new GatewaySmbUser("gatewaySmbUserResource", GatewaySmbUserArgs.builder()
.gatewayId("string")
.password("string")
.username("string")
.build());
gateway_smb_user_resource = alicloud.cloudstoragegateway.GatewaySmbUser("gatewaySmbUserResource",
gateway_id="string",
password="string",
username="string")
const gatewaySmbUserResource = new alicloud.cloudstoragegateway.GatewaySmbUser("gatewaySmbUserResource", {
gatewayId: "string",
password: "string",
username: "string",
});
type: alicloud:cloudstoragegateway:GatewaySmbUser
properties:
gatewayId: string
password: string
username: string
GatewaySmbUser Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The GatewaySmbUser resource accepts the following input properties:
- gateway_
id str - The Gateway ID of the Gateway SMB User.
- password str
- The password of the Gateway SMB User.
- username str
- The username of the Gateway SMB User.
Outputs
All input properties are implicitly available as output properties. Additionally, the GatewaySmbUser resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing GatewaySmbUser Resource
Get an existing GatewaySmbUser resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: GatewaySmbUserState, opts?: CustomResourceOptions): GatewaySmbUser
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
gateway_id: Optional[str] = None,
password: Optional[str] = None,
username: Optional[str] = None) -> GatewaySmbUser
func GetGatewaySmbUser(ctx *Context, name string, id IDInput, state *GatewaySmbUserState, opts ...ResourceOption) (*GatewaySmbUser, error)
public static GatewaySmbUser Get(string name, Input<string> id, GatewaySmbUserState? state, CustomResourceOptions? opts = null)
public static GatewaySmbUser get(String name, Output<String> id, GatewaySmbUserState state, CustomResourceOptions options)
resources: _: type: alicloud:cloudstoragegateway:GatewaySmbUser get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- gateway_
id str - The Gateway ID of the Gateway SMB User.
- password str
- The password of the Gateway SMB User.
- username str
- The username of the Gateway SMB User.
Import
Cloud Storage Gateway Gateway SMB User can be imported using the id, e.g.
$ pulumi import alicloud:cloudstoragegateway/gatewaySmbUser:GatewaySmbUser example <gateway_id>:<username>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.