Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
GCP Inspec for Standard Application Version
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
Experience Coder authored and modular-magician committed Sep 5, 2019
1 parent d0eb095 commit 29939e7
Show file tree
Hide file tree
Showing 17 changed files with 758 additions and 2 deletions.
73 changes: 73 additions & 0 deletions docs/resources/google_appengine_standard_app_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: About the google_appengine_standard_app_version resource
platform: gcp
---

## Syntax
A `google_appengine_standard_app_version` is used to test a Google StandardAppVersion resource

## Examples
```
describe google_appengine_standard_app_version(project: 'chef-gcp-inspec', location: 'europe-west2', version_id: 'v2', service: 'default') do
it { should exist }
its('service') { should eq 'default' }
its('version_id') { should eq 'v2' }
its('runtime') { should eq 'nodejs10' }
end
```

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

* `name`: Full path to the Version resource in the API. Example, "v1".

* `id`: Relative name of the version within the service. For example, `v1`. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names,"default", "latest", and any name with the prefix "ah-".

* `runtime`: Desired runtime. Example python27.

* `threadsafe`: Whether multiple requests can be dispatched to this version at once.

* `runtime_api_version`: The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard//config/appref

* `handlers`: An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.

* `url_regex`: URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path.

* `security_level`: Security (HTTPS) enforcement for this URL.

* `login`: Methods to restrict access to a URL based on login status.

* `auth_fail_action`: Actions to take when the user is not logged in.

* `redirect_http_response_code`: Redirect codes.

* `script`: Executes a script to handle the requests that match this URL pattern. Only the auto value is supported for Node.js in the App Engine standard environment, for example "script:" "auto".

* `static_files`: Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them.

* `libraries`: Configuration for third-party Python runtime libraries that are required by the application.

* `name`: Name of the library. Example "django".

* `version`: Version of the library to select, or "latest".

* `env_variables`: Environment variables available to the application.

* `deployment`: Code and application artifacts that make up this version.

* `zip`: Zip File

* `files`: Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the credentials supplied with this call.

* `entrypoint`: The entrypoint for the application.

* `shell`: The format should be a shell command that can be fed to bash -c.

* `service`: AppEngine service resource



## GCP Permissions

Ensure the [App Engine Admin API](https://console.cloud.google.com/apis/library/appengine.googleapis.com/) is enabled for the current project.
39 changes: 39 additions & 0 deletions docs/resources/google_appengine_standard_app_versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: About the google_appengine_standard_app_versions resource
platform: gcp
---

## Syntax
A `google_appengine_standard_app_versions` is used to test a Google StandardAppVersion resource

## Examples
```
describe google_appengine_standard_app_versions(project: 'chef-gcp-inspec', location: 'europe-west2',service: 'default') do
its('runtimes') { should include 'nodejs10' }
end
```

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

See [google_appengine_standard_app_version.md](google_appengine_standard_app_version.md) for more detailed information
* `names`: an array of `google_appengine_standard_app_version` name
* `version_ids`: an array of `google_appengine_standard_app_version` id
* `runtimes`: an array of `google_appengine_standard_app_version` runtime
* `threadsaves`: an array of `google_appengine_standard_app_version` threadsafe
* `runtime_api_versions`: an array of `google_appengine_standard_app_version` runtime_api_version
* `handlers`: an array of `google_appengine_standard_app_version` handlers
* `libraries`: an array of `google_appengine_standard_app_version` libraries
* `env_variables`: an array of `google_appengine_standard_app_version` env_variables
* `deployments`: an array of `google_appengine_standard_app_version` deployment
* `entrypoints`: an array of `google_appengine_standard_app_version` entrypoint
* `services`: an array of `google_appengine_standard_app_version` service

## 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.

## GCP Permissions

Ensure the [App Engine Admin API](https://console.cloud.google.com/apis/library/appengine.googleapis.com/) is enabled for the current project.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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/appengine/property/standardappversion_deployment_files'
require 'google/appengine/property/standardappversion_deployment_zip'
module GoogleInSpec
module AppEngine
module Property
class StandardAppVersionDeployment
attr_reader :zip

attr_reader :files

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@zip = GoogleInSpec::AppEngine::Property::StandardAppVersionDeploymentZip.new(args['zip'], to_s)
@files = args['files']
end

def to_s
"#{@parent_identifier} StandardAppVersionDeployment"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 AppEngine
module Property
class StandardAppVersionDeploymentFiles
attr_reader :sha1_sum

attr_reader :source_url

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@sha1_sum = args['sha1Sum']
@source_url = args['sourceUrl']
end

def to_s
"#{@parent_identifier} StandardAppVersionDeploymentFiles"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 AppEngine
module Property
class StandardAppVersionDeploymentZip
attr_reader :source_url

attr_reader :files_count

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@source_url = args['sourceUrl']
@files_count = args['filesCount']
end

def to_s
"#{@parent_identifier} StandardAppVersionDeploymentZip"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 AppEngine
module Property
class StandardAppVersionEntrypoint
attr_reader :shell

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@shell = args['shell']
end

def to_s
"#{@parent_identifier} StandardAppVersionEntrypoint"
end
end
end
end
end
62 changes: 62 additions & 0 deletions libraries/google/appengine/property/standardappversion_handlers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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/appengine/property/standardappversion_handlers_script'
require 'google/appengine/property/standardappversion_handlers_static_files'
module GoogleInSpec
module AppEngine
module Property
class StandardAppVersionHandlers
attr_reader :url_regex

attr_reader :security_level

attr_reader :login

attr_reader :auth_fail_action

attr_reader :redirect_http_response_code

attr_reader :script

attr_reader :static_files

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@url_regex = args['urlRegex']
@security_level = args['securityLevel']
@login = args['login']
@auth_fail_action = args['authFailAction']
@redirect_http_response_code = args['redirectHttpResponseCode']
@script = GoogleInSpec::AppEngine::Property::StandardAppVersionHandlersScript.new(args['script'], to_s)
@static_files = GoogleInSpec::AppEngine::Property::StandardAppVersionHandlersStaticFiles.new(args['staticFiles'], to_s)
end

def to_s
"#{@parent_identifier} StandardAppVersionHandlers"
end
end

class StandardAppVersionHandlersArray
def self.parse(value, parent_identifier)
return if value.nil?
return StandardAppVersionHandlers.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| StandardAppVersionHandlers.new(v, parent_identifier) }
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 AppEngine
module Property
class StandardAppVersionHandlersScript
attr_reader :script_path

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@script_path = args['scriptPath']
end

def to_s
"#{@parent_identifier} StandardAppVersionHandlersScript"
end
end
end
end
end
Loading

0 comments on commit 29939e7

Please sign in to comment.