vSphere
getPolicy
The vsphere.getPolicy
data source can be used to discover the UUID of a
vSphere storage policy. This can then be used with resources or data sources that
require a storage policy.
NOTE: Storage policy support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.
Example Usage
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var policy = Output.Create(VSphere.GetPolicy.InvokeAsync(new VSphere.GetPolicyArgs
{
Name = "policy1",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vsphere.GetPolicy(ctx, &GetPolicyArgs{
Name: "policy1",
}, nil)
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
policy = vsphere.get_policy(name="policy1")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const policy = pulumi.output(vsphere.getPolicy({
name: "policy1",
}));
Coming soon!
Using getPolicy
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 getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>
def get_policy(name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPolicyResult
def get_policy_output(name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]
func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
func GetPolicyOutput(ctx *Context, args *GetPolicyOutputArgs, opts ...InvokeOption) GetPolicyResultOutput
> Note: This function is named GetPolicy
in the Go SDK.
public static class GetPolicy
{
public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
public static Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: vsphere:index/getPolicy:getPolicy
Arguments:
# Arguments dictionary
The following arguments are supported:
- Name string
The name of the storage policy.
- Name string
The name of the storage policy.
- name String
The name of the storage policy.
- name string
The name of the storage policy.
- name str
The name of the storage policy.
- name String
The name of the storage policy.
getPolicy Result
The following output properties are available:
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
vsphere
Terraform Provider.