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

Fix dataproc test, add node groups, node templates, network endpoints #185

Merged
merged 5 commits into from
Oct 10, 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
47 changes: 47 additions & 0 deletions docs/resources/google_compute_network_endpoint_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: About the google_compute_network_endpoint_group resource
platform: gcp
---

## Syntax
A `google_compute_network_endpoint_group` is used to test a Google NetworkEndpointGroup resource

## Examples
```

describe google_compute_network_endpoint_group(project: 'chef-gcp-inspec', zone: 'zone', name: 'inspec-gcp-endpoint-group') do
it { should exist }
its('default_port') { should cmp '90' }
end

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

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


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

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

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

* `network_endpoint_type`: Type of network endpoints in this network endpoint group. Currently the only supported value is GCE_VM_IP_PORT.

* `size`: Number of network endpoints in the network endpoint group.

* `network`: The network to which all network endpoints in the NEG belong. Uses "default" project network if unspecified.

* `subnetwork`: Optional subnetwork to which all network endpoints in the NEG belong.

* `default_port`: The default port used if the port number is not specified in the network endpoint.

* `zone`: Zone where the network endpoint group is located.


## GCP Permissions

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

## Syntax
A `google_compute_network_endpoint_groups` is used to test a Google NetworkEndpointGroup resource

## Examples
```

describe google_compute_network_endpoint_groups(project: 'chef-gcp-inspec', zone: 'zone') do
its('default_ports') { should include '90' }
its('names') { should include 'inspec-gcp-endpoint-group' }
end
```

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

See [google_compute_network_endpoint_group.md](google_compute_network_endpoint_group.md) for more detailed information
* `ids`: an array of `google_compute_network_endpoint_group` id
* `names`: an array of `google_compute_network_endpoint_group` name
* `descriptions`: an array of `google_compute_network_endpoint_group` description
* `network_endpoint_types`: an array of `google_compute_network_endpoint_group` network_endpoint_type
* `sizes`: an array of `google_compute_network_endpoint_group` size
* `networks`: an array of `google_compute_network_endpoint_group` network
* `subnetworks`: an array of `google_compute_network_endpoint_group` subnetwork
* `default_ports`: an array of `google_compute_network_endpoint_group` default_port
* `zones`: an array of `google_compute_network_endpoint_group` zone

## 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 [Compute Engine API](https://console.cloud.google.com/apis/library/compute.googleapis.com/) is enabled for the current project.
42 changes: 42 additions & 0 deletions docs/resources/google_compute_node_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: About the google_compute_node_group resource
platform: gcp
---

## Syntax
A `google_compute_node_group` is used to test a Google NodeGroup resource

## Examples
```

describe google_compute_node_group(project: 'chef-gcp-inspec', zone: 'zone', name: 'inspec-node-group') do
it { should exist }
its('description') { should cmp 'A description of the node group' }
its('size') { should cmp '0' }
end

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

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


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

* `description`: An optional textual description of the resource.

* `name`: Name of the resource.

* `node_template`: The URL of the node template to which this node group belongs.

* `size`: The total number of nodes in the node group.

* `zone`: Zone where this node group is located


## GCP Permissions

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

## Syntax
A `google_compute_node_groups` is used to test a Google NodeGroup resource

## Examples
```

describe google_compute_node_groups(project: 'chef-gcp-inspec', zone: 'zone') do
it { should exist }
its('descriptions') { should include 'A description of the node group' }
its('sizes') { should include '0' }
its('names') { should include 'inspec-node-group' }
end
```

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

See [google_compute_node_group.md](google_compute_node_group.md) for more detailed information
* `creation_timestamps`: an array of `google_compute_node_group` creation_timestamp
* `descriptions`: an array of `google_compute_node_group` description
* `names`: an array of `google_compute_node_group` name
* `node_templates`: an array of `google_compute_node_group` node_template
* `sizes`: an array of `google_compute_node_group` size
* `zones`: an array of `google_compute_node_group` zone

## 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 [Compute Engine API](https://console.cloud.google.com/apis/library/compute.googleapis.com/) is enabled for the current project.
49 changes: 49 additions & 0 deletions docs/resources/google_compute_node_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: About the google_compute_node_template resource
platform: gcp
---

## Syntax
A `google_compute_node_template` is used to test a Google NodeTemplate resource

## Examples
```

describe google_compute_node_template(project: 'chef-gcp-inspec', region: 'europe-west2', name: 'inspec-node-template') do
it { should exist }
its('node_affinity_labels') { should include('key' => 'value') }
end

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

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


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

* `description`: An optional textual description of the resource.

* `name`: Name of the resource.

* `node_affinity_labels`: Labels to use for node affinity, which will be used in instance scheduling.

* `node_type`: Node type to use for nodes group that are created from this template. Only one of nodeTypeFlexibility and nodeType can be specified.

* `node_type_flexibility`: Flexible properties for the desired node type. Node groups that use this node template will create nodes of a type that matches these properties. Only one of nodeTypeFlexibility and nodeType can be specified.

* `cpus`: Number of virtual CPUs to use.

* `memory`: Physical memory available to the node, defined in MB.

* `local_ssd`: Use local SSD

* `region`: Region where nodes using the node template will be created


## GCP Permissions

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

## Syntax
A `google_compute_node_templates` is used to test a Google NodeTemplate resource

## Examples
```

describe google_compute_node_templates(project: 'chef-gcp-inspec', region: 'europe-west2') do
its('names') { should include 'inspec-node-template' }
end
```

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

See [google_compute_node_template.md](google_compute_node_template.md) for more detailed information
* `creation_timestamps`: an array of `google_compute_node_template` creation_timestamp
* `descriptions`: an array of `google_compute_node_template` description
* `names`: an array of `google_compute_node_template` name
* `node_affinity_labels`: an array of `google_compute_node_template` node_affinity_labels
* `node_types`: an array of `google_compute_node_template` node_type
* `node_type_flexibilities`: an array of `google_compute_node_template` node_type_flexibility
* `regions`: an array of `google_compute_node_template` region

## 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 [Compute Engine API](https://console.cloud.google.com/apis/library/compute.googleapis.com/) is enabled for the current project.
2 changes: 1 addition & 1 deletion docs/resources/google_compute_snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A `google_compute_snapshot` is used to test a Google Snapshot resource

describe google_compute_snapshot(project: 'chef-gcp-inspec', name: 'inspec-gcp-disk-snapshot') do
it { should exist }
its('source_disk') { should match 'my_disk' }
its('source_disk') { should match 'inspec-snapshot-disk' }
end

describe google_compute_snapshot(project: 'chef-gcp-inspec', name: 'nonexistent') do
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/google_compute_snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
describe.one do
google_compute_snapshots(project: 'chef-gcp-inspec').names do |snapshot_name|
describe google_compute_snapshot(project: 'chef-gcp-inspec', name: snapshot_name) do
its('source_disk') { should match 'my_disk' }
its('source_disk') { should match 'inspec-snapshot-disk' }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 NodeTemplateNodeTypeFlexibility
attr_reader :cpus

attr_reader :memory

attr_reader :local_ssd

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@cpus = args['cpus']
@memory = args['memory']
@local_ssd = args['localSsd']
end

def to_s
"#{@parent_identifier} NodeTemplateNodeTypeFlexibility"
end
end
end
end
end
76 changes: 76 additions & 0 deletions libraries/google_compute_network_endpoint_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# 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 'gcp_backend'

# A provider to manage Compute Engine resources.
class ComputeNetworkEndpointGroup < GcpResourceBase
name 'google_compute_network_endpoint_group'
desc 'NetworkEndpointGroup'
supports platform: 'gcp'

attr_reader :params
attr_reader :id
attr_reader :name
attr_reader :description
attr_reader :network_endpoint_type
attr_reader :size
attr_reader :network
attr_reader :subnetwork
attr_reader :default_port
attr_reader :zone

def initialize(params)
super(params.merge({ use_http_transport: true }))
@params = params
@fetched = @connection.fetch(product_url, resource_base_url, params, 'Get')
parse unless @fetched.nil?
end

def parse
@id = @fetched['id']
@name = @fetched['name']
@description = @fetched['description']
@network_endpoint_type = @fetched['networkEndpointType']
@size = @fetched['size']
@network = @fetched['network']
@subnetwork = @fetched['subnetwork']
@default_port = @fetched['defaultPort']
@zone = @fetched['zone']
end

# Handles parsing RFC3339 time string
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

def exists?
[email protected]?
end

def to_s
"NetworkEndpointGroup #{@params[:name]}"
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}'
end
end
Loading