Skip to content
v2.277.0

IgnoreStrategy Class ​

Represents file path ignoring behavior.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const ignoreStrategy = cdk.IgnoreStrategy.fromCopyOptions({
  exclude: ['exclude'],
  follow: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
}, 'absoluteRootPath');
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

ignore_strategy = cdk.IgnoreStrategy.from_copy_options(cdk.CopyOptions(
    exclude=["exclude"],
    follow=cdk.SymlinkFollowMode.NEVER,
    ignore_mode=cdk.IgnoreMode.GLOB
), "absoluteRootPath")
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

IgnoreStrategy ignoreStrategy = IgnoreStrategy.fromCopyOptions(CopyOptions.builder()
        .exclude(List.of("exclude"))
        .follow(SymlinkFollowMode.NEVER)
        .ignoreMode(IgnoreMode.GLOB)
        .build(), "absoluteRootPath");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var ignoreStrategy = IgnoreStrategy.FromCopyOptions(new CopyOptions {
    Exclude = new [] { "exclude" },
    Follow = SymlinkFollowMode.NEVER,
    IgnoreMode = IgnoreMode.GLOB
}, "absoluteRootPath");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

ignoreStrategy := cdk.IgnoreStrategy_FromCopyOptions(&CopyOptions{
	Exclude: []*string{
		jsii.String("exclude"),
	},
	Follow: cdk.SymlinkFollowMode_NEVER,
	IgnoreMode: cdk.IgnoreMode_GLOB,
}, jsii.String("absoluteRootPath"))

Initializer ​

ts
new IgnoreStrategy()
python
IgnoreStrategy()
java
new IgnoreStrategy()
csharp
new IgnoreStrategy()
go
NewIgnoreStrategy()

Methods ​

add(pattern: string): voiddef add(self, pattern: str) -> Nonepublic void add(String pattern)public void Add(string pattern)func Add(Pattern *string) #
Adds another pattern.
completelyIgnores(absoluteDirectoryPath: string): booleandef completely_ignores(self, absolute_directory_path: str) -> boolpublic Boolean completelyIgnores(String absoluteDirectoryPath)public bool CompletelyIgnores(string absoluteDirectoryPath)func CompletelyIgnores(AbsoluteDirectoryPath *string) *bool #
Determines whether a given directory path should be ignored and have all of its children ignored.
1 parameter · returns

Parameters

  • absoluteDirectoryPathabsolute_directory_pathabsoluteDirectoryPathabsoluteDirectoryPathAbsoluteDirectoryPath — absolute directory path to be assessed against the pattern.

Returns: true if the directory and all of its children should be ignored

docker(absoluteRootPath: string, patterns: string[]): DockerIgnoreStrategy@staticmethod def docker(absolute_root_path: str, patterns: typing.List[str]) -> DockerIgnoreStrategypublic static DockerIgnoreStrategy docker(String absoluteRootPath, List<String> patterns)public static DockerIgnoreStrategy Docker(string absoluteRootPath, string[] patterns)func Docker(AbsoluteRootPath *string, Patterns *[]*string) DockerIgnoreStrategy static #
Ignores file paths based on the `.dockerignore specification`.
1 parameter · returns

Parameters

  • absoluteRootPathabsolute_root_pathabsoluteRootPathabsoluteRootPathAbsoluteRootPath — the absolute path to the root directory of the paths to be considered.

Returns: DockerIgnorePattern associated with the given patterns.

fromCopyOptions(options: CopyOptions, absoluteRootPath: string): IgnoreStrategy // chainable@staticmethod def from_copy_options(options: CopyOptions, absolute_root_path: str) -> IgnoreStrategypublic static IgnoreStrategy fromCopyOptions(CopyOptions options, String absoluteRootPath)public static IgnoreStrategy FromCopyOptions(CopyOptions options, string absoluteRootPath)func FromCopyOptions(Options CopyOptions, AbsoluteRootPath *string) IgnoreStrategy static #
Creates an IgnoreStrategy based on the `ignoreMode` and `exclude` in a `CopyOptions`.
2 parameters · returns

Parameters

  • optionsoptionsoptionsoptionsOptions — the CopyOptions to create the IgnoreStrategy from.
  • absoluteRootPathabsolute_root_pathabsoluteRootPathabsoluteRootPathAbsoluteRootPath — the absolute path to the root directory of the paths to be considered.

Returns: IgnoreStrategy based on the CopyOptions

git(absoluteRootPath: string, patterns: string[]): GitIgnoreStrategy@staticmethod def git(absolute_root_path: str, patterns: typing.List[str]) -> GitIgnoreStrategypublic static GitIgnoreStrategy git(String absoluteRootPath, List<String> patterns)public static GitIgnoreStrategy Git(string absoluteRootPath, string[] patterns)func Git(AbsoluteRootPath *string, Patterns *[]*string) GitIgnoreStrategy static #
Ignores file paths based on the `.gitignore specification`.
1 parameter · returns

Parameters

  • absoluteRootPathabsolute_root_pathabsoluteRootPathabsoluteRootPathAbsoluteRootPath — the absolute path to the root directory of the paths to be considered.

Returns: GitIgnorePattern associated with the given patterns.

glob(absoluteRootPath: string, patterns: string[]): GlobIgnoreStrategy@staticmethod def glob(absolute_root_path: str, patterns: typing.List[str]) -> GlobIgnoreStrategypublic static GlobIgnoreStrategy glob(String absoluteRootPath, List<String> patterns)public static GlobIgnoreStrategy Glob(string absoluteRootPath, string[] patterns)func Glob(AbsoluteRootPath *string, Patterns *[]*string) GlobIgnoreStrategy static #
Ignores file paths based on simple glob patterns.
1 parameter · returns

Parameters

  • absoluteRootPathabsolute_root_pathabsoluteRootPathabsoluteRootPathAbsoluteRootPath — the absolute path to the root directory of the paths to be considered.

Returns: GlobIgnorePattern associated with the given patterns.

ignores(absoluteFilePath: string): booleandef ignores(self, absolute_file_path: str) -> boolpublic Boolean ignores(String absoluteFilePath)public bool Ignores(string absoluteFilePath)func Ignores(AbsoluteFilePath *string) *bool #
Determines whether a given file path should be ignored or not.
1 parameter · returns

Parameters

  • absoluteFilePathabsolute_file_pathabsoluteFilePathabsoluteFilePathAbsoluteFilePath — absolute file path to be assessed against the pattern.

Returns: true if the file should be ignored