vmware-vra 2.6.1 → 3.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.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -1
  3. data/CHANGELOG.md +35 -2
  4. data/README.md +91 -141
  5. data/Rakefile +1 -12
  6. data/lib/vra/catalog.rb +39 -8
  7. data/lib/vra/catalog_base.rb +62 -0
  8. data/lib/vra/catalog_item.rb +29 -75
  9. data/lib/vra/catalog_source.rb +116 -0
  10. data/lib/vra/catalog_type.rb +56 -0
  11. data/lib/vra/client.rb +62 -53
  12. data/lib/vra/deployment.rb +155 -0
  13. data/lib/vra/deployment_request.rb +117 -0
  14. data/lib/vra/{resources.rb → deployments.rb} +26 -17
  15. data/lib/vra/exceptions.rb +2 -2
  16. data/lib/vra/http.rb +20 -7
  17. data/lib/vra/request.rb +28 -36
  18. data/lib/vra/request_parameters.rb +14 -13
  19. data/lib/vra/resource.rb +33 -203
  20. data/lib/vra/version.rb +2 -2
  21. data/lib/vra.rb +15 -12
  22. data/spec/catalog_item_spec.rb +64 -222
  23. data/spec/catalog_source_spec.rb +178 -0
  24. data/spec/catalog_spec.rb +112 -72
  25. data/spec/catalog_type_spec.rb +114 -0
  26. data/spec/client_spec.rb +272 -227
  27. data/spec/deployment_request_spec.rb +192 -0
  28. data/spec/deployment_spec.rb +227 -0
  29. data/spec/deployments_spec.rb +80 -0
  30. data/spec/fixtures/resource/sample_catalog_item.json +18 -0
  31. data/spec/fixtures/resource/sample_catalog_item_2.json +18 -0
  32. data/spec/fixtures/resource/sample_catalog_source.json +20 -0
  33. data/spec/fixtures/resource/sample_catalog_type.json +49 -0
  34. data/spec/fixtures/resource/sample_dep_actions.json +58 -0
  35. data/spec/fixtures/resource/sample_dep_request.json +19 -0
  36. data/spec/fixtures/resource/sample_dep_resource.json +112 -0
  37. data/spec/fixtures/resource/sample_deployment.json +26 -0
  38. data/spec/fixtures/resource/sample_entitlements.json +25 -0
  39. data/spec/http_spec.rb +63 -61
  40. data/spec/request_spec.rb +62 -68
  41. data/spec/resource_spec.rb +71 -390
  42. data/spec/spec_helper.rb +10 -4
  43. data/vmware-vra.gemspec +3 -5
  44. metadata +44 -36
  45. data/.travis.yml +0 -14
  46. data/Jenkinsfile +0 -31
  47. data/lib/vra/catalog_request.rb +0 -126
  48. data/lib/vra/requests.rb +0 -41
  49. data/spec/catalog_request_spec.rb +0 -267
  50. data/spec/requests_spec.rb +0 -60
  51. data/spec/resources_spec.rb +0 -71
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Author:: Chef Partner Engineering (<partnereng@chef.io>)
4
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require "spec_helper"
21
-
22
- describe Vra::Requests do
23
- let(:client) do
24
- Vra::Client.new(username: "user@corp.local",
25
- password: "password",
26
- tenant: "tenant",
27
- base_url: "https://vra.corp.local")
28
- end
29
-
30
- let(:requests) { Vra::Requests.new(client) }
31
-
32
- describe "#all_resources" do
33
- it "calls the requests API endpoint" do
34
- expect(client).to receive(:http_get_paginated_array!)
35
- .with("/catalog-service/api/consumer/requests")
36
- .and_return([])
37
-
38
- requests.all_requests
39
- end
40
-
41
- it "returns an array of request objects" do
42
- allow(client).to receive(:http_get_paginated_array!)
43
- .with("/catalog-service/api/consumer/requests")
44
- .and_return([ { "id" => "1" }, { "id" => "2" } ])
45
-
46
- items = requests.all_requests
47
-
48
- expect(items[0]).to be_an_instance_of(Vra::Request)
49
- expect(items[1]).to be_an_instance_of(Vra::Request)
50
- end
51
- end
52
-
53
- describe "#by_id" do
54
- it "returns a request object" do
55
- expect(Vra::Request).to receive(:new).with(client, "12345")
56
-
57
- requests.by_id("12345")
58
- end
59
- end
60
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Author:: Chef Partner Engineering (<partnereng@chef.io>)
4
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require "spec_helper"
21
-
22
- describe Vra::Resources do
23
- let(:client) do
24
- Vra::Client.new(username: "user@corp.local",
25
- password: "password",
26
- tenant: "tenant",
27
- base_url: "https://vra.corp.local")
28
- end
29
-
30
- let(:resources) { Vra::Resources.new(client) }
31
-
32
- it "#all" do
33
- allow(client).to receive(:http_get_paginated_array!)
34
- .with("/catalog-service/api/consumer/resources")
35
- .and_return([ { "id" => "1" }, { "id" => "2" } ])
36
-
37
- items = resources.all_resources
38
-
39
- expect(items[0]).to be_an_instance_of(Vra::Resource)
40
- expect(items[1]).to be_an_instance_of(Vra::Resource)
41
- end
42
-
43
- describe "#all_resources" do
44
- it "calls the resources API endpoint" do
45
- expect(client).to receive(:http_get_paginated_array!)
46
- .with("/catalog-service/api/consumer/resources")
47
- .and_return([])
48
-
49
- resources.all_resources
50
- end
51
-
52
- it "returns an array of resource objects" do
53
- allow(client).to receive(:http_get_paginated_array!)
54
- .with("/catalog-service/api/consumer/resources")
55
- .and_return([ { "id" => "1" }, { "id" => "2" } ])
56
-
57
- items = resources.all_resources
58
-
59
- expect(items[0]).to be_an_instance_of(Vra::Resource)
60
- expect(items[1]).to be_an_instance_of(Vra::Resource)
61
- end
62
- end
63
-
64
- describe "#by_id" do
65
- it "returns a resource object" do
66
- expect(Vra::Resource).to receive(:new).with(client, id: "12345")
67
-
68
- resources.by_id("12345")
69
- end
70
- end
71
- end