AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi
aws.shield.getProtection
Explore with Pulumi AI
Data source for managing an AWS Shield Protection.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.shield.getProtection({
    protectionId: "abc123",
});
import pulumi
import pulumi_aws as aws
example = aws.shield.get_protection(protection_id="abc123")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := shield.LookupProtection(ctx, &shield.LookupProtectionArgs{
			ProtectionId: pulumi.StringRef("abc123"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Shield.GetProtection.Invoke(new()
    {
        ProtectionId = "abc123",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.shield.ShieldFunctions;
import com.pulumi.aws.shield.inputs.GetProtectionArgs;
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 example = ShieldFunctions.getProtection(GetProtectionArgs.builder()
            .protectionId("abc123")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:shield:getProtection
      arguments:
        protectionId: abc123
By Resource ARN
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.shield.getProtection({
    resourceArn: "arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh",
});
import pulumi
import pulumi_aws as aws
example = aws.shield.get_protection(resource_arn="arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := shield.LookupProtection(ctx, &shield.LookupProtectionArgs{
			ResourceArn: pulumi.StringRef("arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Shield.GetProtection.Invoke(new()
    {
        ResourceArn = "arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.shield.ShieldFunctions;
import com.pulumi.aws.shield.inputs.GetProtectionArgs;
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 example = ShieldFunctions.getProtection(GetProtectionArgs.builder()
            .resourceArn("arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:shield:getProtection
      arguments:
        resourceArn: arn:aws:globalaccelerator::123456789012:accelerator/1234abcd-abcd-1234-abcd-1234abcdefgh
Using getProtection
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 getProtection(args: GetProtectionArgs, opts?: InvokeOptions): Promise<GetProtectionResult>
function getProtectionOutput(args: GetProtectionOutputArgs, opts?: InvokeOptions): Output<GetProtectionResult>def get_protection(protection_id: Optional[str] = None,
                   resource_arn: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetProtectionResult
def get_protection_output(protection_id: Optional[pulumi.Input[str]] = None,
                   resource_arn: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetProtectionResult]func LookupProtection(ctx *Context, args *LookupProtectionArgs, opts ...InvokeOption) (*LookupProtectionResult, error)
func LookupProtectionOutput(ctx *Context, args *LookupProtectionOutputArgs, opts ...InvokeOption) LookupProtectionResultOutput> Note: This function is named LookupProtection in the Go SDK.
public static class GetProtection 
{
    public static Task<GetProtectionResult> InvokeAsync(GetProtectionArgs args, InvokeOptions? opts = null)
    public static Output<GetProtectionResult> Invoke(GetProtectionInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetProtectionResult> getProtection(GetProtectionArgs args, InvokeOptions options)
public static Output<GetProtectionResult> getProtection(GetProtectionArgs args, InvokeOptions options)
fn::invoke:
  function: aws:shield/getProtection:getProtection
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ProtectionId string
- Unique identifier for the protection.
- ResourceArn string
- ARN (Amazon Resource Name) of the resource being protected.
- ProtectionId string
- Unique identifier for the protection.
- ResourceArn string
- ARN (Amazon Resource Name) of the resource being protected.
- protectionId String
- Unique identifier for the protection.
- resourceArn String
- ARN (Amazon Resource Name) of the resource being protected.
- protectionId string
- Unique identifier for the protection.
- resourceArn string
- ARN (Amazon Resource Name) of the resource being protected.
- protection_id str
- Unique identifier for the protection.
- resource_arn str
- ARN (Amazon Resource Name) of the resource being protected.
- protectionId String
- Unique identifier for the protection.
- resourceArn String
- ARN (Amazon Resource Name) of the resource being protected.
getProtection Result
The following output properties are available:
- Id string
- Name string
- Name of the protection.
- ProtectionArn string
- ARN of the protection.
- ProtectionId string
- ResourceArn string
- Id string
- Name string
- Name of the protection.
- ProtectionArn string
- ARN of the protection.
- ProtectionId string
- ResourceArn string
- id String
- name String
- Name of the protection.
- protectionArn String
- ARN of the protection.
- protectionId String
- resourceArn String
- id string
- name string
- Name of the protection.
- protectionArn string
- ARN of the protection.
- protectionId string
- resourceArn string
- id str
- name str
- Name of the protection.
- protection_arn str
- ARN of the protection.
- protection_id str
- resource_arn str
- id String
- name String
- Name of the protection.
- protectionArn String
- ARN of the protection.
- protectionId String
- resourceArn String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.