diff --git a/gen/gen.sh b/gen/gen.sh index 4fe13c71b..458cc14da 100755 --- a/gen/gen.sh +++ b/gen/gen.sh @@ -69,7 +69,7 @@ ensure_rb_vmodl # # The VIM API version used by the vim25 client. # -VIM_VERSION="${VIM_VERSION:-8.0.1.0}" +VIM_VERSION="${VIM_VERSION:-8.0.2.0}" # # Update the vim25 client's VIM version. @@ -78,7 +78,7 @@ update_vim_version "${VIM_VERSION}" # -# All types derive from vSphere 8.0U1c GA, vcenter-all build 22088981. +# All types derive from vSphere 8.0U2 GA, vcenter-all build 22385739. # export COPYRIGHT_DATE_RANGE="2014-2023" @@ -89,14 +89,14 @@ export COPYRIGHT_DATE_RANGE="2014-2023" # export FORCE_BASE_INTERFACE_FOR_TYPES="AgencyConfigInfo" -# ./sdk/ contains the contents of wsdl.zip from vimbase build 21886307. +# ./sdk/ contains the contents of wsdl.zip from vimbase build 22026368. generate "../vim25" "vim" "./rbvmomi/vmodl.db" # from github.com/vmware/rbvmomi@v3.0.0 generate "../pbm" "pbm" generate "../vslm" "vslm" generate "../sms" "sms" # ./sdk/ contains the files eam-messagetypes.xsd and eam-types.xsd from -# eam-wsdl.zip, from eam-vcenter build 21054104. +# eam-wsdl.zip, from eam-vcenter build 22026240. # # Please note the EAM files are also available at the following, public URL -- # http://bit.ly/eam-sdk, therefore the WSDL resource for EAM are in fact diff --git a/gen/gen_from_vmodl.rb b/gen/gen_from_vmodl.rb index b75325e09..a83d0cb3c 100644 --- a/gen/gen_from_vmodl.rb +++ b/gen/gen_from_vmodl.rb @@ -109,7 +109,7 @@ def var_type end def var_tag - "mo:\"%s\"" % name + "json:\"%s\"" % name end def dump(io) diff --git a/gen/vim_wsdl.rb b/gen/vim_wsdl.rb index 5f6cc49f5..2d7948f96 100644 --- a/gen/vim_wsdl.rb +++ b/gen/vim_wsdl.rb @@ -17,7 +17,7 @@ # SINCE_API_FORMAT is used to capture the minimum API version for which some API # symbol is valid. -SINCE_API_FORMAT = /^\*\*\*Since:\*\*\* \w+? API (.+)$/ +SINCE_API_FORMAT = /^\*\*\*Since:\*\*\* \w+? API (?:Release )?(.+)$/ # ENCLOSED_BY_ASTERIK_FORMAT is used to capture words enclosed by a single # asterik on either side. @@ -58,23 +58,31 @@ def init_type(io, name, kind, minApiVersion=nil, minApiVersionsForValues=nil) io.print "func init() {\n" - if minApiVersion != nil - io.print "minAPIVersionForType[\"#{name}\"] = \"#{minApiVersion}\"\n" - end - if minApiVersionsForValues != nil - io.print "minAPIVersionForEnumValue[\"#{name}\"] = map[string]string{\n" - minApiVersionsForValues.each do |k, v| - io.print "\t\t\"#{k}\": \"#{v}\",\n" - end - io.print "}\n" - end if $target == "vim25" io.print "t[\"#{name}\"] = #{t}\n" + if minApiVersion != nil + io.print "minAPIVersionForType[\"#{name}\"] = \"#{minApiVersion}\"\n" + end + if minApiVersionsForValues != nil + io.print "minAPIVersionForEnumValue[\"#{name}\"] = map[string]string{\n" + minApiVersionsForValues.each do |k, v| + io.print "\t\t\"#{k}\": \"#{v}\",\n" + end + io.print "}\n" + end else unless name.start_with? "Base" name = "#{$target}:#{name}" end io.print "types.Add(\"#{name}\", #{t})\n" + if minApiVersion != nil + io.print "types.AddMinAPIVersionForType(\"#{name}\", \"#{minApiVersion}\")\n" + end + if minApiVersionsForValues != nil + minApiVersionsForValues.each do |k, v| + io.print "types.AddMinAPIVersionForEnumValue(\"#{name}\", \"#{k}\", \"#{v}\")\n" + end + end end io.print "}\n\n" diff --git a/govc/test/cli.bats b/govc/test/cli.bats index 029fb53b2..7d6c91cee 100755 --- a/govc/test/cli.bats +++ b/govc/test/cli.bats @@ -29,7 +29,7 @@ load test_helper assert_success version=$(govc about -json -c | jq -r .Client.Version) - assert_equal 8.0.1.0 "$version" # govc's default version + assert_equal 8.0.2.0 "$version" # govc's default version version=$(govc about -json -c -vim-version "" | jq -r .Client.Version) assert_equal uE53DA "$version" # vcsim's service version diff --git a/vim25/mo/type_info.go b/vim25/mo/type_info.go index aeb7d4a79..0a2c229d2 100644 --- a/vim25/mo/type_info.go +++ b/vim25/mo/type_info.go @@ -80,7 +80,7 @@ func buildName(fn string, f reflect.StructField) string { fn += "." } - motag := f.Tag.Get("mo") + motag := f.Tag.Get("json") if motag != "" { return fn + motag } diff --git a/vim25/types/registry.go b/vim25/types/registry.go index a49bc2a8b..6fdb1fa75 100644 --- a/vim25/types/registry.go +++ b/vim25/types/registry.go @@ -37,6 +37,20 @@ func Add(name string, kind reflect.Type) { t[name] = kind } +func AddMinAPIVersionForType(name, minAPIVersion string) { + minAPIVersionForType[name] = minAPIVersion +} + +func AddMinAPIVersionForEnumValue(enumName, enumValue, minAPIVersion string) { + if v, ok := minAPIVersionForEnumValue[enumName]; ok { + v[enumValue] = minAPIVersion + } else { + minAPIVersionForEnumValue[enumName] = map[string]string{ + enumValue: minAPIVersion, + } + } +} + type Func func(string) (reflect.Type, bool) func TypeFunc() Func {