Share feedback
Answers are generated based on the documentation.

Update rule

PATCH/orgs/{org_name}/governance/policies/{policy_id}/rules/{rule_id}

Partially updates a rule. Only fields present in the request body are updated; absent fields are left unchanged. Returns the rule in both its old and new states.

Changing actions across domains (for example, from network actions to filesystem actions) is rejected. Changes may take up to five minutes to reach developer machines.

Connection and access

API connection and authentication guidance

https://hub.docker.com/v2

Use one of these alternatives. Requirements within an alternative apply together.

  • bearerAuth

Parameters

org_name path Required

Docker Hub organization name.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

policy_id path Required

Unique policy identifier.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

rule_id path Required

Unique rule identifier within the policy.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Request

Fields to update. Absent fields are left unchanged.

application/json

Schema: UpdateRuleRequest

default

{
  "resources": [
    "research.mitre.org"
  ]
}

Response 200

Rule updated, returns old and new states.

application/json

Schema: UpdateRuleResponse

default

{
  "new": {
    "actions": [
      "connect:tcp",
      "connect:udp"
    ],
    "decision": "allow",
    "id": "rule_06evsm9qjm1pdsk0a8nkfaxy7jna",
    "name": "allow research mirrors",
    "resources": [
      "research.mitre.org"
    ]
  },
  "old": {
    "actions": [
      "connect:tcp",
      "connect:udp"
    ],
    "decision": "allow",
    "id": "rule_06evsm9qjm1pdsk0a8nkfaxy7jna",
    "name": "allow research mirrors",
    "resources": [
      "research.mitre.org",
      "cve.mitre.org"
    ]
  }
}

Response 400

Bad request

application/json

Schema: Error

default

{
  "error": {
    "code": "invalid_argument",
    "message": "name is required"
  }
}

Response 401

Missing or invalid credentials

application/json

Schema: Error

default

{
  "error": {
    "code": "unauthenticated",
    "message": "unauthenticated"
  }
}

Response 403

Caller lacks the required permission for this org, or the org is not entitled to use governance.

application/json

Schema: Error

default

{
  "error": {
    "code": "permission_denied",
    "message": "permission denied"
  }
}

Response 404

Not found

application/json

Schema: Error

default

{
  "error": {
    "code": "not_found",
    "message": "policy not found"
  }
}

Response 409

Conflict

application/json

Schema: Error

default

{
  "error": {
    "code": "conflict",
    "message": "policy name already in use"
  }
}

Response 500

Internal server error

application/json

Schema: Error

default

{
  "error": {
    "code": "internal",
    "message": "internal error"
  }
}

Referenced schemas

#/components/schemas/UpdateRuleRequest

#/components/schemas/UpdateRuleResponse

Complete operation contract
{
  "description": "Partially updates a rule. Only fields present in the request body are\nupdated; absent fields are left unchanged. Returns the rule in both its\nold and new states.\n\nChanging `actions` across domains (for example, from network actions to\nfilesystem actions) is rejected. Changes may take up to five minutes to\nreach developer machines.\n",
  "operationId": "updateRule",
  "requestBody": {
    "content": {
      "application/json": {
        "examples": {
          "default": {
            "value": {
              "resources": [
                "research.mitre.org"
              ]
            }
          }
        },
        "schema": {
          "$ref": "#/components/schemas/UpdateRuleRequest"
        }
      }
    },
    "description": "Fields to update. Absent fields are left unchanged.",
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "examples": {
            "default": {
              "value": {
                "new": {
                  "actions": [
                    "connect:tcp",
                    "connect:udp"
                  ],
                  "decision": "allow",
                  "id": "rule_06evsm9qjm1pdsk0a8nkfaxy7jna",
                  "name": "allow research mirrors",
                  "resources": [
                    "research.mitre.org"
                  ]
                },
                "old": {
                  "actions": [
                    "connect:tcp",
                    "connect:udp"
                  ],
                  "decision": "allow",
                  "id": "rule_06evsm9qjm1pdsk0a8nkfaxy7jna",
                  "name": "allow research mirrors",
                  "resources": [
                    "research.mitre.org",
                    "cve.mitre.org"
                  ]
                }
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/UpdateRuleResponse"
          }
        }
      },
      "description": "Rule updated, returns old and new states."
    },
    "400": {
      "$ref": "#/components/responses/InvalidArgument"
    },
    "401": {
      "$ref": "#/components/responses/Unauthenticated"
    },
    "403": {
      "$ref": "#/components/responses/PermissionDenied"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "409": {
      "$ref": "#/components/responses/Conflict"
    },
    "500": {
      "$ref": "#/components/responses/InternalError"
    }
  },
  "summary": "Update rule",
  "tags": [
    "rules"
  ]
}