1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="compute_beta.html">Compute Engine API</a> . <a href="compute_beta.securityPolicies.html">securityPolicies</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#addRule">addRule(project, securityPolicy, body=None, validateOnly=None, x__xgafv=None)</a></code></p> 79<p class="firstline">Inserts a rule into a security policy.</p> 80<p class="toc_element"> 81 <code><a href="#close">close()</a></code></p> 82<p class="firstline">Close httplib2 connections.</p> 83<p class="toc_element"> 84 <code><a href="#delete">delete(project, securityPolicy, requestId=None, x__xgafv=None)</a></code></p> 85<p class="firstline">Deletes the specified policy.</p> 86<p class="toc_element"> 87 <code><a href="#get">get(project, securityPolicy, x__xgafv=None)</a></code></p> 88<p class="firstline">List all of the ordered rules present in a single specified policy.</p> 89<p class="toc_element"> 90 <code><a href="#getRule">getRule(project, securityPolicy, priority=None, x__xgafv=None)</a></code></p> 91<p class="firstline">Gets a rule at the specified priority.</p> 92<p class="toc_element"> 93 <code><a href="#insert">insert(project, body=None, requestId=None, validateOnly=None, x__xgafv=None)</a></code></p> 94<p class="firstline">Creates a new policy in the specified project using the data included in the request.</p> 95<p class="toc_element"> 96 <code><a href="#list">list(project, filter=None, maxResults=None, orderBy=None, pageToken=None, returnPartialSuccess=None, x__xgafv=None)</a></code></p> 97<p class="firstline">List all the policies that have been configured for the specified project.</p> 98<p class="toc_element"> 99 <code><a href="#listPreconfiguredExpressionSets">listPreconfiguredExpressionSets(project, filter=None, maxResults=None, orderBy=None, pageToken=None, returnPartialSuccess=None, x__xgafv=None)</a></code></p> 100<p class="firstline">Gets the current list of preconfigured Web Application Firewall (WAF) expressions.</p> 101<p class="toc_element"> 102 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 103<p class="firstline">Retrieves the next page of results.</p> 104<p class="toc_element"> 105 <code><a href="#patch">patch(project, securityPolicy, body=None, requestId=None, x__xgafv=None)</a></code></p> 106<p class="firstline">Patches the specified policy with the data included in the request. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead.</p> 107<p class="toc_element"> 108 <code><a href="#patchRule">patchRule(project, securityPolicy, body=None, priority=None, validateOnly=None, x__xgafv=None)</a></code></p> 109<p class="firstline">Patches a rule at the specified priority.</p> 110<p class="toc_element"> 111 <code><a href="#removeRule">removeRule(project, securityPolicy, priority=None, x__xgafv=None)</a></code></p> 112<p class="firstline">Deletes a rule at the specified priority.</p> 113<p class="toc_element"> 114 <code><a href="#setLabels">setLabels(project, resource, body=None, x__xgafv=None)</a></code></p> 115<p class="firstline">Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.</p> 116<p class="toc_element"> 117 <code><a href="#testIamPermissions">testIamPermissions(project, resource, body=None, x__xgafv=None)</a></code></p> 118<p class="firstline">Returns permissions that a caller has on the specified resource.</p> 119<h3>Method Details</h3> 120<div class="method"> 121 <code class="details" id="addRule">addRule(project, securityPolicy, body=None, validateOnly=None, x__xgafv=None)</code> 122 <pre>Inserts a rule into a security policy. 123 124Args: 125 project: string, Project ID for this request. (required) 126 securityPolicy: string, Name of the security policy to update. (required) 127 body: object, The request body. 128 The object takes the form of: 129 130{ # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 131 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 132 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 133 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 134 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 135 "headerAction": { # Optional, additional actions that are performed on headers. 136 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 137 { 138 "headerName": "A String", # The name of the header to set. 139 "headerValue": "A String", # The value to set the named header to. 140 }, 141 ], 142 }, 143 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 144 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 145 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 146 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 147 "A String", 148 ], 149 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 150 { 151 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 152 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 153 "A String", 154 ], 155 }, 156 ], 157 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 158 "A String", 159 ], 160 }, 161 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 162 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 163 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 164 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 165 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 166 }, 167 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 168 }, 169 "preview": True or False, # If set to true, the specified action is not enforced. 170 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 171 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 172 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 173 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 174 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 175 "intervalSec": 42, # Interval over which the threshold is computed. 176 }, 177 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 178 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 179 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 180 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 181 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 182 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 183 "type": "A String", # Type of the redirect action. 184 }, 185 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 186 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 187 "intervalSec": 42, # Interval over which the threshold is computed. 188 }, 189 }, 190 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 191 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 192 "type": "A String", # Type of the redirect action. 193 }, 194 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 195 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 196 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 197 "A String", 198 ], 199 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 200 "A String", 201 ], 202} 203 204 validateOnly: boolean, If true, the request will not be committed. 205 x__xgafv: string, V1 error format. 206 Allowed values 207 1 - v1 error format 208 2 - v2 error format 209 210Returns: 211 An object of the form: 212 213 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 214 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 215 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 216 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 217 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 218 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 219 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 220 { 221 "code": "A String", # [Output Only] The error type identifier for this error. 222 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 223 "message": "A String", # [Output Only] An optional, human-readable error message. 224 }, 225 ], 226 }, 227 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 228 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 229 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 230 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 231 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 232 "name": "A String", # [Output Only] Name of the operation. 233 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 234 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 235 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 236 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 237 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 238 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 239 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 240 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 241 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 242 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 243 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 244 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 245 { 246 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 247 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 248 { 249 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 250 "value": "A String", # [Output Only] A warning data value corresponding to the key. 251 }, 252 ], 253 "message": "A String", # [Output Only] A human-readable description of the warning code. 254 }, 255 ], 256 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 257}</pre> 258</div> 259 260<div class="method"> 261 <code class="details" id="close">close()</code> 262 <pre>Close httplib2 connections.</pre> 263</div> 264 265<div class="method"> 266 <code class="details" id="delete">delete(project, securityPolicy, requestId=None, x__xgafv=None)</code> 267 <pre>Deletes the specified policy. 268 269Args: 270 project: string, Project ID for this request. (required) 271 securityPolicy: string, Name of the security policy to delete. (required) 272 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). 273 x__xgafv: string, V1 error format. 274 Allowed values 275 1 - v1 error format 276 2 - v2 error format 277 278Returns: 279 An object of the form: 280 281 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 282 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 283 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 284 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 285 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 286 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 287 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 288 { 289 "code": "A String", # [Output Only] The error type identifier for this error. 290 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 291 "message": "A String", # [Output Only] An optional, human-readable error message. 292 }, 293 ], 294 }, 295 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 296 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 297 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 298 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 299 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 300 "name": "A String", # [Output Only] Name of the operation. 301 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 302 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 303 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 304 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 305 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 306 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 307 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 308 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 309 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 310 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 311 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 312 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 313 { 314 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 315 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 316 { 317 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 318 "value": "A String", # [Output Only] A warning data value corresponding to the key. 319 }, 320 ], 321 "message": "A String", # [Output Only] A human-readable description of the warning code. 322 }, 323 ], 324 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 325}</pre> 326</div> 327 328<div class="method"> 329 <code class="details" id="get">get(project, securityPolicy, x__xgafv=None)</code> 330 <pre>List all of the ordered rules present in a single specified policy. 331 332Args: 333 project: string, Project ID for this request. (required) 334 securityPolicy: string, Name of the security policy to get. (required) 335 x__xgafv: string, V1 error format. 336 Allowed values 337 1 - v1 error format 338 2 - v2 error format 339 340Returns: 341 An object of the form: 342 343 { # Represents a Google Cloud Armor security policy resource. Only external backend services that use load balancers can reference a security policy. For more information, see Google Cloud Armor security policy overview. 344 "adaptiveProtectionConfig": { # Configuration options for Cloud Armor Adaptive Protection (CAAP). 345 "layer7DdosDefenseConfig": { # Configuration options for L7 DDoS detection. # If set to true, enables Cloud Armor Machine Learning. 346 "enable": True or False, # If set to true, enables CAAP for L7 DDoS detection. 347 "ruleVisibility": "A String", # Rule visibility can be one of the following: STANDARD - opaque rules. (default) PREMIUM - transparent rules. 348 }, 349 }, 350 "advancedOptionsConfig": { 351 "jsonParsing": "A String", 352 "logLevel": "A String", 353 }, 354 "associations": [ # A list of associations that belong to this policy. 355 { 356 "attachmentId": "A String", # The resource that the security policy is attached to. 357 "displayName": "A String", # [Output Only] The display name of the security policy of the association. 358 "name": "A String", # The name for an association. 359 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 360 }, 361 ], 362 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 363 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 364 "displayName": "A String", # User-provided name of the Organization security plicy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is FIREWALL. The name must be 1-63 characters long, and comply with https://www.ietf.org/rfc/rfc1035.txt. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 365 "fingerprint": "A String", # Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. 366 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 367 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 368 "labelFingerprint": "A String", # A fingerprint for the labels being applied to this security policy, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the security policy. 369 "labels": { # Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. 370 "a_key": "A String", 371 }, 372 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 373 "parent": "A String", # [Output Only] The parent of the security policy. 374 "recaptchaOptionsConfig": { 375 "redirectSiteKey": "A String", # An optional field to supply a reCAPTCHA site key to be used for all the rules using the redirect action with the type of GOOGLE_RECAPTCHA under the security policy. The specified site key needs to be created from the reCAPTCHA API. The user is responsible for the validity of the specified site key. If not specified, a Google-managed site key is used. 376 }, 377 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 378 "rules": [ # A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. 379 { # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 380 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 381 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 382 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 383 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 384 "headerAction": { # Optional, additional actions that are performed on headers. 385 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 386 { 387 "headerName": "A String", # The name of the header to set. 388 "headerValue": "A String", # The value to set the named header to. 389 }, 390 ], 391 }, 392 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 393 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 394 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 395 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 396 "A String", 397 ], 398 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 399 { 400 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 401 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 402 "A String", 403 ], 404 }, 405 ], 406 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 407 "A String", 408 ], 409 }, 410 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 411 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 412 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 413 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 414 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 415 }, 416 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 417 }, 418 "preview": True or False, # If set to true, the specified action is not enforced. 419 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 420 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 421 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 422 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 423 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 424 "intervalSec": 42, # Interval over which the threshold is computed. 425 }, 426 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 427 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 428 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 429 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 430 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 431 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 432 "type": "A String", # Type of the redirect action. 433 }, 434 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 435 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 436 "intervalSec": 42, # Interval over which the threshold is computed. 437 }, 438 }, 439 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 440 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 441 "type": "A String", # Type of the redirect action. 442 }, 443 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 444 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 445 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 446 "A String", 447 ], 448 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 449 "A String", 450 ], 451 }, 452 ], 453 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 454 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 455 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR - Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache. 456}</pre> 457</div> 458 459<div class="method"> 460 <code class="details" id="getRule">getRule(project, securityPolicy, priority=None, x__xgafv=None)</code> 461 <pre>Gets a rule at the specified priority. 462 463Args: 464 project: string, Project ID for this request. (required) 465 securityPolicy: string, Name of the security policy to which the queried rule belongs. (required) 466 priority: integer, The priority of the rule to get from the security policy. 467 x__xgafv: string, V1 error format. 468 Allowed values 469 1 - v1 error format 470 2 - v2 error format 471 472Returns: 473 An object of the form: 474 475 { # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 476 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 477 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 478 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 479 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 480 "headerAction": { # Optional, additional actions that are performed on headers. 481 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 482 { 483 "headerName": "A String", # The name of the header to set. 484 "headerValue": "A String", # The value to set the named header to. 485 }, 486 ], 487 }, 488 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 489 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 490 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 491 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 492 "A String", 493 ], 494 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 495 { 496 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 497 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 498 "A String", 499 ], 500 }, 501 ], 502 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 503 "A String", 504 ], 505 }, 506 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 507 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 508 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 509 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 510 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 511 }, 512 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 513 }, 514 "preview": True or False, # If set to true, the specified action is not enforced. 515 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 516 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 517 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 518 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 519 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 520 "intervalSec": 42, # Interval over which the threshold is computed. 521 }, 522 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 523 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 524 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 525 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 526 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 527 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 528 "type": "A String", # Type of the redirect action. 529 }, 530 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 531 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 532 "intervalSec": 42, # Interval over which the threshold is computed. 533 }, 534 }, 535 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 536 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 537 "type": "A String", # Type of the redirect action. 538 }, 539 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 540 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 541 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 542 "A String", 543 ], 544 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 545 "A String", 546 ], 547}</pre> 548</div> 549 550<div class="method"> 551 <code class="details" id="insert">insert(project, body=None, requestId=None, validateOnly=None, x__xgafv=None)</code> 552 <pre>Creates a new policy in the specified project using the data included in the request. 553 554Args: 555 project: string, Project ID for this request. (required) 556 body: object, The request body. 557 The object takes the form of: 558 559{ # Represents a Google Cloud Armor security policy resource. Only external backend services that use load balancers can reference a security policy. For more information, see Google Cloud Armor security policy overview. 560 "adaptiveProtectionConfig": { # Configuration options for Cloud Armor Adaptive Protection (CAAP). 561 "layer7DdosDefenseConfig": { # Configuration options for L7 DDoS detection. # If set to true, enables Cloud Armor Machine Learning. 562 "enable": True or False, # If set to true, enables CAAP for L7 DDoS detection. 563 "ruleVisibility": "A String", # Rule visibility can be one of the following: STANDARD - opaque rules. (default) PREMIUM - transparent rules. 564 }, 565 }, 566 "advancedOptionsConfig": { 567 "jsonParsing": "A String", 568 "logLevel": "A String", 569 }, 570 "associations": [ # A list of associations that belong to this policy. 571 { 572 "attachmentId": "A String", # The resource that the security policy is attached to. 573 "displayName": "A String", # [Output Only] The display name of the security policy of the association. 574 "name": "A String", # The name for an association. 575 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 576 }, 577 ], 578 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 579 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 580 "displayName": "A String", # User-provided name of the Organization security plicy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is FIREWALL. The name must be 1-63 characters long, and comply with https://www.ietf.org/rfc/rfc1035.txt. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 581 "fingerprint": "A String", # Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. 582 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 583 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 584 "labelFingerprint": "A String", # A fingerprint for the labels being applied to this security policy, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the security policy. 585 "labels": { # Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. 586 "a_key": "A String", 587 }, 588 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 589 "parent": "A String", # [Output Only] The parent of the security policy. 590 "recaptchaOptionsConfig": { 591 "redirectSiteKey": "A String", # An optional field to supply a reCAPTCHA site key to be used for all the rules using the redirect action with the type of GOOGLE_RECAPTCHA under the security policy. The specified site key needs to be created from the reCAPTCHA API. The user is responsible for the validity of the specified site key. If not specified, a Google-managed site key is used. 592 }, 593 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 594 "rules": [ # A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. 595 { # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 596 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 597 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 598 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 599 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 600 "headerAction": { # Optional, additional actions that are performed on headers. 601 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 602 { 603 "headerName": "A String", # The name of the header to set. 604 "headerValue": "A String", # The value to set the named header to. 605 }, 606 ], 607 }, 608 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 609 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 610 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 611 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 612 "A String", 613 ], 614 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 615 { 616 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 617 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 618 "A String", 619 ], 620 }, 621 ], 622 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 623 "A String", 624 ], 625 }, 626 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 627 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 628 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 629 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 630 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 631 }, 632 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 633 }, 634 "preview": True or False, # If set to true, the specified action is not enforced. 635 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 636 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 637 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 638 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 639 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 640 "intervalSec": 42, # Interval over which the threshold is computed. 641 }, 642 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 643 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 644 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 645 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 646 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 647 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 648 "type": "A String", # Type of the redirect action. 649 }, 650 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 651 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 652 "intervalSec": 42, # Interval over which the threshold is computed. 653 }, 654 }, 655 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 656 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 657 "type": "A String", # Type of the redirect action. 658 }, 659 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 660 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 661 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 662 "A String", 663 ], 664 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 665 "A String", 666 ], 667 }, 668 ], 669 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 670 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 671 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR - Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache. 672} 673 674 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). 675 validateOnly: boolean, If true, the request will not be committed. 676 x__xgafv: string, V1 error format. 677 Allowed values 678 1 - v1 error format 679 2 - v2 error format 680 681Returns: 682 An object of the form: 683 684 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 685 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 686 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 687 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 688 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 689 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 690 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 691 { 692 "code": "A String", # [Output Only] The error type identifier for this error. 693 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 694 "message": "A String", # [Output Only] An optional, human-readable error message. 695 }, 696 ], 697 }, 698 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 699 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 700 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 701 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 702 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 703 "name": "A String", # [Output Only] Name of the operation. 704 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 705 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 706 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 707 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 708 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 709 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 710 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 711 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 712 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 713 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 714 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 715 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 716 { 717 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 718 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 719 { 720 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 721 "value": "A String", # [Output Only] A warning data value corresponding to the key. 722 }, 723 ], 724 "message": "A String", # [Output Only] A human-readable description of the warning code. 725 }, 726 ], 727 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 728}</pre> 729</div> 730 731<div class="method"> 732 <code class="details" id="list">list(project, filter=None, maxResults=None, orderBy=None, pageToken=None, returnPartialSuccess=None, x__xgafv=None)</code> 733 <pre>List all the policies that have been configured for the specified project. 734 735Args: 736 project: string, Project ID for this request. (required) 737 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` 738 maxResults: integer, The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) 739 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. 740 pageToken: string, Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. 741 returnPartialSuccess: boolean, Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. 742 x__xgafv: string, V1 error format. 743 Allowed values 744 1 - v1 error format 745 2 - v2 error format 746 747Returns: 748 An object of the form: 749 750 { 751 "id": "A String", # [Output Only] Unique identifier for the resource; defined by the server. 752 "items": [ # A list of SecurityPolicy resources. 753 { # Represents a Google Cloud Armor security policy resource. Only external backend services that use load balancers can reference a security policy. For more information, see Google Cloud Armor security policy overview. 754 "adaptiveProtectionConfig": { # Configuration options for Cloud Armor Adaptive Protection (CAAP). 755 "layer7DdosDefenseConfig": { # Configuration options for L7 DDoS detection. # If set to true, enables Cloud Armor Machine Learning. 756 "enable": True or False, # If set to true, enables CAAP for L7 DDoS detection. 757 "ruleVisibility": "A String", # Rule visibility can be one of the following: STANDARD - opaque rules. (default) PREMIUM - transparent rules. 758 }, 759 }, 760 "advancedOptionsConfig": { 761 "jsonParsing": "A String", 762 "logLevel": "A String", 763 }, 764 "associations": [ # A list of associations that belong to this policy. 765 { 766 "attachmentId": "A String", # The resource that the security policy is attached to. 767 "displayName": "A String", # [Output Only] The display name of the security policy of the association. 768 "name": "A String", # The name for an association. 769 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 770 }, 771 ], 772 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 773 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 774 "displayName": "A String", # User-provided name of the Organization security plicy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is FIREWALL. The name must be 1-63 characters long, and comply with https://www.ietf.org/rfc/rfc1035.txt. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 775 "fingerprint": "A String", # Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. 776 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 777 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 778 "labelFingerprint": "A String", # A fingerprint for the labels being applied to this security policy, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the security policy. 779 "labels": { # Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. 780 "a_key": "A String", 781 }, 782 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 783 "parent": "A String", # [Output Only] The parent of the security policy. 784 "recaptchaOptionsConfig": { 785 "redirectSiteKey": "A String", # An optional field to supply a reCAPTCHA site key to be used for all the rules using the redirect action with the type of GOOGLE_RECAPTCHA under the security policy. The specified site key needs to be created from the reCAPTCHA API. The user is responsible for the validity of the specified site key. If not specified, a Google-managed site key is used. 786 }, 787 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 788 "rules": [ # A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. 789 { # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 790 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 791 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 792 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 793 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 794 "headerAction": { # Optional, additional actions that are performed on headers. 795 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 796 { 797 "headerName": "A String", # The name of the header to set. 798 "headerValue": "A String", # The value to set the named header to. 799 }, 800 ], 801 }, 802 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 803 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 804 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 805 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 806 "A String", 807 ], 808 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 809 { 810 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 811 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 812 "A String", 813 ], 814 }, 815 ], 816 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 817 "A String", 818 ], 819 }, 820 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 821 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 822 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 823 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 824 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 825 }, 826 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 827 }, 828 "preview": True or False, # If set to true, the specified action is not enforced. 829 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 830 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 831 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 832 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 833 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 834 "intervalSec": 42, # Interval over which the threshold is computed. 835 }, 836 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 837 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 838 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 839 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 840 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 841 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 842 "type": "A String", # Type of the redirect action. 843 }, 844 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 845 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 846 "intervalSec": 42, # Interval over which the threshold is computed. 847 }, 848 }, 849 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 850 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 851 "type": "A String", # Type of the redirect action. 852 }, 853 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 854 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 855 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 856 "A String", 857 ], 858 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 859 "A String", 860 ], 861 }, 862 ], 863 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 864 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 865 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR - Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache. 866 }, 867 ], 868 "kind": "compute#securityPolicyList", # [Output Only] Type of resource. Always compute#securityPolicyList for listsof securityPolicies 869 "nextPageToken": "A String", # [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. 870 "warning": { # [Output Only] Informational warning message. 871 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 872 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 873 { 874 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 875 "value": "A String", # [Output Only] A warning data value corresponding to the key. 876 }, 877 ], 878 "message": "A String", # [Output Only] A human-readable description of the warning code. 879 }, 880}</pre> 881</div> 882 883<div class="method"> 884 <code class="details" id="listPreconfiguredExpressionSets">listPreconfiguredExpressionSets(project, filter=None, maxResults=None, orderBy=None, pageToken=None, returnPartialSuccess=None, x__xgafv=None)</code> 885 <pre>Gets the current list of preconfigured Web Application Firewall (WAF) expressions. 886 887Args: 888 project: string, Project ID for this request. (required) 889 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` 890 maxResults: integer, The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) 891 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. 892 pageToken: string, Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. 893 returnPartialSuccess: boolean, Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. 894 x__xgafv: string, V1 error format. 895 Allowed values 896 1 - v1 error format 897 2 - v2 error format 898 899Returns: 900 An object of the form: 901 902 { 903 "preconfiguredExpressionSets": { 904 "wafRules": { 905 "expressionSets": [ # List of entities that are currently supported for WAF rules. 906 { 907 "aliases": [ # A list of alternate IDs. The format should be: - E.g. XSS-stable Generic suffix like "stable" is particularly useful if a policy likes to avail newer set of expressions without having to change the policy. A given alias name can't be used for more than one entity set. 908 "A String", 909 ], 910 "expressions": [ # List of available expressions. 911 { 912 "id": "A String", # Expression ID should uniquely identify the origin of the expression. E.g. owasp-crs-v020901-id973337 identifies Owasp core rule set version 2.9.1 rule id 973337. The ID could be used to determine the individual attack definition that has been detected. It could also be used to exclude it from the policy in case of false positive. required 913 }, 914 ], 915 "id": "A String", # Google specified expression set ID. The format should be: - E.g. XSS-20170329 required 916 }, 917 ], 918 }, 919 }, 920}</pre> 921</div> 922 923<div class="method"> 924 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 925 <pre>Retrieves the next page of results. 926 927Args: 928 previous_request: The request for the previous page. (required) 929 previous_response: The response from the request for the previous page. (required) 930 931Returns: 932 A request object that you can call 'execute()' on to request the next 933 page. Returns None if there are no more items in the collection. 934 </pre> 935</div> 936 937<div class="method"> 938 <code class="details" id="patch">patch(project, securityPolicy, body=None, requestId=None, x__xgafv=None)</code> 939 <pre>Patches the specified policy with the data included in the request. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead. 940 941Args: 942 project: string, Project ID for this request. (required) 943 securityPolicy: string, Name of the security policy to update. (required) 944 body: object, The request body. 945 The object takes the form of: 946 947{ # Represents a Google Cloud Armor security policy resource. Only external backend services that use load balancers can reference a security policy. For more information, see Google Cloud Armor security policy overview. 948 "adaptiveProtectionConfig": { # Configuration options for Cloud Armor Adaptive Protection (CAAP). 949 "layer7DdosDefenseConfig": { # Configuration options for L7 DDoS detection. # If set to true, enables Cloud Armor Machine Learning. 950 "enable": True or False, # If set to true, enables CAAP for L7 DDoS detection. 951 "ruleVisibility": "A String", # Rule visibility can be one of the following: STANDARD - opaque rules. (default) PREMIUM - transparent rules. 952 }, 953 }, 954 "advancedOptionsConfig": { 955 "jsonParsing": "A String", 956 "logLevel": "A String", 957 }, 958 "associations": [ # A list of associations that belong to this policy. 959 { 960 "attachmentId": "A String", # The resource that the security policy is attached to. 961 "displayName": "A String", # [Output Only] The display name of the security policy of the association. 962 "name": "A String", # The name for an association. 963 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 964 }, 965 ], 966 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 967 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 968 "displayName": "A String", # User-provided name of the Organization security plicy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is FIREWALL. The name must be 1-63 characters long, and comply with https://www.ietf.org/rfc/rfc1035.txt. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 969 "fingerprint": "A String", # Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. 970 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 971 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 972 "labelFingerprint": "A String", # A fingerprint for the labels being applied to this security policy, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the security policy. 973 "labels": { # Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. 974 "a_key": "A String", 975 }, 976 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 977 "parent": "A String", # [Output Only] The parent of the security policy. 978 "recaptchaOptionsConfig": { 979 "redirectSiteKey": "A String", # An optional field to supply a reCAPTCHA site key to be used for all the rules using the redirect action with the type of GOOGLE_RECAPTCHA under the security policy. The specified site key needs to be created from the reCAPTCHA API. The user is responsible for the validity of the specified site key. If not specified, a Google-managed site key is used. 980 }, 981 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 982 "rules": [ # A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. 983 { # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 984 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 985 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 986 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 987 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 988 "headerAction": { # Optional, additional actions that are performed on headers. 989 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 990 { 991 "headerName": "A String", # The name of the header to set. 992 "headerValue": "A String", # The value to set the named header to. 993 }, 994 ], 995 }, 996 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 997 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 998 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 999 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 1000 "A String", 1001 ], 1002 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 1003 { 1004 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 1005 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 1006 "A String", 1007 ], 1008 }, 1009 ], 1010 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 1011 "A String", 1012 ], 1013 }, 1014 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 1015 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 1016 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 1017 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 1018 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 1019 }, 1020 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 1021 }, 1022 "preview": True or False, # If set to true, the specified action is not enforced. 1023 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 1024 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 1025 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 1026 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 1027 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 1028 "intervalSec": 42, # Interval over which the threshold is computed. 1029 }, 1030 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 1031 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 1032 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 1033 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 1034 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 1035 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 1036 "type": "A String", # Type of the redirect action. 1037 }, 1038 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 1039 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 1040 "intervalSec": 42, # Interval over which the threshold is computed. 1041 }, 1042 }, 1043 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 1044 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 1045 "type": "A String", # Type of the redirect action. 1046 }, 1047 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 1048 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 1049 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 1050 "A String", 1051 ], 1052 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 1053 "A String", 1054 ], 1055 }, 1056 ], 1057 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1058 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1059 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR - Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache. 1060} 1061 1062 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). 1063 x__xgafv: string, V1 error format. 1064 Allowed values 1065 1 - v1 error format 1066 2 - v2 error format 1067 1068Returns: 1069 An object of the form: 1070 1071 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 1072 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1073 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1074 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1075 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1076 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1077 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1078 { 1079 "code": "A String", # [Output Only] The error type identifier for this error. 1080 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1081 "message": "A String", # [Output Only] An optional, human-readable error message. 1082 }, 1083 ], 1084 }, 1085 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 1086 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 1087 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 1088 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1089 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 1090 "name": "A String", # [Output Only] Name of the operation. 1091 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 1092 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 1093 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 1094 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1095 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1096 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1097 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 1098 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1099 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1100 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 1101 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 1102 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1103 { 1104 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 1105 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1106 { 1107 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 1108 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1109 }, 1110 ], 1111 "message": "A String", # [Output Only] A human-readable description of the warning code. 1112 }, 1113 ], 1114 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1115}</pre> 1116</div> 1117 1118<div class="method"> 1119 <code class="details" id="patchRule">patchRule(project, securityPolicy, body=None, priority=None, validateOnly=None, x__xgafv=None)</code> 1120 <pre>Patches a rule at the specified priority. 1121 1122Args: 1123 project: string, Project ID for this request. (required) 1124 securityPolicy: string, Name of the security policy to update. (required) 1125 body: object, The request body. 1126 The object takes the form of: 1127 1128{ # Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). 1129 "action": "A String", # The Action to perform when the rule is matched. The following are the valid actions: - allow: allow access to target. - deny(): deny access to target, returns the HTTP response code specified (valid values are 403, 404, and 502). - rate_based_ban: limit client traffic to the configured threshold and ban the client if the traffic exceeds the threshold. Configure parameters for this action in RateLimitOptions. Requires rate_limit_options to be set. - redirect: redirect to a different target. This can either be an internal reCAPTCHA redirect, or an external URL-based redirect via a 302 response. Parameters for this action can be configured via redirectOptions. - throttle: limit client traffic to the configured threshold. Configure parameters for this action in rateLimitOptions. Requires rate_limit_options to be set for this. 1130 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 1131 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 1132 "enableLogging": True or False, # Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. This field may only be specified when the versioned_expr is set to FIREWALL. 1133 "headerAction": { # Optional, additional actions that are performed on headers. 1134 "requestHeadersToAdds": [ # The list of request headers to add or overwrite if they're already present. 1135 { 1136 "headerName": "A String", # The name of the header to set. 1137 "headerValue": "A String", # The value to set the named header to. 1138 }, 1139 ], 1140 }, 1141 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 1142 "match": { # Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. # A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. 1143 "config": { # The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. 1144 "destIpRanges": [ # CIDR IP address range. This field may only be specified when versioned_expr is set to FIREWALL. 1145 "A String", 1146 ], 1147 "layer4Configs": [ # Pairs of IP protocols and ports that the rule should match. This field may only be specified when versioned_expr is set to FIREWALL. 1148 { 1149 "ipProtocol": "A String", # The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. 1150 "ports": [ # An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. This field may only be specified when versioned_expr is set to FIREWALL. 1151 "A String", 1152 ], 1153 }, 1154 ], 1155 "srcIpRanges": [ # CIDR IP address range. Maximum number of src_ip_ranges allowed is 10. 1156 "A String", 1157 ], 1158 }, 1159 "expr": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. 1160 "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 1161 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 1162 "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 1163 "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. 1164 }, 1165 "versionedExpr": "A String", # Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. 1166 }, 1167 "preview": True or False, # If set to true, the specified action is not enforced. 1168 "priority": 42, # An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. 1169 "rateLimitOptions": { # Must be specified if the action is "rate_based_ban" or "throttle". Cannot be specified for any other actions. 1170 "banDurationSec": 42, # Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold. 1171 "banThreshold": { # Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. 1172 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 1173 "intervalSec": 42, # Interval over which the threshold is computed. 1174 }, 1175 "conformAction": "A String", # Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. 1176 "enforceOnKey": "A String", # Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if this field 'enforce_on_key' is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforce_on_key_name". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. 1177 "enforceOnKeyName": "A String", # Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value. 1178 "exceedAction": "A String", # Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceed_redirect_options below. 1179 "exceedRedirectOptions": { # Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. 1180 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 1181 "type": "A String", # Type of the redirect action. 1182 }, 1183 "rateLimitThreshold": { # Threshold at which to begin ratelimiting. 1184 "count": 42, # Number of HTTP(S) requests for calculating the threshold. 1185 "intervalSec": 42, # Interval over which the threshold is computed. 1186 }, 1187 }, 1188 "redirectOptions": { # Parameters defining the redirect action. Cannot be specified for any other actions. 1189 "target": "A String", # Target for the redirect action. This is required if the type is EXTERNAL_302 and cannot be specified for GOOGLE_RECAPTCHA. 1190 "type": "A String", # Type of the redirect action. 1191 }, 1192 "ruleNumber": "A String", # Identifier for the rule. This is only unique within the given security policy. This can only be set during rule creation, if rule number is not specified it will be generated by the server. 1193 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 1194 "targetResources": [ # A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. This field may only be specified when versioned_expr is set to FIREWALL. 1195 "A String", 1196 ], 1197 "targetServiceAccounts": [ # A list of service accounts indicating the sets of instances that are applied with this rule. 1198 "A String", 1199 ], 1200} 1201 1202 priority: integer, The priority of the rule to patch. 1203 validateOnly: boolean, If true, the request will not be committed. 1204 x__xgafv: string, V1 error format. 1205 Allowed values 1206 1 - v1 error format 1207 2 - v2 error format 1208 1209Returns: 1210 An object of the form: 1211 1212 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 1213 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1214 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1215 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1216 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1217 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1218 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1219 { 1220 "code": "A String", # [Output Only] The error type identifier for this error. 1221 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1222 "message": "A String", # [Output Only] An optional, human-readable error message. 1223 }, 1224 ], 1225 }, 1226 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 1227 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 1228 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 1229 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1230 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 1231 "name": "A String", # [Output Only] Name of the operation. 1232 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 1233 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 1234 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 1235 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1236 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1237 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1238 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 1239 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1240 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1241 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 1242 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 1243 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1244 { 1245 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 1246 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1247 { 1248 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 1249 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1250 }, 1251 ], 1252 "message": "A String", # [Output Only] A human-readable description of the warning code. 1253 }, 1254 ], 1255 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1256}</pre> 1257</div> 1258 1259<div class="method"> 1260 <code class="details" id="removeRule">removeRule(project, securityPolicy, priority=None, x__xgafv=None)</code> 1261 <pre>Deletes a rule at the specified priority. 1262 1263Args: 1264 project: string, Project ID for this request. (required) 1265 securityPolicy: string, Name of the security policy to update. (required) 1266 priority: integer, The priority of the rule to remove from the security policy. 1267 x__xgafv: string, V1 error format. 1268 Allowed values 1269 1 - v1 error format 1270 2 - v2 error format 1271 1272Returns: 1273 An object of the form: 1274 1275 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 1276 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1277 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1278 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1279 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1280 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1281 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1282 { 1283 "code": "A String", # [Output Only] The error type identifier for this error. 1284 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1285 "message": "A String", # [Output Only] An optional, human-readable error message. 1286 }, 1287 ], 1288 }, 1289 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 1290 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 1291 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 1292 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1293 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 1294 "name": "A String", # [Output Only] Name of the operation. 1295 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 1296 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 1297 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 1298 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1299 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1300 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1301 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 1302 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1303 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1304 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 1305 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 1306 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1307 { 1308 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 1309 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1310 { 1311 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 1312 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1313 }, 1314 ], 1315 "message": "A String", # [Output Only] A human-readable description of the warning code. 1316 }, 1317 ], 1318 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1319}</pre> 1320</div> 1321 1322<div class="method"> 1323 <code class="details" id="setLabels">setLabels(project, resource, body=None, x__xgafv=None)</code> 1324 <pre>Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation. 1325 1326Args: 1327 project: string, Project ID for this request. (required) 1328 resource: string, Name or id of the resource for this request. (required) 1329 body: object, The request body. 1330 The object takes the form of: 1331 1332{ 1333 "labelFingerprint": "A String", # The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels, otherwise the request will fail with error 412 conditionNotMet. Make a get() request to the resource to get the latest fingerprint. 1334 "labels": { # A list of labels to apply for this resource. Each label key & value must comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. For example, "webserver-frontend": "images". A label value can also be empty (e.g. "my-label": ""). 1335 "a_key": "A String", 1336 }, 1337} 1338 1339 x__xgafv: string, V1 error format. 1340 Allowed values 1341 1 - v1 error format 1342 2 - v2 error format 1343 1344Returns: 1345 An object of the form: 1346 1347 { # Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/beta/globalOperations) * [Regional](/compute/docs/reference/rest/beta/regionOperations) * [Zonal](/compute/docs/reference/rest/beta/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zonalOperations` resource. For more information, read Global, Regional, and Zonal Resources. 1348 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1349 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1350 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1351 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1352 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1353 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1354 { 1355 "code": "A String", # [Output Only] The error type identifier for this error. 1356 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1357 "message": "A String", # [Output Only] An optional, human-readable error message. 1358 }, 1359 ], 1360 }, 1361 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. 1362 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. 1363 "id": "A String", # [Output Only] The unique identifier for the operation. This identifier is defined by the server. 1364 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1365 "kind": "compute#operation", # [Output Only] Type of the resource. Always `compute#operation` for Operation resources. 1366 "name": "A String", # [Output Only] Name of the operation. 1367 "operationGroupId": "A String", # [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. 1368 "operationType": "A String", # [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. 1369 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 1370 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1371 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1372 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1373 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. 1374 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1375 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1376 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 1377 "user": "A String", # [Output Only] User who requested the operation, for example: `[email protected]`. 1378 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1379 { 1380 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 1381 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1382 { 1383 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 1384 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1385 }, 1386 ], 1387 "message": "A String", # [Output Only] A human-readable description of the warning code. 1388 }, 1389 ], 1390 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1391}</pre> 1392</div> 1393 1394<div class="method"> 1395 <code class="details" id="testIamPermissions">testIamPermissions(project, resource, body=None, x__xgafv=None)</code> 1396 <pre>Returns permissions that a caller has on the specified resource. 1397 1398Args: 1399 project: string, Project ID for this request. (required) 1400 resource: string, Name or id of the resource for this request. (required) 1401 body: object, The request body. 1402 The object takes the form of: 1403 1404{ 1405 "permissions": [ # The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. 1406 "A String", 1407 ], 1408} 1409 1410 x__xgafv: string, V1 error format. 1411 Allowed values 1412 1 - v1 error format 1413 2 - v2 error format 1414 1415Returns: 1416 An object of the form: 1417 1418 { 1419 "permissions": [ # A subset of `TestPermissionsRequest.permissions` that the caller is allowed. 1420 "A String", 1421 ], 1422}</pre> 1423</div> 1424 1425</body></html>