knife-oci 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ # Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'chef/knife'
4
+ require 'chef/knife/oci_common_options'
5
+ require 'chef/knife/oci_helper'
6
+
7
+ class Chef
8
+ class Knife
9
+ # List OCI subnets in a VCN.
10
+ class OciSubnetList < Knife
11
+ banner 'knife oci subnet list (options)'
12
+
13
+ include OciHelper
14
+ include OciCommonOptions
15
+
16
+ deps do
17
+ require 'oci'
18
+ end
19
+
20
+ option :limit,
21
+ long: '--limit LIMIT',
22
+ description: 'The maximum number of items to return.'
23
+
24
+ option :vcn_id,
25
+ long: '--vcn-id VCN',
26
+ description: 'The VCN ID to list subnets for. (required)'
27
+
28
+ def run
29
+ validate_required_params(%i[vcn_id], config)
30
+ options = {}
31
+ options[:limit] = config[:limit] if config[:limit]
32
+
33
+ columns = ['Display Name', 'ID', 'CIDR Block', 'Availability Domain', 'State']
34
+
35
+ list_for_display = config[:format] == 'summary' ? bold(columns) : []
36
+ list_data, last_response = get_display_results(options) do |client_options|
37
+ response = network_client.list_subnets(compartment_id, config[:vcn_id], client_options)
38
+
39
+ items = response_to_list(response) do |item|
40
+ [item.display_name, item.id, item.cidr_block, item.availability_domain, item.lifecycle_state]
41
+ end
42
+ [response, items]
43
+ end
44
+ list_for_display += list_data
45
+
46
+ display_list_from_array(list_for_display, columns.length)
47
+ warn_if_page_is_truncated(last_response)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,46 @@
1
+ # Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'chef/knife'
4
+ require 'chef/knife/oci_common_options'
5
+ require 'chef/knife/oci_helper'
6
+
7
+ class Chef
8
+ class Knife
9
+ # List OCI VCNs. Note that this lists all VCNs in a compartment, not just those that are set up as Chef nodes.
10
+ class OciVcnList < Knife
11
+ banner 'knife oci vcn list (options)'
12
+
13
+ include OciHelper
14
+ include OciCommonOptions
15
+
16
+ deps do
17
+ require 'oci'
18
+ end
19
+
20
+ option :limit,
21
+ long: '--limit LIMIT',
22
+ description: 'The maximum number of items to return.'
23
+
24
+ def run
25
+ options = {}
26
+ options[:limit] = config[:limit] if config[:limit]
27
+
28
+ columns = ['Display Name', 'ID', 'CIDR Block', 'State']
29
+
30
+ list_for_display = config[:format] == 'summary' ? bold(columns) : []
31
+ list_data, last_response = get_display_results(options) do |client_options|
32
+ response = network_client.list_vcns(compartment_id, client_options)
33
+
34
+ items = response_to_list(response) do |item|
35
+ [item.display_name, item.id, item.cidr_block, item.lifecycle_state]
36
+ end
37
+ [response, items]
38
+ end
39
+ list_for_display += list_data
40
+
41
+ display_list_from_array(list_for_display, columns.length)
42
+ warn_if_page_is_truncated(last_response)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,7 @@
1
+ # Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module Knife
4
+ module OCI
5
+ VERSION = '2.0.0'.freeze
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: knife-oci
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Oracle
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oci
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ description: ''
34
+ email:
35
+ - brian.gustafson@oracle.com
36
+ - joe.levy@oracle.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - "./lib/chef/knife/oci_ad_list.rb"
42
+ - "./lib/chef/knife/oci_common_options.rb"
43
+ - "./lib/chef/knife/oci_compartment_list.rb"
44
+ - "./lib/chef/knife/oci_helper.rb"
45
+ - "./lib/chef/knife/oci_image_list.rb"
46
+ - "./lib/chef/knife/oci_server_create.rb"
47
+ - "./lib/chef/knife/oci_server_delete.rb"
48
+ - "./lib/chef/knife/oci_server_list.rb"
49
+ - "./lib/chef/knife/oci_server_show.rb"
50
+ - "./lib/chef/knife/oci_shape_list.rb"
51
+ - "./lib/chef/knife/oci_subnet_list.rb"
52
+ - "./lib/chef/knife/oci_vcn_list.rb"
53
+ - "./lib/knife-oci/version.rb"
54
+ - LICENSE.txt
55
+ homepage: https://github.com/oracle/knife-oci
56
+ licenses:
57
+ - UPL-1.0
58
+ - Apache-2.0
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.2.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.6.8
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Chef Knife Plugin for Oracle Cloud Infrastructure
80
+ test_files: []