Alibaba Cloud

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

GatewayLogging

Provides a Cloud Storage Gateway Gateway Logging resource.

For information about Cloud Storage Gateway Gateway Logging and how to use it, see What is Gateway Logging.

NOTE: Available in v1.144.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "example";
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            VpcName = name,
            CidrBlock = "172.16.0.0/12",
        });
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = "VSwitch",
        }));
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/21",
            ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
            VswitchName = name,
        });
        var defaultStorageBundle = new AliCloud.CloudStorageGateway.StorageBundle("defaultStorageBundle", new AliCloud.CloudStorageGateway.StorageBundleArgs
        {
            StorageBundleName = name,
        });
        var defaultGateway = new AliCloud.CloudStorageGateway.Gateway("defaultGateway", new AliCloud.CloudStorageGateway.GatewayArgs
        {
            Description = "tf-acctestDesalone",
            GatewayClass = "Basic",
            Type = "File",
            PaymentType = "PayAsYouGo",
            VswitchId = defaultSwitch.Id,
            ReleaseAfterExpiration = true,
            PublicNetworkBandwidth = 10,
            StorageBundleId = defaultStorageBundle.Id,
            Location = "Cloud",
            GatewayName = name,
        });
        var defaultProject = new AliCloud.Log.Project("defaultProject", new AliCloud.Log.ProjectArgs
        {
            Description = "created by terraform",
        });
        var defaultStore = new AliCloud.Log.Store("defaultStore", new AliCloud.Log.StoreArgs
        {
            Project = defaultProject.Name,
            ShardCount = 3,
            AutoSplit = true,
            MaxSplitShardCount = 60,
            AppendMeta = true,
        });
        var defaultGatewayLogging = new AliCloud.CloudStorageGateway.GatewayLogging("defaultGatewayLogging", new AliCloud.CloudStorageGateway.GatewayLoggingArgs
        {
            GatewayId = defaultGateway.Id,
            SlsLogstore = defaultStore.Name,
            SlsProject = defaultProject.Name,
        });
    }

}
package main

import (
	"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/log"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"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 := "example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			VpcName:   pulumi.String(name),
			CidrBlock: pulumi.String("172.16.0.0/12"),
		})
		if err != nil {
			return err
		}
		defaultZones, err := alicloud.GetZones(ctx, &GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
		}, nil)
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			VpcId:       defaultNetwork.ID(),
			CidrBlock:   pulumi.String("172.16.0.0/21"),
			ZoneId:      pulumi.String(defaultZones.Zones[0].Id),
			VswitchName: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultStorageBundle, err := cloudstoragegateway.NewStorageBundle(ctx, "defaultStorageBundle", &cloudstoragegateway.StorageBundleArgs{
			StorageBundleName: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultGateway, err := cloudstoragegateway.NewGateway(ctx, "defaultGateway", &cloudstoragegateway.GatewayArgs{
			Description:            pulumi.String("tf-acctestDesalone"),
			GatewayClass:           pulumi.String("Basic"),
			Type:                   pulumi.String("File"),
			PaymentType:            pulumi.String("PayAsYouGo"),
			VswitchId:              defaultSwitch.ID(),
			ReleaseAfterExpiration: pulumi.Bool(true),
			PublicNetworkBandwidth: pulumi.Int(10),
			StorageBundleId:        defaultStorageBundle.ID(),
			Location:               pulumi.String("Cloud"),
			GatewayName:            pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultProject, err := log.NewProject(ctx, "defaultProject", &log.ProjectArgs{
			Description: pulumi.String("created by terraform"),
		})
		if err != nil {
			return err
		}
		defaultStore, err := log.NewStore(ctx, "defaultStore", &log.StoreArgs{
			Project:            defaultProject.Name,
			ShardCount:         pulumi.Int(3),
			AutoSplit:          pulumi.Bool(true),
			MaxSplitShardCount: pulumi.Int(60),
			AppendMeta:         pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = cloudstoragegateway.NewGatewayLogging(ctx, "defaultGatewayLogging", &cloudstoragegateway.GatewayLoggingArgs{
			GatewayId:   defaultGateway.ID(),
			SlsLogstore: defaultStore.Name,
			SlsProject:  defaultProject.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.adb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.cloudstoragegateway.GatewayLogging;
import com.pulumi.alicloud.cloudstoragegateway.GatewayLoggingArgs;
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("example");
        var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
            .vpcName(name)
            .cidrBlock("172.16.0.0/12")
            .build());

        final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation("VSwitch")
            .build());

        var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()        
            .vpcId(defaultNetwork.id())
            .cidrBlock("172.16.0.0/21")
            .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .vswitchName(name)
            .build());

        var defaultStorageBundle = new StorageBundle("defaultStorageBundle", StorageBundleArgs.builder()        
            .storageBundleName(name)
            .build());

        var defaultGateway = new Gateway("defaultGateway", GatewayArgs.builder()        
            .description("tf-acctestDesalone")
            .gatewayClass("Basic")
            .type("File")
            .paymentType("PayAsYouGo")
            .vswitchId(defaultSwitch.id())
            .releaseAfterExpiration(true)
            .publicNetworkBandwidth(10)
            .storageBundleId(defaultStorageBundle.id())
            .location("Cloud")
            .gatewayName(name)
            .build());

        var defaultProject = new Project("defaultProject", ProjectArgs.builder()        
            .description("created by terraform")
            .build());

        var defaultStore = new Store("defaultStore", StoreArgs.builder()        
            .project(defaultProject.name())
            .shardCount(3)
            .autoSplit(true)
            .maxSplitShardCount(60)
            .appendMeta(true)
            .build());

        var defaultGatewayLogging = new GatewayLogging("defaultGatewayLogging", GatewayLoggingArgs.builder()        
            .gatewayId(defaultGateway.id())
            .slsLogstore(defaultStore.name())
            .slsProject(defaultProject.name())
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "example"
default_network = alicloud.vpc.Network("defaultNetwork",
    vpc_name=name,
    cidr_block="172.16.0.0/12")
default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/21",
    zone_id=default_zones.zones[0].id,
    vswitch_name=name)
default_storage_bundle = alicloud.cloudstoragegateway.StorageBundle("defaultStorageBundle", storage_bundle_name=name)
default_gateway = alicloud.cloudstoragegateway.Gateway("defaultGateway",
    description="tf-acctestDesalone",
    gateway_class="Basic",
    type="File",
    payment_type="PayAsYouGo",
    vswitch_id=default_switch.id,
    release_after_expiration=True,
    public_network_bandwidth=10,
    storage_bundle_id=default_storage_bundle.id,
    location="Cloud",
    gateway_name=name)
default_project = alicloud.log.Project("defaultProject", description="created by terraform")
default_store = alicloud.log.Store("defaultStore",
    project=default_project.name,
    shard_count=3,
    auto_split=True,
    max_split_shard_count=60,
    append_meta=True)
default_gateway_logging = alicloud.cloudstoragegateway.GatewayLogging("defaultGatewayLogging",
    gateway_id=default_gateway.id,
    sls_logstore=default_store.name,
    sls_project=default_project.name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "example";
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {
    vpcName: name,
    cidrBlock: "172.16.0.0/12",
});
const defaultZones = alicloud.getZones({
    availableResourceCreation: "VSwitch",
});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/21",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
    vswitchName: name,
});
const defaultStorageBundle = new alicloud.cloudstoragegateway.StorageBundle("defaultStorageBundle", {storageBundleName: name});
const defaultGateway = new alicloud.cloudstoragegateway.Gateway("defaultGateway", {
    description: "tf-acctestDesalone",
    gatewayClass: "Basic",
    type: "File",
    paymentType: "PayAsYouGo",
    vswitchId: defaultSwitch.id,
    releaseAfterExpiration: true,
    publicNetworkBandwidth: 10,
    storageBundleId: defaultStorageBundle.id,
    location: "Cloud",
    gatewayName: name,
});
const defaultProject = new alicloud.log.Project("defaultProject", {description: "created by terraform"});
const defaultStore = new alicloud.log.Store("defaultStore", {
    project: defaultProject.name,
    shardCount: 3,
    autoSplit: true,
    maxSplitShardCount: 60,
    appendMeta: true,
});
const defaultGatewayLogging = new alicloud.cloudstoragegateway.GatewayLogging("defaultGatewayLogging", {
    gatewayId: defaultGateway.id,
    slsLogstore: defaultStore.name,
    slsProject: defaultProject.name,
});
configuration:
  name:
    type: string
    default: example
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      vpcName: ${name}
      cidrBlock: 172.16.0.0/12
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/21
      zoneId: ${defaultZones.zones[0].id}
      vswitchName: ${name}
  defaultStorageBundle:
    type: alicloud:cloudstoragegateway:StorageBundle
    properties:
      storageBundleName: ${name}
  defaultGateway:
    type: alicloud:cloudstoragegateway:Gateway
    properties:
      description: tf-acctestDesalone
      gatewayClass: Basic
      type: File
      paymentType: PayAsYouGo
      vswitchId: ${defaultSwitch.id}
      releaseAfterExpiration: true
      publicNetworkBandwidth: 10
      storageBundleId: ${defaultStorageBundle.id}
      location: Cloud
      gatewayName: ${name}
  defaultProject:
    type: alicloud:log:Project
    properties:
      description: created by terraform
  defaultStore:
    type: alicloud:log:Store
    properties:
      project: ${defaultProject.name}
      shardCount: 3
      autoSplit: true
      maxSplitShardCount: 60
      appendMeta: true
  defaultGatewayLogging:
    type: alicloud:cloudstoragegateway:GatewayLogging
    properties:
      gatewayId: ${defaultGateway.id}
      slsLogstore: ${defaultStore.name}
      slsProject: ${defaultProject.name}
variables:
  defaultZones:
    Fn::Invoke:
      Function: alicloud:getZones
      Arguments:
        availableResourceCreation: VSwitch

Create a GatewayLogging Resource

new GatewayLogging(name: string, args: GatewayLoggingArgs, opts?: CustomResourceOptions);
@overload
def GatewayLogging(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   gateway_id: Optional[str] = None,
                   sls_logstore: Optional[str] = None,
                   sls_project: Optional[str] = None,
                   status: Optional[str] = None)
@overload
def GatewayLogging(resource_name: str,
                   args: GatewayLoggingArgs,
                   opts: Optional[ResourceOptions] = None)
func NewGatewayLogging(ctx *Context, name string, args GatewayLoggingArgs, opts ...ResourceOption) (*GatewayLogging, error)
public GatewayLogging(string name, GatewayLoggingArgs args, CustomResourceOptions? opts = null)
public GatewayLogging(String name, GatewayLoggingArgs args)
public GatewayLogging(String name, GatewayLoggingArgs args, CustomResourceOptions options)
type: alicloud:cloudstoragegateway:GatewayLogging
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args GatewayLoggingArgs
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 GatewayLoggingArgs
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 GatewayLoggingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GatewayLoggingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args GatewayLoggingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

GatewayLogging Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The GatewayLogging resource accepts the following input properties:

GatewayId string

The ID of the Gateway.

SlsLogstore string

The name of the Log Store.

SlsProject string

The name of the Project.

Status string

The status of the resource. Valid values: Enabled, Disable.

GatewayId string

The ID of the Gateway.

SlsLogstore string

The name of the Log Store.

SlsProject string

The name of the Project.

Status string

The status of the resource. Valid values: Enabled, Disable.

gatewayId String

The ID of the Gateway.

slsLogstore String

The name of the Log Store.

slsProject String

The name of the Project.

status String

The status of the resource. Valid values: Enabled, Disable.

gatewayId string

The ID of the Gateway.

slsLogstore string

The name of the Log Store.

slsProject string

The name of the Project.

status string

The status of the resource. Valid values: Enabled, Disable.

gateway_id str

The ID of the Gateway.

sls_logstore str

The name of the Log Store.

sls_project str

The name of the Project.

status str

The status of the resource. Valid values: Enabled, Disable.

gatewayId String

The ID of the Gateway.

slsLogstore String

The name of the Log Store.

slsProject String

The name of the Project.

status String

The status of the resource. Valid values: Enabled, Disable.

Outputs

All input properties are implicitly available as output properties. Additionally, the GatewayLogging 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 an Existing GatewayLogging Resource

Get an existing GatewayLogging 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?: GatewayLoggingState, opts?: CustomResourceOptions): GatewayLogging
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        gateway_id: Optional[str] = None,
        sls_logstore: Optional[str] = None,
        sls_project: Optional[str] = None,
        status: Optional[str] = None) -> GatewayLogging
func GetGatewayLogging(ctx *Context, name string, id IDInput, state *GatewayLoggingState, opts ...ResourceOption) (*GatewayLogging, error)
public static GatewayLogging Get(string name, Input<string> id, GatewayLoggingState? state, CustomResourceOptions? opts = null)
public static GatewayLogging get(String name, Output<String> id, GatewayLoggingState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
The following state arguments are supported:
GatewayId string

The ID of the Gateway.

SlsLogstore string

The name of the Log Store.

SlsProject string

The name of the Project.

Status string

The status of the resource. Valid values: Enabled, Disable.

GatewayId string

The ID of the Gateway.

SlsLogstore string

The name of the Log Store.

SlsProject string

The name of the Project.

Status string

The status of the resource. Valid values: Enabled, Disable.

gatewayId String

The ID of the Gateway.

slsLogstore String

The name of the Log Store.

slsProject String

The name of the Project.

status String

The status of the resource. Valid values: Enabled, Disable.

gatewayId string

The ID of the Gateway.

slsLogstore string

The name of the Log Store.

slsProject string

The name of the Project.

status string

The status of the resource. Valid values: Enabled, Disable.

gateway_id str

The ID of the Gateway.

sls_logstore str

The name of the Log Store.

sls_project str

The name of the Project.

status str

The status of the resource. Valid values: Enabled, Disable.

gatewayId String

The ID of the Gateway.

slsLogstore String

The name of the Log Store.

slsProject String

The name of the Project.

status String

The status of the resource. Valid values: Enabled, Disable.

Import

Cloud Storage Gateway Gateway Logging can be imported using the id, e.g.

 $ pulumi import alicloud:cloudstoragegateway/gatewayLogging:GatewayLogging example <gateway_id>

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.