Continuum / Client / create_supply_chain_policy
create_supply_chain_policy¶
- Continuum.Client.create_supply_chain_policy(**kwargs)¶
Creates a Supply Chain policy in the calling account and Region. A policy holds up to five deny rules, which CreatePackageDecision evaluates for every package.
See also: AWS API Documentation
Request Syntax
response = client.create_supply_chain_policy( policy={ 'name': 'string', 'description': 'string', 'rules': [ { 'ruleId': 'string', 'enforcementMode': 'AUDIT'|'ENFORCE', 'denyWhen': { 'allOf': [ { 'signal': 'PACKAGE_IDENTITY'|'INSPECTOR_SEVERITY'|'KEV'|'MALICIOUS', 'operator': 'MATCHES'|'AT_LEAST'|'EQUALS'|'NOT_EQUALS'|'IN'|'PRESENT', 'value': { 'packageIdentity': { 'ecosystem': 'string', 'name': 'string', 'version': 'string', 'versionRange': 'string' }, 'severity': 'LOW'|'MEDIUM'|'HIGH'|'CRITICAL'|'UNTRIAGED', 'stringValue': 'string', 'stringSet': [ 'string', ] } }, ] } }, ] }, tags={ 'string': 'string' }, clientToken='string' )
- Parameters:
policy (dict) –
[REQUIRED]
The policy to create: its name, description, and rules.
name (string) – [REQUIRED]
The display name of the policy.
description (string) –
A description of the policy.
rules (list) – [REQUIRED]
The deny rules of the policy, from 1 to 5.
(dict) –
A single deny rule. The rule matches a package when all of its conditions are true. When several rules match, the strongest enforcement mode wins.
ruleId (string) – [REQUIRED]
The identifier of the rule, unique within the policy. Policy exceptions and decision evidence refer to rules by this ID.
enforcementMode (string) – [REQUIRED]
What happens when the rule matches. ENFORCE denies the package. AUDIT records the match and allows the package.
denyWhen (dict) – [REQUIRED]
The conditions that must all be true for the rule to match.
allOf (list) – [REQUIRED]
The conditions, from 1 to 20. All of them must be true for the rule to match.
(dict) –
A single condition: a signal, an operator, and a value. The service checks that the operator and value are valid for the signal when the policy is created or updated.
signal (string) – [REQUIRED]
The package attribute that the condition tests.
operator (string) – [REQUIRED]
How the signal is compared with the value.
value (dict) –
The value to compare the signal with. Omit it for the PRESENT operator, which takes no value.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
packageIdentity,severity,stringValue,stringSet.packageIdentity (dict) –
The package to match, for the PACKAGE_IDENTITY signal.
ecosystem (string) – [REQUIRED]
The package ecosystem, such as
npmorpypi.name (string) – [REQUIRED]
The package name, as used in its ecosystem.
version (string) –
Exact version. Mutually exclusive with versionRange, validated server-side.
versionRange (string) –
A version range as one or more comparisons separated by commas, such as
>=1.0, <2.0. Each comparison is=,>,>=,<, or<=followed by a version in the ecosystem’s own format. Ecosystem shorthands such as^1.0or~=1.2aren’t accepted. Mutually exclusive with version.
severity (string) –
An Amazon Inspector severity, for the INSPECTOR_SEVERITY signal.
stringValue (string) –
A single value, for the EQUALS and NOT_EQUALS operators.
stringSet (list) –
A set of up to 20 values, for the IN operator.
(string) –
A condition value, from 1 to 256 characters.
tags (dict) –
Tags to add to the policy when it’s created.
(string) –
The key of a tag.
(string) –
The value of a tag.
clientToken (string) –
Idempotency token. Generated SDKs fill it automatically. Within one hour, the same token with the same policy returns the policy it created. The same token with a different policy, or after that policy was deleted, returns ConflictException. Tags are not compared, and a repeated create leaves the policy’s tags unchanged.
This field is autopopulated if not provided.
- Return type:
dict
- Returns:
Response Syntax
{ 'id': 'string', 'arn': 'string', 'policy': { 'name': 'string', 'description': 'string', 'rules': [ { 'ruleId': 'string', 'enforcementMode': 'AUDIT'|'ENFORCE', 'denyWhen': { 'allOf': [ { 'signal': 'PACKAGE_IDENTITY'|'INSPECTOR_SEVERITY'|'KEV'|'MALICIOUS', 'operator': 'MATCHES'|'AT_LEAST'|'EQUALS'|'NOT_EQUALS'|'IN'|'PRESENT', 'value': { 'packageIdentity': { 'ecosystem': 'string', 'name': 'string', 'version': 'string', 'versionRange': 'string' }, 'severity': 'LOW'|'MEDIUM'|'HIGH'|'CRITICAL'|'UNTRIAGED', 'stringValue': 'string', 'stringSet': [ 'string', ] } }, ] } }, ] }, 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1), 'tags': { 'string': 'string' } }
Response Structure
(dict) –
Output for
CreateSupplyChainPolicy.id (string) –
Opaque identifier generated by the service.
arn (string) –
The ARN of the policy.
policy (dict) –
The policy as stored.
name (string) –
The display name of the policy.
description (string) –
A description of the policy.
rules (list) –
The deny rules of the policy, from 1 to 5.
(dict) –
A single deny rule. The rule matches a package when all of its conditions are true. When several rules match, the strongest enforcement mode wins.
ruleId (string) –
The identifier of the rule, unique within the policy. Policy exceptions and decision evidence refer to rules by this ID.
enforcementMode (string) –
What happens when the rule matches. ENFORCE denies the package. AUDIT records the match and allows the package.
denyWhen (dict) –
The conditions that must all be true for the rule to match.
allOf (list) –
The conditions, from 1 to 20. All of them must be true for the rule to match.
(dict) –
A single condition: a signal, an operator, and a value. The service checks that the operator and value are valid for the signal when the policy is created or updated.
signal (string) –
The package attribute that the condition tests.
operator (string) –
How the signal is compared with the value.
value (dict) –
The value to compare the signal with. Omit it for the PRESENT operator, which takes no value.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
packageIdentity,severity,stringValue,stringSet. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
packageIdentity (dict) –
The package to match, for the PACKAGE_IDENTITY signal.
ecosystem (string) –
The package ecosystem, such as
npmorpypi.name (string) –
The package name, as used in its ecosystem.
version (string) –
Exact version. Mutually exclusive with versionRange, validated server-side.
versionRange (string) –
A version range as one or more comparisons separated by commas, such as
>=1.0, <2.0. Each comparison is=,>,>=,<, or<=followed by a version in the ecosystem’s own format. Ecosystem shorthands such as^1.0or~=1.2aren’t accepted. Mutually exclusive with version.
severity (string) –
An Amazon Inspector severity, for the INSPECTOR_SEVERITY signal.
stringValue (string) –
A single value, for the EQUALS and NOT_EQUALS operators.
stringSet (list) –
A set of up to 20 values, for the IN operator.
(string) –
A condition value, from 1 to 256 characters.
createdAt (datetime) –
The time the policy was created.
updatedAt (datetime) –
The time the policy was last updated. Equal to createdAt for a new policy.
tags (dict) –
The tags on the policy.
(string) –
The key of a tag.
(string) –
The value of a tag.
Exceptions