Container Registry API, gRPC: ScanPolicyService.Create
Creates a scan policy for the specified registry.
gRPC request
rpc Create (CreateScanPolicyRequest) returns (operation.Operation)
CreateScanPolicyRequest
{
"registryId": "string",
"name": "string",
"description": "string",
"rules": {
"pushRule": {
"repositoryPrefixes": [
"string"
],
"disabled": "bool"
},
"scheduleRules": [
{
"repositoryPrefixes": [
"string"
],
"rescanPeriod": "google.protobuf.Duration",
"disabled": "bool"
}
]
}
}
Field |
Description |
registryId |
string Required field. ID of the scan policy registry. |
name |
string Name of the scan policy. |
description |
string Description of the scan policy. |
rules |
Rules of the scan policy. |
ScanRules
Field |
Description |
pushRule |
Description of on-push scan rule. |
scheduleRules[] |
Description of time based rescan rule. |
PushRule
Field |
Description |
repositoryPrefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
disabled |
bool Turns off scan rule. |
ScheduledRule
Field |
Description |
repositoryPrefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
rescanPeriod |
Required field. Period of time since last scan to trigger automatic rescan. |
disabled |
bool Turns off scan rule. |
operation.Operation
{
"id": "string",
"description": "string",
"createdAt": "google.protobuf.Timestamp",
"createdBy": "string",
"modifiedAt": "google.protobuf.Timestamp",
"done": "bool",
"metadata": {
"scanPolicyId": "string"
},
// Includes only one of the fields `error`, `response`
"error": "google.rpc.Status",
"response": {
"id": "string",
"registryId": "string",
"name": "string",
"description": "string",
"rules": {
"pushRule": {
"repositoryPrefixes": [
"string"
],
"disabled": "bool"
},
"scheduleRules": [
{
"repositoryPrefixes": [
"string"
],
"rescanPeriod": "google.protobuf.Duration",
"disabled": "bool"
}
]
},
"createdAt": "google.protobuf.Timestamp",
"disabled": "bool"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
createdAt |
Creation timestamp. |
createdBy |
string ID of the user or service account who initiated the operation. |
modifiedAt |
The time when the Operation resource was last modified. |
done |
bool If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
CreateScanPolicyMetadata
Field |
Description |
scanPolicyId |
string ID of created scan policy resource. |
ScanPolicy
Field |
Description |
id |
string Output only. ID of the scan policy. |
registryId |
string ID of the registry that the scan policy belongs to. |
name |
string Name of the scan policy. |
description |
string Description of the scan policy. |
rules |
The rules of scan policy. |
createdAt |
Output only. Creation timestamp. |
disabled |
bool Turns off scan policy. |
ScanRules
Field |
Description |
pushRule |
Description of on-push scan rule. |
scheduleRules[] |
Description of time based rescan rule. |
PushRule
Field |
Description |
repositoryPrefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
disabled |
bool Turns off scan rule. |
ScheduledRule
Field |
Description |
repositoryPrefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
rescanPeriod |
Required field. Period of time since last scan to trigger automatic rescan. |
disabled |
bool Turns off scan rule. |