Control Plane v0.0.27 published on Saturday, May 25, 2024 by pulumiverse
cpln.Policy
Explore with Pulumi AI
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
@overload
def Policy(resource_name: str,
args: PolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
opts: Optional[ResourceOptions] = None,
target_kind: Optional[str] = None,
bindings: Optional[Sequence[PolicyBindingArgs]] = None,
description: Optional[str] = None,
gvc: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
target: Optional[str] = None,
target_links: Optional[Sequence[str]] = None,
target_query: Optional[PolicyTargetQueryArgs] = None)
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: cpln:Policy
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 PolicyArgs
- 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 PolicyArgs
- 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 PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- 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 policyResource = new Cpln.Policy("policyResource", new()
{
TargetKind = "string",
Bindings = new[]
{
new Cpln.Inputs.PolicyBindingArgs
{
Permissions = new[]
{
"string",
},
PrincipalLinks = new[]
{
"string",
},
},
},
Description = "string",
Gvc = "string",
Name = "string",
Tags =
{
{ "string", "string" },
},
Target = "string",
TargetLinks = new[]
{
"string",
},
TargetQuery = new Cpln.Inputs.PolicyTargetQueryArgs
{
Fetch = "string",
Spec = new Cpln.Inputs.PolicyTargetQuerySpecArgs
{
Match = "string",
Terms = new[]
{
new Cpln.Inputs.PolicyTargetQuerySpecTermArgs
{
Op = "string",
Property = "string",
Tag = "string",
Value = "string",
},
},
},
},
});
example, err := cpln.NewPolicy(ctx, "policyResource", &cpln.PolicyArgs{
TargetKind: pulumi.String("string"),
Bindings: cpln.PolicyBindingArray{
&cpln.PolicyBindingArgs{
Permissions: pulumi.StringArray{
pulumi.String("string"),
},
PrincipalLinks: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Description: pulumi.String("string"),
Gvc: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
Target: pulumi.String("string"),
TargetLinks: pulumi.StringArray{
pulumi.String("string"),
},
TargetQuery: &cpln.PolicyTargetQueryArgs{
Fetch: pulumi.String("string"),
Spec: &cpln.PolicyTargetQuerySpecArgs{
Match: pulumi.String("string"),
Terms: cpln.PolicyTargetQuerySpecTermArray{
&cpln.PolicyTargetQuerySpecTermArgs{
Op: pulumi.String("string"),
Property: pulumi.String("string"),
Tag: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
},
},
})
var policyResource = new Policy("policyResource", PolicyArgs.builder()
.targetKind("string")
.bindings(PolicyBindingArgs.builder()
.permissions("string")
.principalLinks("string")
.build())
.description("string")
.gvc("string")
.name("string")
.tags(Map.of("string", "string"))
.target("string")
.targetLinks("string")
.targetQuery(PolicyTargetQueryArgs.builder()
.fetch("string")
.spec(PolicyTargetQuerySpecArgs.builder()
.match("string")
.terms(PolicyTargetQuerySpecTermArgs.builder()
.op("string")
.property("string")
.tag("string")
.value("string")
.build())
.build())
.build())
.build());
policy_resource = cpln.Policy("policyResource",
target_kind="string",
bindings=[cpln.PolicyBindingArgs(
permissions=["string"],
principal_links=["string"],
)],
description="string",
gvc="string",
name="string",
tags={
"string": "string",
},
target="string",
target_links=["string"],
target_query=cpln.PolicyTargetQueryArgs(
fetch="string",
spec=cpln.PolicyTargetQuerySpecArgs(
match="string",
terms=[cpln.PolicyTargetQuerySpecTermArgs(
op="string",
property="string",
tag="string",
value="string",
)],
),
))
const policyResource = new cpln.Policy("policyResource", {
targetKind: "string",
bindings: [{
permissions: ["string"],
principalLinks: ["string"],
}],
description: "string",
gvc: "string",
name: "string",
tags: {
string: "string",
},
target: "string",
targetLinks: ["string"],
targetQuery: {
fetch: "string",
spec: {
match: "string",
terms: [{
op: "string",
property: "string",
tag: "string",
value: "string",
}],
},
},
});
type: cpln:Policy
properties:
bindings:
- permissions:
- string
principalLinks:
- string
description: string
gvc: string
name: string
tags:
string: string
target: string
targetKind: string
targetLinks:
- string
targetQuery:
fetch: string
spec:
match: string
terms:
- op: string
property: string
tag: string
value: string
Policy 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 Policy resource accepts the following input properties:
- Target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- Bindings
List<Pulumiverse.
Cpln. Inputs. Policy Binding> - The association between a target kind and the bound permissions to service principals.
- Description string
- Description of the Policy.
- Gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - Name string
- Name of the Policy.
- Dictionary<string, string>
- Key-value map of resource tags.
- Target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - Target
Links List<string> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - Target
Query Pulumiverse.Cpln. Inputs. Policy Target Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- Target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- Bindings
[]Policy
Binding Args - The association between a target kind and the bound permissions to service principals.
- Description string
- Description of the Policy.
- Gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - Name string
- Name of the Policy.
- map[string]string
- Key-value map of resource tags.
- Target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - Target
Links []string - List of the targets this policy will be applied to. Not used if
target
is set toall
. - Target
Query PolicyTarget Query Args - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- target
Kind String - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- bindings
List<Policy
Binding> - The association between a target kind and the bound permissions to service principals.
- description String
- Description of the Policy.
- gvc String
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name String
- Name of the Policy.
- Map<String,String>
- Key-value map of resource tags.
- target String
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Links List<String> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query PolicyTarget Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- bindings
Policy
Binding[] - The association between a target kind and the bound permissions to service principals.
- description string
- Description of the Policy.
- gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name string
- Name of the Policy.
- {[key: string]: string}
- Key-value map of resource tags.
- target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Links string[] - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query PolicyTarget Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- target_
kind str - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- bindings
Sequence[Policy
Binding Args] - The association between a target kind and the bound permissions to service principals.
- description str
- Description of the Policy.
- gvc str
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name str
- Name of the Policy.
- Mapping[str, str]
- Key-value map of resource tags.
- target str
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target_
links Sequence[str] - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target_
query PolicyTarget Query Args - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- target
Kind String - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- bindings List<Property Map>
- The association between a target kind and the bound permissions to service principals.
- description String
- Description of the Policy.
- gvc String
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name String
- Name of the Policy.
- Map<String>
- Key-value map of resource tags.
- target String
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Links List<String> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query Property Map - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
Look up Existing Policy Resource
Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bindings: Optional[Sequence[PolicyBindingArgs]] = None,
cpln_id: Optional[str] = None,
description: Optional[str] = None,
gvc: Optional[str] = None,
name: Optional[str] = None,
origin: Optional[str] = None,
self_link: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
target: Optional[str] = None,
target_kind: Optional[str] = None,
target_links: Optional[Sequence[str]] = None,
target_query: Optional[PolicyTargetQueryArgs] = None) -> Policy
func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
public static Policy get(String name, Output<String> id, PolicyState 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.
- Bindings
List<Pulumiverse.
Cpln. Inputs. Policy Binding> - The association between a target kind and the bound permissions to service principals.
- Cpln
Id string - The ID, in GUID format, of the Policy.
- Description string
- Description of the Policy.
- Gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - Name string
- Name of the Policy.
- Origin string
- Origin of the Policy. Either
builtin
ordefault
. - Self
Link string - Full link to this resource. Can be referenced by other resources.
- Dictionary<string, string>
- Key-value map of resource tags.
- Target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - Target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- Target
Links List<string> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - Target
Query Pulumiverse.Cpln. Inputs. Policy Target Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- Bindings
[]Policy
Binding Args - The association between a target kind and the bound permissions to service principals.
- Cpln
Id string - The ID, in GUID format, of the Policy.
- Description string
- Description of the Policy.
- Gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - Name string
- Name of the Policy.
- Origin string
- Origin of the Policy. Either
builtin
ordefault
. - Self
Link string - Full link to this resource. Can be referenced by other resources.
- map[string]string
- Key-value map of resource tags.
- Target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - Target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- Target
Links []string - List of the targets this policy will be applied to. Not used if
target
is set toall
. - Target
Query PolicyTarget Query Args - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- bindings
List<Policy
Binding> - The association between a target kind and the bound permissions to service principals.
- cpln
Id String - The ID, in GUID format, of the Policy.
- description String
- Description of the Policy.
- gvc String
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name String
- Name of the Policy.
- origin String
- Origin of the Policy. Either
builtin
ordefault
. - self
Link String - Full link to this resource. Can be referenced by other resources.
- Map<String,String>
- Key-value map of resource tags.
- target String
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Kind String - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- target
Links List<String> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query PolicyTarget Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- bindings
Policy
Binding[] - The association between a target kind and the bound permissions to service principals.
- cpln
Id string - The ID, in GUID format, of the Policy.
- description string
- Description of the Policy.
- gvc string
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name string
- Name of the Policy.
- origin string
- Origin of the Policy. Either
builtin
ordefault
. - self
Link string - Full link to this resource. Can be referenced by other resources.
- {[key: string]: string}
- Key-value map of resource tags.
- target string
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Kind string - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- target
Links string[] - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query PolicyTarget Query - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- bindings
Sequence[Policy
Binding Args] - The association between a target kind and the bound permissions to service principals.
- cpln_
id str - The ID, in GUID format, of the Policy.
- description str
- Description of the Policy.
- gvc str
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name str
- Name of the Policy.
- origin str
- Origin of the Policy. Either
builtin
ordefault
. - self_
link str - Full link to this resource. Can be referenced by other resources.
- Mapping[str, str]
- Key-value map of resource tags.
- target str
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target_
kind str - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- target_
links Sequence[str] - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target_
query PolicyTarget Query Args - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
- bindings List<Property Map>
- The association between a target kind and the bound permissions to service principals.
- cpln
Id String - The ID, in GUID format, of the Policy.
- description String
- Description of the Policy.
- gvc String
- The GVC for
identity
,workload
andvolumeset
target kinds only. - name String
- Name of the Policy.
- origin String
- Origin of the Policy. Either
builtin
ordefault
. - self
Link String - Full link to this resource. Can be referenced by other resources.
- Map<String>
- Key-value map of resource tags.
- target String
- Set this value of this attribute to
all
if this policy should target all objects of the given target_kind. Otherwise, do not include the attribute. - target
Kind String - The kind of resource to target (e.g., gvc, serviceaccount, etc.).
- target
Links List<String> - List of the targets this policy will be applied to. Not used if
target
is set toall
. - target
Query Property Map - A defined set of criteria or conditions used to identify the target entities or resources to which the policy applies.
Supporting Types
PolicyBinding, PolicyBindingArgs
- Permissions List<string>
- Principal
Links List<string>
- Permissions []string
- Principal
Links []string
- permissions List<String>
- principal
Links List<String>
- permissions string[]
- principal
Links string[]
- permissions Sequence[str]
- principal_
links Sequence[str]
- permissions List<String>
- principal
Links List<String>
PolicyTargetQuery, PolicyTargetQueryArgs
- Fetch string
- Spec
Policy
Target Query Spec
- fetch String
- spec
Policy
Target Query Spec
- fetch string
- spec
Policy
Target Query Spec
- fetch String
- spec Property Map
PolicyTargetQuerySpec, PolicyTargetQuerySpecArgs
- match String
- terms List<Property Map>
PolicyTargetQuerySpecTerm, PolicyTargetQuerySpecTermArgs
Package Details
- Repository
- cpln pulumiverse/pulumi-cpln
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cpln
Terraform Provider.