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_alpha.html">Compute Engine API</a> . <a href="compute_alpha.securityPolicies.html">securityPolicies</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#addRule">addRule(project, securityPolicy, body, validateOnly=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="#delete">delete(project, securityPolicy, requestId=None)</a></code></p> 82<p class="firstline">Deletes the specified policy.</p> 83<p class="toc_element"> 84 <code><a href="#get">get(project, securityPolicy)</a></code></p> 85<p class="firstline">List all of the ordered rules present in a single specified policy.</p> 86<p class="toc_element"> 87 <code><a href="#getRule">getRule(project, securityPolicy, priority=None)</a></code></p> 88<p class="firstline">Gets a rule at the specified priority.</p> 89<p class="toc_element"> 90 <code><a href="#insert">insert(project, body, requestId=None, validateOnly=None)</a></code></p> 91<p class="firstline">Creates a new policy in the specified project using the data included in the request.</p> 92<p class="toc_element"> 93 <code><a href="#list">list(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</a></code></p> 94<p class="firstline">List all the policies that have been configured for the specified project.</p> 95<p class="toc_element"> 96 <code><a href="#listPreconfiguredExpressionSets">listPreconfiguredExpressionSets(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</a></code></p> 97<p class="firstline">Gets the current list of preconfigured Web Application Firewall (WAF) expressions.</p> 98<p class="toc_element"> 99 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 100<p class="firstline">Retrieves the next page of results.</p> 101<p class="toc_element"> 102 <code><a href="#patch">patch(project, securityPolicy, body, requestId=None)</a></code></p> 103<p class="firstline">Patches the specified policy with the data included in the request.</p> 104<p class="toc_element"> 105 <code><a href="#patchRule">patchRule(project, securityPolicy, body, validateOnly=None, priority=None)</a></code></p> 106<p class="firstline">Patches a rule at the specified priority.</p> 107<p class="toc_element"> 108 <code><a href="#removeRule">removeRule(project, securityPolicy, priority=None)</a></code></p> 109<p class="firstline">Deletes a rule at the specified priority.</p> 110<p class="toc_element"> 111 <code><a href="#setLabels">setLabels(project, resource, body)</a></code></p> 112<p class="firstline">Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.</p> 113<p class="toc_element"> 114 <code><a href="#testIamPermissions">testIamPermissions(project, resource, body)</a></code></p> 115<p class="firstline">Returns permissions that a caller has on the specified resource.</p> 116<h3>Method Details</h3> 117<div class="method"> 118 <code class="details" id="addRule">addRule(project, securityPolicy, body, validateOnly=None)</code> 119 <pre>Inserts a rule into a security policy. 120 121Args: 122 project: string, Project ID for this request. (required) 123 securityPolicy: string, Name of the security policy to update. (required) 124 body: object, The request body. (required) 125 The object takes the form of: 126 127{ # 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). 128 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 129 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 130 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 131 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 132 "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. 133 # 134 # This field may only be specified when the versioned_expr is set to FIREWALL. 135 "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 prority. 136 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 137 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 138 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 139 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 140 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 141 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 142 }, 143 "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. 144 # 145 # This field may only be specified when versioned_expr is set to FIREWALL. 146 "A String", 147 ], 148 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 149 "preview": True or False, # If set to true, the specified action is not enforced. 150 "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. 151 "expr": { # Represents an expression text. Example: # 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. 152 # 153 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 154 "title": "A String", # An 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. 155 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 156 # 157 # The application context of the containing message determines which well-known feature set of CEL is supported. 158 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 159 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 160 }, 161 "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. 162 "srcIpRanges": [ # CIDR IP address range. 163 "A String", 164 ], 165 "destIpRanges": [ # CIDR IP address range. 166 # 167 # This field may only be specified when versioned_expr is set to FIREWALL. 168 "A String", 169 ], 170 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 171 # 172 # This field may only be specified when versioned_expr is set to FIREWALL. 173 { 174 "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. 175 "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. 176 # 177 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 178 # 179 # This field may only be specified when versioned_expr is set to FIREWALL. 180 "A String", 181 ], 182 }, 183 ], 184 }, 185 "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. 186 }, 187} 188 189 validateOnly: boolean, If true, the request will not be committed. 190 191Returns: 192 An object of the form: 193 194 { # Represents an Operation resource. 195 # 196 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 197 # 198 # Operations can be global, regional or zonal. 199 # - For global operations, use the globalOperations resource. 200 # - For regional operations, use the regionOperations resource. 201 # - For zonal operations, use the zonalOperations resource. 202 # 203 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 204 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 205 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 206 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 207 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 208 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 209 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 210 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 211 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 212 "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. 213 "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. 214 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 215 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 216 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 217 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 218 { 219 "message": "A String", # [Output Only] A human-readable description of the warning code. 220 "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. 221 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 222 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 223 { 224 "value": "A String", # [Output Only] A warning data value corresponding to the key. 225 "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). 226 }, 227 ], 228 }, 229 ], 230 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 231 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 232 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 233 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 234 "name": "A String", # [Output Only] Name of the resource. 235 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 236 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 237 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 238 { 239 "message": "A String", # [Output Only] An optional, human-readable error message. 240 "code": "A String", # [Output Only] The error type identifier for this error. 241 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 242 }, 243 ], 244 }, 245 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 246 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 247 "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. 248 }</pre> 249</div> 250 251<div class="method"> 252 <code class="details" id="delete">delete(project, securityPolicy, requestId=None)</code> 253 <pre>Deletes the specified policy. 254 255Args: 256 project: string, Project ID for this request. (required) 257 securityPolicy: string, Name of the security policy to delete. (required) 258 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. 259 260For 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. 261 262The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 263 264Returns: 265 An object of the form: 266 267 { # Represents an Operation resource. 268 # 269 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 270 # 271 # Operations can be global, regional or zonal. 272 # - For global operations, use the globalOperations resource. 273 # - For regional operations, use the regionOperations resource. 274 # - For zonal operations, use the zonalOperations resource. 275 # 276 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 277 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 278 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 279 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 280 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 281 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 282 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 283 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 284 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 285 "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. 286 "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. 287 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 288 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 289 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 290 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 291 { 292 "message": "A String", # [Output Only] A human-readable description of the warning code. 293 "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. 294 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 295 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 296 { 297 "value": "A String", # [Output Only] A warning data value corresponding to the key. 298 "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). 299 }, 300 ], 301 }, 302 ], 303 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 304 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 305 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 306 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 307 "name": "A String", # [Output Only] Name of the resource. 308 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 309 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 310 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 311 { 312 "message": "A String", # [Output Only] An optional, human-readable error message. 313 "code": "A String", # [Output Only] The error type identifier for this error. 314 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 315 }, 316 ], 317 }, 318 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 319 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 320 "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. 321 }</pre> 322</div> 323 324<div class="method"> 325 <code class="details" id="get">get(project, securityPolicy)</code> 326 <pre>List all of the ordered rules present in a single specified policy. 327 328Args: 329 project: string, Project ID for this request. (required) 330 securityPolicy: string, Name of the security policy to get. (required) 331 332Returns: 333 An object of the form: 334 335 { # A security policy is comprised of one or more rules. It can also be associated with one or more 'targets'. (== resource_for v1.securityPolicies ==) (== resource_for beta.securityPolicies ==) 336 "associations": [ # A list of assocations that belong to this policy. 337 { 338 "attachmentId": "A String", # The resource that the security policy is attached to. 339 "name": "A String", # The name for an association. 340 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 341 }, 342 ], 343 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 344 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 345 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 346 "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. 347 { # 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). 348 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 349 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 350 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 351 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 352 "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. 353 # 354 # This field may only be specified when the versioned_expr is set to FIREWALL. 355 "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 prority. 356 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 357 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 358 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 359 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 360 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 361 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 362 }, 363 "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. 364 # 365 # This field may only be specified when versioned_expr is set to FIREWALL. 366 "A String", 367 ], 368 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 369 "preview": True or False, # If set to true, the specified action is not enforced. 370 "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. 371 "expr": { # Represents an expression text. Example: # 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. 372 # 373 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 374 "title": "A String", # An 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. 375 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 376 # 377 # The application context of the containing message determines which well-known feature set of CEL is supported. 378 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 379 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 380 }, 381 "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. 382 "srcIpRanges": [ # CIDR IP address range. 383 "A String", 384 ], 385 "destIpRanges": [ # CIDR IP address range. 386 # 387 # This field may only be specified when versioned_expr is set to FIREWALL. 388 "A String", 389 ], 390 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 391 # 392 # This field may only be specified when versioned_expr is set to FIREWALL. 393 { 394 "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. 395 "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. 396 # 397 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 398 # 399 # This field may only be specified when versioned_expr is set to FIREWALL. 400 "A String", 401 ], 402 }, 403 ], 404 }, 405 "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. 406 }, 407 }, 408 ], 409 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR policies apply to backend services. FIREWALL policies apply to organizations. 410 "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. 411 # 412 # To see the latest fingerprint, make get() request to the security policy. 413 "labels": { # Labels to apply to this security policy resource. These can be later modified by the setLabels method. Each label key/value must comply with RFC1035. Label values may be empty. 414 "a_key": "A String", 415 }, 416 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 417 "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. 418 # 419 # To see the latest fingerprint, make get() request to the security policy. 420 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 421 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 422 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 423 "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. 424 }</pre> 425</div> 426 427<div class="method"> 428 <code class="details" id="getRule">getRule(project, securityPolicy, priority=None)</code> 429 <pre>Gets a rule at the specified priority. 430 431Args: 432 project: string, Project ID for this request. (required) 433 securityPolicy: string, Name of the security policy to which the queried rule belongs. (required) 434 priority: integer, The priority of the rule to get from the security policy. 435 436Returns: 437 An object of the form: 438 439 { # 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). 440 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 441 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 442 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 443 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 444 "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. 445 # 446 # This field may only be specified when the versioned_expr is set to FIREWALL. 447 "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 prority. 448 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 449 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 450 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 451 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 452 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 453 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 454 }, 455 "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. 456 # 457 # This field may only be specified when versioned_expr is set to FIREWALL. 458 "A String", 459 ], 460 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 461 "preview": True or False, # If set to true, the specified action is not enforced. 462 "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. 463 "expr": { # Represents an expression text. Example: # 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. 464 # 465 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 466 "title": "A String", # An 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. 467 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 468 # 469 # The application context of the containing message determines which well-known feature set of CEL is supported. 470 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 471 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 472 }, 473 "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. 474 "srcIpRanges": [ # CIDR IP address range. 475 "A String", 476 ], 477 "destIpRanges": [ # CIDR IP address range. 478 # 479 # This field may only be specified when versioned_expr is set to FIREWALL. 480 "A String", 481 ], 482 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 483 # 484 # This field may only be specified when versioned_expr is set to FIREWALL. 485 { 486 "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. 487 "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. 488 # 489 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 490 # 491 # This field may only be specified when versioned_expr is set to FIREWALL. 492 "A String", 493 ], 494 }, 495 ], 496 }, 497 "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. 498 }, 499 }</pre> 500</div> 501 502<div class="method"> 503 <code class="details" id="insert">insert(project, body, requestId=None, validateOnly=None)</code> 504 <pre>Creates a new policy in the specified project using the data included in the request. 505 506Args: 507 project: string, Project ID for this request. (required) 508 body: object, The request body. (required) 509 The object takes the form of: 510 511{ # A security policy is comprised of one or more rules. It can also be associated with one or more 'targets'. (== resource_for v1.securityPolicies ==) (== resource_for beta.securityPolicies ==) 512 "associations": [ # A list of assocations that belong to this policy. 513 { 514 "attachmentId": "A String", # The resource that the security policy is attached to. 515 "name": "A String", # The name for an association. 516 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 517 }, 518 ], 519 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 520 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 521 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 522 "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. 523 { # 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). 524 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 525 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 526 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 527 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 528 "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. 529 # 530 # This field may only be specified when the versioned_expr is set to FIREWALL. 531 "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 prority. 532 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 533 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 534 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 535 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 536 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 537 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 538 }, 539 "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. 540 # 541 # This field may only be specified when versioned_expr is set to FIREWALL. 542 "A String", 543 ], 544 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 545 "preview": True or False, # If set to true, the specified action is not enforced. 546 "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. 547 "expr": { # Represents an expression text. Example: # 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. 548 # 549 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 550 "title": "A String", # An 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. 551 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 552 # 553 # The application context of the containing message determines which well-known feature set of CEL is supported. 554 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 555 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 556 }, 557 "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. 558 "srcIpRanges": [ # CIDR IP address range. 559 "A String", 560 ], 561 "destIpRanges": [ # CIDR IP address range. 562 # 563 # This field may only be specified when versioned_expr is set to FIREWALL. 564 "A String", 565 ], 566 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 567 # 568 # This field may only be specified when versioned_expr is set to FIREWALL. 569 { 570 "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. 571 "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. 572 # 573 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 574 # 575 # This field may only be specified when versioned_expr is set to FIREWALL. 576 "A String", 577 ], 578 }, 579 ], 580 }, 581 "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. 582 }, 583 }, 584 ], 585 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR policies apply to backend services. FIREWALL policies apply to organizations. 586 "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. 587 # 588 # To see the latest fingerprint, make get() request to the security policy. 589 "labels": { # Labels to apply to this security policy resource. These can be later modified by the setLabels method. Each label key/value must comply with RFC1035. Label values may be empty. 590 "a_key": "A String", 591 }, 592 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 593 "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. 594 # 595 # To see the latest fingerprint, make get() request to the security policy. 596 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 597 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 598 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 599 "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. 600} 601 602 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. 603 604For 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. 605 606The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 607 validateOnly: boolean, If true, the request will not be committed. 608 609Returns: 610 An object of the form: 611 612 { # Represents an Operation resource. 613 # 614 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 615 # 616 # Operations can be global, regional or zonal. 617 # - For global operations, use the globalOperations resource. 618 # - For regional operations, use the regionOperations resource. 619 # - For zonal operations, use the zonalOperations resource. 620 # 621 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 622 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 623 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 624 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 625 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 626 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 627 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 628 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 629 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 630 "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. 631 "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. 632 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 633 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 634 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 635 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 636 { 637 "message": "A String", # [Output Only] A human-readable description of the warning code. 638 "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. 639 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 640 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 641 { 642 "value": "A String", # [Output Only] A warning data value corresponding to the key. 643 "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). 644 }, 645 ], 646 }, 647 ], 648 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 649 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 650 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 651 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 652 "name": "A String", # [Output Only] Name of the resource. 653 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 654 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 655 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 656 { 657 "message": "A String", # [Output Only] An optional, human-readable error message. 658 "code": "A String", # [Output Only] The error type identifier for this error. 659 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 660 }, 661 ], 662 }, 663 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 664 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 665 "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. 666 }</pre> 667</div> 668 669<div class="method"> 670 <code class="details" id="list">list(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</code> 671 <pre>List all the policies that have been configured for the specified project. 672 673Args: 674 project: string, Project ID for this request. (required) 675 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. 676 677You 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. 678 679Currently, only sorting by name or creationTimestamp desc is supported. 680 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) 681 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. 682 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. 683 684For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. 685 686You 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. 687 688To 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). 689 690Returns: 691 An object of the form: 692 693 { 694 "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. 695 "items": [ # A list of SecurityPolicy resources. 696 { # A security policy is comprised of one or more rules. It can also be associated with one or more 'targets'. (== resource_for v1.securityPolicies ==) (== resource_for beta.securityPolicies ==) 697 "associations": [ # A list of assocations that belong to this policy. 698 { 699 "attachmentId": "A String", # The resource that the security policy is attached to. 700 "name": "A String", # The name for an association. 701 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 702 }, 703 ], 704 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 705 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 706 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 707 "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. 708 { # 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). 709 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 710 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 711 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 712 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 713 "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. 714 # 715 # This field may only be specified when the versioned_expr is set to FIREWALL. 716 "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 prority. 717 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 718 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 719 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 720 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 721 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 722 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 723 }, 724 "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. 725 # 726 # This field may only be specified when versioned_expr is set to FIREWALL. 727 "A String", 728 ], 729 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 730 "preview": True or False, # If set to true, the specified action is not enforced. 731 "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. 732 "expr": { # Represents an expression text. Example: # 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. 733 # 734 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 735 "title": "A String", # An 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. 736 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 737 # 738 # The application context of the containing message determines which well-known feature set of CEL is supported. 739 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 740 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 741 }, 742 "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. 743 "srcIpRanges": [ # CIDR IP address range. 744 "A String", 745 ], 746 "destIpRanges": [ # CIDR IP address range. 747 # 748 # This field may only be specified when versioned_expr is set to FIREWALL. 749 "A String", 750 ], 751 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 752 # 753 # This field may only be specified when versioned_expr is set to FIREWALL. 754 { 755 "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. 756 "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. 757 # 758 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 759 # 760 # This field may only be specified when versioned_expr is set to FIREWALL. 761 "A String", 762 ], 763 }, 764 ], 765 }, 766 "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. 767 }, 768 }, 769 ], 770 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR policies apply to backend services. FIREWALL policies apply to organizations. 771 "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. 772 # 773 # To see the latest fingerprint, make get() request to the security policy. 774 "labels": { # Labels to apply to this security policy resource. These can be later modified by the setLabels method. Each label key/value must comply with RFC1035. Label values may be empty. 775 "a_key": "A String", 776 }, 777 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 778 "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. 779 # 780 # To see the latest fingerprint, make get() request to the security policy. 781 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 782 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 783 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 784 "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. 785 }, 786 ], 787 "kind": "compute#securityPolicyList", # [Output Only] Type of resource. Always compute#securityPolicyList for listsof securityPolicies 788 "warning": { # [Output Only] Informational warning message. 789 "message": "A String", # [Output Only] A human-readable description of the warning code. 790 "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. 791 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 792 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 793 { 794 "value": "A String", # [Output Only] A warning data value corresponding to the key. 795 "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). 796 }, 797 ], 798 }, 799 "id": "A String", # [Output Only] Unique identifier for the resource; defined by the server. 800 }</pre> 801</div> 802 803<div class="method"> 804 <code class="details" id="listPreconfiguredExpressionSets">listPreconfiguredExpressionSets(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</code> 805 <pre>Gets the current list of preconfigured Web Application Firewall (WAF) expressions. 806 807Args: 808 project: string, Project ID for this request. (required) 809 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. 810 811You 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. 812 813Currently, only sorting by name or creationTimestamp desc is supported. 814 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) 815 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. 816 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. 817 818For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. 819 820You 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. 821 822To 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). 823 824Returns: 825 An object of the form: 826 827 { 828 "preconfiguredExpressionSets": { 829 "wafRules": { 830 "expressionSets": [ # List of entities that are currently supported for WAF rules. 831 { 832 "expressions": [ # List of available expressions. 833 { 834 "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. 835 }, 836 ], 837 "id": "A String", # Google specified expression set ID. The format should be: - E.g. XSS-20170329 838 "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. 839 "A String", 840 ], 841 }, 842 ], 843 }, 844 }, 845 }</pre> 846</div> 847 848<div class="method"> 849 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 850 <pre>Retrieves the next page of results. 851 852Args: 853 previous_request: The request for the previous page. (required) 854 previous_response: The response from the request for the previous page. (required) 855 856Returns: 857 A request object that you can call 'execute()' on to request the next 858 page. Returns None if there are no more items in the collection. 859 </pre> 860</div> 861 862<div class="method"> 863 <code class="details" id="patch">patch(project, securityPolicy, body, requestId=None)</code> 864 <pre>Patches the specified policy with the data included in the request. 865 866Args: 867 project: string, Project ID for this request. (required) 868 securityPolicy: string, Name of the security policy to update. (required) 869 body: object, The request body. (required) 870 The object takes the form of: 871 872{ # A security policy is comprised of one or more rules. It can also be associated with one or more 'targets'. (== resource_for v1.securityPolicies ==) (== resource_for beta.securityPolicies ==) 873 "associations": [ # A list of assocations that belong to this policy. 874 { 875 "attachmentId": "A String", # The resource that the security policy is attached to. 876 "name": "A String", # The name for an association. 877 "securityPolicyId": "A String", # [Output Only] The security policy ID of the association. 878 }, 879 ], 880 "kind": "compute#securityPolicy", # [Output only] Type of the resource. Always compute#securityPolicyfor security policies 881 "ruleTupleCount": 42, # [Output Only] Total count of all security policy rule tuples. A security policy can not exceed a set number of tuples. 882 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 883 "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. 884 { # 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). 885 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 886 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 887 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 888 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 889 "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. 890 # 891 # This field may only be specified when the versioned_expr is set to FIREWALL. 892 "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 prority. 893 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 894 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 895 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 896 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 897 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 898 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 899 }, 900 "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. 901 # 902 # This field may only be specified when versioned_expr is set to FIREWALL. 903 "A String", 904 ], 905 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 906 "preview": True or False, # If set to true, the specified action is not enforced. 907 "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. 908 "expr": { # Represents an expression text. Example: # 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. 909 # 910 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 911 "title": "A String", # An 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. 912 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 913 # 914 # The application context of the containing message determines which well-known feature set of CEL is supported. 915 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 916 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 917 }, 918 "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. 919 "srcIpRanges": [ # CIDR IP address range. 920 "A String", 921 ], 922 "destIpRanges": [ # CIDR IP address range. 923 # 924 # This field may only be specified when versioned_expr is set to FIREWALL. 925 "A String", 926 ], 927 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 928 # 929 # This field may only be specified when versioned_expr is set to FIREWALL. 930 { 931 "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. 932 "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. 933 # 934 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 935 # 936 # This field may only be specified when versioned_expr is set to FIREWALL. 937 "A String", 938 ], 939 }, 940 ], 941 }, 942 "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. 943 }, 944 }, 945 ], 946 "type": "A String", # The type indicates the intended use of the security policy. CLOUD_ARMOR policies apply to backend services. FIREWALL policies apply to organizations. 947 "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. 948 # 949 # To see the latest fingerprint, make get() request to the security policy. 950 "labels": { # Labels to apply to this security policy resource. These can be later modified by the setLabels method. Each label key/value must comply with RFC1035. Label values may be empty. 951 "a_key": "A String", 952 }, 953 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 954 "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. 955 # 956 # To see the latest fingerprint, make get() request to the security policy. 957 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 958 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 959 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 960 "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. 961} 962 963 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. 964 965For 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. 966 967The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 968 969Returns: 970 An object of the form: 971 972 { # Represents an Operation resource. 973 # 974 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 975 # 976 # Operations can be global, regional or zonal. 977 # - For global operations, use the globalOperations resource. 978 # - For regional operations, use the regionOperations resource. 979 # - For zonal operations, use the zonalOperations resource. 980 # 981 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 982 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 983 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 984 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 985 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 986 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 987 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 988 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 989 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 990 "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. 991 "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. 992 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 993 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 994 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 995 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 996 { 997 "message": "A String", # [Output Only] A human-readable description of the warning code. 998 "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. 999 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 1000 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1001 { 1002 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1003 "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). 1004 }, 1005 ], 1006 }, 1007 ], 1008 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1009 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 1010 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1011 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 1012 "name": "A String", # [Output Only] Name of the resource. 1013 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1014 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1015 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1016 { 1017 "message": "A String", # [Output Only] An optional, human-readable error message. 1018 "code": "A String", # [Output Only] The error type identifier for this error. 1019 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1020 }, 1021 ], 1022 }, 1023 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1024 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1025 "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. 1026 }</pre> 1027</div> 1028 1029<div class="method"> 1030 <code class="details" id="patchRule">patchRule(project, securityPolicy, body, validateOnly=None, priority=None)</code> 1031 <pre>Patches a rule at the specified priority. 1032 1033Args: 1034 project: string, Project ID for this request. (required) 1035 securityPolicy: string, Name of the security policy to update. (required) 1036 body: object, The request body. (required) 1037 The object takes the form of: 1038 1039{ # 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). 1040 "direction": "A String", # The direction in which this rule applies. This field may only be specified when versioned_expr is set to FIREWALL. 1041 "ruleTupleCount": 42, # [Output Only] Calculation of the complexity of a single firewall security policy rule. 1042 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 1043 "kind": "compute#securityPolicyRule", # [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules 1044 "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. 1045 # 1046 # This field may only be specified when the versioned_expr is set to FIREWALL. 1047 "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 prority. 1048 "rateLimitOptions": { # Must be specified if the action is "rate_based_blacklist" or "throttle". Cannot be specified for any other actions. 1049 "enforceOnKey": "A String", # Determines the key to enforce the threshold_rps limit on. If key is "IP", each IP has this limit enforced separately, whereas "ALL_IPs" means a single limit is applied to all requests matching this rule. 1050 "thresholdRps": 42, # Rate in requests per second at which to begin ratelimiting. 1051 "conformAction": "A String", # Action to take when requests are under the given threshold. When requests are throttled, this is also the action for all requests which are not dropped. Valid options are "allow", "fairshare", and "drop_overload". 1052 "blockDuration": 42, # Can only be specifed if the action for the rule is "rate_based_blacklist" If specified, determines the time (in seconds) the traffic will continue to be blocked by the rate limit after the rate falls below the threshold. The default value is 0 seconds. 1053 "exceedAction": "A String", # When a request is denied, returns the HTTP response code specified. Valid options are "deny()" where valid values for status are 403, 404, 429, and 502. 1054 }, 1055 "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. 1056 # 1057 # This field may only be specified when versioned_expr is set to FIREWALL. 1058 "A String", 1059 ], 1060 "action": "A String", # The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502. 1061 "preview": True or False, # If set to true, the specified action is not enforced. 1062 "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. 1063 "expr": { # Represents an expression text. Example: # 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. 1064 # 1065 # title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" 1066 "title": "A String", # An 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. 1067 "expression": "A String", # Textual representation of an expression in Common Expression Language syntax. 1068 # 1069 # The application context of the containing message determines which well-known feature set of CEL is supported. 1070 "description": "A String", # An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. 1071 "location": "A String", # An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. 1072 }, 1073 "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. 1074 "srcIpRanges": [ # CIDR IP address range. 1075 "A String", 1076 ], 1077 "destIpRanges": [ # CIDR IP address range. 1078 # 1079 # This field may only be specified when versioned_expr is set to FIREWALL. 1080 "A String", 1081 ], 1082 "destPorts": [ # Pairs of IP protocols and ports that the rule should match. 1083 # 1084 # This field may only be specified when versioned_expr is set to FIREWALL. 1085 { 1086 "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. 1087 "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. 1088 # 1089 # Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. 1090 # 1091 # This field may only be specified when versioned_expr is set to FIREWALL. 1092 "A String", 1093 ], 1094 }, 1095 ], 1096 }, 1097 "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. 1098 }, 1099} 1100 1101 validateOnly: boolean, If true, the request will not be committed. 1102 priority: integer, The priority of the rule to patch. 1103 1104Returns: 1105 An object of the form: 1106 1107 { # Represents an Operation resource. 1108 # 1109 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 1110 # 1111 # Operations can be global, regional or zonal. 1112 # - For global operations, use the globalOperations resource. 1113 # - For regional operations, use the regionOperations resource. 1114 # - For zonal operations, use the zonalOperations resource. 1115 # 1116 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 1117 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1118 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1119 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1120 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 1121 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1122 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1123 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 1124 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 1125 "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. 1126 "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. 1127 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1128 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 1129 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1130 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1131 { 1132 "message": "A String", # [Output Only] A human-readable description of the warning code. 1133 "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. 1134 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 1135 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1136 { 1137 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1138 "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). 1139 }, 1140 ], 1141 }, 1142 ], 1143 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1144 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 1145 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1146 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 1147 "name": "A String", # [Output Only] Name of the resource. 1148 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1149 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1150 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1151 { 1152 "message": "A String", # [Output Only] An optional, human-readable error message. 1153 "code": "A String", # [Output Only] The error type identifier for this error. 1154 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1155 }, 1156 ], 1157 }, 1158 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1159 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1160 "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. 1161 }</pre> 1162</div> 1163 1164<div class="method"> 1165 <code class="details" id="removeRule">removeRule(project, securityPolicy, priority=None)</code> 1166 <pre>Deletes a rule at the specified priority. 1167 1168Args: 1169 project: string, Project ID for this request. (required) 1170 securityPolicy: string, Name of the security policy to update. (required) 1171 priority: integer, The priority of the rule to remove from the security policy. 1172 1173Returns: 1174 An object of the form: 1175 1176 { # Represents an Operation resource. 1177 # 1178 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 1179 # 1180 # Operations can be global, regional or zonal. 1181 # - For global operations, use the globalOperations resource. 1182 # - For regional operations, use the regionOperations resource. 1183 # - For zonal operations, use the zonalOperations resource. 1184 # 1185 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 1186 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1187 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1188 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1189 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 1190 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1191 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1192 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 1193 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 1194 "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. 1195 "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. 1196 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1197 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 1198 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1199 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1200 { 1201 "message": "A String", # [Output Only] A human-readable description of the warning code. 1202 "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. 1203 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 1204 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1205 { 1206 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1207 "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). 1208 }, 1209 ], 1210 }, 1211 ], 1212 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1213 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 1214 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1215 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 1216 "name": "A String", # [Output Only] Name of the resource. 1217 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1218 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1219 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1220 { 1221 "message": "A String", # [Output Only] An optional, human-readable error message. 1222 "code": "A String", # [Output Only] The error type identifier for this error. 1223 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1224 }, 1225 ], 1226 }, 1227 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1228 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1229 "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. 1230 }</pre> 1231</div> 1232 1233<div class="method"> 1234 <code class="details" id="setLabels">setLabels(project, resource, body)</code> 1235 <pre>Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation. 1236 1237Args: 1238 project: string, Project ID for this request. (required) 1239 resource: string, Name or id of the resource for this request. (required) 1240 body: object, The request body. (required) 1241 The object takes the form of: 1242 1243{ 1244 "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. 1245 "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": ""). 1246 "a_key": "A String", 1247 }, 1248 } 1249 1250 1251Returns: 1252 An object of the form: 1253 1254 { # Represents an Operation resource. 1255 # 1256 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 1257 # 1258 # Operations can be global, regional or zonal. 1259 # - For global operations, use the globalOperations resource. 1260 # - For regional operations, use the regionOperations resource. 1261 # - For zonal operations, use the zonalOperations resource. 1262 # 1263 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 1264 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1265 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1266 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1267 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 1268 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1269 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1270 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 1271 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 1272 "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. 1273 "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. 1274 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1275 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 1276 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1277 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1278 { 1279 "message": "A String", # [Output Only] A human-readable description of the warning code. 1280 "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. 1281 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 1282 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1283 { 1284 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1285 "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). 1286 }, 1287 ], 1288 }, 1289 ], 1290 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1291 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 1292 "startTime": "A String", # [Output Only] The time that this operation was started by the server. 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 resource. 1295 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1296 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1297 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1298 { 1299 "message": "A String", # [Output Only] An optional, human-readable error message. 1300 "code": "A String", # [Output Only] The error type identifier for this error. 1301 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1302 }, 1303 ], 1304 }, 1305 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1306 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1307 "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. 1308 }</pre> 1309</div> 1310 1311<div class="method"> 1312 <code class="details" id="testIamPermissions">testIamPermissions(project, resource, body)</code> 1313 <pre>Returns permissions that a caller has on the specified resource. 1314 1315Args: 1316 project: string, Project ID for this request. (required) 1317 resource: string, Name or id of the resource for this request. (required) 1318 body: object, The request body. (required) 1319 The object takes the form of: 1320 1321{ 1322 "permissions": [ # The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. 1323 "A String", 1324 ], 1325 } 1326 1327 1328Returns: 1329 An object of the form: 1330 1331 { 1332 "permissions": [ # A subset of `TestPermissionsRequest.permissions` that the caller is allowed. 1333 "A String", 1334 ], 1335 }</pre> 1336</div> 1337 1338</body></html>