1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. SavedQuery
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.resourcemanager.SavedQuery

Explore with Pulumi AI

Provides a Resource Manager Saved Query resource. ResourceCenter Saved Query.

For information about Resource Manager Saved Query and how to use it, see What is Saved Query.

NOTE: Available since v1.212.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new alicloud.resourcemanager.SavedQuery("default", {
    description: name,
    expression: "select * from resources limit 1;",
    savedQueryName: name,
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default = alicloud.resourcemanager.SavedQuery("default",
    description=name,
    expression="select * from resources limit 1;",
    saved_query_name=name)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
	"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 := "terraform-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_, err := resourcemanager.NewSavedQuery(ctx, "default", &resourcemanager.SavedQueryArgs{
			Description:    pulumi.String(name),
			Expression:     pulumi.String("select * from resources limit 1;"),
			SavedQueryName: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "terraform-example";
    var @default = new AliCloud.ResourceManager.SavedQuery("default", new()
    {
        Description = name,
        Expression = "select * from resources limit 1;",
        SavedQueryName = name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.SavedQuery;
import com.pulumi.alicloud.resourcemanager.SavedQueryArgs;
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("terraform-example");
        var default_ = new SavedQuery("default", SavedQueryArgs.builder()
            .description(name)
            .expression("select * from resources limit 1;")
            .savedQueryName(name)
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  default:
    type: alicloud:resourcemanager:SavedQuery
    properties:
      description: ${name}
      expression: select * from resources limit 1;
      savedQueryName: ${name}
Copy

Create SavedQuery Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new SavedQuery(name: string, args: SavedQueryArgs, opts?: CustomResourceOptions);
@overload
def SavedQuery(resource_name: str,
               args: SavedQueryArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def SavedQuery(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               expression: Optional[str] = None,
               saved_query_name: Optional[str] = None,
               description: Optional[str] = None)
func NewSavedQuery(ctx *Context, name string, args SavedQueryArgs, opts ...ResourceOption) (*SavedQuery, error)
public SavedQuery(string name, SavedQueryArgs args, CustomResourceOptions? opts = null)
public SavedQuery(String name, SavedQueryArgs args)
public SavedQuery(String name, SavedQueryArgs args, CustomResourceOptions options)
type: alicloud:resourcemanager:SavedQuery
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SavedQueryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SavedQueryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SavedQueryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SavedQueryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SavedQueryArgs
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 savedQueryResource = new AliCloud.ResourceManager.SavedQuery("savedQueryResource", new()
{
    Expression = "string",
    SavedQueryName = "string",
    Description = "string",
});
Copy
example, err := resourcemanager.NewSavedQuery(ctx, "savedQueryResource", &resourcemanager.SavedQueryArgs{
	Expression:     pulumi.String("string"),
	SavedQueryName: pulumi.String("string"),
	Description:    pulumi.String("string"),
})
Copy
var savedQueryResource = new SavedQuery("savedQueryResource", SavedQueryArgs.builder()
    .expression("string")
    .savedQueryName("string")
    .description("string")
    .build());
Copy
saved_query_resource = alicloud.resourcemanager.SavedQuery("savedQueryResource",
    expression="string",
    saved_query_name="string",
    description="string")
Copy
const savedQueryResource = new alicloud.resourcemanager.SavedQuery("savedQueryResource", {
    expression: "string",
    savedQueryName: "string",
    description: "string",
});
Copy
type: alicloud:resourcemanager:SavedQuery
properties:
    description: string
    expression: string
    savedQueryName: string
Copy

SavedQuery 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 SavedQuery resource accepts the following input properties:

Expression This property is required. string
Query Expression.
SavedQueryName This property is required. string
The name of the resource.
Description string
Query Description.
Expression This property is required. string
Query Expression.
SavedQueryName This property is required. string
The name of the resource.
Description string
Query Description.
expression This property is required. String
Query Expression.
savedQueryName This property is required. String
The name of the resource.
description String
Query Description.
expression This property is required. string
Query Expression.
savedQueryName This property is required. string
The name of the resource.
description string
Query Description.
expression This property is required. str
Query Expression.
saved_query_name This property is required. str
The name of the resource.
description str
Query Description.
expression This property is required. String
Query Expression.
savedQueryName This property is required. String
The name of the resource.
description String
Query Description.

Outputs

All input properties are implicitly available as output properties. Additionally, the SavedQuery resource produces the following output properties:

CreateTime string
The creation time of the resource.
Id string
The provider-assigned unique ID for this managed resource.
CreateTime string
The creation time of the resource.
Id string
The provider-assigned unique ID for this managed resource.
createTime String
The creation time of the resource.
id String
The provider-assigned unique ID for this managed resource.
createTime string
The creation time of the resource.
id string
The provider-assigned unique ID for this managed resource.
create_time str
The creation time of the resource.
id str
The provider-assigned unique ID for this managed resource.
createTime String
The creation time of the resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing SavedQuery Resource

Get an existing SavedQuery 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?: SavedQueryState, opts?: CustomResourceOptions): SavedQuery
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        expression: Optional[str] = None,
        saved_query_name: Optional[str] = None) -> SavedQuery
func GetSavedQuery(ctx *Context, name string, id IDInput, state *SavedQueryState, opts ...ResourceOption) (*SavedQuery, error)
public static SavedQuery Get(string name, Input<string> id, SavedQueryState? state, CustomResourceOptions? opts = null)
public static SavedQuery get(String name, Output<String> id, SavedQueryState state, CustomResourceOptions options)
resources:  _:    type: alicloud:resourcemanager:SavedQuery    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CreateTime string
The creation time of the resource.
Description string
Query Description.
Expression string
Query Expression.
SavedQueryName string
The name of the resource.
CreateTime string
The creation time of the resource.
Description string
Query Description.
Expression string
Query Expression.
SavedQueryName string
The name of the resource.
createTime String
The creation time of the resource.
description String
Query Description.
expression String
Query Expression.
savedQueryName String
The name of the resource.
createTime string
The creation time of the resource.
description string
Query Description.
expression string
Query Expression.
savedQueryName string
The name of the resource.
create_time str
The creation time of the resource.
description str
Query Description.
expression str
Query Expression.
saved_query_name str
The name of the resource.
createTime String
The creation time of the resource.
description String
Query Description.
expression String
Query Expression.
savedQueryName String
The name of the resource.

Import

Resource Manager Saved Query can be imported using the id, e.g.

$ pulumi import alicloud:resourcemanager/savedQuery:SavedQuery example <id>
Copy

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.