Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http hc backend #104

Merged
merged 4 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/resources/google_compute_backend_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: About the BackendService resource
platform: gcp
---


## Syntax
A `google_compute_backend_service` is used to test a Google BackendService resource

## Examples
```
describe google_compute_backend_service(project: 'chef-gcp-inspec', name: 'inspec-gcp-backend-service') do
it { should exist }
its('description') { should eq 'A description' }
its('port_name') { should eq 'http' }
its('protocol') { should eq 'HTTP' }
its('timeout_sec') { should eq '10' }
its('enable_cdn') { should eq 'true' }
end

describe google_compute_backend_service(project: 'chef-gcp-inspec', name: 'nonexistent') do
it { should_not exist }
end
```

## Properties
Properties that can be accessed from the `google_compute_backend_service` resource:

* `affinity_cookie_ttl_sec`: Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to 0, the cookie is non-persistent and lasts only until the end of the browser session (or equivalent). The maximum allowed value for TTL is one day. When the load balancing scheme is INTERNAL, this field is not used.

* `backends`: The list of backends that serve this BackendService.

* `balancingMode`: Specifies the balancing mode for this backend. For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). This cannot be used for internal load balancing.

* `capacityScaler`: A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, RATE or CONNECTION). Default value is 1, which means the group will serve up to 100% of its configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. This cannot be used for internal load balancing.

* `description`: An optional description of this resource. Provide this property when you create the resource.

* `group`: This instance group defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource. When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService.

* `maxConnections`: The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. This cannot be used for internal load balancing.

* `maxConnectionsPerInstance`: The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION or UTILIZATION balancing modes. For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. This cannot be used for internal load balancing.

* `maxRate`: The max requests per second (RPS) of the group. Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. This cannot be used for internal load balancing.

* `maxRatePerInstance`: The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. This cannot be used for internal load balancing.

* `maxUtilization`: Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. This cannot be used for internal load balancing.

* `cdn_policy`: Cloud CDN configuration for this BackendService.

* `cacheKeyPolicy`: The CacheKeyPolicy for this CdnPolicy.

* `connection_draining`: Settings for connection draining

* `drainingTimeoutSec`: Time for which instance will be drained (not accept new connections, but still work to finish started).

* `creation_timestamp`: Creation timestamp in RFC3339 text format.

* `description`: An optional description of this resource.

* `enable_cdn`: If true, enable Cloud CDN for this BackendService. When the load balancing scheme is INTERNAL, this field is not used.

* `health_checks`: The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. For internal load balancing, a URL to a HealthCheck resource must be specified instead.

* `id`: The unique identifier for the resource.

* `iap`: Settings for enabling Cloud Identity Aware Proxy

* `enabled`: Enables IAP.

* `oauth2ClientId`: OAuth2 Client ID for IAP

* `oauth2ClientSecret`: OAuth2 Client Secret for IAP

* `oauth2ClientSecretSha256`: OAuth2 Client Secret SHA-256 for IAP

* `load_balancing_scheme`: Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be used with the other.

* `name`: 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.

* `port_name`: Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. When the load balancing scheme is INTERNAL, this field is not used.

* `protocol`: The protocol this BackendService uses to communicate with backends. Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. For internal load balancing, the possible values are TCP and UDP, and the default is TCP.

* `region`: The region where the regional backend service resides. This field is not applicable to global backend services.

* `session_affinity`: Type of session affinity to use. The default is NONE. When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO. When the protocol is UDP, this field is not used.

* `timeout_sec`: How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. Valid range is [1, 86400].
45 changes: 45 additions & 0 deletions docs/resources/google_compute_backend_services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: About the BackendService resource
platform: gcp
---


## Syntax
A `google_compute_backend_services` is used to test a Google BackendService resource

## Examples
```
describe google_compute_backend_services(project: 'chef-gcp-inspec') do
its('count') { should be >= 1 }
its('names') { should include 'inspec-gcp-backend-service' }
its('port_names') { should include 'http' }
its('protocols') { should include 'HTTP' }
its('timeout_secs') { should include '10' }
end
```

## Properties
Properties that can be accessed from the `google_compute_backend_services` resource:

See [google_compute_backend_service.md](google_compute_backend_service.md) for more detailed information
* `affinity_cookie_ttl_secs`: an array of `google_compute_backend_service` affinity_cookie_ttl_sec
* `backends`: an array of `google_compute_backend_service` backends
* `cdn_policies`: an array of `google_compute_backend_service` cdn_policy
* `connection_drainings`: an array of `google_compute_backend_service` connection_draining
* `creation_timestamps`: an array of `google_compute_backend_service` creation_timestamp
* `descriptions`: an array of `google_compute_backend_service` description
* `enable_cdns`: an array of `google_compute_backend_service` enable_cdn
* `health_checks`: an array of `google_compute_backend_service` health_checks
* `ids`: an array of `google_compute_backend_service` id
* `iaps`: an array of `google_compute_backend_service` iap
* `load_balancing_schemes`: an array of `google_compute_backend_service` load_balancing_scheme
* `names`: an array of `google_compute_backend_service` name
* `port_names`: an array of `google_compute_backend_service` port_name
* `protocols`: an array of `google_compute_backend_service` protocol
* `regions`: an array of `google_compute_backend_service` region
* `session_affinities`: an array of `google_compute_backend_service` session_affinity
* `timeout_secs`: an array of `google_compute_backend_service` timeout_sec

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with `where` as a block or a method.
47 changes: 47 additions & 0 deletions docs/resources/google_compute_http_health_check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: About the HttpHealthCheck resource
platform: gcp
---


## Syntax
A `google_compute_http_health_check` is used to test a Google HttpHealthCheck resource

## Examples
```
describe google_compute_http_health_check(project: 'chef-gcp-inspec', name: 'inspec-gcp-http-health-check') do
it { should exist }
its('timeout_sec') { should eq '20' }
its('request_path') { should eq '/health_check' }
its('check_interval_sec') { should eq '20' }
end
describe google_compute_http_health_check(project: 'chef-gcp-inspec', name: 'nonexistent') do
it { should_not exist }
end
```

## Properties
Properties that can be accessed from the `google_compute_http_health_check` resource:

* `check_interval_sec`: How often (in seconds) to send a health check. The default value is 5 seconds.

* `creation_timestamp`: Creation timestamp in RFC3339 text format.

* `description`: An optional description of this resource. Provide this property when you create the resource.

* `healthy_threshold`: A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2.

* `host`: The value of the host header in the HTTP health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used.

* `id`: The unique identifier for the resource. This identifier is defined by the server.

* `name`: 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.

* `port`: The TCP port number for the HTTP health check request. The default value is 80.

* `request_path`: The request path of the HTTP health check request. The default value is /.

* `timeout_sec`: How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec.

* `unhealthy_threshold`: A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2.
37 changes: 37 additions & 0 deletions docs/resources/google_compute_http_health_checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: About the HttpHealthCheck resource
platform: gcp
---


## Syntax
A `google_compute_http_health_checks` is used to test a Google HttpHealthCheck resource

## Examples
```
describe google_compute_http_health_checks(project: 'chef-gcp-inspec') do
its('names') { should include 'inspec-gcp-http-health-check' }
its('timeout_secs') { should include '20' }
its('check_interval_secs') { should include '20' }
end
```

## Properties
Properties that can be accessed from the `google_compute_http_health_checks` resource:

See [google_compute_http_health_check.md](google_compute_http_health_check.md) for more detailed information
* `check_interval_secs`: an array of `google_compute_http_health_check` check_interval_sec
* `creation_timestamps`: an array of `google_compute_http_health_check` creation_timestamp
* `descriptions`: an array of `google_compute_http_health_check` description
* `healthy_thresholds`: an array of `google_compute_http_health_check` healthy_threshold
* `hosts`: an array of `google_compute_http_health_check` host
* `ids`: an array of `google_compute_http_health_check` id
* `names`: an array of `google_compute_http_health_check` name
* `ports`: an array of `google_compute_http_health_check` port
* `request_paths`: an array of `google_compute_http_health_check` request_path
* `timeout_secs`: an array of `google_compute_http_health_check` timeout_sec
* `unhealthy_thresholds`: an array of `google_compute_http_health_check` unhealthy_threshold

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with `where` as a block or a method.
61 changes: 61 additions & 0 deletions libraries/google/compute/property/backendservice_backends.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Compute
module Property
class BackendServiceBackends
attr_reader :balancing_mode

attr_reader :capacity_scaler

attr_reader :description

attr_reader :group

attr_reader :max_connections

attr_reader :max_connections_per_instance

attr_reader :max_rate

attr_reader :max_rate_per_instance

attr_reader :max_utilization

def initialize(args = nil)
return if args.nil?
@balancing_mode = args['balancingMode']
@capacity_scaler = args['capacityScaler']
@description = args['description']
@group = args['group']
@max_connections = args['maxConnections']
@max_connections_per_instance = args['maxConnectionsPerInstance']
@max_rate = args['maxRate']
@max_rate_per_instance = args['maxRatePerInstance']
@max_utilization = args['maxUtilization']
end
end

class BackendServiceBackendsArray
def self.parse(value)
return if value.nil?
return BackendServiceBackends.new(value) unless value.is_a?(::Array)
value.map { |v| BackendServiceBackends.new(v) }
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Compute
module Property
class BackendServiceCachekeypolicy
attr_reader :include_host

attr_reader :include_protocol

attr_reader :include_query_string

attr_reader :query_string_blacklist

attr_reader :query_string_whitelist

def initialize(args = nil)
return if args.nil?
@include_host = args['includeHost']
@include_protocol = args['includeProtocol']
@include_query_string = args['includeQueryString']
@query_string_blacklist = args['queryStringBlacklist']
@query_string_whitelist = args['queryStringWhitelist']
end
end
end
end
end
30 changes: 30 additions & 0 deletions libraries/google/compute/property/backendservice_cdn_policy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/compute/property/backendservice_cache_key_policy'
module GoogleInSpec
module Compute
module Property
class BackendServiceCdnpolicy
attr_reader :cache_key_policy

def initialize(args = nil)
return if args.nil?
@cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCachekeypolicy.new(args['cacheKeyPolicy'])
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Compute
module Property
class BackendServiceConnectiondraining
attr_reader :draining_timeout_sec

def initialize(args = nil)
return if args.nil?
@draining_timeout_sec = args['drainingTimeoutSec']
end
end
end
end
end
Loading