vsphere-automation-vcenter 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -17
  3. data/README.md +1 -1
  4. data/lib/vsphere-automation-vcenter/version.rb +1 -1
  5. data/pkg/vsphere-automation-vcenter-0.4.0.gem +0 -0
  6. data/spec/api/certificate_management_vcenter_tls_api_spec.rb +0 -1
  7. data/spec/api/deployment_api_spec.rb +0 -1
  8. data/spec/api/deployment_import_history_api_spec.rb +0 -1
  9. data/spec/api/deployment_install_api_spec.rb +0 -1
  10. data/spec/api/deployment_install_psc_replicated_api_spec.rb +0 -1
  11. data/spec/api/deployment_install_psc_standalone_api_spec.rb +0 -1
  12. data/spec/api/deployment_install_remote_psc_api_spec.rb +0 -1
  13. data/spec/api/deployment_question_api_spec.rb +0 -1
  14. data/spec/api/deployment_upgrade_api_spec.rb +0 -1
  15. data/spec/api/inventory_datastore_api_spec.rb +0 -1
  16. data/spec/api/inventory_network_api_spec.rb +0 -1
  17. data/spec/api/iso_image_api_spec.rb +0 -2
  18. data/spec/api/ovf_library_item_api_spec.rb +0 -1
  19. data/spec/api/storage_policies_api_spec.rb +0 -1
  20. data/spec/api/topology_pscs_api_spec.rb +0 -1
  21. data/spec/api/vcha_cluster_active_api_spec.rb +0 -1
  22. data/spec/api/vcha_cluster_api_spec.rb +0 -1
  23. data/spec/api/vcha_cluster_mode_api_spec.rb +0 -1
  24. data/spec/api/vcha_cluster_passive_api_spec.rb +0 -1
  25. data/spec/api/vcha_cluster_witness_api_spec.rb +0 -1
  26. data/spec/api/vcha_vc_credentials_api_spec.rb +0 -1
  27. data/spec/api/vm_guest_power_api_spec.rb +0 -1
  28. data/spec/api/vm_storage_policy_compliance_api_spec.rb +0 -1
  29. data/spec/api/vm_template_library_items_api_spec.rb +0 -1
  30. data/spec/spec_helper.rb +3 -0
  31. data/vsphere-automation-vcenter.gemspec +2 -3
  32. metadata +7 -15
  33. data/lib/vsphere-automation-vcenter/api_client.rb +0 -390
  34. data/lib/vsphere-automation-vcenter/api_error.rb +0 -34
  35. data/lib/vsphere-automation-vcenter/configuration.rb +0 -212
  36. data/pkg/vsphere-automation-vcenter-0.2.1.gem +0 -0
  37. data/pkg/vsphere-automation-vcenter-0.2.2.gem +0 -0
  38. data/spec/api_client_spec.rb +0 -222
  39. data/spec/configuration_spec.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e78460873061d19d2443005768491580d6367229069af969851b09a09a64d716
4
- data.tar.gz: 6a91d0ee461d1cf57217fec056e1f9fb492f8690284aaba24bb046d3ab62a681
3
+ metadata.gz: 3bbd2b171fa80fe719a1bae370e48bcb47ae3418077c7251b1cf3320b12aff90
4
+ data.tar.gz: 345838f2d5be00b4c4654a6ba21604033e39c6cf9d5159efe67cc7f0f30fbcc3
5
5
  SHA512:
6
- metadata.gz: 8a08225653323871b673ededb1297a203bd5022a79ce50368a410db94f095dc88eadf5f6ec49d4b5657639faf6f919767d320ff9f030baf2f1cd9aa3b4c25424
7
- data.tar.gz: ca43303f75bcfe8836a186d0bbb3149937adc02034059f2bb69c71deb2e4d639f8624514c4f12254766cf39f7ed91ae412cfc21ecf624a3de25f3b89386ad83c
6
+ metadata.gz: 8df69b01bd72cd16058e71e254f0b87d4c05d64190733d5ba81c60d35b5faef86d9b78bdd2a64a87f188ed89fb1ff0dc34f5f988765207ee18ae47c1500e7a44
7
+ data.tar.gz: 8149168f811c2c89fb1b4ac3edba02ea872d8217f07f21faad3aee5a646f213753b78abea20fd932b72d3a145e6cdd86256cf82a8a826acc6efcbad2b2c2490b
@@ -1,45 +1,41 @@
1
1
  PATH
2
2
  remote: ../cis
3
3
  specs:
4
- vsphere-automation-cis (0.3.0)
5
- vsphere-automation-runtime (~> 0.3.0)
4
+ vsphere-automation-cis (0.4.0)
5
+ vsphere-automation-runtime (~> 0.4.0)
6
6
 
7
7
  PATH
8
8
  remote: ../runtime
9
9
  specs:
10
- vsphere-automation-runtime (0.3.0)
11
- typhoeus (~> 1.3)
10
+ vsphere-automation-runtime (0.4.0)
12
11
 
13
12
  PATH
14
13
  remote: .
15
14
  specs:
16
- vsphere-automation-vcenter (0.3.0)
17
- vsphere-automation-cis (~> 0.3.0)
18
- vsphere-automation-runtime (~> 0.3.0)
15
+ vsphere-automation-vcenter (0.4.0)
16
+ vsphere-automation-cis (~> 0.4.0)
17
+ vsphere-automation-runtime (~> 0.4.0)
19
18
 
20
19
  GEM
21
20
  remote: https://rubygems.org/
22
21
  specs:
23
- addressable (2.6.0)
24
- public_suffix (>= 2.0.2, < 4.0)
22
+ addressable (2.7.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
25
24
  ast (2.4.0)
26
25
  coderay (1.1.2)
27
26
  crack (0.4.3)
28
27
  safe_yaml (~> 1.0.0)
29
28
  diff-lcs (1.3)
30
- ethon (0.12.0)
31
- ffi (>= 1.3.0)
32
- ffi (1.11.1)
33
29
  hashdiff (1.0.0)
34
30
  jaro_winkler (1.5.3)
35
31
  method_source (0.9.2)
36
32
  parallel (1.17.0)
37
- parser (2.6.3.0)
33
+ parser (2.6.4.0)
38
34
  ast (~> 2.4.0)
39
35
  pry (0.12.2)
40
36
  coderay (~> 1.1.0)
41
37
  method_source (~> 0.9.0)
42
- public_suffix (3.1.1)
38
+ public_suffix (4.0.1)
43
39
  rainbow (3.0.0)
44
40
  rake (12.3.3)
45
41
  rspec (3.8.0)
@@ -64,11 +60,9 @@ GEM
64
60
  unicode-display_width (>= 1.4.0, < 1.7)
65
61
  ruby-progressbar (1.10.1)
66
62
  safe_yaml (1.0.5)
67
- typhoeus (1.3.1)
68
- ethon (>= 0.9.0)
69
63
  unicode-display_width (1.6.0)
70
64
  vcr (5.0.0)
71
- webmock (3.6.2)
65
+ webmock (3.7.2)
72
66
  addressable (>= 2.3.6)
73
67
  crack (>= 0.3.2)
74
68
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The Ruby gem for the vSphere VCenter API
4
4
 
5
5
  - API version: 2.0.0
6
- - Package version: 0.3.0
6
+ - Package version: 0.4.0
7
7
 
8
8
  ## Installation
9
9
 
@@ -8,6 +8,6 @@
8
8
 
9
9
  module VSphereAutomation
10
10
  module VCenter
11
- VERSION = '0.3.0'
11
+ VERSION = '0.4.0'
12
12
  end
13
13
  end
@@ -40,7 +40,6 @@ describe 'CertificateManagementVcenterTlsApi' do
40
40
 
41
41
  # unit tests for renew
42
42
  # Renews the TLS certificate for the given duration period.
43
- # @param action action&#x3D;renew
44
43
  # @param [Hash] opts the optional parameters
45
44
  # @option opts [VcenterCertificateManagementVcenterTlsRenew] :request_body
46
45
  # @return [nil]
@@ -40,7 +40,6 @@ describe 'DeploymentApi' do
40
40
 
41
41
  # unit tests for rollback
42
42
  # Rollback a failed appliance so it can be configured once again.
43
- # @param action action&#x3D;rollback
44
43
  # @param [Hash] opts the optional parameters
45
44
  # @return [nil]
46
45
  describe 'rollback test' do
@@ -30,7 +30,6 @@ describe 'DeploymentImportHistoryApi' do
30
30
 
31
31
  # unit tests for cancel
32
32
  # Cancels the task for importing vCenter historical data.
33
- # @param action action&#x3D;cancel
34
33
  # @param [Hash] opts the optional parameters
35
34
  # @return [nil]
36
35
  describe 'cancel test' do
@@ -30,7 +30,6 @@ describe 'DeploymentInstallApi' do
30
30
 
31
31
  # unit tests for cancel
32
32
  # Cancel the appliance installation that is in progress.
33
- # @param action action&#x3D;cancel
34
33
  # @param [Hash] opts the optional parameters
35
34
  # @return [nil]
36
35
  describe 'cancel test' do
@@ -30,7 +30,6 @@ describe 'DeploymentInstallPscReplicatedApi' do
30
30
 
31
31
  # unit tests for check
32
32
  # Checks whether the provided remote PSC is reachable and can be replicated.
33
- # @param action action&#x3D;check
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [VcenterDeploymentInstallPscReplicatedCheckResult]
@@ -30,7 +30,6 @@ describe 'DeploymentInstallPscStandaloneApi' do
30
30
 
31
31
  # unit tests for check
32
32
  # Checks that the information to configure a non-replicated PSC satisfies the requirements.
33
- # @param action action&#x3D;check
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [VcenterDeploymentInstallPscStandaloneCheckResult]
@@ -30,7 +30,6 @@ describe 'DeploymentInstallRemotePscApi' do
30
30
 
31
31
  # unit tests for check
32
32
  # Checks whether the remote PSC is reachable and the deployed vCenter Server can be registered with the remote PSC.
33
- # @param action action&#x3D;check
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [VcenterDeploymentInstallRemotePscCheckResult]
@@ -30,7 +30,6 @@ describe 'DeploymentQuestionApi' do
30
30
 
31
31
  # unit tests for answer
32
32
  # Supply answer to the raised question.
33
- # @param action action&#x3D;answer
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [nil]
@@ -30,7 +30,6 @@ describe 'DeploymentUpgradeApi' do
30
30
 
31
31
  # unit tests for cancel
32
32
  # Cancel the appliance upgrade that is in progress.
33
- # @param action action&#x3D;cancel
34
33
  # @param [Hash] opts the optional parameters
35
34
  # @return [nil]
36
35
  describe 'cancel test' do
@@ -30,7 +30,6 @@ describe 'InventoryDatastoreApi' do
30
30
 
31
31
  # unit tests for find
32
32
  # Returns datastore information for the specified datastores. The key in the {@term result} {@term map} is the datastore identifier and the value in the {@term map} is the datastore information.
33
- # @param action ~action&#x3D;find
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [VcenterInventoryDatastoreFindResult]
@@ -30,7 +30,6 @@ describe 'InventoryNetworkApi' do
30
30
 
31
31
  # unit tests for find
32
32
  # Returns network information for the specified vCenter Server networks. The key in the {@term result} {@term map} is the network identifier and the value in the {@term map} is the network information.
33
- # @param action ~action&#x3D;find
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [VcenterInventoryNetworkFindResult]
@@ -31,7 +31,6 @@ describe 'IsoImageApi' do
31
31
  # unit tests for mount
32
32
  # Mounts an ISO image from a content library on a virtual machine.
33
33
  # @param library_item The identifier of the library item having the ISO image to mount on the virtual machine.
34
- # @param action ~action&#x3D;mount
35
34
  # @param request_body
36
35
  # @param [Hash] opts the optional parameters
37
36
  # @return [VcenterIsoImageMountResult]
@@ -44,7 +43,6 @@ describe 'IsoImageApi' do
44
43
  # unit tests for unmount
45
44
  # Unmounts a previously mounted CD-ROM using an ISO image as a backing.
46
45
  # @param vm The identifier of the virtual machine from which to unmount the virtual CD-ROM.
47
- # @param action ~action&#x3D;unmount
48
46
  # @param request_body
49
47
  # @param [Hash] opts the optional parameters
50
48
  # @return [nil]
@@ -42,7 +42,6 @@ describe 'OvfLibraryItemApi' do
42
42
  # unit tests for deploy
43
43
  # Deploys an OVF package stored in content library to a newly created virtual machine or virtual appliance. &lt;p&gt; This {@term operation} deploys an OVF package which is stored in the library item specified by {@param.name ovfLibraryItemId}. It uses the deployment specification in {@param.name deploymentSpec} to deploy the OVF package to the location specified by {@param.name target}. &lt;/p&gt;
44
44
  # @param ovf_library_item_id Identifier of the content library item containing the OVF package to be deployed.
45
- # @param action ~action&#x3D;deploy
46
45
  # @param request_body
47
46
  # @param [Hash] opts the optional parameters
48
47
  # @return [VcenterOvfLibraryItemDeployResult]
@@ -31,7 +31,6 @@ describe 'StoragePoliciesApi' do
31
31
  # unit tests for check_compatibility
32
32
  # Returns datastore compatibility summary about a specific storage policy.
33
33
  # @param policy The storage policy identifier The parameter must be an identifier for the resource type: vcenter.StoragePolicy.
34
- # @param action action&#x3D;check-compatibility
35
34
  # @param request_body
36
35
  # @param [Hash] opts the optional parameters
37
36
  # @return [VcenterStoragePoliciesCheckCompatibilityResult]
@@ -31,7 +31,6 @@ describe 'TopologyPscsApi' do
31
31
  # unit tests for decommissiontask
32
32
  # Decommission the external Platform Services Controller node.
33
33
  # @param hostname FQDN or IP address of external Platform Services Controller node to be decommissioned.
34
- # @param action action&#x3D;decommission&amp;vmw-task
35
34
  # @param request_body
36
35
  # @param [Hash] opts the optional parameters
37
36
  # @return [VcenterTopologyPscsDecommissionTaskResult]
@@ -30,7 +30,6 @@ describe 'VchaClusterActiveApi' do
30
30
 
31
31
  # unit tests for get
32
32
  # Retrieves information about the active node of a VCHA cluster.
33
- # @param action action&#x3D;get
34
33
  # @param [Hash] opts the optional parameters
35
34
  # @option opts [VcenterVchaClusterActiveGet] :request_body
36
35
  # @return [VcenterVchaClusterActiveResult]
@@ -41,7 +41,6 @@ describe 'VchaClusterApi' do
41
41
 
42
42
  # unit tests for failovertask
43
43
  # Initiates failover from the active vCenter node to the passive node. For forced failover, Active node immediately initiates a failover. This may result into a data loss after failover. For planned failover, Active node flushes all the state to the Passive node, waits for the flush to complete before causing a failover. After the failover, Passive node starts without any data loss. A failover is allowed only in the following cases: 1. Cluster&#39;s mode is enabled and all cluster members are present. 2. Cluster&#39;s mode is maintenance and all cluster members are present.
44
- # @param action action&#x3D;failover&amp;vmw-task
45
44
  # @param request_body
46
45
  # @param [Hash] opts the optional parameters
47
46
  # @return [VcenterVchaClusterFailoverTaskResult]
@@ -40,7 +40,6 @@ describe 'VchaClusterModeApi' do
40
40
 
41
41
  # unit tests for settask
42
42
  # Manipulates the mode of a VCHA Cluster. Following mode transitions are allowed: enabled -&gt; disabled - Allowed only in healthy and degraded states. enabled -&gt; maintenance - Allowed only in healthy state. disabled -&gt; enabled - Allowed only in healthy state. maintenance -&gt; enabled - Allowed only in healthy state with all nodes are running the same version. maintenance -&gt; disabled - Allowed only in healthy state with all nodes are running the same version. All other transitions are not allowed. VCHA Cluster configuration remains intact in any of the cluster modes.
43
- # @param vmw_task vmw-task&#x3D;true
44
43
  # @param request_body
45
44
  # @param [Hash] opts the optional parameters
46
45
  # @return [VcenterVchaClusterModeSetTaskResult]
@@ -41,7 +41,6 @@ describe 'VchaClusterPassiveApi' do
41
41
 
42
42
  # unit tests for redeploytask
43
43
  # Creates the passive node in a degraded cluster with node location information and pre-existing VCHA cluster configuration from the active node.
44
- # @param action action&#x3D;redeploy&amp;vmw-task
45
44
  # @param request_body
46
45
  # @param [Hash] opts the optional parameters
47
46
  # @return [VcenterVchaClusterPassiveRedeployTaskResult]
@@ -41,7 +41,6 @@ describe 'VchaClusterWitnessApi' do
41
41
 
42
42
  # unit tests for redeploytask
43
43
  # Creates the witness node in a degraded cluster with node location information and pre-existing VCHA cluster configuration from the active node.
44
- # @param action action&#x3D;redeploy&amp;vmw-task
45
44
  # @param request_body
46
45
  # @param [Hash] opts the optional parameters
47
46
  # @return [VcenterVchaClusterWitnessRedeployTaskResult]
@@ -30,7 +30,6 @@ describe 'VchaVcCredentialsApi' do
30
30
 
31
31
  # unit tests for validate
32
32
  # Validates the credentials of the management vCenter server of the active node of a VCHA cluster.
33
- # @param action action&#x3D;validate
34
33
  # @param request_body
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @return [nil]
@@ -42,7 +42,6 @@ describe 'VmGuestPowerApi' do
42
42
  # unit tests for reboot
43
43
  # Issues a request to the guest operating system asking it to perform a reboot. This request returns immediately and does not wait for the guest operating system to complete the operation.
44
44
  # @param vm Identifier of the virtual machine. The parameter must be an identifier for the resource type: VirtualMachine.
45
- # @param action action&#x3D;reboot
46
45
  # @param [Hash] opts the optional parameters
47
46
  # @return [nil]
48
47
  describe 'reboot test' do
@@ -31,7 +31,6 @@ describe 'VmStoragePolicyComplianceApi' do
31
31
  # unit tests for check
32
32
  # Returns the storage policy Compliance Compliance.Info of a virtual machine after explicitly re-computing compliance check.
33
33
  # @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
34
- # @param action action&#x3D;check
35
34
  # @param [Hash] opts the optional parameters
36
35
  # @option opts [VcenterVmStoragePolicyComplianceCheck] :request_body
37
36
  # @return [VcenterVmStoragePolicyComplianceCheckResult]
@@ -42,7 +42,6 @@ describe 'VmTemplateLibraryItemsApi' do
42
42
  # unit tests for deploy
43
43
  # Deploys a virtual machine as a copy of the source virtual machine template contained in the library item specified by {@param.name templateLibraryItem}. It uses the deployment specification in {@param.name spec}. If {@link DeploySpec#poweredOn} and/or {@link DeploySpec#guestCustomization} are specified, the server triggers the power on and/or guest customization operations, which are executed asynchronously.
44
44
  # @param template_library_item identifier of the content library item containing the source virtual machine template to be deployed.
45
- # @param action action&#x3D;deploy
46
45
  # @param request_body
47
46
  # @param [Hash] opts the optional parameters
48
47
  # @return [VcenterVmTemplateLibraryItemsDeployResult]
@@ -8,6 +8,9 @@
8
8
 
9
9
  # load the gem
10
10
  require 'vsphere-automation-vcenter'
11
+ require 'webmock/rspec'
12
+
13
+ WebMock.disable_net_connect!(allow_localhost: true)
11
14
 
12
15
  # The following was generated by the `rspec --init` command. Conventionally, all
13
16
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@@ -22,9 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.description = "A Ruby SDK for the vSphere APIs (vCenter)"
23
23
  s.license = 'MIT'
24
24
  s.required_ruby_version = ">= 2.3"
25
-
26
- s.add_runtime_dependency 'vsphere-automation-runtime', '~> 0.3.0'
27
- s.add_runtime_dependency 'vsphere-automation-cis', '~> 0.3.0'
25
+ s.add_runtime_dependency 'vsphere-automation-runtime', '~> 0.4.0'
26
+ s.add_runtime_dependency 'vsphere-automation-cis', '~> 0.4.0'
28
27
 
29
28
  s.add_development_dependency 'bundler', '~> 2.0'
30
29
  s.add_development_dependency 'pry', '~> 0.12.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vsphere-automation-vcenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.R. Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vsphere-automation-runtime
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 0.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.0
26
+ version: 0.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: vsphere-automation-cis
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 0.4.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: 0.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -816,9 +816,6 @@ files:
816
816
  - lib/vsphere-automation-vcenter/api/vm_storage_policy_api.rb
817
817
  - lib/vsphere-automation-vcenter/api/vm_storage_policy_compliance_api.rb
818
818
  - lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb
819
- - lib/vsphere-automation-vcenter/api_client.rb
820
- - lib/vsphere-automation-vcenter/api_error.rb
821
- - lib/vsphere-automation-vcenter/configuration.rb
822
819
  - lib/vsphere-automation-vcenter/models/cis_task_progress.rb
823
820
  - lib/vsphere-automation-vcenter/models/cis_task_status.rb
824
821
  - lib/vsphere-automation-vcenter/models/vapi_std_dynamic_id.rb
@@ -1355,8 +1352,7 @@ files:
1355
1352
  - lib/vsphere-automation-vcenter/models/vcenter_vm_template_library_items_result.rb
1356
1353
  - lib/vsphere-automation-vcenter/models/vcenter_vm_template_library_items_vm_home_storage_info.rb
1357
1354
  - lib/vsphere-automation-vcenter/version.rb
1358
- - pkg/vsphere-automation-vcenter-0.2.1.gem
1359
- - pkg/vsphere-automation-vcenter-0.2.2.gem
1355
+ - pkg/vsphere-automation-vcenter-0.4.0.gem
1360
1356
  - spec/api/certificate_management_vcenter_tls_api_spec.rb
1361
1357
  - spec/api/certificate_management_vcenter_tls_csr_api_spec.rb
1362
1358
  - spec/api/certificate_management_vcenter_trusted_root_chains_api_spec.rb
@@ -1423,8 +1419,6 @@ files:
1423
1419
  - spec/api/vm_storage_policy_api_spec.rb
1424
1420
  - spec/api/vm_storage_policy_compliance_api_spec.rb
1425
1421
  - spec/api/vm_template_library_items_api_spec.rb
1426
- - spec/api_client_spec.rb
1427
- - spec/configuration_spec.rb
1428
1422
  - spec/models/cis_task_progress_spec.rb
1429
1423
  - spec/models/cis_task_status_spec.rb
1430
1424
  - spec/models/vapi_std_dynamic_id_spec.rb
@@ -2052,8 +2046,6 @@ test_files:
2052
2046
  - spec/api/system_config_deployment_type_api_spec.rb
2053
2047
  - spec/api/storage_policies_vm_api_spec.rb
2054
2048
  - spec/api/certificate_management_vcenter_tls_csr_api_spec.rb
2055
- - spec/api_client_spec.rb
2056
- - spec/configuration_spec.rb
2057
2049
  - spec/models/vcenter_vm_storage_policy_update_spec_spec.rb
2058
2050
  - spec/models/vcenter_vm_result_spec.rb
2059
2051
  - spec/models/vcenter_services_service_list_details_result_value_spec.rb
@@ -1,390 +0,0 @@
1
- =begin
2
- # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
3
- # SPDX-License-Identifier: MIT
4
-
5
- # DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
6
-
7
- # vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
8
-
9
- =end
10
-
11
- require 'date'
12
- require 'json'
13
- require 'logger'
14
- require 'tempfile'
15
- require 'typhoeus'
16
- require 'uri'
17
-
18
- module VSphereAutomation
19
- class ApiClient
20
- # The Configuration object holding settings to be used in the API client.
21
- attr_accessor :config
22
-
23
- # Defines the headers to be used in HTTP requests of all API calls by default.
24
- #
25
- # @return [Hash]
26
- attr_accessor :default_headers
27
-
28
- # Initializes the ApiClient
29
- # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
30
- def initialize(config = Configuration.default)
31
- @config = config
32
- @user_agent = "SDK/0.3.0 Ruby/#{RUBY_VERSION} (#{Gem::Platform.local.os}; #{Gem::Platform.local.version}; #{Gem::Platform.local.cpu})"
33
- @default_headers = {
34
- 'Content-Type' => 'application/json',
35
- 'User-Agent' => @user_agent
36
- }
37
- end
38
-
39
- def self.default
40
- @@default ||= ApiClient.new
41
- end
42
-
43
- # Call an API with given options.
44
- #
45
- # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
46
- # the data deserialized from response body (could be nil), response status code and response headers.
47
- def call_api(http_method, path, opts = {})
48
- request = build_request(http_method, path, opts)
49
- response = request.run
50
-
51
- if @config.debugging
52
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
53
- end
54
-
55
- unless opts.fetch(:return_type, {}).keys.include?(response.code.to_s) || response.success?
56
- if response.timed_out?
57
- fail ApiError.new('Connection timed out')
58
- elsif response.code == 0
59
- # Errors from libcurl will be made visible here
60
- fail ApiError.new(:code => 0,
61
- :message => response.return_message)
62
- else
63
- fail ApiError.new(:code => response.code,
64
- :response_headers => response.headers,
65
- :response_body => response.body),
66
- response.status_message
67
- end
68
- end
69
-
70
- if opts[:return_type]
71
- data = deserialize(response, opts[:return_type][response.code.to_s])
72
- if path == '/com/vmware/cis/session'
73
- @config.api_key['vmware-api-session-id'] = data.value
74
- end
75
- else
76
- data = nil
77
- end
78
- return data, response.code, response.headers
79
- end
80
-
81
- # Builds the HTTP request
82
- #
83
- # @param [String] http_method HTTP method/verb (e.g. POST)
84
- # @param [String] path URL path (e.g. /account/new)
85
- # @option opts [Hash] :header_params Header parameters
86
- # @option opts [Hash] :query_params Query parameters
87
- # @option opts [Hash] :form_params Query parameters
88
- # @option opts [Object] :body HTTP body (JSON/XML)
89
- # @return [Typhoeus::Request] A Typhoeus Request
90
- def build_request(http_method, path, opts = {})
91
- url = build_request_url(path)
92
- http_method = http_method.to_sym.downcase
93
-
94
- header_params = @default_headers.merge(opts[:header_params] || {})
95
- query_params = opts[:query_params] || {}
96
- form_params = opts[:form_params] || {}
97
-
98
- update_params_for_auth! header_params, query_params, opts[:auth_names]
99
-
100
- # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
101
- _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
102
-
103
- req_opts = {
104
- :method => http_method,
105
- :headers => header_params,
106
- :params => query_params,
107
- :params_encoding => @config.params_encoding,
108
- :timeout => @config.timeout,
109
- :ssl_verifypeer => @config.verify_ssl,
110
- :ssl_verifyhost => _verify_ssl_host,
111
- :sslcert => @config.cert_file,
112
- :sslkey => @config.key_file,
113
- :verbose => @config.debugging
114
- }
115
-
116
- # set custom cert, if provided
117
- req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
118
-
119
- if [:post, :patch, :put, :delete].include?(http_method)
120
- req_body = build_request_body(header_params, form_params, opts[:body])
121
- req_opts.update :body => req_body
122
- if @config.debugging
123
- @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
124
- end
125
- end
126
-
127
- request = Typhoeus::Request.new(url, req_opts)
128
- download_file(request) if opts[:return_type] == 'File'
129
- request
130
- end
131
-
132
- # Check if the given MIME is a JSON MIME.
133
- # JSON MIME examples:
134
- # application/json
135
- # application/json; charset=UTF8
136
- # APPLICATION/JSON
137
- # */*
138
- # @param [String] mime MIME
139
- # @return [Boolean] True if the MIME is application/json
140
- def json_mime?(mime)
141
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
142
- end
143
-
144
- # Deserialize the response to the given return type.
145
- #
146
- # @param [Response] response HTTP response
147
- # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
148
- def deserialize(response, return_type)
149
- body = response.body
150
-
151
- # handle file downloading - return the File instance processed in request callbacks
152
- # note that response body is empty when the file is written in chunks in request on_body callback
153
- return @tempfile if return_type == 'File'
154
-
155
- return nil if body.nil? || body.empty?
156
-
157
- # return response body directly for String return type
158
- return body if return_type == 'String'
159
-
160
- # ensuring a default content type
161
- content_type = response.headers['Content-Type'] || 'application/json'
162
-
163
- fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
164
-
165
- begin
166
- data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
167
- rescue JSON::ParserError => e
168
- if %w(String Date DateTime).include?(return_type)
169
- data = body
170
- else
171
- raise e
172
- end
173
- end
174
-
175
- convert_to_type data, return_type
176
- end
177
-
178
- # Convert data to the given return type.
179
- # @param [Object] data Data to be converted
180
- # @param [String] return_type Return type
181
- # @return [Mixed] Data in a particular type
182
- def convert_to_type(data, return_type)
183
- return nil if data.nil?
184
- case return_type
185
- when 'String'
186
- data.to_s
187
- when 'Integer'
188
- data.to_i
189
- when 'Float'
190
- data.to_f
191
- when 'BOOLEAN'
192
- data == true
193
- when 'DateTime'
194
- # parse date time (expecting ISO 8601 format)
195
- DateTime.parse data
196
- when 'Date'
197
- # parse date time (expecting ISO 8601 format)
198
- Date.parse data
199
- when 'Object'
200
- # generic object (usually a Hash), return directly
201
- data
202
- when /\AArray<(.+)>\z/
203
- # e.g. Array<Pet>
204
- sub_type = $1
205
- data.map { |item| convert_to_type(item, sub_type) }
206
- when /\AHash\<String, (.+)\>\z/
207
- # e.g. Hash<String, Integer>
208
- sub_type = $1
209
- {}.tap do |hash|
210
- data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
211
- end
212
- else
213
- # models, e.g. Pet
214
- VSphereAutomation.const_get(return_type).new.tap do |model|
215
- model.build_from_hash data
216
- end
217
- end
218
- end
219
-
220
- # Save response body into a file in (the defined) temporary folder, using the filename
221
- # from the "Content-Disposition" header if provided, otherwise a random filename.
222
- # The response body is written to the file in chunks in order to handle files which
223
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
224
- # process can use.
225
- #
226
- # @see Configuration#temp_folder_path
227
- def download_file(request)
228
- tempfile = nil
229
- encoding = nil
230
- request.on_headers do |response|
231
- content_disposition = response.headers['Content-Disposition']
232
- if content_disposition && content_disposition =~ /filename=/i
233
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
234
- prefix = sanitize_filename(filename)
235
- else
236
- prefix = 'download-'
237
- end
238
- prefix = prefix + '-' unless prefix.end_with?('-')
239
- encoding = response.body.encoding
240
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
241
- @tempfile = tempfile
242
- end
243
- request.on_body do |chunk|
244
- chunk.force_encoding(encoding)
245
- tempfile.write(chunk)
246
- end
247
- request.on_complete do |response|
248
- tempfile.close
249
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
250
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
251
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
252
- "explicitly with `tempfile.delete`"
253
- end
254
- end
255
-
256
- # Sanitize filename by removing path.
257
- # e.g. ../../sun.gif becomes sun.gif
258
- #
259
- # @param [String] filename the filename to be sanitized
260
- # @return [String] the sanitized filename
261
- def sanitize_filename(filename)
262
- filename.gsub(/.*[\/\\]/, '')
263
- end
264
-
265
- def build_request_url(path)
266
- # Add leading and trailing slashes to path
267
- path = "/#{path}".gsub(/\/+/, '/')
268
- URI.encode(@config.base_url + path)
269
- end
270
-
271
- # Builds the HTTP request body
272
- #
273
- # @param [Hash] header_params Header parameters
274
- # @param [Hash] form_params Query parameters
275
- # @param [Object] body HTTP body (JSON/XML)
276
- # @return [String] HTTP body data in the form of string
277
- def build_request_body(header_params, form_params, body)
278
- # http form
279
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
280
- header_params['Content-Type'] == 'multipart/form-data'
281
- data = {}
282
- form_params.each do |key, value|
283
- case value
284
- when ::File, ::Array, nil
285
- # let typhoeus handle File, Array and nil parameters
286
- data[key] = value
287
- else
288
- data[key] = value.to_s
289
- end
290
- end
291
- elsif body
292
- data = body.is_a?(String) ? body : body.to_json
293
- else
294
- data = nil
295
- end
296
- data
297
- end
298
-
299
- # Update hearder and query params based on authentication settings.
300
- #
301
- # @param [Hash] header_params Header parameters
302
- # @param [Hash] query_params Query parameters
303
- # @param [String] auth_names Authentication scheme name
304
- def update_params_for_auth!(header_params, query_params, auth_names)
305
- Array(auth_names).each do |auth_name|
306
- auth_setting = @config.auth_settings[auth_name]
307
- next unless auth_setting
308
- case auth_setting[:in]
309
- when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
310
- when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
311
- else fail ArgumentError, 'Authentication token must be in `query` of `header`'
312
- end
313
- end
314
- end
315
-
316
- # Sets user agent in HTTP header
317
- #
318
- # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
319
- def user_agent=(user_agent)
320
- @user_agent = user_agent
321
- @default_headers['User-Agent'] = @user_agent
322
- end
323
-
324
- # Return Accept header based on an array of accepts provided.
325
- # @param [Array] accepts array for Accept
326
- # @return [String] the Accept header (e.g. application/json)
327
- def select_header_accept(accepts)
328
- return nil if accepts.nil? || accepts.empty?
329
- # use JSON when present, otherwise use all of the provided
330
- json_accept = accepts.find { |s| json_mime?(s) }
331
- json_accept || accepts.join(',')
332
- end
333
-
334
- # Return Content-Type header based on an array of content types provided.
335
- # @param [Array] content_types array for Content-Type
336
- # @return [String] the Content-Type header (e.g. application/json)
337
- def select_header_content_type(content_types)
338
- # use application/json by default
339
- return 'application/json' if content_types.nil? || content_types.empty?
340
- # use JSON when present, otherwise use the first one
341
- json_content_type = content_types.find { |s| json_mime?(s) }
342
- json_content_type || content_types.first
343
- end
344
-
345
- # Convert object (array, hash, object, etc) to JSON string.
346
- # @param [Object] model object to be converted into JSON string
347
- # @return [String] JSON string representation of the object
348
- def object_to_http_body(model)
349
- return model if model.nil? || model.is_a?(String)
350
- local_body = nil
351
- if model.is_a?(Array)
352
- local_body = model.map { |m| object_to_hash(m) }
353
- else
354
- local_body = object_to_hash(model)
355
- end
356
- local_body.to_json
357
- end
358
-
359
- # Convert object(non-array) to hash.
360
- # @param [Object] obj object to be converted into JSON string
361
- # @return [String] JSON string representation of the object
362
- def object_to_hash(obj)
363
- if obj.respond_to?(:to_hash)
364
- obj.to_hash
365
- else
366
- obj
367
- end
368
- end
369
-
370
- # Build parameter value according to the given collection format.
371
- # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
372
- def build_collection_param(param, collection_format)
373
- case collection_format
374
- when :csv
375
- param.join(',')
376
- when :ssv
377
- param.join(' ')
378
- when :tsv
379
- param.join("\t")
380
- when :pipes
381
- param.join('|')
382
- when :multi
383
- # return the array directly as typhoeus will handle it as expected
384
- param
385
- else
386
- fail "unknown collection format: #{collection_format.inspect}"
387
- end
388
- end
389
- end
390
- end