Skip to content
v2.278.0

ClusterGrants ​

Facade Stable

Collection of grant methods for a IClusterRef.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_ecs as interfaces_ecs } from 'aws-cdk-lib/interfaces';

declare const clusterRef: interfaces_ecs.IClusterRef;
const clusterGrants = ecs.ClusterGrants.fromCluster(clusterRef);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs
from aws_cdk.interfaces import aws_ecs as interfaces_ecs

# cluster_ref: interfaces_ecs.IClusterRef

cluster_grants = ecs.ClusterGrants.from_cluster(cluster_ref)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;
import software.amazon.awscdk.interfaces.ecs.*;

IClusterRef clusterRef;

ClusterGrants clusterGrants = ClusterGrants.fromCluster(clusterRef);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.Interfaces.ECS;

IClusterRef clusterRef;

var clusterGrants = ClusterGrants.FromCluster(clusterRef);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var clusterRef IClusterRef

clusterGrants := awscdk.Aws_ecs.ClusterGrants_FromCluster(clusterRef)

Methods ​

fromCluster(resource: IClusterRef): ClusterGrants // chainable@staticmethod def from_cluster(resource: IClusterRef) -> ClusterGrantspublic static ClusterGrants fromCluster(IClusterRef resource)public static ClusterGrants FromCluster(IClusterRef resource)func FromCluster(Resource IClusterRef) ClusterGrants static #
Creates grants for ClusterGrants.
taskProtection(grantee: IGrantable): Grantdef task_protection(self, grantee: IGrantable) -> Grantpublic Grant taskProtection(IGrantable grantee)public Grant TaskProtection(IGrantable grantee)func TaskProtection(Grantee IGrantable) Grant #
Grants an ECS Task Protection API permission to the specified grantee.

This method provides a streamlined way to assign the 'ecs:UpdateTaskProtection' permission, enabling the grantee to manage task protection in the ECS cluster.