Class: Aws::NetworkSecurityManager::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb

Overview

An API client for NetworkSecurityManager. To construct a client, you need to configure a :region and :credentials.

client = Aws::NetworkSecurityManager::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

For details on configuring region and credentials see the developer guide.

See #initialize for a full list of supported configuration options.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#api_requests, #stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

Options Hash (options):

  • :plugins (Array<Seahorse::Client::Plugin>) — default: []] —

    A list of plugins to apply to the client. Each plugin is either a class name or an instance of a plugin class.

  • :credentials (required, Aws::CredentialProvider) —

    Your AWS credentials used for authentication. This can be any class that includes and implements Aws::CredentialProvider, or instance of any one of the following classes:

    • Aws::Credentials - Used for configuring static, non-refreshing credentials.

    • Aws::SharedCredentials - Used for loading static credentials from a shared file, such as ~/.aws/config.

    • Aws::AssumeRoleCredentials - Used when you need to assume a role.

    • Aws::AssumeRoleWebIdentityCredentials - Used when you need to assume a role after providing credentials via the web.

    • Aws::SSOCredentials - Used for loading credentials from AWS SSO using an access token generated from aws login.

    • Aws::ProcessCredentials - Used for loading credentials from a process that outputs to stdout.

    • Aws::InstanceProfileCredentials - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • Aws::ECSCredentials - Used for loading credentials from instances running in ECS.

    • Aws::CognitoIdentityCredentials - Used for loading credentials from the Cognito Identity service.

    When :credentials are not configured directly, the following locations will be searched for credentials:

    • Aws.config[:credentials]

    • The :access_key_id, :secret_access_key, :session_token, and :account_id options.

    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'], ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID'].

    • ~/.aws/credentials

    • ~/.aws/config

    • EC2/ECS IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of Aws::InstanceProfileCredentials or Aws::ECSCredentials to enable retries and extended timeouts. Instance profile credential fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED'] to true.

  • :region (required, String) —

    The AWS region to connect to. The configured :region is used to determine the service :endpoint. When not passed, a default :region is searched for in the following locations:

    • Aws.config[:region]
    • ENV['AWS_REGION']
    • ENV['AMAZON_REGION']
    • ENV['AWS_DEFAULT_REGION']
    • ~/.aws/credentials
    • ~/.aws/config
  • :access_key_id (String)
  • :account_id (String)
  • :active_endpoint_cache (Boolean) — default: false —

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false.

  • :adaptive_retry_wait_to_fill (Boolean) — default: true —

    Used only in adaptive retry mode. When true, the request will sleep until there is sufficent client side capacity to retry the request. When false, the request will raise a RetryCapacityNotAvailableError and will not retry instead of sleeping.

  • :auth_scheme_preference (Array<String>) —

    A list of preferred authentication schemes to use when making a request. Supported values are: sigv4, sigv4a, httpBearerAuth, and noAuth. When set using ENV['AWS_AUTH_SCHEME_PREFERENCE'] or in shared config as auth_scheme_preference, the value should be a comma-separated list.

  • :client_side_monitoring (Boolean) — default: false —

    When true, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: "" —

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_host (String) — default: "127.0.0.1" —

    Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_port (Integer) — default: 31000 —

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher —

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true —

    When true, an attempt is made to coerce request parameters into the required types.

  • :correct_clock_skew (Boolean) — default: true —

    Used only in standard and adaptive retry modes. Specifies whether to apply a clock skew correction and retry requests with skewed client clocks. Takes effect only when disable_clock_skew_correction is not set.

  • :defaults_mode (String) — default: "legacy" —

    See DefaultsModeConfiguration for a list of the accepted modes and the configuration defaults that are included.

  • :disable_clock_skew_correction (Boolean) —

    Used only in standard and adaptive retry modes. When true, the SDK does not apply a clock skew correction, does not update its stored skew from responses, and does not retry clock skew errors. Clock skew correction is enabled by default.

  • :disable_host_prefix_injection (Boolean) — default: false —

    When true, the SDK will not prepend the modeled host prefix to the endpoint.

  • :disable_request_compression (Boolean) — default: false —

    When set to 'true' the request body will not be compressed for supported operations.

  • :endpoint (String, URI::HTTPS, URI::HTTP) —

    Normally you should not configure the :endpoint option directly. This is normally constructed from the :region option. Configuring :endpoint is normally reserved for connecting to test or custom endpoints. The endpoint should be a URI formatted like:

    'http://example.com'
    'https://example.com'
    'http://example.com:123'
    
  • :endpoint_cache_max_entries (Integer) — default: 1000 —

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10 —

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60 —

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec.

  • :endpoint_discovery (Boolean) — default: false —

    When set to true, endpoint discovery will be enabled for operations when available.

  • :ignore_configured_endpoint_urls (Boolean) —

    Setting to true disables use of endpoint URLs provided via environment variables and the shared configuration file.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default —

    The log formatter.

  • :log_level (Symbol) — default: :info —

    The log level to send messages to the :logger at.

  • :logger (Logger) —

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :max_attempts (Integer) — default: 3 —

    An integer representing the maximum number attempts that will be made for a single request, including the initial attempt. For example, setting this value to 5 will result in a request being retried up to 4 times. Used in standard and adaptive retry modes. Defaults to 3, except for DynamoDB and DynamoDB Streams, which default to 4.

  • :profile (String) — default: "default" —

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used.

  • :request_checksum_calculation (String) — default: "when_supported" —

    Determines when a checksum will be calculated for request payloads. Values are:

    • when_supported - (default) When set, a checksum will be calculated for all request payloads of operations modeled with the httpChecksum trait where requestChecksumRequired is true and/or a requestAlgorithmMember is modeled.
    • when_required - When set, a checksum will only be calculated for request payloads of operations modeled with the httpChecksum trait where requestChecksumRequired is true or where a requestAlgorithmMember is modeled and supplied.
  • :request_min_compression_size_bytes (Integer) — default: 10240 —

    The minimum size in bytes that triggers compression for request bodies. The value must be non-negative integer value between 0 and 10485780 bytes inclusive.

  • :response_checksum_validation (String) — default: "when_supported" —

    Determines when checksum validation will be performed on response payloads. Values are:

    • when_supported - (default) When set, checksum validation is performed on all response payloads of operations modeled with the httpChecksum trait where responseAlgorithms is modeled, except when no modeled checksum algorithms are supported.
    • when_required - When set, checksum validation is not performed on response payloads of operations unless the checksum algorithm is supported and the requestValidationModeMember member is set to ENABLED.
  • :retry_backoff (Proc) —

    A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay. This option is only used in the legacy retry mode.

  • :retry_base_delay (Float) — default: 0.3 —

    The base delay in seconds used by the default backoff function. This option is only used in the legacy retry mode.

  • :retry_jitter (Symbol) — default: :none —

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number. This option is only used in the legacy retry mode.

    @see https://www.awsarchitectureblog.com/2015/03/backoff.html

  • :retry_limit (Integer) — default: 3 —

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors, auth errors, endpoint discovery, and errors from expired credentials. This option is only used in the legacy retry mode.

  • :retry_max_delay (Integer) — default: 0 —

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function. This option is only used in the legacy retry mode.

  • :retry_mode (String) — default: "standard" —

    Specifies which retry algorithm to use. Values are:

    • legacy - The pre-existing retry behavior.

    • standard - A standardized set of retry rules across the AWS SDKs. This includes support for retry quotas, which limit the number of unsuccessful retries a client can make. This is the default value if no retry mode is provided.

    • adaptive - A retry mode that includes all the functionality of standard mode along with automatic client side throttling.

  • :sdk_ua_app_id (String) —

    A unique and opaque application ID that is appended to the User-Agent header as app/sdk_ua_app_id. It should have a maximum length of 50. This variable is sourced from environment variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.

  • :secret_access_key (String)
  • :session_token (String)
  • :sigv4a_signing_region_set (Array) —

    A list of regions that should be signed with SigV4a signing. When not passed, a default :sigv4a_signing_region_set is searched for in the following locations:

    • Aws.config[:sigv4a_signing_region_set]
    • ENV['AWS_SIGV4A_SIGNING_REGION_SET']
    • ~/.aws/config
  • :stub_responses (Boolean) — default: false —

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled.

  • :telemetry_provider (Aws::Telemetry::TelemetryProviderBase) — default: Aws::Telemetry::NoOpTelemetryProvider —

    Allows you to provide a telemetry provider, which is used to emit telemetry data. By default, uses NoOpTelemetryProvider which will not record or emit any telemetry data. The SDK supports the following telemetry providers:

    • OpenTelemetry (OTel) - To use the OTel provider, install and require the opentelemetry-sdk gem and then, pass in an instance of a Aws::Telemetry::OTelProvider for telemetry provider.
  • :token_provider (Aws::TokenProvider) —

    Your Bearer token used for authentication. This can be any class that includes and implements Aws::TokenProvider, or instance of any one of the following classes:

    • Aws::StaticTokenProvider - Used for configuring static, non-refreshing tokens.

    • Aws::SSOTokenProvider - Used for loading tokens from AWS SSO using an access token generated from aws login.

    When :token_provider is not configured directly, the Aws::TokenProviderChain will be used to search for tokens configured for your profile in shared configuration files.

  • :use_dualstack_endpoint (Boolean) —

    When set to true, dualstack enabled endpoints (with .aws TLD) will be used if available.

  • :use_fips_endpoint (Boolean) —

    When set to true, fips compatible endpoints will be used if available. When a fips region is used, the region is normalized and this config is set to true.

  • :validate_params (Boolean) — default: true —

    When true, request parameters are validated before sending the request.

  • :endpoint_provider (Aws::NetworkSecurityManager::EndpointProvider) —

    The endpoint provider used to resolve endpoints. Any object that responds to #resolve_endpoint(parameters) where parameters is a Struct similar to Aws::NetworkSecurityManager::EndpointParameters.

  • :http_continue_timeout (Float) — default: 1 —

    The number of seconds to wait for a 100-continue response before sending the request body. This option has no effect unless the request has "Expect" header set to "100-continue". Defaults to nil which disables this behaviour. This value can safely be set per request on the session.

  • :http_idle_timeout (Float) — default: 5 —

    The number of seconds a connection is allowed to sit idle before it is considered stale. Stale connections are closed and removed from the pool before making a request.

  • :http_open_timeout (Float) — default: 15 —

    The default number of seconds to wait for response data. This value can safely be set per-request on the session.

  • :http_proxy (URI::HTTP, String) —

    A proxy to send requests through. Formatted like 'http://proxy.com:123'.

  • :http_read_timeout (Float) — default: 60 —

    The default number of seconds to wait for response data. This value can safely be set per-request on the session.

  • :http_wire_trace (Boolean) — default: false —

    When true, HTTP debug output will be sent to the :logger.

  • :on_chunk_received (Proc) —

    When a Proc object is provided, it will be used as callback when each chunk of the response body is received. It provides three arguments: the chunk, the number of bytes received, and the total number of bytes in the response (or nil if the server did not send a content-length).

  • :on_chunk_sent (Proc) —

    When a Proc object is provided, it will be used as callback when each chunk of the request body is sent. It provides three arguments: the chunk, the number of bytes read from the body, and the total number of bytes in the body.

  • :raise_response_errors (Boolean) — default: true —

    When true, response errors are raised.

  • :ssl_ca_bundle (String) —

    Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.

  • :ssl_ca_directory (String) —

    Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.

  • :ssl_ca_store (String) —

    Sets the X509::Store to verify peer certificate.

  • :ssl_cert (OpenSSL::X509::Certificate) —

    Sets a client certificate when creating http connections.

  • :ssl_key (OpenSSL::PKey) —

    Sets a client key when creating http connections.

  • :ssl_timeout (Float) —

    Sets the SSL timeout in seconds

  • :ssl_verify_peer (Boolean) — default: true —

    When true, SSL peer certificates are verified when establishing a connection.



479
480
481
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 479

def initialize(*args)
  super
end

Instance Method Details

#create_deployment(params = {}) ⇒ Types::CreateDeploymentOutput

Creates a deployment. A deployment applies one or more policies to the accounts and resources selected by a scope. Use isPublished to create the deployment in published (ACTIVE) or draft (DRAFT) state. The response includes coverage information and any warnings about the deployment.

Examples:

Example: Create a deployment


# Creates a new deployment in draft state.

resp = client.create_deployment({
  associated_policy_list: [
    {
      policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  client_token: "550e8400-e29b-41d4-a716-446655440003", 
  deployment_configuration: {
    enable_cross_account_visibility: false, 
  }, 
  deployment_description: "Production deployment for US East 1 region", 
  deployment_name: "prod-us-east-1-deployment", 
  is_published: false, 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_policy_list: [
    {
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  deployment_configuration: {
    enable_cross_account_visibility: false, 
  }, 
  deployment_description: "Production deployment for US East 1 region", 
  deployment_id: "def456", 
  deployment_name: "prod-us-east-1-deployment", 
  has_published_version: false, 
  is_snapshot: false, 
  status: "DRAFT", 
  update_token: "f4a5b6c7-7d8e-4f9a-8b1c-1d2e3f4a5b6c", 
}

Request syntax with placeholder values


resp = client.create_deployment({
  client_token: "IdempotencyToken",
  deployment_name: "DeploymentName", # required
  deployment_description: "Description",
  deployment_configuration: { # required
    enable_cross_account_visibility: false, # required
  },
  associated_policy_list: [ # required
    {
      policy_identifier: "PolicyIdentifier", # required
    },
  ],
  associated_scope_list: [ # required
    {
      scope_identifier: "ScopeIdentifier", # required
    },
  ],
  is_published: false,
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.deployment_id #=> String
resp.deployment_arn #=> String
resp.deployment_name #=> String
resp.deployment_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.deployment_configuration. #=> Boolean
resp.associated_policy_list #=> Array
resp.associated_policy_list[0].policy_arn #=> String
resp.associated_scope_list #=> Array
resp.associated_scope_list[0].scope_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.deployment_coverage #=> Array
resp.deployment_coverage[0].firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.deployment_coverage[0].policy_arns #=> Array
resp.deployment_coverage[0].policy_arns[0] #=> String
resp.deployment_coverage[0].in_scope_resource_types #=> Array
resp.deployment_coverage[0].in_scope_resource_types[0] #=> String, one of "AWS::ApiGateway::Stage", "AWS::CloudFront::Distribution", "AWS::EC2::EIP", "AWS::ElasticLoadBalancingV2::LoadBalancer::application", "AWS::ElasticLoadBalancing::LoadBalancer"
resp.warnings #=> Array
resp.warnings[0].code #=> String
resp.warnings[0].policy_arn #=> String
resp.warnings[0].message #=> String
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :deployment_name (required, String) —

    The name of the deployment.

  • :deployment_description (String) —

    A description of the deployment.

  • :deployment_configuration (required, Types::DeploymentConfiguration) —

    The configuration settings for the deployment.

  • :associated_policy_list (required, Array<Types::PolicyReference>) —

    The policies associated with the deployment.

  • :associated_scope_list (required, Array<Types::ScopeReference>) —

    The scope associated with the deployment. A deployment has exactly one scope.

  • :is_published (Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT). Default: true.

  • :tags (Hash<String,String>) —

    The tags to add to the resource when it is created.

Returns:

See Also:



650
651
652
653
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 650

def create_deployment(params = {}, options = {})
  req = build_request(:create_deployment, params)
  req.send_request(options)
end

#create_deployment_snapshot(params = {}) ⇒ Types::CreateDeploymentSnapshotOutput

Creates a snapshot of the current published version of the specified deployment.

Examples:

Example: Create a deployment snapshot


# Creates an immutable snapshot of the current published version of a deployment. The snapshot is addressable by a
# version-qualified ARN.

resp = client.create_deployment_snapshot({
  client_token: "550e8400-e29b-41d4-a716-446655440014", 
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_policy_list: [
    {
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456:2", 
  deployment_configuration: {
    enable_cross_account_visibility: true, 
  }, 
  deployment_id: "def456", 
  deployment_name: "prod-us-east-1-deployment", 
  is_snapshot: true, 
  status: "ACTIVE", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.create_deployment_snapshot({
  deployment_identifier: "DeploymentIdentifier", # required
  client_token: "IdempotencyToken",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.deployment_id #=> String
resp.deployment_arn #=> String
resp.deployment_name #=> String
resp.deployment_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.deployment_configuration. #=> Boolean
resp.associated_policy_list #=> Array
resp.associated_policy_list[0].policy_arn #=> String
resp.associated_scope_list #=> Array
resp.associated_scope_list[0].scope_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment. This is the deployment's Amazon Resource Name (ARN).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :tags (Hash<String,String>) —

    The tags to add to the snapshot when it is created.

Returns:

See Also:



757
758
759
760
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 757

def create_deployment_snapshot(params = {}, options = {})
  req = build_request(:create_deployment_snapshot, params)
  req.send_request(options)
end

#create_policy(params = {}) ⇒ Types::CreatePolicyOutput

Creates a policy. A policy combines templates and rules with enforcement settings for a firewall type, such as AWS WAF or AWS Shield Advanced. Use isPublished to create the policy in published (ACTIVE) or draft (DRAFT) state.

Examples:

Example: Create a WAF policy


# Creates a new WAF policy in draft state with a template association.

resp = client.create_policy({
  associated_template_and_rule_list: [
    {
      template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  client_token: "550e8400-e29b-41d4-a716-446655440002", 
  firewall_type: "WAF", 
  is_published: false, 
  policy_configuration: {
    remediation_enabled: false, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_description: "WAF policy for web application protection", 
  policy_name: "web-app-waf-policy", 
  priority: 1, 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_template_and_rule_list: [
    {
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: false, 
  is_snapshot: false, 
  policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  policy_configuration: {
    remediation_enabled: false, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_description: "WAF policy for web application protection", 
  policy_id: "xyz789", 
  policy_name: "web-app-waf-policy", 
  priority: 1, 
  status: "DRAFT", 
  update_token: "e3f4a5b6-6c7d-4e8f-9a0b-0c1d2e3f4a5b", 
}

Request syntax with placeholder values


resp = client.create_policy({
  client_token: "IdempotencyToken",
  policy_name: "PolicyName", # required
  policy_description: "Description",
  priority: 1, # required
  associated_template_and_rule_list: [
    {
      template_identifier: "TemplateIdentifier",
      rule_identifier: "RuleIdentifier",
    },
  ],
  firewall_type: "WAF", # required, accepts WAF, SHIELD_ADVANCED
  policy_configuration: { # required
    remediation_enabled: false, # required
    resources_clean_up: false, # required
    waf_config: {
      existing_customer_web_acl_resolution: "RETROFIT", # required, accepts RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION
      conflict_resolution: "MERGE_WHERE_APPLICABLE", # required, accepts MERGE_WHERE_APPLICABLE
    },
  },
  is_published: false,
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.policy_id #=> String
resp.policy_arn #=> String
resp.policy_name #=> String
resp.policy_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.priority #=> Integer
resp.associated_template_and_rule_list #=> Array
resp.associated_template_and_rule_list[0].template_arn #=> String
resp.associated_template_and_rule_list[0].rule_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.policy_configuration.remediation_enabled #=> Boolean
resp.policy_configuration.resources_clean_up #=> Boolean
resp.policy_configuration.waf_config.existing_customer_web_acl_resolution #=> String, one of "RETROFIT", "OVERRIDE_ASSOCIATION", "NO_REMEDIATION"
resp.policy_configuration.waf_config.conflict_resolution #=> String, one of "MERGE_WHERE_APPLICABLE"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :policy_name (required, String) —

    The name of the policy.

  • :policy_description (String) —

    A description of the policy.

  • :priority (required, Integer) —

    The priority of the resource. A lower number indicates a higher priority.

  • :associated_template_and_rule_list (Array<Types::TemplateOrRuleReference>) —

    The templates and rules to associate with the policy. For AWS WAF policies, specify 1 to 100 templates or rules, of which at most 2 can be templates. For AWS Shield Advanced policies, this list must be empty.

  • :firewall_type (required, String) —

    The firewall type associated with the resource.

  • :policy_configuration (required, Types::PolicyConfiguration) —

    The configuration settings that control the policy's behavior, including remediation and firewall-type-specific settings.

  • :is_published (Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT). Default: true.

  • :tags (Hash<String,String>) —

    The tags to add to the resource when it is created.

Returns:

See Also:



933
934
935
936
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 933

def create_policy(params = {}, options = {})
  req = build_request(:create_policy, params)
  req.send_request(options)
end

#create_policy_snapshot(params = {}) ⇒ Types::CreatePolicySnapshotOutput

Creates a snapshot of the current published version of the specified policy.

Examples:

Example: Create a policy snapshot


# Creates an immutable snapshot of the current published version of a policy. The snapshot is addressable by a
# version-qualified ARN.

resp = client.create_policy_snapshot({
  client_token: "550e8400-e29b-41d4-a716-446655440013", 
  policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_template_and_rule_list: [
    {
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  firewall_type: "WAF", 
  is_snapshot: true, 
  policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789:2", 
  policy_configuration: {
    remediation_enabled: true, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_id: "xyz789", 
  policy_name: "web-app-waf-policy", 
  priority: 2, 
  status: "ACTIVE", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.create_policy_snapshot({
  policy_identifier: "PolicyIdentifier", # required
  client_token: "IdempotencyToken",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.policy_id #=> String
resp.policy_arn #=> String
resp.policy_name #=> String
resp.policy_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.priority #=> Integer
resp.associated_template_and_rule_list #=> Array
resp.associated_template_and_rule_list[0].template_arn #=> String
resp.associated_template_and_rule_list[0].rule_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.policy_configuration.remediation_enabled #=> Boolean
resp.policy_configuration.resources_clean_up #=> Boolean
resp.policy_configuration.waf_config.existing_customer_web_acl_resolution #=> String, one of "RETROFIT", "OVERRIDE_ASSOCIATION", "NO_REMEDIATION"
resp.policy_configuration.waf_config.conflict_resolution #=> String, one of "MERGE_WHERE_APPLICABLE"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :policy_identifier (required, String) —

    The identifier of the policy. This is the policy's Amazon Resource Name (ARN).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :tags (Hash<String,String>) —

    The tags to add to the snapshot when it is created.

Returns:

See Also:



1047
1048
1049
1050
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1047

def create_policy_snapshot(params = {}, options = {})
  req = build_request(:create_policy_snapshot, params)
  req.send_request(options)
end

#create_rule(params = {}) ⇒ Types::CreateRuleOutput

Creates a rule. A rule defines a network security configuration to enforce, such as an AWS WAF rule group or configuration data. Use isPublished to create the rule in published (ACTIVE) or draft (DRAFT) state.

Examples:

Example: Create a WAF rule


# Creates a new WAF inspection rule in draft state.

resp = client.create_rule({
  client_token: "550e8400-e29b-41d4-a716-446655440000", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  is_published: false, 
  rule_description: "Blocks requests from known malicious IP addresses", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
})

resp.to_h outputs the following:
{
  version: "1", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  has_published_version: false, 
  is_snapshot: false, 
  rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
  rule_description: "Blocks requests from known malicious IP addresses", 
  rule_id: "abc123", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
  status: "DRAFT", 
  update_token: "c1d2e3f4-4a5b-4c6d-9e7f-8a9b0c1d2e3f", 
}

Request syntax with placeholder values


resp = client.create_rule({
  client_token: "IdempotencyToken",
  rule_name: "RuleName", # required
  firewall_type: "WAF", # required, accepts WAF
  rule_type: "CONFIGURATION", # required, accepts CONFIGURATION, INSPECTION
  rule_description: "Description",
  configuration: { # required
  },
  is_published: false,
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.rule_id #=> String
resp.rule_arn #=> String
resp.rule_name #=> String
resp.firewall_type #=> String, one of "WAF"
resp.rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.rule_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :rule_name (required, String) —

    The name of the rule.

  • :firewall_type (required, String) —

    The firewall type associated with the resource.

  • :rule_type (required, String) —

    The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

  • :rule_description (String) —

    A description of the rule.

  • :configuration (required, Hash, Array, String, Numeric, Boolean) —

    The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF INSPECTION rule, provide an AWS WAF rule group. For an AWS WAF CONFIGURATION rule, provide a single web ACL setting, such as DefaultAction or VisibilityConfig; use wafConfigDataType to declare which setting the document contains. For the schema of each setting and complete examples, see Writing rule configurations in the AWS Network Security Manager Developer Guide.

    Document type used to carry open content (Hash,Array,String,Numeric,Boolean). A document type value is serialized using the same format as its surroundings and requires no additional encoding or escaping.

  • :is_published (Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT). Default: true.

  • :tags (Hash<String,String>) —

    The tags to add to the resource when it is created.

Returns:

See Also:



1190
1191
1192
1193
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1190

def create_rule(params = {}, options = {})
  req = build_request(:create_rule, params)
  req.send_request(options)
end

#create_rule_snapshot(params = {}) ⇒ Types::CreateRuleSnapshotOutput

Creates a snapshot of the current published version of the specified rule. A snapshot is an immutable, versioned copy that other resources can reference.

Examples:

Example: Create a rule snapshot


# Creates an immutable snapshot of the current published version of a rule. The snapshot is addressable by a
# version-qualified ARN.

resp = client.create_rule_snapshot({
  client_token: "550e8400-e29b-41d4-a716-446655440011", 
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
})

resp.to_h outputs the following:
{
  version: "2", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  is_snapshot: true, 
  rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123:2", 
  rule_id: "abc123", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
  status: "ACTIVE", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.create_rule_snapshot({
  rule_identifier: "RuleIdentifier", # required
  client_token: "IdempotencyToken",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.rule_id #=> String
resp.rule_arn #=> String
resp.rule_name #=> String
resp.firewall_type #=> String, one of "WAF"
resp.rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.rule_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :rule_identifier (required, String) —

    The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :tags (Hash<String,String>) —

    The tags to add to the snapshot when it is created.

Returns:

See Also:



1286
1287
1288
1289
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1286

def create_rule_snapshot(params = {}, options = {})
  req = build_request(:create_rule_snapshot, params)
  req.send_request(options)
end

#create_scope(params = {}) ⇒ Types::CreateScopeOutput

Creates a scope. A scope selects the accounts and resources that a deployment applies to. Use isPublished to create the scope in published (ACTIVE) or draft (DRAFT) state.

Examples:

Example: Create a scope


# Creates a new scope in published (ACTIVE) state.

resp = client.create_scope({
  client_token: "550e8400-e29b-41d4-a716-446655440001", 
  is_published: true, 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_description: "Scope covering all production web application resources", 
  scope_name: "production-web-apps", 
})

resp.to_h outputs the following:
{
  version: "1", 
  has_published_version: true, 
  is_snapshot: false, 
  scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_description: "Scope covering all production web application resources", 
  scope_id: "abc123", 
  scope_name: "production-web-apps", 
  status: "ACTIVE", 
  update_token: "b0c4d1e2-3f4a-4b5c-8d6e-7f8a9b0c1d2e", 
}

Request syntax with placeholder values


resp = client.create_scope({
  client_token: "IdempotencyToken",
  scope_name: "ScopeName", # required
  scope_description: "Description",
  scope_configuration: { # required
    account_filter: {
      include_all: {
      },
      include: {
        account_ids: ["AccountId"],
        organizational_units: ["OrganizationalUnit"],
      },
      exclude: {
        account_ids: ["AccountId"],
        organizational_units: ["OrganizationalUnit"],
      },
    },
    resource_scopes: { # required
      "AWS::ApiGateway::Stage" => {
        include_all: false,
        include: {
          explicit_arns: ["Arn"],
          expression: {
            criteria: {
              tags: {
                "String" => "String",
              },
              alb_config: {
                scheme: "internet-facing", # accepts internet-facing, internal
                ip_address_type: "ipv4", # accepts ipv4, dualstack, dualstack-without-public-ipv4
              },
            },
            and: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            or: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            not: {
              # recursive ResourceLogicalExpression
            },
          },
        },
        exclude: {
          explicit_arns: ["Arn"],
          expression: {
            criteria: {
              tags: {
                "String" => "String",
              },
              alb_config: {
                scheme: "internet-facing", # accepts internet-facing, internal
                ip_address_type: "ipv4", # accepts ipv4, dualstack, dualstack-without-public-ipv4
              },
            },
            and: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            or: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            not: {
              # recursive ResourceLogicalExpression
            },
          },
        },
      },
    },
  },
  is_published: false,
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.scope_id #=> String
resp.scope_arn #=> String
resp.scope_name #=> String
resp.scope_description #=> String
resp.scope_configuration..include. #=> Array
resp.scope_configuration..include.[0] #=> String
resp.scope_configuration..include.organizational_units #=> Array
resp.scope_configuration..include.organizational_units[0] #=> String
resp.scope_configuration..exclude. #=> Array
resp.scope_configuration..exclude.[0] #=> String
resp.scope_configuration..exclude.organizational_units #=> Array
resp.scope_configuration..exclude.organizational_units[0] #=> String
resp.scope_configuration.resource_scopes #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include_all #=> Boolean
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.not #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.not #=> Types::ResourceLogicalExpression
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :scope_name (required, String) —

    The name of the scope.

  • :scope_description (String) —

    A description of the scope.

  • :scope_configuration (required, Types::ScopeConfiguration) —

    The configuration that defines which accounts and resources are in scope.

  • :is_published (Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT). Default: true.

  • :tags (Hash<String,String>) —

    The tags to add to the resource when it is created.

Returns:

See Also:



1511
1512
1513
1514
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1511

def create_scope(params = {}, options = {})
  req = build_request(:create_scope, params)
  req.send_request(options)
end

#create_scope_snapshot(params = {}) ⇒ Types::CreateScopeSnapshotOutput

Creates a snapshot of the current published version of the specified scope.

Examples:

Example: Create a scope snapshot


# Creates an immutable snapshot of the current published version of a scope. The snapshot is addressable by a
# version-qualified ARN.

resp = client.create_scope_snapshot({
  client_token: "550e8400-e29b-41d4-a716-446655440010", 
  scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
})

resp.to_h outputs the following:
{
  version: "2", 
  is_snapshot: true, 
  scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123:2", 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_id: "abc123", 
  scope_name: "production-web-apps", 
  status: "ACTIVE", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.create_scope_snapshot({
  scope_identifier: "ScopeIdentifier", # required
  client_token: "IdempotencyToken",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.scope_id #=> String
resp.scope_arn #=> String
resp.scope_name #=> String
resp.scope_description #=> String
resp.scope_configuration..include. #=> Array
resp.scope_configuration..include.[0] #=> String
resp.scope_configuration..include.organizational_units #=> Array
resp.scope_configuration..include.organizational_units[0] #=> String
resp.scope_configuration..exclude. #=> Array
resp.scope_configuration..exclude.[0] #=> String
resp.scope_configuration..exclude.organizational_units #=> Array
resp.scope_configuration..exclude.organizational_units[0] #=> String
resp.scope_configuration.resource_scopes #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include_all #=> Boolean
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.not #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.not #=> Types::ResourceLogicalExpression
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :scope_identifier (required, String) —

    The identifier of the scope. This is the scope's Amazon Resource Name (ARN).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :tags (Hash<String,String>) —

    The tags to add to the snapshot when it is created.

Returns:

See Also:



1638
1639
1640
1641
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1638

def create_scope_snapshot(params = {}, options = {})
  req = build_request(:create_scope_snapshot, params)
  req.send_request(options)
end

#create_template(params = {}) ⇒ Types::CreateTemplateOutput

Creates a template. A template groups one or more rules to simplify reuse across policies. You can also associate rules with a policy directly, without a template. Use isPublished to create the template in published (ACTIVE) or draft (DRAFT) state.

Examples:

Example: Create a WAF template


# Creates a new WAF template in published (ACTIVE) state with an associated rule.

resp = client.create_template({
  associated_rule_list: [
    {
      rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  client_token: "550e8400-e29b-41d4-a716-446655440004", 
  firewall_type: "WAF", 
  is_published: true, 
  template_description: "Standard WAF template with baseline rule groups", 
  template_name: "standard-waf-template", 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_rule_list: [
    {
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  status: "ACTIVE", 
  template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
  template_description: "Standard WAF template with baseline rule groups", 
  template_id: "xyz789", 
  template_name: "standard-waf-template", 
  update_token: "d2e3f4a5-5b6c-4d7e-8f9a-9b0c1d2e3f4a", 
}

Request syntax with placeholder values


resp = client.create_template({
  client_token: "IdempotencyToken",
  template_name: "TemplateName", # required
  template_description: "Description",
  associated_rule_list: [ # required
    {
      rule_identifier: "RuleIdentifier", # required
    },
  ],
  firewall_type: "WAF", # required, accepts WAF
  is_published: false,
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.template_id #=> String
resp.template_arn #=> String
resp.template_name #=> String
resp.template_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.associated_rule_list #=> Array
resp.associated_rule_list[0].rule_arn #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :template_name (required, String) —

    The name of the template.

  • :template_description (String) —

    A description of the template.

  • :associated_rule_list (required, Array<Types::RuleReference>) —

    The rules associated with the template.

  • :firewall_type (required, String) —

    The firewall type associated with the resource.

  • :is_published (Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT). Default: true.

  • :tags (Hash<String,String>) —

    The tags to add to the resource when it is created.

Returns:

See Also:



1767
1768
1769
1770
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1767

def create_template(params = {}, options = {})
  req = build_request(:create_template, params)
  req.send_request(options)
end

#create_template_snapshot(params = {}) ⇒ Types::CreateTemplateSnapshotOutput

Creates a snapshot of the current published version of the specified template.

Examples:

Example: Create a template snapshot


# Creates an immutable snapshot of the current published version of a template. The snapshot is addressable by a
# version-qualified ARN.

resp = client.create_template_snapshot({
  client_token: "550e8400-e29b-41d4-a716-446655440012", 
  template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_rule_list: [
    {
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  firewall_type: "WAF", 
  is_snapshot: true, 
  status: "ACTIVE", 
  template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789:2", 
  template_id: "xyz789", 
  template_name: "standard-waf-template", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.create_template_snapshot({
  template_identifier: "TemplateIdentifier", # required
  client_token: "IdempotencyToken",
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.template_id #=> String
resp.template_arn #=> String
resp.template_name #=> String
resp.template_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.associated_rule_list #=> Array
resp.associated_rule_list[0].rule_arn #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :template_identifier (required, String) —

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :tags (Hash<String,String>) —

    The tags to add to the snapshot when it is created.

Returns:

See Also:



1864
1865
1866
1867
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1864

def create_template_snapshot(params = {}, options = {})
  req = build_request(:create_template_snapshot, params)
  req.send_request(options)
end

#delete_admin_account(params = {}) ⇒ Struct

Removes the specified AWS Network Security Manager administrator account.

Examples:

Example: Remove an administrator account


# Removes an account's Network Security Manager administrator designation.

resp = client.({
  account_id: "234567890123", 
})

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :account_id (required, String) —

    The AWS account ID of the administrator account to remove.

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



1896
1897
1898
1899
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1896

def (params = {}, options = {})
  req = build_request(:delete_admin_account, params)
  req.send_request(options)
end

#delete_deployment(params = {}) ⇒ Struct

Deletes the specified deployment.

Examples:

Example: Delete a deployment


# Deletes a deployment by its ARN. Deleting an active deployment stops enforcement and triggers cleanup of managed
# firewall resources.

resp = client.delete_deployment({
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
})

Request syntax with placeholder values


resp = client.delete_deployment({
  deployment_identifier: "DeploymentIdentifier", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment. This is the deployment's Amazon Resource Name (ARN).

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



1929
1930
1931
1932
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1929

def delete_deployment(params = {}, options = {})
  req = build_request(:delete_deployment, params)
  req.send_request(options)
end

#delete_policy(params = {}) ⇒ Struct

Deletes the specified policy.

Examples:

Example: Delete a policy


# Deletes a policy by its ARN. The policy must not be associated with any deployment.

resp = client.delete_policy({
  policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
})

Request syntax with placeholder values


resp = client.delete_policy({
  policy_identifier: "PolicyIdentifier", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :policy_identifier (required, String) —

    The identifier of the policy. This is the policy's Amazon Resource Name (ARN).

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



1961
1962
1963
1964
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1961

def delete_policy(params = {}, options = {})
  req = build_request(:delete_policy, params)
  req.send_request(options)
end

#delete_rule(params = {}) ⇒ Struct

Deletes the specified rule.

Examples:

Example: Delete a rule


# Deletes a rule by its ARN. The rule must not be associated with any template or policy.

resp = client.delete_rule({
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
})

Request syntax with placeholder values


resp = client.delete_rule({
  rule_identifier: "RuleIdentifier", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :rule_identifier (required, String) —

    The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



1993
1994
1995
1996
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 1993

def delete_rule(params = {}, options = {})
  req = build_request(:delete_rule, params)
  req.send_request(options)
end

#delete_scope(params = {}) ⇒ Struct

Deletes the specified scope.

Examples:

Example: Delete a scope


# Deletes a scope by its ARN. The scope must not be associated with any deployment.

resp = client.delete_scope({
  scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
})

Request syntax with placeholder values


resp = client.delete_scope({
  scope_identifier: "ScopeIdentifier", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :scope_identifier (required, String) —

    The identifier of the scope. This is the scope's Amazon Resource Name (ARN).

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



2025
2026
2027
2028
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2025

def delete_scope(params = {}, options = {})
  req = build_request(:delete_scope, params)
  req.send_request(options)
end

#delete_template(params = {}) ⇒ Struct

Deletes the specified template.

Examples:

Example: Delete a template


# Deletes a template by its ARN. The template must not be associated with any policy.

resp = client.delete_template({
  template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
})

Request syntax with placeholder values


resp = client.delete_template({
  template_identifier: "TemplateIdentifier", # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :template_identifier (required, String) —

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



2057
2058
2059
2060
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2057

def delete_template(params = {}, options = {})
  req = build_request(:delete_template, params)
  req.send_request(options)
end

#generate_rule_configuration(params = {}) ⇒ Types::GenerateRuleConfigurationResponse

Generates a rule configuration from a natural-language description. Provide a prompt along with the rule's firewall type and rule type. The service returns a configuration that you can use when you create or update a rule. If you also provide an existing configuration, the service edits that configuration instead of generating a new one.

Examples:

Example: Generate a rule configuration from a description


# Generates a firewall rule configuration from a natural language description. The response contains the generated
# configuration as a JSON string, ready to use as the configuration of a rule.

resp = client.generate_rule_configuration({
  client_token: "550e8400-e29b-41d4-a716-446655440015", 
  prompt: "Create a rate limiting rule that blocks IP addresses sending more than 2000 requests in 5 minutes", 
  rule_firewall_type: "WAF", 
  rule_type: "INSPECTION", 
})

resp.to_h outputs the following:
{
  configuration: "{\"name\":\"rate-limit-rule\",\"priority\":1,\"statement\":{\"rateBasedStatement\":{\"limit\":2000,\"evaluationWindowSec\":300,\"aggregateKeyType\":\"IP\"}},\"action\":{\"block\":{}}}", 
}

Request syntax with placeholder values


resp = client.generate_rule_configuration({
  prompt: "GenerateRuleConfigurationRequestPromptString", # required
  rule_firewall_type: "WAF", # required, accepts WAF
  rule_type: "CONFIGURATION", # required, accepts CONFIGURATION, INSPECTION
  waf_config_data_type: "DefaultAction", # accepts DefaultAction, VisibilityConfig, CaptchaConfig, ChallengeConfig, CustomResponseBodies, LoggingConfiguration, DataProtectionConfig, AssociationConfig, OnSourceDDoSProtectionConfig, TokenDomains
  current_configuration: "GenerateRuleConfigurationRequestCurrentConfigurationString",
  client_token: "IdempotencyToken",
})

Response structure


resp.configuration #=> String
resp.description #=> String

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :prompt (required, String) —

    A natural-language description of the configuration that you want to generate.

  • :rule_firewall_type (required, String) —

    The firewall type of the rule.

  • :rule_type (required, String) —

    The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

  • :waf_config_data_type (String) —

    For AWS WAF configuration rules, the specific AWS WAF configuration variant to generate. This is optional; if you omit it, the service selects the variant.

  • :current_configuration (String) —

    An existing configuration to edit, as a JSON string. When you provide this value, the operation edits the configuration. When you omit it, the operation generates a new configuration.

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



2141
2142
2143
2144
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2141

def generate_rule_configuration(params = {}, options = {})
  req = build_request(:generate_rule_configuration, params)
  req.send_request(options)
end

#get_admin_account(params = {}) ⇒ Types::GetAdminAccountResponse

Retrieves the details of the specified AWS Network Security Manager administrator account.

Examples:

Example: Get an administrator account


# Retrieves the details and administrative scope of a Network Security Manager administrator account.

resp = client.({
  account_id: "234567890123", 
})

resp.to_h outputs the following:
{
  admin_account_details: {
    admin_account: "234567890123", 
    admin_scope: {
      firewall_type_scope: {
        all_firewall_types_enabled: false, 
        firewall_types: [
          "WAF", 
        ], 
      }, 
      scope_filter: {
        include_only: {
          organizational_units: [
            {
              name: "Production", 
              ou_id: "ou-abcd-12345678", 
            }, 
          ], 
        }, 
      }, 
    }, 
    priority: 2, 
    status: "ONBOARDED", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
})

Response structure


resp.. #=> String
resp..priority #=> Integer
resp..admin_scope.scope_filter.include_only.accounts #=> Array
resp..admin_scope.scope_filter.include_only.accounts[0]. #=> String
resp..admin_scope.scope_filter.include_only.accounts[0].name #=> String
resp..admin_scope.scope_filter.include_only.accounts[0].email #=> String
resp..admin_scope.scope_filter.include_only.organizational_units #=> Array
resp..admin_scope.scope_filter.include_only.organizational_units[0].ou_id #=> String
resp..admin_scope.scope_filter.include_only.organizational_units[0].name #=> String
resp..admin_scope.scope_filter.exclude_only.accounts #=> Array
resp..admin_scope.scope_filter.exclude_only.accounts[0]. #=> String
resp..admin_scope.scope_filter.exclude_only.accounts[0].name #=> String
resp..admin_scope.scope_filter.exclude_only.accounts[0].email #=> String
resp..admin_scope.scope_filter.exclude_only.organizational_units #=> Array
resp..admin_scope.scope_filter.exclude_only.organizational_units[0].ou_id #=> String
resp..admin_scope.scope_filter.exclude_only.organizational_units[0].name #=> String
resp..admin_scope.firewall_type_scope.all_firewall_types_enabled #=> Boolean
resp..admin_scope.firewall_type_scope.firewall_types #=> Array
resp..admin_scope.firewall_type_scope.firewall_types[0] #=> String, one of "WAF", "SHIELD_ADVANCED"
resp..status #=> String, one of "ONBOARDED", "OFFBOARDED"

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :account_id (required, String) —

    The AWS account ID of the administrator account to retrieve.

Returns:

See Also:



2225
2226
2227
2228
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2225

def (params = {}, options = {})
  req = build_request(:get_admin_account, params)
  req.send_request(options)
end

#get_deployment(params = {}) ⇒ Types::GetDeploymentOutput

Retrieves the details of the specified deployment, including coverage information and any warnings.

Examples:

Example: Get a deployment


# Retrieves the current published version of a deployment by its base ARN, including per-firewall-type coverage showing
# which in-scope resource types each policy protects.

resp = client.get_deployment({
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_policy_list: [
    {
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  deployment_configuration: {
    enable_cross_account_visibility: false, 
  }, 
  deployment_coverage: [
    {
      firewall_type: "WAF", 
      in_scope_resource_types: [
        "AWS::ElasticLoadBalancingV2::LoadBalancer::application", 
        "AWS::CloudFront::Distribution", 
      ], 
      policy_arns: [
        "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
      ], 
    }, 
  ], 
  deployment_description: "Production deployment for US East 1 region", 
  deployment_id: "def456", 
  deployment_name: "prod-us-east-1-deployment", 
  has_published_version: true, 
  is_snapshot: false, 
  status: "ACTIVE", 
  update_token: "f4a5b6c7-7d8e-4f9a-8b1c-1d2e3f4a5b6c", 
}

Request syntax with placeholder values


resp = client.get_deployment({
  deployment_identifier: "DeploymentIdentifier", # required
})

Response structure


resp.deployment_id #=> String
resp.deployment_arn #=> String
resp.deployment_name #=> String
resp.deployment_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.deployment_configuration. #=> Boolean
resp.associated_policy_list #=> Array
resp.associated_policy_list[0].policy_arn #=> String
resp.associated_scope_list #=> Array
resp.associated_scope_list[0].scope_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time
resp.deployment_coverage #=> Array
resp.deployment_coverage[0].firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.deployment_coverage[0].policy_arns #=> Array
resp.deployment_coverage[0].policy_arns[0] #=> String
resp.deployment_coverage[0].in_scope_resource_types #=> Array
resp.deployment_coverage[0].in_scope_resource_types[0] #=> String, one of "AWS::ApiGateway::Stage", "AWS::CloudFront::Distribution", "AWS::EC2::EIP", "AWS::ElasticLoadBalancingV2::LoadBalancer::application", "AWS::ElasticLoadBalancing::LoadBalancer"
resp.warnings #=> Array
resp.warnings[0].code #=> String
resp.warnings[0].policy_arn #=> String
resp.warnings[0].message #=> String

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment. This is the deployment's Amazon Resource Name (ARN).

Returns:

See Also:



2341
2342
2343
2344
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2341

def get_deployment(params = {}, options = {})
  req = build_request(:get_deployment, params)
  req.send_request(options)
end

#get_policy(params = {}) ⇒ Types::GetPolicyOutput

Retrieves the details of the specified policy.

Examples:

Example: Get a policy


# Retrieves the current published version of a policy by its base ARN, including its associated templates and rules and
# its enforcement configuration.

resp = client.get_policy({
  policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_template_and_rule_list: [
    {
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  policy_configuration: {
    remediation_enabled: true, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_description: "WAF policy for web application protection", 
  policy_id: "xyz789", 
  policy_name: "web-app-waf-policy", 
  priority: 1, 
  status: "ACTIVE", 
  update_token: "e3f4a5b6-6c7d-4e8f-9a0b-0c1d2e3f4a5b", 
}

Request syntax with placeholder values


resp = client.get_policy({
  policy_identifier: "PolicyIdentifier", # required
})

Response structure


resp.policy_id #=> String
resp.policy_arn #=> String
resp.policy_name #=> String
resp.policy_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.priority #=> Integer
resp.associated_template_and_rule_list #=> Array
resp.associated_template_and_rule_list[0].template_arn #=> String
resp.associated_template_and_rule_list[0].rule_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.policy_configuration.remediation_enabled #=> Boolean
resp.policy_configuration.resources_clean_up #=> Boolean
resp.policy_configuration.waf_config.existing_customer_web_acl_resolution #=> String, one of "RETROFIT", "OVERRIDE_ASSOCIATION", "NO_REMEDIATION"
resp.policy_configuration.waf_config.conflict_resolution #=> String, one of "MERGE_WHERE_APPLICABLE"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :policy_identifier (required, String) —

    The identifier of the policy. This is the policy's Amazon Resource Name (ARN).

Returns:

See Also:



2439
2440
2441
2442
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2439

def get_policy(params = {}, options = {})
  req = build_request(:get_policy, params)
  req.send_request(options)
end

#get_rule(params = {}) ⇒ Types::GetRuleOutput

Retrieves the details of the specified rule.

Examples:

Example: Get a rule


# Retrieves the current published version of a rule by its base ARN.

resp = client.get_rule({
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
})

resp.to_h outputs the following:
{
  version: "1", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
  rule_description: "Blocks requests from known malicious IP addresses", 
  rule_id: "abc123", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
  status: "ACTIVE", 
  update_token: "c1d2e3f4-4a5b-4c6d-9e7f-8a9b0c1d2e3f", 
}

Example: Get a specific version of a rule


# Retrieves a specific immutable version (snapshot) of a rule using a version-qualified ARN. The response has isSnapshot
# set to true. Omitting the version qualifier returns the current published rule instead.

resp = client.get_rule({
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123:3", 
})

resp.to_h outputs the following:
{
  version: "3", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  is_snapshot: true, 
  rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123:3", 
  rule_description: "Blocks requests from known malicious IP addresses", 
  rule_id: "abc123", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
  status: "ACTIVE", 
}

Request syntax with placeholder values


resp = client.get_rule({
  rule_identifier: "RuleIdentifier", # required
})

Response structure


resp.rule_id #=> String
resp.rule_arn #=> String
resp.rule_name #=> String
resp.firewall_type #=> String, one of "WAF"
resp.rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.rule_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :rule_identifier (required, String) —

    The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

Returns:

See Also:



2541
2542
2543
2544
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2541

def get_rule(params = {}, options = {})
  req = build_request(:get_rule, params)
  req.send_request(options)
end

#get_scope(params = {}) ⇒ Types::GetScopeOutput

Retrieves the details of the specified scope.

Examples:

Example: Get a scope


# Retrieves the current published version of a scope by its base ARN.

resp = client.get_scope({
  scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
})

resp.to_h outputs the following:
{
  version: "1", 
  has_published_version: true, 
  is_snapshot: false, 
  scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_description: "Scope covering all production web application resources", 
  scope_id: "abc123", 
  scope_name: "production-web-apps", 
  status: "ACTIVE", 
  update_token: "b0c4d1e2-3f4a-4b5c-8d6e-7f8a9b0c1d2e", 
}

Request syntax with placeholder values


resp = client.get_scope({
  scope_identifier: "ScopeIdentifier", # required
})

Response structure


resp.scope_id #=> String
resp.scope_arn #=> String
resp.scope_name #=> String
resp.scope_description #=> String
resp.scope_configuration..include. #=> Array
resp.scope_configuration..include.[0] #=> String
resp.scope_configuration..include.organizational_units #=> Array
resp.scope_configuration..include.organizational_units[0] #=> String
resp.scope_configuration..exclude. #=> Array
resp.scope_configuration..exclude.[0] #=> String
resp.scope_configuration..exclude.organizational_units #=> Array
resp.scope_configuration..exclude.organizational_units[0] #=> String
resp.scope_configuration.resource_scopes #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include_all #=> Boolean
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.not #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.not #=> Types::ResourceLogicalExpression
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :scope_identifier (required, String) —

    The identifier of the scope. This is the scope's Amazon Resource Name (ARN).

Returns:

See Also:



2651
2652
2653
2654
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2651

def get_scope(params = {}, options = {})
  req = build_request(:get_scope, params)
  req.send_request(options)
end

#get_template(params = {}) ⇒ Types::GetTemplateOutput

Retrieves the details of the specified template.

Examples:

Example: Get a template


# Retrieves the current published version of a template by its base ARN, including its associated rules.

resp = client.get_template({
  template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
})

resp.to_h outputs the following:
{
  version: "1", 
  associated_rule_list: [
    {
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  status: "ACTIVE", 
  template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
  template_description: "Standard WAF template with baseline rule groups", 
  template_id: "xyz789", 
  template_name: "standard-waf-template", 
  update_token: "d2e3f4a5-5b6c-4d7e-8f9a-9b0c1d2e3f4a", 
}

Request syntax with placeholder values


resp = client.get_template({
  template_identifier: "TemplateIdentifier", # required
})

Response structure


resp.template_id #=> String
resp.template_arn #=> String
resp.template_name #=> String
resp.template_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.associated_rule_list #=> Array
resp.associated_rule_list[0].rule_arn #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :template_identifier (required, String) —

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

Returns:

See Also:



2731
2732
2733
2734
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2731

def get_template(params = {}, options = {})
  req = build_request(:get_template, params)
  req.send_request(options)
end

#list_admin_accounts(params = {}) ⇒ Types::ListAdminAccountsResponse

Lists the AWS Network Security Manager administrator accounts in the organization.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List administrator accounts


# Lists the Network Security Manager administrator accounts for the organization.

resp = client.list_admin_accounts({
  max_results: 10, 
})

resp.to_h outputs the following:
{
  admin_accounts: [
    {
      account_id: "234567890123", 
      priority: 2, 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_admin_accounts({
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.admin_accounts #=> Array
resp.admin_accounts[0]. #=> String
resp.admin_accounts[0].priority #=> Integer
resp.admin_accounts[0].name #=> String
resp.admin_accounts[0].email #=> String

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



2795
2796
2797
2798
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2795

def list_admin_accounts(params = {}, options = {})
  req = build_request(:list_admin_accounts, params)
  req.send_request(options)
end

#list_aggregate_resource_synchronization_statuses(params = {}) ⇒ Types::ListAggregateResourceSynchronizationStatusesOutput

Lists the aggregated synchronization statuses of resources across the deployments in your administrator account. You can filter the results by synchronization status and page through them.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List synchronization statuses across all deployments


# Lists the aggregate synchronization status of resources across all deployments in the account.

resp = client.list_aggregate_resource_synchronization_statuses({
  max_results: 10, 
  synchronization_status: "IN_SYNC", 
})

resp.to_h outputs the following:
{
  resource_synchronization_statuses: [
    {
      account_id: "234567890123", 
      evaluated_at: Time.parse("2026-08-20T12:00:00Z"), 
      resource_arn: "arn:aws:elasticloadbalancing:us-east-1:234567890123:loadbalancer/app/my-alb/50dc6c495c0c9188", 
      resource_type: "AWS::ElasticLoadBalancingV2::LoadBalancer::application", 
      synchronization_status: "IN_SYNC", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_aggregate_resource_synchronization_statuses({
  synchronization_status: "IN_SYNC", # accepts IN_SYNC, OUT_OF_SYNC, NOT_APPLICABLE
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.resource_synchronization_statuses #=> Array
resp.resource_synchronization_statuses[0].synchronization_status #=> String, one of "IN_SYNC", "OUT_OF_SYNC", "NOT_APPLICABLE"
resp.resource_synchronization_statuses[0]. #=> String
resp.resource_synchronization_statuses[0].resource_arn #=> String
resp.resource_synchronization_statuses[0].deployment_arn #=> String
resp.resource_synchronization_statuses[0].resource_type #=> String, one of "AWS::ApiGateway::Stage", "AWS::CloudFront::Distribution", "AWS::EC2::EIP", "AWS::ElasticLoadBalancingV2::LoadBalancer::application", "AWS::ElasticLoadBalancing::LoadBalancer", "AWS::WAFv2::WebACL", "AWS::Shield::Protection", "AWS::ShieldRegional::Protection"
resp.resource_synchronization_statuses[0].updated_at #=> Time
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons #=> Hash
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].missing_firewall #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.not_visible.reason #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues #=> Hash
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].issue_type #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].message #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].corrective_action #=> String
resp.resource_synchronization_statuses[0].remediation_issues.not_visible.reason #=> String
resp.resource_synchronization_statuses[0].evaluated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :synchronization_status (String) —

    Filters the results by synchronization status, such as IN_SYNC or OUT_OF_SYNC.

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



2905
2906
2907
2908
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2905

def list_aggregate_resource_synchronization_statuses(params = {}, options = {})
  req = build_request(:list_aggregate_resource_synchronization_statuses, params)
  req.send_request(options)
end

#list_deployment_snapshots(params = {}) ⇒ Types::ListDeploymentSnapshotsOutput

Lists the snapshots of the specified deployment.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List the snapshots of a deployment


# Lists the immutable snapshots that have been created for a deployment.

resp = client.list_deployment_snapshots({
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  max_results: 10, 
})

resp.to_h outputs the following:
{
  snapshots: [
    {
      version: "2", 
      deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456:2", 
      deployment_id: "def456", 
      deployment_name: "prod-us-east-1-deployment", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_deployment_snapshots({
  deployment_identifier: "DeploymentIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.snapshots #=> Array
resp.snapshots[0].deployment_id #=> String
resp.snapshots[0].deployment_arn #=> String
resp.snapshots[0].deployment_name #=> String
resp.snapshots[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.snapshots[0].version #=> String
resp.snapshots[0].has_published_version #=> Boolean
resp.snapshots[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment. This is the deployment's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



2981
2982
2983
2984
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 2981

def list_deployment_snapshots(params = {}, options = {})
  req = build_request(:list_deployment_snapshots, params)
  req.send_request(options)
end

#list_deployments(params = {}) ⇒ Types::ListDeploymentsOutput

Lists the deployments in the account. You can filter the results by status and page through them using maxResults and nextToken.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List deployments


# Lists the published deployments in the account, one page at a time.

resp = client.list_deployments({
  max_results: 10, 
  status: "ACTIVE", 
})

resp.to_h outputs the following:
{
  deployments: [
    {
      version: "2", 
      deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
      deployment_id: "def456", 
      deployment_name: "prod-us-east-1-deployment", 
      has_published_version: true, 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_deployments({
  max_results: 1,
  next_token: "NextToken",
  status: "ACTIVE", # accepts ACTIVE, DRAFT, DISABLED
})

Response structure


resp.next_token #=> String
resp.deployments #=> Array
resp.deployments[0].deployment_id #=> String
resp.deployments[0].deployment_arn #=> String
resp.deployments[0].deployment_name #=> String
resp.deployments[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.deployments[0].version #=> String
resp.deployments[0].has_published_version #=> Boolean
resp.deployments[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

  • :status (String) —

    Filters the results by status: ACTIVE, DRAFT, or DISABLED.

Returns:

See Also:



3058
3059
3060
3061
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3058

def list_deployments(params = {}, options = {})
  req = build_request(:list_deployments, params)
  req.send_request(options)
end

#list_policies(params = {}) ⇒ Types::ListPoliciesOutput

Lists the policies in the account. You can filter the results by status and page through them using maxResults and nextToken.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List policies


# Lists the published policies in the account, one page at a time.

resp = client.list_policies({
  max_results: 10, 
  status: "ACTIVE", 
})

resp.to_h outputs the following:
{
  policies: [
    {
      version: "2", 
      firewall_type: "WAF", 
      has_published_version: true, 
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
      policy_id: "xyz789", 
      policy_name: "web-app-waf-policy", 
      priority: 2, 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_policies({
  max_results: 1,
  next_token: "NextToken",
  status: "ACTIVE", # accepts ACTIVE, DRAFT, DISABLED
})

Response structure


resp.next_token #=> String
resp.policies #=> Array
resp.policies[0].policy_id #=> String
resp.policies[0].policy_arn #=> String
resp.policies[0].policy_name #=> String
resp.policies[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.policies[0].version #=> String
resp.policies[0].has_published_version #=> Boolean
resp.policies[0].firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.policies[0].priority #=> Integer
resp.policies[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

  • :status (String) —

    Filters the results by status, either ACTIVE or DRAFT.

Returns:

See Also:



3139
3140
3141
3142
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3139

def list_policies(params = {}, options = {})
  req = build_request(:list_policies, params)
  req.send_request(options)
end

#list_policy_snapshots(params = {}) ⇒ Types::ListPolicySnapshotsOutput

Lists the snapshots of the specified policy.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List the snapshots of a policy


# Lists the immutable snapshots that have been created for a policy.

resp = client.list_policy_snapshots({
  max_results: 10, 
  policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
})

resp.to_h outputs the following:
{
  snapshots: [
    {
      version: "2", 
      firewall_type: "WAF", 
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789:2", 
      policy_id: "xyz789", 
      policy_name: "web-app-waf-policy", 
      priority: 2, 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_policy_snapshots({
  policy_identifier: "PolicyIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.snapshots #=> Array
resp.snapshots[0].policy_id #=> String
resp.snapshots[0].policy_arn #=> String
resp.snapshots[0].policy_name #=> String
resp.snapshots[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.snapshots[0].version #=> String
resp.snapshots[0].has_published_version #=> Boolean
resp.snapshots[0].firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.snapshots[0].priority #=> Integer
resp.snapshots[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :policy_identifier (required, String) —

    The identifier of the policy. This is the policy's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3219
3220
3221
3222
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3219

def list_policy_snapshots(params = {}, options = {})
  req = build_request(:list_policy_snapshots, params)
  req.send_request(options)
end

#list_resource_associations(params = {}) ⇒ Types::ListResourceAssociationsOutput

Lists the resources associated with the specified resource.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List what references a rule


# Lists the resources that reference the given rule, such as the templates and policies it is associated with.

resp = client.list_resource_associations({
  max_results: 10, 
  resource_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
})

resp.to_h outputs the following:
{
  resource_associations: [
    {
      arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
      resource_type: "Template", 
    }, 
    {
      arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
      resource_type: "Policy", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_resource_associations({
  resource_identifier: "ResourceIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.resource_associations #=> Array
resp.resource_associations[0].arn #=> String
resp.resource_associations[0].resource_type #=> String, one of "Rule", "Template", "Policy", "Deployment", "Scope"

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :resource_identifier (required, String) —

    The identifier of the resource to list associations for. This is the resource's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3290
3291
3292
3293
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3290

def list_resource_associations(params = {}, options = {})
  req = build_request(:list_resource_associations, params)
  req.send_request(options)
end

#list_resource_synchronization_statuses(params = {}) ⇒ Types::ListResourceSynchronizationStatusesOutput

Lists the synchronization statuses of the resources covered by the specified deployment. You can filter the results by synchronization status and page through them.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List out-of-sync resources for a deployment


# Lists the resources tracked by a deployment that are out of sync, including the structured reason. Here a CloudFront
# distribution has no web ACL where the policy requires one.

resp = client.list_resource_synchronization_statuses({
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  max_results: 10, 
  synchronization_status: "OUT_OF_SYNC", 
})

resp.to_h outputs the following:
{
  resource_synchronization_statuses: [
    {
      account_id: "123456789012", 
      deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
      evaluated_at: Time.parse("2026-08-20T12:00:00Z"), 
      out_of_sync_reasons: {
        reasons: {
          "WAF" => {
            missing_firewall: "No web ACL is associated with the resource", 
          }, 
        }, 
      }, 
      resource_arn: "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", 
      resource_type: "AWS::CloudFront::Distribution", 
      synchronization_status: "OUT_OF_SYNC", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_resource_synchronization_statuses({
  deployment_identifier: "DeploymentIdentifier", # required
  synchronization_status: "IN_SYNC", # accepts IN_SYNC, OUT_OF_SYNC, NOT_APPLICABLE
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.resource_synchronization_statuses #=> Array
resp.resource_synchronization_statuses[0].synchronization_status #=> String, one of "IN_SYNC", "OUT_OF_SYNC", "NOT_APPLICABLE"
resp.resource_synchronization_statuses[0]. #=> String
resp.resource_synchronization_statuses[0].resource_arn #=> String
resp.resource_synchronization_statuses[0].deployment_arn #=> String
resp.resource_synchronization_statuses[0].resource_type #=> String, one of "AWS::ApiGateway::Stage", "AWS::CloudFront::Distribution", "AWS::EC2::EIP", "AWS::ElasticLoadBalancingV2::LoadBalancer::application", "AWS::ElasticLoadBalancing::LoadBalancer", "AWS::WAFv2::WebACL", "AWS::Shield::Protection", "AWS::ShieldRegional::Protection"
resp.resource_synchronization_statuses[0].updated_at #=> Time
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons #=> Hash
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].missing_firewall #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_single_value_configurations[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_appendable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_appendable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.incorrect_appendable_configuration_order[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.missing_mergeable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values #=> Array
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].configuration_name #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].expected_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.reasons["PolicyFirewallType"].invalid_firewall.unexpected_mergeable_configuration_values[0].actual_value #=> String
resp.resource_synchronization_statuses[0].out_of_sync_reasons.not_visible.reason #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues #=> Hash
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].issue_type #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].message #=> String
resp.resource_synchronization_statuses[0].remediation_issues.issues["PolicyFirewallType"].corrective_action #=> String
resp.resource_synchronization_statuses[0].remediation_issues.not_visible.reason #=> String
resp.resource_synchronization_statuses[0].evaluated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment to list synchronization statuses for. This is the deployment's Amazon Resource Name (ARN).

  • :synchronization_status (String) —

    Filters the results by synchronization status, such as IN_SYNC or OUT_OF_SYNC.

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3415
3416
3417
3418
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3415

def list_resource_synchronization_statuses(params = {}, options = {})
  req = build_request(:list_resource_synchronization_statuses, params)
  req.send_request(options)
end

#list_rule_snapshots(params = {}) ⇒ Types::ListRuleSnapshotsOutput

Lists the snapshots of the specified rule.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List the snapshots of a rule


# Lists the immutable snapshots that have been created for a rule.

resp = client.list_rule_snapshots({
  max_results: 10, 
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
})

resp.to_h outputs the following:
{
  snapshots: [
    {
      version: "2", 
      firewall_type: "WAF", 
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123:2", 
      rule_id: "abc123", 
      rule_name: "block-known-bad-ips", 
      rule_type: "INSPECTION", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
    {
      version: "3", 
      firewall_type: "WAF", 
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123:3", 
      rule_id: "abc123", 
      rule_name: "block-known-bad-ips", 
      rule_type: "INSPECTION", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-21T09:30:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_rule_snapshots({
  rule_identifier: "RuleIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.snapshots #=> Array
resp.snapshots[0].rule_id #=> String
resp.snapshots[0].rule_arn #=> String
resp.snapshots[0].rule_name #=> String
resp.snapshots[0].firewall_type #=> String, one of "WAF"
resp.snapshots[0].rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.snapshots[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.snapshots[0].version #=> String
resp.snapshots[0].has_published_version #=> Boolean
resp.snapshots[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :rule_identifier (required, String) —

    The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3505
3506
3507
3508
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3505

def list_rule_snapshots(params = {}, options = {})
  req = build_request(:list_rule_snapshots, params)
  req.send_request(options)
end

#list_rules(params = {}) ⇒ Types::ListRulesOutput

Lists the rules in the account. You can filter the results by status and page through them using maxResults and nextToken.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List rules


# Lists the published rules in the account, one page at a time.

resp = client.list_rules({
  max_results: 10, 
  status: "ACTIVE", 
})

resp.to_h outputs the following:
{
  rules: [
    {
      version: "2", 
      firewall_type: "WAF", 
      has_published_version: true, 
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
      rule_id: "abc123", 
      rule_name: "block-known-bad-ips", 
      rule_type: "INSPECTION", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_rules({
  max_results: 1,
  next_token: "NextToken",
  status: "ACTIVE", # accepts ACTIVE, DRAFT, DISABLED
})

Response structure


resp.next_token #=> String
resp.rules #=> Array
resp.rules[0].rule_id #=> String
resp.rules[0].rule_arn #=> String
resp.rules[0].rule_name #=> String
resp.rules[0].firewall_type #=> String, one of "WAF"
resp.rules[0].rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.rules[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.rules[0].version #=> String
resp.rules[0].has_published_version #=> Boolean
resp.rules[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

  • :status (String) —

    Filters the results by status, either ACTIVE or DRAFT.

Returns:

See Also:



3586
3587
3588
3589
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3586

def list_rules(params = {}, options = {})
  req = build_request(:list_rules, params)
  req.send_request(options)
end

#list_scope_snapshots(params = {}) ⇒ Types::ListScopeSnapshotsOutput

Lists the snapshots of the specified scope.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List the snapshots of a scope


# Lists the immutable snapshots that have been created for a scope.

resp = client.list_scope_snapshots({
  max_results: 10, 
  scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
})

resp.to_h outputs the following:
{
  snapshots: [
    {
      version: "2", 
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123:2", 
      scope_id: "abc123", 
      scope_name: "production-web-apps", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_scope_snapshots({
  scope_identifier: "ScopeIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.snapshots #=> Array
resp.snapshots[0].scope_id #=> String
resp.snapshots[0].scope_arn #=> String
resp.snapshots[0].scope_name #=> String
resp.snapshots[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.snapshots[0].version #=> String
resp.snapshots[0].has_published_version #=> Boolean
resp.snapshots[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :scope_identifier (required, String) —

    The identifier of the scope. This is the scope's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3662
3663
3664
3665
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3662

def list_scope_snapshots(params = {}, options = {})
  req = build_request(:list_scope_snapshots, params)
  req.send_request(options)
end

#list_scopes(params = {}) ⇒ Types::ListScopesOutput

Lists the scopes in the account. You can filter the results by status and page through them using maxResults and nextToken.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List scopes


# Lists the published scopes in the account, one page at a time.

resp = client.list_scopes({
  max_results: 10, 
  status: "ACTIVE", 
})

resp.to_h outputs the following:
{
  next_token: "eyJsYXN0RXZhbHVhdGVkS2V5IjoiYWJjMTIzIn0=", 
  scopes: [
    {
      version: "2", 
      has_published_version: true, 
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
      scope_id: "abc123", 
      scope_name: "production-web-apps", 
      status: "ACTIVE", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_scopes({
  max_results: 1,
  next_token: "NextToken",
  status: "ACTIVE", # accepts ACTIVE, DRAFT, DISABLED
})

Response structure


resp.next_token #=> String
resp.scopes #=> Array
resp.scopes[0].scope_id #=> String
resp.scopes[0].scope_arn #=> String
resp.scopes[0].scope_name #=> String
resp.scopes[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.scopes[0].version #=> String
resp.scopes[0].has_published_version #=> Boolean
resp.scopes[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

  • :status (String) —

    Filters the results by status: ACTIVE, DRAFT, or DISABLED.

Returns:

See Also:



3740
3741
3742
3743
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3740

def list_scopes(params = {}, options = {})
  req = build_request(:list_scopes, params)
  req.send_request(options)
end

#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceOutput

Lists the tags associated with the specified resource.

Examples:

Example: List the tags on a resource


# Lists the tags associated with a Network Security Manager resource.

resp = client.list_tags_for_resource({
  resource_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
})

resp.to_h outputs the following:
{
  tags: {
    "Environment" => "Production", 
    "Team" => "NetworkSecurity", 
  }, 
}

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "Arn", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :resource_arn (required, String) —

    The ARN of the resource to list tags for. The ARN must not include a :DRAFT qualifier.

Returns:

See Also:



3787
3788
3789
3790
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3787

def list_tags_for_resource(params = {}, options = {})
  req = build_request(:list_tags_for_resource, params)
  req.send_request(options)
end

#list_template_snapshots(params = {}) ⇒ Types::ListTemplateSnapshotsOutput

Lists the snapshots of the specified template.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List the snapshots of a template


# Lists the immutable snapshots that have been created for a template.

resp = client.list_template_snapshots({
  max_results: 10, 
  template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
})

resp.to_h outputs the following:
{
  snapshots: [
    {
      version: "2", 
      firewall_type: "WAF", 
      status: "ACTIVE", 
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789:2", 
      template_id: "xyz789", 
      template_name: "standard-waf-template", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_template_snapshots({
  template_identifier: "TemplateIdentifier", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.snapshots #=> Array
resp.snapshots[0].template_id #=> String
resp.snapshots[0].template_arn #=> String
resp.snapshots[0].template_name #=> String
resp.snapshots[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.snapshots[0].version #=> String
resp.snapshots[0].has_published_version #=> Boolean
resp.snapshots[0].firewall_type #=> String, one of "WAF"
resp.snapshots[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :template_identifier (required, String) —

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

Returns:

See Also:



3865
3866
3867
3868
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3865

def list_template_snapshots(params = {}, options = {})
  req = build_request(:list_template_snapshots, params)
  req.send_request(options)
end

#list_templates(params = {}) ⇒ Types::ListTemplatesOutput

Lists the templates in the account. You can filter the results by status and page through them using maxResults and nextToken.

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: List templates


# Lists the published templates in the account, one page at a time.

resp = client.list_templates({
  max_results: 10, 
  status: "ACTIVE", 
})

resp.to_h outputs the following:
{
  templates: [
    {
      version: "2", 
      firewall_type: "WAF", 
      has_published_version: true, 
      status: "ACTIVE", 
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
      template_id: "xyz789", 
      template_name: "standard-waf-template", 
      updated_at: Time.parse("2026-08-20T12:00:00Z"), 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_templates({
  max_results: 1,
  next_token: "NextToken",
  status: "ACTIVE", # accepts ACTIVE, DRAFT, DISABLED
})

Response structure


resp.next_token #=> String
resp.templates #=> Array
resp.templates[0].template_id #=> String
resp.templates[0].template_arn #=> String
resp.templates[0].template_name #=> String
resp.templates[0].status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.templates[0].version #=> String
resp.templates[0].has_published_version #=> Boolean
resp.templates[0].firewall_type #=> String, one of "WAF"
resp.templates[0].updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :max_results (Integer) —

    The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned nextToken value in a subsequent call.

  • :next_token (String) —

    The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.

  • :status (String) —

    Filters the results by status, either ACTIVE or DRAFT.

Returns:

See Also:



3944
3945
3946
3947
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 3944

def list_templates(params = {}, options = {})
  req = build_request(:list_templates, params)
  req.send_request(options)
end

#put_admin_account(params = {}) ⇒ Types::PutAdminAccountResponse

Sets the AWS account that serves as an AWS Network Security Manager administrator account, and optionally configures the scope of resources that the administrator can manage.

You can't set an administrator account again immediately after you remove it, or while the service creates its service-linked role. Retry the request after a few minutes.

Examples:

Example: Designate an administrator account


# Designates an account as a Network Security Manager administrator, scoped to a specific organizational unit and the WAF
# firewall type.

resp = client.({
  account_id: "234567890123", 
  admin_scope: {
    firewall_type_scope: {
      all_firewall_types_enabled: false, 
      firewall_types: [
        "WAF", 
      ], 
    }, 
    scope_filter: {
      include_only: {
        organizational_units: [
          "ou-abcd-12345678", 
        ], 
      }, 
    }, 
  }, 
  priority: 2, 
})

resp.to_h outputs the following:
{
  admin_account_details: {
    admin_account: "234567890123", 
    admin_scope: {
      firewall_type_scope: {
        all_firewall_types_enabled: false, 
        firewall_types: [
          "WAF", 
        ], 
      }, 
      scope_filter: {
        include_only: {
          organizational_units: [
            {
              name: "Production", 
              ou_id: "ou-abcd-12345678", 
            }, 
          ], 
        }, 
      }, 
    }, 
    priority: 2, 
    status: "ONBOARDED", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
  priority: 1, # required
  admin_scope: {
    scope_filter: {
      include_all: {
      },
      include_only: {
        accounts: ["AccountId"],
        organizational_units: ["OrganizationalUnitId"],
      },
      exclude_only: {
        accounts: ["AccountId"],
        organizational_units: ["OrganizationalUnitId"],
      },
    },
    firewall_type_scope: {
      all_firewall_types_enabled: false,
      firewall_types: ["WAF"], # accepts WAF, SHIELD_ADVANCED
    },
  },
})

Response structure


resp.. #=> String
resp..priority #=> Integer
resp..admin_scope.scope_filter.include_only.accounts #=> Array
resp..admin_scope.scope_filter.include_only.accounts[0]. #=> String
resp..admin_scope.scope_filter.include_only.accounts[0].name #=> String
resp..admin_scope.scope_filter.include_only.accounts[0].email #=> String
resp..admin_scope.scope_filter.include_only.organizational_units #=> Array
resp..admin_scope.scope_filter.include_only.organizational_units[0].ou_id #=> String
resp..admin_scope.scope_filter.include_only.organizational_units[0].name #=> String
resp..admin_scope.scope_filter.exclude_only.accounts #=> Array
resp..admin_scope.scope_filter.exclude_only.accounts[0]. #=> String
resp..admin_scope.scope_filter.exclude_only.accounts[0].name #=> String
resp..admin_scope.scope_filter.exclude_only.accounts[0].email #=> String
resp..admin_scope.scope_filter.exclude_only.organizational_units #=> Array
resp..admin_scope.scope_filter.exclude_only.organizational_units[0].ou_id #=> String
resp..admin_scope.scope_filter.exclude_only.organizational_units[0].name #=> String
resp..admin_scope.firewall_type_scope.all_firewall_types_enabled #=> Boolean
resp..admin_scope.firewall_type_scope.firewall_types #=> Array
resp..admin_scope.firewall_type_scope.firewall_types[0] #=> String, one of "WAF", "SHIELD_ADVANCED"
resp..status #=> String, one of "ONBOARDED", "OFFBOARDED"

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :account_id (required, String) —

    The AWS account ID to set as the AWS Network Security Manager administrator account.

  • :priority (required, Integer) —

    The priority to assign to the administrator account.

  • :admin_scope (Types::AdminScopeInput) —

    The scope of accounts, organizational units, and firewall types that the administrator can manage.

Returns:

See Also:



4077
4078
4079
4080
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4077

def (params = {}, options = {})
  req = build_request(:put_admin_account, params)
  req.send_request(options)
end

#tag_resource(params = {}) ⇒ Struct

Adds or overwrites the specified tags on the given resource.

Examples:

Example: Tag a resource


# Adds tags to a Network Security Manager resource.

resp = client.tag_resource({
  resource_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  tags: {
    "Environment" => "Production", 
    "Team" => "NetworkSecurity", 
  }, 
})

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "Arn", # required
  tags: { # required
    "TagKey" => "TagValue",
  },
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :resource_arn (required, String) —

    The ARN of the resource to tag. The ARN must not include a :DRAFT qualifier.

  • :tags (required, Hash<String,String>) —

    The tags to add to the resource.

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



4119
4120
4121
4122
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4119

def tag_resource(params = {}, options = {})
  req = build_request(:tag_resource, params)
  req.send_request(options)
end

#untag_resource(params = {}) ⇒ Struct

Removes the specified tags from the given resource.

Examples:

Example: Remove tags from a resource


# Removes the specified tag keys from a Network Security Manager resource.

resp = client.untag_resource({
  resource_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  tag_keys: [
    "Environment", 
  ], 
})

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "Arn", # required
  tag_keys: ["TagKey"], # required
})

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :resource_arn (required, String) —

    The ARN of the resource to remove tags from. The ARN must not include a :DRAFT qualifier.

  • :tag_keys (required, Array<String>) —

    The keys of the tags to remove from the resource.

Returns:

  • (Struct) —

    Returns an empty response.

See Also:



4158
4159
4160
4161
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4158

def untag_resource(params = {}, options = {})
  req = build_request(:untag_resource, params)
  req.send_request(options)
end

#update_deployment(params = {}) ⇒ Types::UpdateDeploymentOutput

Updates the specified deployment. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the deployment as a draft.

Examples:

Example: Update a deployment and publish it


# Updates the deployment's associations and publishes the change. The response includes deploymentCoverage showing which
# resource types the associated policies can protect. The updateToken from the most recent read is required for optimistic
# locking.

resp = client.update_deployment({
  associated_policy_list: [
    {
      policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  deployment_configuration: {
    enable_cross_account_visibility: true, 
  }, 
  deployment_description: "Production deployment for US East 1 region - updated", 
  deployment_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  is_published: true, 
  update_token: "f4a5b6c7-7d8e-4f9a-8b1c-1d2e3f4a5b6c", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_policy_list: [
    {
      policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
    }, 
  ], 
  associated_scope_list: [
    {
      scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
    }, 
  ], 
  deployment_arn: "arn:aws:network-security-manager:us-east-1:123456789012:deployment:def456", 
  deployment_configuration: {
    enable_cross_account_visibility: true, 
  }, 
  deployment_coverage: [
    {
      firewall_type: "WAF", 
      in_scope_resource_types: [
        "AWS::ElasticLoadBalancingV2::LoadBalancer::application", 
        "AWS::CloudFront::Distribution", 
      ], 
      policy_arns: [
        "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
      ], 
    }, 
  ], 
  deployment_description: "Production deployment for US East 1 region - updated", 
  deployment_id: "def456", 
  deployment_name: "prod-us-east-1-deployment", 
  has_published_version: true, 
  is_snapshot: false, 
  status: "ACTIVE", 
  update_token: "a5b6c7d8-8e9f-4a0b-9c1d-2e3f4a5b6c7d", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.update_deployment({
  deployment_identifier: "DeploymentIdentifier", # required
  update_token: "UpdateToken", # required
  deployment_description: "Description",
  deployment_configuration: {
    enable_cross_account_visibility: false, # required
  },
  associated_policy_list: [
    {
      policy_identifier: "PolicyIdentifier", # required
    },
  ],
  associated_scope_list: [
    {
      scope_identifier: "ScopeIdentifier", # required
    },
  ],
  is_published: false, # required
  client_token: "IdempotencyToken",
})

Response structure


resp.deployment_id #=> String
resp.deployment_arn #=> String
resp.deployment_name #=> String
resp.deployment_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.deployment_configuration. #=> Boolean
resp.associated_policy_list #=> Array
resp.associated_policy_list[0].policy_arn #=> String
resp.associated_scope_list #=> Array
resp.associated_scope_list[0].scope_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.deployment_coverage #=> Array
resp.deployment_coverage[0].firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.deployment_coverage[0].policy_arns #=> Array
resp.deployment_coverage[0].policy_arns[0] #=> String
resp.deployment_coverage[0].in_scope_resource_types #=> Array
resp.deployment_coverage[0].in_scope_resource_types[0] #=> String, one of "AWS::ApiGateway::Stage", "AWS::CloudFront::Distribution", "AWS::EC2::EIP", "AWS::ElasticLoadBalancingV2::LoadBalancer::application", "AWS::ElasticLoadBalancing::LoadBalancer"
resp.warnings #=> Array
resp.warnings[0].code #=> String
resp.warnings[0].policy_arn #=> String
resp.warnings[0].message #=> String
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :deployment_identifier (required, String) —

    The identifier of the deployment. This is the deployment's Amazon Resource Name (ARN).

  • :update_token (required, String) —

    A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

  • :deployment_description (String) —

    A description of the deployment.

  • :deployment_configuration (Types::DeploymentConfiguration) —

    The configuration settings for the deployment.

  • :associated_policy_list (Array<Types::PolicyReference>) —

    The policies associated with the deployment.

  • :associated_scope_list (Array<Types::ScopeReference>) —

    The scope associated with the deployment. A deployment has exactly one scope.

  • :is_published (required, Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



4342
4343
4344
4345
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4342

def update_deployment(params = {}, options = {})
  req = build_request(:update_deployment, params)
  req.send_request(options)
end

#update_policy(params = {}) ⇒ Types::UpdatePolicyOutput

Updates the specified policy. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the policy as a draft.

Examples:

Example: Update a policy and publish it


# Updates the policy's description, priority, and configuration and publishes the change. The updateToken from the most
# recent read is required for optimistic locking.

resp = client.update_policy({
  associated_template_and_rule_list: [
    {
      template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  is_published: true, 
  policy_configuration: {
    remediation_enabled: true, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_description: "WAF policy for web application protection - updated", 
  policy_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  priority: 2, 
  update_token: "e3f4a5b6-6c7d-4e8f-9a0b-0c1d2e3f4a5b", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_template_and_rule_list: [
    {
      template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  policy_arn: "arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789", 
  policy_configuration: {
    remediation_enabled: true, 
    resources_clean_up: false, 
    waf_config: {
      conflict_resolution: "MERGE_WHERE_APPLICABLE", 
      existing_customer_web_acl_resolution: "NO_REMEDIATION", 
    }, 
  }, 
  policy_description: "WAF policy for web application protection - updated", 
  policy_id: "xyz789", 
  policy_name: "web-app-waf-policy", 
  priority: 2, 
  status: "ACTIVE", 
  update_token: "f4a5b6c7-7d8e-4f9a-8b1c-1d2e3f4a5b6c", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.update_policy({
  policy_identifier: "PolicyIdentifier", # required
  update_token: "UpdateToken", # required
  policy_description: "Description",
  priority: 1,
  associated_template_and_rule_list: [
    {
      template_identifier: "TemplateIdentifier",
      rule_identifier: "RuleIdentifier",
    },
  ],
  policy_configuration: {
    remediation_enabled: false, # required
    resources_clean_up: false, # required
    waf_config: {
      existing_customer_web_acl_resolution: "RETROFIT", # required, accepts RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION
      conflict_resolution: "MERGE_WHERE_APPLICABLE", # required, accepts MERGE_WHERE_APPLICABLE
    },
  },
  is_published: false, # required
  client_token: "IdempotencyToken",
})

Response structure


resp.policy_id #=> String
resp.policy_arn #=> String
resp.policy_name #=> String
resp.policy_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.priority #=> Integer
resp.associated_template_and_rule_list #=> Array
resp.associated_template_and_rule_list[0].template_arn #=> String
resp.associated_template_and_rule_list[0].rule_arn #=> String
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF", "SHIELD_ADVANCED"
resp.policy_configuration.remediation_enabled #=> Boolean
resp.policy_configuration.resources_clean_up #=> Boolean
resp.policy_configuration.waf_config.existing_customer_web_acl_resolution #=> String, one of "RETROFIT", "OVERRIDE_ASSOCIATION", "NO_REMEDIATION"
resp.policy_configuration.waf_config.conflict_resolution #=> String, one of "MERGE_WHERE_APPLICABLE"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :policy_identifier (required, String) —

    The identifier of the policy. This is the policy's Amazon Resource Name (ARN).

  • :update_token (required, String) —

    A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

  • :policy_description (String) —

    A description of the policy.

  • :priority (Integer) —

    The priority of the resource. A lower number indicates a higher priority.

  • :associated_template_and_rule_list (Array<Types::TemplateOrRuleReference>) —

    The templates and rules to associate with the policy. For AWS WAF policies, specify 1 to 100 templates or rules, of which at most 2 can be templates. For AWS Shield Advanced policies, this list must be empty.

  • :policy_configuration (Types::PolicyConfiguration) —

    The configuration settings that control the policy's behavior, including remediation and firewall-type-specific settings.

  • :is_published (required, Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



4515
4516
4517
4518
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4515

def update_policy(params = {}, options = {})
  req = build_request(:update_policy, params)
  req.send_request(options)
end

#update_rule(params = {}) ⇒ Types::UpdateRuleOutput

Updates the specified rule. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the rule as a draft.

Examples:

Example: Update a rule and publish it


# Updates the rule's description and configuration and publishes the change. The updateToken from the most recent read is
# required for optimistic locking.

resp = client.update_rule({
  configuration: {
  }, 
  is_published: true, 
  rule_description: "Blocks requests from known malicious IP addresses - updated list", 
  rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
  rule_type: "INSPECTION", 
  update_token: "c1d2e3f4-4a5b-4c6d-9e7f-8a9b0c1d2e3f", 
})

resp.to_h outputs the following:
{
  version: "2", 
  configuration: {
  }, 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
  rule_description: "Blocks requests from known malicious IP addresses - updated list", 
  rule_id: "abc123", 
  rule_name: "block-known-bad-ips", 
  rule_type: "INSPECTION", 
  status: "ACTIVE", 
  update_token: "d2e3f4a5-5b6c-4d7e-8f9a-9b0c1d2e3f4a", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.update_rule({
  rule_identifier: "RuleIdentifier", # required
  update_token: "UpdateToken", # required
  rule_type: "CONFIGURATION", # accepts CONFIGURATION, INSPECTION
  rule_description: "Description",
  configuration: {
  },
  is_published: false, # required
  client_token: "IdempotencyToken",
})

Response structure


resp.rule_id #=> String
resp.rule_arn #=> String
resp.rule_name #=> String
resp.firewall_type #=> String, one of "WAF"
resp.rule_type #=> String, one of "CONFIGURATION", "INSPECTION"
resp.rule_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :rule_identifier (required, String) —

    The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

  • :update_token (required, String) —

    A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

  • :rule_type (String) —

    The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

  • :rule_description (String) —

    A description of the rule.

  • :configuration (Hash, Array, String, Numeric, Boolean) —

    The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF INSPECTION rule, provide an AWS WAF rule group. For an AWS WAF CONFIGURATION rule, provide a single web ACL setting, such as DefaultAction or VisibilityConfig; use wafConfigDataType to declare which setting the document contains. For the schema of each setting and complete examples, see Writing rule configurations in the AWS Network Security Manager Developer Guide.

    Document type used to carry open content (Hash,Array,String,Numeric,Boolean). A document type value is serialized using the same format as its surroundings and requires no additional encoding or escaping.

  • :is_published (required, Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



4655
4656
4657
4658
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4655

def update_rule(params = {}, options = {})
  req = build_request(:update_rule, params)
  req.send_request(options)
end

#update_scope(params = {}) ⇒ Types::UpdateScopeOutput

Updates the specified scope. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the scope as a draft.

Examples:

Example: Update a scope and publish it


# Updates the scope's description and configuration and publishes the change. The updateToken from the most recent read is
# required for optimistic locking.

resp = client.update_scope({
  is_published: true, 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_description: "Scope covering all production web application resources in US East 1", 
  scope_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
  update_token: "b0c4d1e2-3f4a-4b5c-8d6e-7f8a9b0c1d2e", 
})

resp.to_h outputs the following:
{
  version: "2", 
  has_published_version: true, 
  is_snapshot: false, 
  scope_arn: "arn:aws:network-security-manager:us-east-1:123456789012:scope:abc123", 
  scope_configuration: {
    account_filter: {
      include_all: {
      }, 
    }, 
    resource_scopes: {
    }, 
  }, 
  scope_description: "Scope covering all production web application resources in US East 1", 
  scope_id: "abc123", 
  scope_name: "production-web-apps", 
  status: "ACTIVE", 
  update_token: "c1d2e3f4-4a5b-4c6d-9e7f-8a9b0c1d2e3f", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.update_scope({
  scope_identifier: "ScopeIdentifier", # required
  update_token: "UpdateToken", # required
  scope_description: "Description",
  scope_configuration: {
    account_filter: {
      include_all: {
      },
      include: {
        account_ids: ["AccountId"],
        organizational_units: ["OrganizationalUnit"],
      },
      exclude: {
        account_ids: ["AccountId"],
        organizational_units: ["OrganizationalUnit"],
      },
    },
    resource_scopes: { # required
      "AWS::ApiGateway::Stage" => {
        include_all: false,
        include: {
          explicit_arns: ["Arn"],
          expression: {
            criteria: {
              tags: {
                "String" => "String",
              },
              alb_config: {
                scheme: "internet-facing", # accepts internet-facing, internal
                ip_address_type: "ipv4", # accepts ipv4, dualstack, dualstack-without-public-ipv4
              },
            },
            and: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            or: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            not: {
              # recursive ResourceLogicalExpression
            },
          },
        },
        exclude: {
          explicit_arns: ["Arn"],
          expression: {
            criteria: {
              tags: {
                "String" => "String",
              },
              alb_config: {
                scheme: "internet-facing", # accepts internet-facing, internal
                ip_address_type: "ipv4", # accepts ipv4, dualstack, dualstack-without-public-ipv4
              },
            },
            and: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            or: [
              {
                # recursive ResourceLogicalExpression
              },
            ],
            not: {
              # recursive ResourceLogicalExpression
            },
          },
        },
      },
    },
  },
  is_published: false, # required
  client_token: "IdempotencyToken",
})

Response structure


resp.scope_id #=> String
resp.scope_arn #=> String
resp.scope_name #=> String
resp.scope_description #=> String
resp.scope_configuration..include. #=> Array
resp.scope_configuration..include.[0] #=> String
resp.scope_configuration..include.organizational_units #=> Array
resp.scope_configuration..include.organizational_units[0] #=> String
resp.scope_configuration..exclude. #=> Array
resp.scope_configuration..exclude.[0] #=> String
resp.scope_configuration..exclude.organizational_units #=> Array
resp.scope_configuration..exclude.organizational_units[0] #=> String
resp.scope_configuration.resource_scopes #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include_all #=> Boolean
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].include.expression.not #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.explicit_arns[0] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags #=> Hash
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.tags["String"] #=> String
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.scheme #=> String, one of "internet-facing", "internal"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.criteria.alb_config.ip_address_type #=> String, one of "ipv4", "dualstack", "dualstack-without-public-ipv4"
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.and[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or #=> Array
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.or[0] #=> Types::ResourceLogicalExpression
resp.scope_configuration.resource_scopes["ScopeResourceType"].exclude.expression.not #=> Types::ResourceLogicalExpression
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :scope_identifier (required, String) —

    The identifier of the scope. This is the scope's Amazon Resource Name (ARN).

  • :update_token (required, String) —

    A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

  • :scope_description (String) —

    A description of the scope.

  • :scope_configuration (Types::ScopeConfiguration) —

    The configuration that defines which accounts and resources are in scope. If you don't include this member, the scope keeps its existing configuration.

    A new configuration can change which accounts and resources are selected, but it can't add or remove the account filter itself: a scope created for multi-account use stays multi-account, and a scope created for single-account use stays single-account.

  • :is_published (required, Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



4889
4890
4891
4892
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 4889

def update_scope(params = {}, options = {})
  req = build_request(:update_scope, params)
  req.send_request(options)
end

#update_template(params = {}) ⇒ Types::UpdateTemplateOutput

Updates the specified template. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the template as a draft.

Examples:

Example: Update a template and publish it


# Updates the template's description and rule associations and publishes the change. The updateToken from the most recent
# read is required for optimistic locking.

resp = client.update_template({
  associated_rule_list: [
    {
      rule_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  is_published: true, 
  template_description: "Standard WAF template with baseline rule groups - updated", 
  template_identifier: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
  update_token: "d2e3f4a5-5b6c-4d7e-8f9a-9b0c1d2e3f4a", 
})

resp.to_h outputs the following:
{
  version: "2", 
  associated_rule_list: [
    {
      rule_arn: "arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123", 
    }, 
  ], 
  firewall_type: "WAF", 
  has_published_version: true, 
  is_snapshot: false, 
  status: "ACTIVE", 
  template_arn: "arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789", 
  template_description: "Standard WAF template with baseline rule groups - updated", 
  template_id: "xyz789", 
  template_name: "standard-waf-template", 
  update_token: "e3f4a5b6-6c7d-4e8f-9a0b-0c1d2e3f4a5b", 
  updated_at: Time.parse("2026-08-20T12:00:00Z"), 
}

Request syntax with placeholder values


resp = client.update_template({
  template_identifier: "TemplateIdentifier", # required
  update_token: "UpdateToken", # required
  template_description: "Description",
  associated_rule_list: [
    {
      rule_identifier: "RuleIdentifier", # required
    },
  ],
  is_published: false, # required
  client_token: "IdempotencyToken",
})

Response structure


resp.template_id #=> String
resp.template_arn #=> String
resp.template_name #=> String
resp.template_description #=> String
resp.status #=> String, one of "DRAFT", "ACTIVE", "DISABLED"
resp.version #=> String
resp.associated_rule_list #=> Array
resp.associated_rule_list[0].rule_arn #=> String
resp.update_token #=> String
resp.is_snapshot #=> Boolean
resp.has_published_version #=> Boolean
resp.firewall_type #=> String, one of "WAF"
resp.updated_at #=> Time

Parameters:

  • params (Hash) (defaults to: {}) —

    ({})

Options Hash (params):

  • :template_identifier (required, String) —

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

  • :update_token (required, String) —

    A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

  • :template_description (String) —

    A description of the template.

  • :associated_rule_list (Array<Types::RuleReference>) —

    The rules associated with the template.

  • :is_published (required, Boolean) —

    Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

  • :client_token (String) —

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



5015
5016
5017
5018
# File 'gems/aws-sdk-networksecuritymanager/lib/aws-sdk-networksecuritymanager/client.rb', line 5015

def update_template(params = {}, options = {})
  req = build_request(:update_template, params)
  req.send_request(options)
end