build(deps): bump the go-deps group with 6 updates

Bumps the go-deps group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.45.10` | `1.45.16` |
| [github.com/gophercloud/gophercloud](https://github.com/gophercloud/gophercloud) | `1.6.0` | `1.7.0` |
| [github.com/openshift-online/ocm-sdk-go](https://github.com/openshift-online/ocm-sdk-go) | `0.1.364` | `0.1.371` |
| [github.com/osbuild/images](https://github.com/osbuild/images) | `0.5.1-0.20230915095808-dd48a38be218` | `0.7.0` |
| [github.com/vmware/govmomi](https://github.com/vmware/govmomi) | `0.30.7` | `0.31.0` |
| [google.golang.org/api](https://github.com/googleapis/google-api-go-client) | `0.142.0` | `0.143.0` |


Updates `github.com/aws/aws-sdk-go` from 1.45.10 to 1.45.16
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.45.10...v1.45.16)

Updates `github.com/gophercloud/gophercloud` from 1.6.0 to 1.7.0
- [Release notes](https://github.com/gophercloud/gophercloud/releases)
- [Changelog](https://github.com/gophercloud/gophercloud/blob/v1.7.0/CHANGELOG.md)
- [Commits](https://github.com/gophercloud/gophercloud/compare/v1.6.0...v1.7.0)

Updates `github.com/openshift-online/ocm-sdk-go` from 0.1.364 to 0.1.371
- [Release notes](https://github.com/openshift-online/ocm-sdk-go/releases)
- [Changelog](https://github.com/openshift-online/ocm-sdk-go/blob/main/CHANGES.md)
- [Commits](https://github.com/openshift-online/ocm-sdk-go/compare/v0.1.364...v0.1.371)

Updates `github.com/osbuild/images` from 0.5.1-0.20230915095808-dd48a38be218 to 0.7.0
- [Release notes](https://github.com/osbuild/images/releases)
- [Commits](https://github.com/osbuild/images/commits/v0.7.0)

Updates `github.com/vmware/govmomi` from 0.30.7 to 0.31.0
- [Release notes](https://github.com/vmware/govmomi/releases)
- [Changelog](https://github.com/vmware/govmomi/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vmware/govmomi/compare/v0.30.7...v0.31.0)

Updates `google.golang.org/api` from 0.142.0 to 0.143.0
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.142.0...v0.143.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: github.com/gophercloud/gophercloud
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/openshift-online/ocm-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: github.com/osbuild/images
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/vmware/govmomi
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2023-09-26 04:16:38 +00:00 committed by Sanne Raymaekers
parent 9d7159dab3
commit 41aacd8817
88 changed files with 65996 additions and 13187 deletions

22
go.mod
View file

@ -12,7 +12,7 @@ require (
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
github.com/BurntSushi/toml v1.3.2
github.com/aws/aws-sdk-go v1.45.10
github.com/aws/aws-sdk-go v1.45.16
github.com/coreos/go-semver v0.3.1
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/deepmap/oapi-codegen v1.8.2
@ -21,7 +21,7 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.1
github.com/gophercloud/gophercloud v1.6.0
github.com/gophercloud/gophercloud v1.7.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/jackc/pgtype v1.14.0
github.com/jackc/pgx/v4 v4.18.1
@ -29,25 +29,25 @@ require (
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b
github.com/labstack/echo/v4 v4.11.1
github.com/labstack/gommon v0.4.0
github.com/openshift-online/ocm-sdk-go v0.1.364
github.com/openshift-online/ocm-sdk-go v0.1.371
github.com/oracle/oci-go-sdk/v54 v54.0.0
github.com/osbuild/images v0.5.1-0.20230915095808-dd48a38be218
github.com/osbuild/images v0.7.0
github.com/prometheus/client_golang v1.16.0
github.com/segmentio/ksuid v1.0.4
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/ubccr/kerby v0.0.0-20170626144437-201a958fc453
github.com/vmware/govmomi v0.30.7
github.com/vmware/govmomi v0.31.0
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/oauth2 v0.12.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.12.0
google.golang.org/api v0.141.0
google.golang.org/api v0.143.0
)
require (
cloud.google.com/go v0.110.6 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 // indirect
@ -99,7 +99,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-containerregistry v0.16.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
@ -173,9 +173,9 @@ require (
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect

44
go.sum
View file

@ -13,8 +13,8 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q=
cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI=
cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o=
cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
@ -98,8 +98,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.45.10 h1:GoqAm25t0qrs4rrXAjqt3luZnM9mV0lzfNwzgaCKpm4=
github.com/aws/aws-sdk-go v1.45.10/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.45.16 h1:spca2z7UJgoQ5V2fX6XiHDCj2E65kOJAfbUPozSkE24=
github.com/aws/aws-sdk-go v1.45.16/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@ -346,14 +346,14 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM=
github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w=
github.com/googleapis/enterprise-certificate-proxy v0.3.1 h1:SBWmZhjUDRorQxrN0nwzf+AHBxnbFjViHQS4P0yVpmQ=
github.com/googleapis/enterprise-certificate-proxy v0.3.1/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas=
github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
github.com/gophercloud/gophercloud v1.6.0 h1:JwJN1bauRnWPba5ueWs9IluONHteXPWjjK+MvfM4krY=
github.com/gophercloud/gophercloud v1.6.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/gophercloud v1.7.0 h1:fyJGKh0LBvIZKLvBWvQdIgkaV5yTM3Jh9EYUh+UNCAs=
github.com/gophercloud/gophercloud v1.7.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
@ -574,12 +574,12 @@ github.com/opencontainers/runc v1.1.9 h1:XR0VIHTGce5eWPkaPesqTBrhW2yAcaraWfsEalN
github.com/opencontainers/runc v1.1.9/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50=
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/openshift-online/ocm-sdk-go v0.1.364 h1:Oaol0hc/5EaGan6zlU+rGEaqu+wI8TbY8/XbWm5mHoU=
github.com/openshift-online/ocm-sdk-go v0.1.364/go.mod h1:KYOw8kAKAHyPrJcQoVR82CneQ4ofC02Na4cXXaTq4Nw=
github.com/openshift-online/ocm-sdk-go v0.1.371 h1:9/VPu3YZG1XxSwno81UWbOGFlr1fJU4mQIlvVqZhhHs=
github.com/openshift-online/ocm-sdk-go v0.1.371/go.mod h1:KYOw8kAKAHyPrJcQoVR82CneQ4ofC02Na4cXXaTq4Nw=
github.com/oracle/oci-go-sdk/v54 v54.0.0 h1:CDLjeSejv2aDpElAJrhKpi6zvT/zhZCZuXchUUZ+LS4=
github.com/oracle/oci-go-sdk/v54 v54.0.0/go.mod h1:+t+yvcFGVp+3ZnztnyxqXfQDsMlq8U25faBLa+mqCMc=
github.com/osbuild/images v0.5.1-0.20230915095808-dd48a38be218 h1:EhsTDn5qIp3MlhzRqD12UtG3SAhikCekjgZSVeZ+2wM=
github.com/osbuild/images v0.5.1-0.20230915095808-dd48a38be218/go.mod h1:fgwdEAURXcQjQzNc1igQ3Kn2mSJKNCN6DPOfLoLPWDc=
github.com/osbuild/images v0.7.0 h1:ZYRnjriW734sQt2FWROVze4oEFM/pD2nAss5mE/CWwo=
github.com/osbuild/images v0.7.0/go.mod h1:qQeyRP2cjKLusNtaFKPeheHlCdvpenlz5as+/W5u4Ss=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -699,8 +699,8 @@ github.com/vbauerster/mpb/v8 v8.6.1 h1:XbBpIbJxJOO9yMcKPpI4oEFPW6tLAptefNQJNcGWr
github.com/vbauerster/mpb/v8 v8.6.1/go.mod h1:S0tuIjikxlLxCeNijNhwAuD/BB3UE/d2nygG8SOldk0=
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vmware/govmomi v0.30.7 h1:YO8CcDpLJzmq6PK5/CBQbXyV21iCMh8SbdXt+xNkXp8=
github.com/vmware/govmomi v0.30.7/go.mod h1:epgoslm97rLECMV4D+08ORzUBEU7boFSepKjt7AYVGg=
github.com/vmware/govmomi v0.31.0 h1:+NC7le8yeXj7f4YUC841jgdWsehN7A3ivqLxm79eKyo=
github.com/vmware/govmomi v0.31.0/go.mod h1:JA63Pg0SgQcSjk+LuPzjh3rJdcWBo/ZNCIwbb1qf2/0=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
@ -1047,8 +1047,8 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/api v0.141.0 h1:Df6vfMgDoIM6ss0m7H4MPwFwY87WNXHfBIda/Bmfl4E=
google.golang.org/api v0.141.0/go.mod h1:iZqLkdPlXKyG0b90eu6KxVSE4D/ccRF2e/doKD2CnQQ=
google.golang.org/api v0.143.0 h1:o8cekTkqhywkbZT6p1UHJPZ9+9uuCAJs/KYomxZB8fA=
google.golang.org/api v0.143.0/go.mod h1:FoX9DO9hT7DLNn97OuoZAGSDuNAXdJRuGK98rSUgurk=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@ -1086,12 +1086,12 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 h1:o4LtQxebKIJ4vkzyhtD2rfUNZ20Zf0ik5YVP5E7G7VE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA=
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4=
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI=
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=

View file

@ -26,7 +26,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/advisorynotifications/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/ai/generativelanguage/apiv1beta2": {
@ -89,6 +89,16 @@
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/alloydb/connectors/apiv1alpha": {
"api_shortname": "connectors",
"distribution_name": "cloud.google.com/go/alloydb/connectors/apiv1alpha",
"description": "AlloyDB connectors",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/alloydb/latest/connectors/apiv1alpha",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/analytics/admin/apiv1alpha": {
"api_shortname": "analyticsadmin",
"distribution_name": "cloud.google.com/go/analytics/admin/apiv1alpha",
@ -276,7 +286,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/beyondcorp/latest/appconnections/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/beyondcorp/appconnectors/apiv1": {
@ -286,7 +296,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/beyondcorp/latest/appconnectors/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/beyondcorp/appgateways/apiv1": {
@ -296,7 +306,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/beyondcorp/latest/appgateways/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/beyondcorp/clientconnectorservices/apiv1": {
@ -306,7 +316,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/beyondcorp/latest/clientconnectorservices/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/beyondcorp/clientgateways/apiv1": {
@ -316,7 +326,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/beyondcorp/latest/clientgateways/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/bigquery": {
@ -336,7 +346,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/bigquery/latest/analyticshub/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/bigquery/connection/apiv1": {
@ -376,7 +386,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/bigquery/latest/datapolicies/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/bigquery/datapolicies/apiv1beta1": {
@ -545,7 +555,7 @@
"description": "Cloud Build API",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/cloudbuild/apiv1/v2",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/cloudbuild/latest/apiv1/v2",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
@ -599,6 +609,16 @@
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/commerce/consumer/procurement/apiv1": {
"api_shortname": "cloudcommerceconsumerprocurement",
"distribution_name": "cloud.google.com/go/commerce/consumer/procurement/apiv1",
"description": "Cloud Commerce Consumer Procurement API",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/commerce/latest/consumer/procurement/apiv1",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/compute/apiv1": {
"api_shortname": "compute",
"distribution_name": "cloud.google.com/go/compute/apiv1",
@ -626,7 +646,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/confidentialcomputing/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/confidentialcomputing/apiv1alpha1": {
@ -696,7 +716,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/datacatalog/latest/lineage/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/dataflow/apiv1beta3": {
@ -826,13 +846,13 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/debugger/apiv2",
"release_level": "stable",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/deploy/apiv1": {
"api_shortname": "clouddeploy",
"distribution_name": "cloud.google.com/go/deploy/apiv1",
"description": "Google Cloud Deploy API",
"description": "Cloud Deploy API",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/deploy/latest/apiv1",
@ -886,7 +906,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/discoveryengine/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/discoveryengine/apiv1beta": {
@ -996,7 +1016,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/eventarc/latest/publishing/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/filestore/apiv1": {
@ -1106,7 +1126,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/gkemulticloud/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/gsuiteaddons/apiv1": {
@ -1306,7 +1326,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/maps/latest/places/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/maps/routing/apiv2": {
@ -1419,6 +1439,16 @@
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/netapp/apiv1": {
"api_shortname": "netapp",
"distribution_name": "cloud.google.com/go/netapp/apiv1",
"description": "NetApp API",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/netapp/latest/apiv1",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/networkconnectivity/apiv1": {
"api_shortname": "networkconnectivity",
"distribution_name": "cloud.google.com/go/networkconnectivity/apiv1",
@ -1589,6 +1619,16 @@
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/policysimulator/apiv1": {
"api_shortname": "policysimulator",
"distribution_name": "cloud.google.com/go/policysimulator/apiv1",
"description": "Policy Simulator API",
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/policysimulator/latest/apiv1",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/policytroubleshooter/apiv1": {
"api_shortname": "policytroubleshooter",
"distribution_name": "cloud.google.com/go/policytroubleshooter/apiv1",
@ -1666,7 +1706,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/rapidmigrationassessment/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/recaptchaenterprise/v2/apiv1": {
@ -2036,7 +2076,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/speech/latest/apiv2",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/storage": {
@ -2086,7 +2126,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/support/latest/apiv2",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/talent/apiv4": {
@ -2176,7 +2216,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/video/stitcher/apiv1",
"release_level": "stable",
"release_level": "preview",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/video/transcoder/apiv1": {
@ -2256,7 +2296,7 @@
"language": "go",
"client_library_type": "generated",
"client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/vmwareengine/latest/apiv1",
"release_level": "preview",
"release_level": "stable",
"library_type": "GAPIC_AUTO"
},
"cloud.google.com/go/vpcaccess/apiv1": {

View file

@ -7212,6 +7212,9 @@ var awsPartition = partition{
endpointKey{
Region: "ap-south-1",
}: endpoint{},
endpointKey{
Region: "ap-south-2",
}: endpoint{},
endpointKey{
Region: "ap-southeast-1",
}: endpoint{},
@ -7242,12 +7245,18 @@ var awsPartition = partition{
endpointKey{
Region: "eu-central-1",
}: endpoint{},
endpointKey{
Region: "eu-central-2",
}: endpoint{},
endpointKey{
Region: "eu-north-1",
}: endpoint{},
endpointKey{
Region: "eu-south-1",
}: endpoint{},
endpointKey{
Region: "eu-south-2",
}: endpoint{},
endpointKey{
Region: "eu-west-1",
}: endpoint{},
@ -7260,6 +7269,9 @@ var awsPartition = partition{
endpointKey{
Region: "il-central-1",
}: endpoint{},
endpointKey{
Region: "me-central-1",
}: endpoint{},
endpointKey{
Region: "me-south-1",
}: endpoint{},
@ -20349,6 +20361,14 @@ var awsPartition = partition{
Region: "eu-central-1",
},
},
endpointKey{
Region: "eu-central-2",
}: endpoint{
Hostname: "oidc.eu-central-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "eu-central-2",
},
},
endpointKey{
Region: "eu-north-1",
}: endpoint{
@ -21180,6 +21200,9 @@ var awsPartition = partition{
endpointKey{
Region: "ap-south-1",
}: endpoint{},
endpointKey{
Region: "ap-south-2",
}: endpoint{},
endpointKey{
Region: "ap-southeast-1",
}: endpoint{},
@ -21195,12 +21218,18 @@ var awsPartition = partition{
endpointKey{
Region: "eu-central-1",
}: endpoint{},
endpointKey{
Region: "eu-central-2",
}: endpoint{},
endpointKey{
Region: "eu-north-1",
}: endpoint{},
endpointKey{
Region: "eu-south-1",
}: endpoint{},
endpointKey{
Region: "eu-south-2",
}: endpoint{},
endpointKey{
Region: "eu-west-1",
}: endpoint{},
@ -21447,6 +21476,14 @@ var awsPartition = partition{
Region: "eu-central-1",
},
},
endpointKey{
Region: "eu-central-2",
}: endpoint{
Hostname: "portal.sso.eu-central-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "eu-central-2",
},
},
endpointKey{
Region: "eu-north-1",
}: endpoint{
@ -27978,6 +28015,9 @@ var awsPartition = partition{
endpointKey{
Region: "eu-central-1",
}: endpoint{},
endpointKey{
Region: "eu-central-2",
}: endpoint{},
endpointKey{
Region: "eu-north-1",
}: endpoint{},
@ -33201,6 +33241,26 @@ var awscnPartition = partition{
}: endpoint{},
},
},
"oidc": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "cn-north-1",
}: endpoint{
Hostname: "oidc.cn-north-1.amazonaws.com.cn",
CredentialScope: credentialScope{
Region: "cn-north-1",
},
},
endpointKey{
Region: "cn-northwest-1",
}: endpoint{
Hostname: "oidc.cn-northwest-1.amazonaws.com.cn",
CredentialScope: credentialScope{
Region: "cn-northwest-1",
},
},
},
},
"organizations": service{
PartitionEndpoint: "aws-cn-global",
IsRegionalized: boxedFalse,
@ -33239,6 +33299,26 @@ var awscnPartition = partition{
}: endpoint{},
},
},
"portal.sso": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "cn-north-1",
}: endpoint{
Hostname: "portal.sso.cn-north-1.amazonaws.com.cn",
CredentialScope: credentialScope{
Region: "cn-north-1",
},
},
endpointKey{
Region: "cn-northwest-1",
}: endpoint{
Hostname: "portal.sso.cn-northwest-1.amazonaws.com.cn",
CredentialScope: credentialScope{
Region: "cn-northwest-1",
},
},
},
},
"ram": service{
Endpoints: serviceEndpoints{
endpointKey{
@ -33670,6 +33750,16 @@ var awscnPartition = partition{
}: endpoint{},
},
},
"sso": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "cn-north-1",
}: endpoint{},
endpointKey{
Region: "cn-northwest-1",
}: endpoint{},
},
},
"states": service{
Endpoints: serviceEndpoints{
endpointKey{
@ -38439,6 +38529,16 @@ var awsusgovPartition = partition{
}: endpoint{},
},
},
"rolesanywhere": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "us-gov-east-1",
}: endpoint{},
endpointKey{
Region: "us-gov-west-1",
}: endpoint{},
},
},
"route53": service{
PartitionEndpoint: "aws-us-gov-global",
IsRegionalized: boxedFalse,

View file

@ -389,8 +389,15 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, e
updateString(&cfg.Region, section, regionKey)
updateString(&cfg.CustomCABundle, section, customCABundleKey)
// we're retaining a behavioral quirk with this field that existed before
// the removal of literal parsing for (aws-sdk-go-v2/#2276):
// - if the key is missing, the config field will not be set
// - if the key is set to a non-numeric, the config field will be set to 0
if section.Has(roleDurationSecondsKey) {
d := time.Duration(section.Int(roleDurationSecondsKey)) * time.Second
var d time.Duration
if v, ok := section.Int(roleDurationSecondsKey); ok {
d = time.Duration(v) * time.Second
}
cfg.AssumeRoleDuration = &d
}
@ -668,7 +675,10 @@ func updateBool(dst *bool, section ini.Section, key string) {
if !section.Has(key) {
return
}
*dst = section.Bool(key)
// retains pre-(aws-sdk-go-v2#2276) behavior where non-bool value would resolve to false
v, _ := section.Bool(key)
*dst = v
}
// updateBoolPtr will only update the dst with the value in the section key,
@ -677,8 +687,11 @@ func updateBoolPtr(dst **bool, section ini.Section, key string) {
if !section.Has(key) {
return
}
// retains pre-(aws-sdk-go-v2#2276) behavior where non-bool value would resolve to false
v, _ := section.Bool(key)
*dst = new(bool)
**dst = section.Bool(key)
**dst = v
}
// SharedConfigLoadError is an error for the shared config file failed to load.
@ -805,7 +818,8 @@ func updateUseDualStackEndpoint(dst *endpoints.DualStackEndpointState, section i
return
}
if section.Bool(key) {
// retains pre-(aws-sdk-go-v2/#2276) behavior where non-bool value would resolve to false
if v, _ := section.Bool(key); v {
*dst = endpoints.DualStackEndpointStateEnabled
} else {
*dst = endpoints.DualStackEndpointStateDisabled
@ -821,7 +835,8 @@ func updateUseFIPSEndpoint(dst *endpoints.FIPSEndpointState, section ini.Section
return
}
if section.Bool(key) {
// retains pre-(aws-sdk-go-v2/#2276) behavior where non-bool value would resolve to false
if v, _ := section.Bool(key); v {
*dst = endpoints.FIPSEndpointStateEnabled
} else {
*dst = endpoints.FIPSEndpointStateDisabled

View file

@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"
// SDKVersion is the version of this SDK
const SDKVersion = "1.45.10"
const SDKVersion = "1.45.16"

View file

@ -154,11 +154,11 @@ func (v ValueType) String() string {
// ValueType enums
const (
NoneType = ValueType(iota)
DecimalType
IntegerType
DecimalType // deprecated
IntegerType // deprecated
StringType
QuotedStringType
BoolType
BoolType // deprecated
)
// Value is a union container
@ -166,9 +166,9 @@ type Value struct {
Type ValueType
raw []rune
integer int64
decimal float64
boolean bool
integer int64 // deprecated
decimal float64 // deprecated
boolean bool // deprecated
str string
}
@ -253,24 +253,6 @@ func newLitToken(b []rune) (Token, int, error) {
}
token = newToken(TokenLit, b[:n], QuotedStringType)
} else if isNumberValue(b) {
var base int
base, n, err = getNumericalValue(b)
if err != nil {
return token, 0, err
}
value := b[:n]
vType := IntegerType
if contains(value, '.') || hasExponent(value) {
vType = DecimalType
}
token = newToken(TokenLit, value, vType)
token.base = base
} else if isBoolValue(b) {
n, err = getBoolValue(b)
token = newToken(TokenLit, b[:n], BoolType)
} else {
n, err = getValue(b)
token = newToken(TokenLit, b[:n], StringType)
@ -280,18 +262,33 @@ func newLitToken(b []rune) (Token, int, error) {
}
// IntValue returns an integer value
func (v Value) IntValue() int64 {
return v.integer
func (v Value) IntValue() (int64, bool) {
i, err := strconv.ParseInt(string(v.raw), 0, 64)
if err != nil {
return 0, false
}
return i, true
}
// FloatValue returns a float value
func (v Value) FloatValue() float64 {
return v.decimal
func (v Value) FloatValue() (float64, bool) {
f, err := strconv.ParseFloat(string(v.raw), 64)
if err != nil {
return 0, false
}
return f, true
}
// BoolValue returns a bool value
func (v Value) BoolValue() bool {
return v.boolean
func (v Value) BoolValue() (bool, bool) {
// we don't use ParseBool as it recognizes more than what we've
// historically supported
if isCaselessLitValue(runesTrue, v.raw) {
return true, true
} else if isCaselessLitValue(runesFalse, v.raw) {
return false, true
}
return false, false
}
func isTrimmable(r rune) bool {

View file

@ -145,17 +145,17 @@ func (t Section) ValueType(k string) (ValueType, bool) {
}
// Bool returns a bool value at k
func (t Section) Bool(k string) bool {
func (t Section) Bool(k string) (bool, bool) {
return t.values[k].BoolValue()
}
// Int returns an integer value at k
func (t Section) Int(k string) int64 {
func (t Section) Int(k string) (int64, bool) {
return t.values[k].IntValue()
}
// Float64 returns a float value at k
func (t Section) Float64(k string) float64 {
func (t Section) Float64(k string) (float64, bool) {
return t.values[k].FloatValue()
}

View file

@ -187865,6 +187865,69 @@ const (
// InstanceTypeR7gd16xlarge is a InstanceType enum value
InstanceTypeR7gd16xlarge = "r7gd.16xlarge"
// InstanceTypeR7aMedium is a InstanceType enum value
InstanceTypeR7aMedium = "r7a.medium"
// InstanceTypeR7aLarge is a InstanceType enum value
InstanceTypeR7aLarge = "r7a.large"
// InstanceTypeR7aXlarge is a InstanceType enum value
InstanceTypeR7aXlarge = "r7a.xlarge"
// InstanceTypeR7a2xlarge is a InstanceType enum value
InstanceTypeR7a2xlarge = "r7a.2xlarge"
// InstanceTypeR7a4xlarge is a InstanceType enum value
InstanceTypeR7a4xlarge = "r7a.4xlarge"
// InstanceTypeR7a8xlarge is a InstanceType enum value
InstanceTypeR7a8xlarge = "r7a.8xlarge"
// InstanceTypeR7a12xlarge is a InstanceType enum value
InstanceTypeR7a12xlarge = "r7a.12xlarge"
// InstanceTypeR7a16xlarge is a InstanceType enum value
InstanceTypeR7a16xlarge = "r7a.16xlarge"
// InstanceTypeR7a24xlarge is a InstanceType enum value
InstanceTypeR7a24xlarge = "r7a.24xlarge"
// InstanceTypeR7a32xlarge is a InstanceType enum value
InstanceTypeR7a32xlarge = "r7a.32xlarge"
// InstanceTypeR7a48xlarge is a InstanceType enum value
InstanceTypeR7a48xlarge = "r7a.48xlarge"
// InstanceTypeC7iLarge is a InstanceType enum value
InstanceTypeC7iLarge = "c7i.large"
// InstanceTypeC7iXlarge is a InstanceType enum value
InstanceTypeC7iXlarge = "c7i.xlarge"
// InstanceTypeC7i2xlarge is a InstanceType enum value
InstanceTypeC7i2xlarge = "c7i.2xlarge"
// InstanceTypeC7i4xlarge is a InstanceType enum value
InstanceTypeC7i4xlarge = "c7i.4xlarge"
// InstanceTypeC7i8xlarge is a InstanceType enum value
InstanceTypeC7i8xlarge = "c7i.8xlarge"
// InstanceTypeC7i12xlarge is a InstanceType enum value
InstanceTypeC7i12xlarge = "c7i.12xlarge"
// InstanceTypeC7i16xlarge is a InstanceType enum value
InstanceTypeC7i16xlarge = "c7i.16xlarge"
// InstanceTypeC7i24xlarge is a InstanceType enum value
InstanceTypeC7i24xlarge = "c7i.24xlarge"
// InstanceTypeC7i48xlarge is a InstanceType enum value
InstanceTypeC7i48xlarge = "c7i.48xlarge"
// InstanceTypeMac2M2proMetal is a InstanceType enum value
InstanceTypeMac2M2proMetal = "mac2-m2pro.metal"
)
// InstanceType_Values returns all elements of the InstanceType enum
@ -188590,6 +188653,27 @@ func InstanceType_Values() []string {
InstanceTypeR7gd8xlarge,
InstanceTypeR7gd12xlarge,
InstanceTypeR7gd16xlarge,
InstanceTypeR7aMedium,
InstanceTypeR7aLarge,
InstanceTypeR7aXlarge,
InstanceTypeR7a2xlarge,
InstanceTypeR7a4xlarge,
InstanceTypeR7a8xlarge,
InstanceTypeR7a12xlarge,
InstanceTypeR7a16xlarge,
InstanceTypeR7a24xlarge,
InstanceTypeR7a32xlarge,
InstanceTypeR7a48xlarge,
InstanceTypeC7iLarge,
InstanceTypeC7iXlarge,
InstanceTypeC7i2xlarge,
InstanceTypeC7i4xlarge,
InstanceTypeC7i8xlarge,
InstanceTypeC7i12xlarge,
InstanceTypeC7i16xlarge,
InstanceTypeC7i24xlarge,
InstanceTypeC7i48xlarge,
InstanceTypeMac2M2proMetal,
}
}

View file

@ -478,9 +478,12 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou
// For more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html)
// in the Amazon S3 User Guide.
//
// If the source object's storage class is GLACIER, you must restore a copy
// of this object before you can use it as a source object for the copy operation.
// For more information, see RestoreObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html).
// If the source object's storage class is GLACIER or DEEP_ARCHIVE, or the object's
// storage class is INTELLIGENT_TIERING and it's S3 Intelligent-Tiering access
// tier (https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering-overview.html#intel-tiering-tier-definition)
// is Archive Access or Deep Archive Access, you must restore a copy of this
// object before you can use it as a source object for the copy operation. For
// more information, see RestoreObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html).
// For more information, see Copying Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjectsExamples.html).
//
// # Versioning
@ -593,11 +596,12 @@ func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *request.Request
// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html).
//
// By default, the bucket is created in the US East (N. Virginia) Region. You
// can optionally specify a Region in the request body. You might choose a Region
// to optimize latency, minimize costs, or address regulatory requirements.
// For example, if you reside in Europe, you will probably find it advantageous
// to create buckets in the Europe (Ireland) Region. For more information, see
// Accessing a bucket (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro).
// can optionally specify a Region in the request body. To constrain the bucket
// creation to a specific Region, you can use LocationConstraint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucketConfiguration.html)
// condition key. You might choose a Region to optimize latency, minimize costs,
// or address regulatory requirements. For example, if you reside in Europe,
// you will probably find it advantageous to create buckets in the Europe (Ireland)
// Region. For more information, see Accessing a bucket (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro).
//
// If you send your create bucket request to the s3.amazonaws.com endpoint,
// the request goes to the us-east-1 Region. Accordingly, the signature calculations
@ -7646,15 +7650,13 @@ func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *r
// By default, all buckets have a default encryption configuration that uses
// server-side encryption with Amazon S3 managed keys (SSE-S3). You can optionally
// configure default encryption for a bucket by using server-side encryption
// with Key Management Service (KMS) keys (SSE-KMS), dual-layer server-side
// encryption with Amazon Web Services KMS keys (DSSE-KMS), or server-side encryption
// with customer-provided keys (SSE-C). If you specify default encryption by
// using SSE-KMS, you can also configure Amazon S3 Bucket Keys. For information
// about bucket default encryption, see Amazon S3 bucket default encryption
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html)
// in the Amazon S3 User Guide. For more information about S3 Bucket Keys, see
// Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html)
// in the Amazon S3 User Guide.
// with Key Management Service (KMS) keys (SSE-KMS) or dual-layer server-side
// encryption with Amazon Web Services KMS keys (DSSE-KMS). If you specify default
// encryption by using SSE-KMS, you can also configure Amazon S3 Bucket Keys
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html). If you
// use PutBucketEncryption to set your default bucket encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html)
// to SSE-KMS, you should verify that your KMS key ID is correct. Amazon S3
// does not validate the KMS key ID provided in PutBucketEncryption requests.
//
// This action requires Amazon Web Services Signature Version 4. For more information,
// see Authenticating Requests (Amazon Web Services Signature Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html).
@ -8941,6 +8943,9 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req
// configuration, you provide the name of the destination bucket or buckets
// where you want Amazon S3 to replicate objects, the IAM role that Amazon S3
// can assume to replicate objects on your behalf, and other relevant information.
// You can invoke this request for a specific Amazon Web Services Region by
// using the aws:RequestedRegion (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requestedregion)
// condition key.
//
// A replication configuration must include at least one rule, and can contain
// a maximum of 1,000. Each rule identifies a subset of objects to replicate
@ -9167,7 +9172,7 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request
// name, and then organize your billing information to see the total cost of
// that application across several services. For more information, see Cost
// Allocation and Tagging (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html)
// and Using Cost Allocation in Amazon S3 Bucket Tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/CostAllocTagging.html).
// and Using Cost Allocation in Amazon S3 Bucket Tags (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CostAllocTagging.html).
//
// When this operation sets the tags for a bucket, it will overwrite any current
// tags the bucket already has. You cannot use this operation to add tags to
@ -9179,22 +9184,20 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request
// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources)
// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html).
//
// PutBucketTagging has the following special errors:
// PutBucketTagging has the following special errors. For more Amazon S3 errors
// see, Error Responses (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html).
//
// - Error code: InvalidTagError Description: The tag provided was not a
// valid tag. This error can occur if the tag did not pass input validation.
// For information about tag restrictions, see User-Defined Tag Restrictions
// (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html)
// and Amazon Web Services-Generated Cost Allocation Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/aws-tag-restrictions.html).
// - InvalidTag - The tag provided was not a valid tag. This error can occur
// if the tag did not pass input validation. For more information, see Using
// Cost Allocation in Amazon S3 Bucket Tags (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CostAllocTagging.html).
//
// - Error code: MalformedXMLError Description: The XML provided does not
// match the schema.
// - MalformedXML - The XML provided does not match the schema.
//
// - Error code: OperationAbortedError Description: A conflicting conditional
// action is currently in progress against this resource. Please try again.
// - OperationAborted - A conflicting conditional action is currently in
// progress against this resource. Please try again.
//
// - Error code: InternalError Description: The service was unable to apply
// the provided tag to the bucket.
// - InternalError - The service was unable to apply the provided tag to
// the bucket.
//
// The following operations are related to PutBucketTagging:
//
@ -9456,6 +9459,8 @@ func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request
// more information, see Configuring an Object Redirect (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html)
// in the Amazon S3 User Guide.
//
// The maximum request length is limited to 128 KB.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
@ -10116,12 +10121,13 @@ func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request
// PutObjectTagging API operation for Amazon Simple Storage Service.
//
// Sets the supplied tag-set to an object that already exists in a bucket.
// Sets the supplied tag-set to an object that already exists in a bucket. A
// tag is a key-value pair. For more information, see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html).
//
// A tag is a key-value pair. You can associate tags with an object by sending
// a PUT request against the tagging subresource that is associated with the
// object. You can retrieve tags by sending a GET request. For more information,
// see GetObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html).
// You can associate tags with an object by sending a PUT request against the
// tagging subresource that is associated with the object. You can retrieve
// tags by sending a GET request. For more information, see GetObjectTagging
// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html).
//
// For tagging-related restrictions related to characters and encodings, see
// Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html).
@ -10134,22 +10140,20 @@ func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request
// To put tags of any other version, use the versionId query parameter. You
// also need permission for the s3:PutObjectVersionTagging action.
//
// For information about the Amazon S3 object tagging feature, see Object Tagging
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html).
// PutObjectTagging has the following special errors. For more Amazon S3 errors
// see, Error Responses (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html).
//
// PutObjectTagging has the following special errors:
// - InvalidTag - The tag provided was not a valid tag. This error can occur
// if the tag did not pass input validation. For more information, see Object
// Tagging (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html).
//
// - Code: InvalidTagError Cause: The tag provided was not a valid tag. This
// error can occur if the tag did not pass input validation. For more information,
// see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html).
// - MalformedXML - The XML provided does not match the schema.
//
// - Code: MalformedXMLError Cause: The XML provided does not match the schema.
// - OperationAborted - A conflicting conditional action is currently in
// progress against this resource. Please try again.
//
// - Code: OperationAbortedError Cause: A conflicting conditional action
// is currently in progress against this resource. Please try again.
//
// - Code: InternalError Cause: The service was unable to apply the provided
// tag to the object.
// - InternalError - The service was unable to apply the provided tag to
// the object.
//
// The following operations are related to PutObjectTagging:
//
@ -10242,7 +10246,7 @@ func (c *S3) PutPublicAccessBlockRequest(input *PutPublicAccessBlockInput) (req
// or an object, it checks the PublicAccessBlock configuration for both the
// bucket (or the bucket that contains the object) and the bucket owner's account.
// If the PublicAccessBlock configurations are different between the bucket
// and the account, Amazon S3 uses the most restrictive combination of the bucket-level
// and the account, S3 uses the most restrictive combination of the bucket-level
// and account-level settings.
//
// For more information about when Amazon S3 considers a bucket or an object
@ -11399,7 +11403,9 @@ type AbortMultipartUploadInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -12819,7 +12825,9 @@ type CompleteMultipartUploadInput struct {
MultipartUpload *CompletedMultipartUpload `locationName:"CompleteMultipartUpload" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -13634,7 +13642,9 @@ type CopyObjectInput struct {
ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -13669,11 +13679,11 @@ type CopyObjectInput struct {
// String and GoString methods.
SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"`
// Specifies the KMS key ID to use for object encryption. All GET and PUT requests
// for an object protected by KMS will fail if they're not made via SSL or using
// SigV4. For information about configuring any of the officially supported
// Amazon Web Services SDKs and Amazon Web Services CLI, see Specifying the
// Signature Version in Request Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version)
// Specifies the KMS ID (Key ID, Key ARN, or Key Alias) to use for object encryption.
// All GET and PUT requests for an object protected by KMS will fail if they're
// not made via SSL or using SigV4. For information about configuring any of
// the officially supported Amazon Web Services SDKs and Amazon Web Services
// CLI, see Specifying the Signature Version in Request Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version)
// in the Amazon S3 User Guide.
//
// SSEKMSKeyId is a sensitive parameter and its value will be
@ -13685,11 +13695,12 @@ type CopyObjectInput struct {
// S3 (for example, AES256, aws:kms, aws:kms:dsse).
ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"`
// By default, Amazon S3 uses the STANDARD Storage Class to store newly created
// objects. The STANDARD storage class provides high durability and high availability.
// Depending on performance needs, you can specify a different Storage Class.
// Amazon S3 on Outposts only uses the OUTPOSTS Storage Class. For more information,
// see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html)
// If the x-amz-storage-class header is not used, the copied object will be
// stored in the STANDARD Storage Class by default. The STANDARD storage class
// provides high durability and high availability. Depending on performance
// needs, you can specify a different Storage Class. Amazon S3 on Outposts only
// uses the OUTPOSTS Storage Class. For more information, see Storage Classes
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html)
// in the Amazon S3 User Guide.
StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"`
@ -14704,7 +14715,9 @@ type CreateMultipartUploadInput struct {
ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -14739,12 +14752,12 @@ type CreateMultipartUploadInput struct {
// String and GoString methods.
SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"`
// Specifies the ID of the symmetric encryption customer managed key to use
// for object encryption. All GET and PUT requests for an object protected by
// KMS will fail if they're not made via SSL or using SigV4. For information
// about configuring any of the officially supported Amazon Web Services SDKs
// and Amazon Web Services CLI, see Specifying the Signature Version in Request
// Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version)
// Specifies the ID (Key ID, Key ARN, or Key Alias) of the symmetric encryption
// customer managed key to use for object encryption. All GET and PUT requests
// for an object protected by KMS will fail if they're not made via SSL or using
// SigV4. For information about configuring any of the officially supported
// Amazon Web Services SDKs and Amazon Web Services CLI, see Specifying the
// Signature Version in Request Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version)
// in the Amazon S3 User Guide.
//
// SSEKMSKeyId is a sensitive parameter and its value will be
@ -17066,7 +17079,9 @@ type DeleteObjectInput struct {
MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -17195,8 +17210,10 @@ func (s DeleteObjectInput) updateArnableField(v string) (interface{}, error) {
type DeleteObjectOutput struct {
_ struct{} `type:"structure"`
// Specifies whether the versioned object that was permanently deleted was (true)
// or was not (false) a delete marker.
// Indicates whether the specified object version that was permanently deleted
// was (true) or was not (false) a delete marker before deletion. In a simple
// DELETE, this header indicates whether (true) or not (false) the current version
// of the object is a delete marker.
DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"`
// If present, indicates that the requester was successfully charged for the
@ -17480,7 +17497,9 @@ type DeleteObjectsInput struct {
MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -17777,9 +17796,10 @@ func (s DeletePublicAccessBlockOutput) GoString() string {
type DeletedObject struct {
_ struct{} `type:"structure"`
// Specifies whether the versioned object that was permanently deleted was (true)
// or was not (false) a delete marker. In a simple DELETE, this header indicates
// whether (true) or not (false) a delete marker was created.
// Indicates whether the specified object version that was permanently deleted
// was (true) or was not (false) a delete marker before deletion. In a simple
// DELETE, this header indicates whether (true) or not (false) the current version
// of the object is a delete marker.
DeleteMarker *bool `type:"boolean"`
// The version ID of the delete marker created as a result of the DELETE operation.
@ -18737,7 +18757,9 @@ type GetBucketAccelerateConfigurationInput struct {
ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -21517,7 +21539,9 @@ type GetObjectAclInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -21728,7 +21752,9 @@ type GetObjectAttributesInput struct {
PartNumberMarker *int64 `location:"header" locationName:"x-amz-part-number-marker" type:"integer"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -22168,7 +22194,9 @@ type GetObjectInput struct {
Range *string `location:"header" locationName:"Range" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -22450,7 +22478,9 @@ type GetObjectLegalHoldInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -23152,7 +23182,9 @@ type GetObjectRetentionInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -23331,7 +23363,9 @@ type GetObjectTaggingInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -23507,7 +23541,9 @@ type GetObjectTorrentInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -24194,7 +24230,9 @@ type HeadObjectInput struct {
Range *string `location:"header" locationName:"Range" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -27107,7 +27145,9 @@ type ListMultipartUploadsInput struct {
Prefix *string `location:"querystring" locationName:"prefix" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -27459,7 +27499,9 @@ type ListObjectVersionsInput struct {
Prefix *string `location:"querystring" locationName:"prefix" type:"string"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -28530,7 +28572,9 @@ type ListPartsInput struct {
PartNumberMarker *int64 `location:"querystring" locationName:"part-number-marker" type:"integer"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -29893,7 +29937,7 @@ type Object struct {
RestoreStatus *RestoreStatus `type:"structure"`
// Size in bytes of the object
Size *int64 `type:"integer"`
Size *int64 `type:"long"`
// The class of storage used to store the object.
StorageClass *string `type:"string" enum:"ObjectStorageClass"`
@ -30221,7 +30265,7 @@ type ObjectPart struct {
PartNumber *int64 `type:"integer"`
// The size of the uploaded part in bytes.
Size *int64 `type:"integer"`
Size *int64 `type:"long"`
}
// String returns the string representation.
@ -30309,7 +30353,7 @@ type ObjectVersion struct {
RestoreStatus *RestoreStatus `type:"structure"`
// Size in bytes of the object.
Size *int64 `type:"integer"`
Size *int64 `type:"long"`
// The class of storage used to store the object.
StorageClass *string `type:"string" enum:"ObjectVersionStorageClass"`
@ -30727,7 +30771,7 @@ type Part struct {
PartNumber *int64 `type:"integer"`
// Size in bytes of the uploaded part data.
Size *int64 `type:"integer"`
Size *int64 `type:"long"`
}
// String returns the string representation.
@ -34324,7 +34368,9 @@ type PutObjectAclInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -34693,7 +34739,9 @@ type PutObjectInput struct {
ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -34731,9 +34779,9 @@ type PutObjectInput struct {
SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"`
// If x-amz-server-side-encryption has a valid value of aws:kms or aws:kms:dsse,
// this header specifies the ID of the Key Management Service (KMS) symmetric
// encryption customer managed key that was used for the object. If you specify
// x-amz-server-side-encryption:aws:kms or x-amz-server-side-encryption:aws:kms:dsse,
// this header specifies the ID (Key ID, Key ARN, or Key Alias) of the Key Management
// Service (KMS) symmetric encryption customer managed key that was used for
// the object. If you specify x-amz-server-side-encryption:aws:kms or x-amz-server-side-encryption:aws:kms:dsse,
// but do not providex-amz-server-side-encryption-aws-kms-key-id, Amazon S3
// uses the Amazon Web Services managed key (aws/s3) to protect the data. If
// the KMS key does not exist in the same account that's issuing the command,
@ -35136,7 +35184,9 @@ type PutObjectLegalHoldInput struct {
LegalHold *ObjectLockLegalHold `locationName:"LegalHold" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -35332,7 +35382,9 @@ type PutObjectLockConfigurationInput struct {
ObjectLockConfiguration *ObjectLockConfiguration `locationName:"ObjectLockConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -35723,7 +35775,9 @@ type PutObjectRetentionInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -35946,7 +36000,9 @@ type PutObjectTaggingInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -37329,7 +37385,9 @@ type RestoreObjectInput struct {
Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -38574,7 +38632,15 @@ type ServerSideEncryptionByDefault struct {
// KMS key ID to use for the default encryption. This parameter is allowed if
// and only if SSEAlgorithm is set to aws:kms.
//
// You can specify the key ID or the Amazon Resource Name (ARN) of the KMS key.
// You can specify the key ID, key alias, or the Amazon Resource Name (ARN)
// of the KMS key.
//
// * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
//
// * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
//
// * Key Alias: alias/alias-name
//
// If you use a key ID, you can run into a LogDestination undeliverable error
// when creating a VPC flow log.
//
@ -38582,10 +38648,6 @@ type ServerSideEncryptionByDefault struct {
// operations you must use a fully qualified KMS key ARN. For more information,
// see Using encryption for cross-account operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html#bucket-encryption-update-bucket-policy).
//
// * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
//
// * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
//
// Amazon S3 only supports symmetric encryption KMS keys. For more information,
// see Asymmetric keys in Amazon Web Services KMS (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html)
// in the Amazon Web Services Key Management Service Developer Guide.
@ -39697,7 +39759,9 @@ type UploadPartCopyInput struct {
PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -40148,7 +40212,9 @@ type UploadPartInput struct {
PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -40845,9 +40911,9 @@ type WriteGetObjectResponseInput struct {
// server-side encryption with customer-provided encryption keys (SSE-C) (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html).
SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption-customer-key-MD5" type:"string"`
// If present, specifies the ID of the Amazon Web Services Key Management Service
// (Amazon Web Services KMS) symmetric encryption customer managed key that
// was used for stored in Amazon S3 object.
// If present, specifies the ID (Key ID, Key ARN, or Key Alias) of the Amazon
// Web Services Key Management Service (Amazon Web Services KMS) symmetric encryption
// customer managed key that was used for stored in Amazon S3 object.
//
// SSEKMSKeyId is a sensitive parameter and its value will be
// replaced with "sensitive" in string returned by WriteGetObjectResponseInput's
@ -42356,7 +42422,9 @@ func RequestCharged_Values() []string {
}
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.

View file

@ -187,7 +187,9 @@ type UploadInput struct {
ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"`
// Confirms that the requester knows that they will be charged for the request.
// Bucket owners need not specify this parameter in their requests. For information
// Bucket owners need not specify this parameter in their requests. If either
// the source or destination Amazon S3 bucket has Requester Pays enabled, the
// requester will pay for corresponding charges to copy the object. For information
// about downloading objects from Requester Pays buckets, see Downloading Objects
// in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html)
// in the Amazon S3 User Guide.
@ -217,9 +219,9 @@ type UploadInput struct {
SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"`
// If x-amz-server-side-encryption has a valid value of aws:kms or aws:kms:dsse,
// this header specifies the ID of the Key Management Service (KMS) symmetric
// encryption customer managed key that was used for the object. If you specify
// x-amz-server-side-encryption:aws:kms or x-amz-server-side-encryption:aws:kms:dsse,
// this header specifies the ID (Key ID, Key ARN, or Key Alias) of the Key Management
// Service (KMS) symmetric encryption customer managed key that was used for
// the object. If you specify x-amz-server-side-encryption:aws:kms or x-amz-server-side-encryption:aws:kms:dsse,
// but do not providex-amz-server-side-encryption-aws-kms-key-id, Amazon S3
// uses the Amazon Web Services managed key (aws/s3) to protect the data. If
// the KMS key does not exist in the same account that's issuing the command,

View file

@ -35,6 +35,8 @@ import (
const signAPI = "EnterpriseCertSigner.Sign"
const certificateChainAPI = "EnterpriseCertSigner.CertificateChain"
const publicKeyAPI = "EnterpriseCertSigner.Public"
const encryptAPI = "EnterpriseCertSigner.Encrypt"
const decryptAPI = "EnterpriseCertSigner.Decrypt"
// A Connection wraps a pair of unidirectional streams as an io.ReadWriteCloser.
type Connection struct {
@ -54,13 +56,28 @@ func (c *Connection) Close() error {
func init() {
gob.Register(crypto.SHA256)
gob.Register(crypto.SHA384)
gob.Register(crypto.SHA512)
gob.Register(&rsa.PSSOptions{})
gob.Register(&rsa.OAEPOptions{})
}
// SignArgs contains arguments to a crypto Signer.Sign method.
// SignArgs contains arguments for a Sign API call.
type SignArgs struct {
Digest []byte // The content to sign.
Opts crypto.SignerOpts // Options for signing, such as Hash identifier.
Opts crypto.SignerOpts // Options for signing. Must implement HashFunc().
}
// EncryptArgs contains arguments for an Encrypt API call.
type EncryptArgs struct {
Plaintext []byte // The plaintext to encrypt.
Opts any // Options for encryption. Ex: an instance of crypto.Hash.
}
// DecryptArgs contains arguments to for a Decrypt API call.
type DecryptArgs struct {
Ciphertext []byte // The ciphertext to decrypt.
Opts crypto.DecrypterOpts // Options for decryption. Ex: an instance of *rsa.OAEPOptions.
}
// Key implements credential.Credential by holding the executed signer subprocess.
@ -98,7 +115,7 @@ func (k *Key) Public() crypto.PublicKey {
return k.publicKey
}
// Sign signs a message digest, using the specified signer options.
// Sign signs a message digest, using the specified signer opts. Implements crypto.Signer interface.
func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed []byte, err error) {
if opts != nil && opts.HashFunc() != 0 && len(digest) != opts.HashFunc().Size() {
return nil, fmt.Errorf("Digest length of %v bytes does not match Hash function size of %v bytes", len(digest), opts.HashFunc().Size())
@ -107,6 +124,18 @@ func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed [
return
}
// Encrypt encrypts a plaintext msg into ciphertext, using the specified encrypt opts.
func (k *Key) Encrypt(_ io.Reader, msg []byte, opts any) (ciphertext []byte, err error) {
err = k.client.Call(encryptAPI, EncryptArgs{Plaintext: msg, Opts: opts}, &ciphertext)
return
}
// Decrypt decrypts a ciphertext msg into plaintext, using the specified decrypter opts. Implements crypto.Decrypter interface.
func (k *Key) Decrypt(_ io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {
err = k.client.Call(decryptAPI, DecryptArgs{Ciphertext: msg, Opts: opts}, &plaintext)
return
}
// ErrCredUnavailable is a sentinel error that indicates ECP Cred is unavailable,
// possibly due to missing config or missing binary path.
var ErrCredUnavailable = errors.New("Cred is unavailable")
@ -120,7 +149,12 @@ var ErrCredUnavailable = errors.New("Cred is unavailable")
// The config file also specifies which certificate the signer should use.
func Cred(configFilePath string) (*Key, error) {
if configFilePath == "" {
configFilePath = util.GetDefaultConfigFilePath()
envFilePath := util.GetConfigFilePathFromEnv()
if envFilePath != "" {
configFilePath = envFilePath
} else {
configFilePath = util.GetDefaultConfigFilePath()
}
}
enterpriseCertSignerPath, err := util.LoadSignerBinaryPath(configFilePath)
if err != nil {

View file

@ -22,6 +22,7 @@ import (
"os/user"
"path/filepath"
"runtime"
"strings"
)
const configFileName = "certificate_config.json"
@ -63,6 +64,9 @@ func LoadSignerBinaryPath(configFilePath string) (path string, err error) {
if signerBinaryPath == "" {
return "", ErrConfigUnavailable
}
signerBinaryPath = strings.ReplaceAll(signerBinaryPath, "~", guessHomeDir())
signerBinaryPath = strings.ReplaceAll(signerBinaryPath, "$HOME", guessHomeDir())
return signerBinaryPath, nil
}
@ -89,3 +93,8 @@ func getDefaultConfigFileDirectory() (directory string) {
func GetDefaultConfigFilePath() (path string) {
return filepath.Join(getDefaultConfigFileDirectory(), configFileName)
}
// GetConfigFilePathFromEnv returns the path associated with environment variable GOOGLE_API_CERTIFICATE_CONFIG
func GetConfigFilePathFromEnv() (path string) {
return os.Getenv("GOOGLE_API_CERTIFICATE_CONFIG")
}

View file

@ -1,3 +1,19 @@
## v1.7.0 (2023-09-22)
New features and improvements:
* [GH-2782](https://github.com/gophercloud/gophercloud/pull/2782) [v1] (manual clean backport) Add tag field to compute block_device_v2
CI changes:
* [GH-2760](https://github.com/gophercloud/gophercloud/pull/2760) [v1 backports] semver auto labels
* [GH-2775](https://github.com/gophercloud/gophercloud/pull/2775) [v1] Fix typos in comments
* [GH-2783](https://github.com/gophercloud/gophercloud/pull/2783) [v1] (clean manual backport) ci/functional: fix ubuntu version & add antelope
* [GH-2785](https://github.com/gophercloud/gophercloud/pull/2785) [v1] Acceptance: Handle numerical version names in version comparison helpers
* [GH-2787](https://github.com/gophercloud/gophercloud/pull/2787) backport-v1: fixes to semver label
* [GH-2788](https://github.com/gophercloud/gophercloud/pull/2788) [v1] Make acceptance tests internal
## v1.6.0 (2023-08-30)
New features and improvements:

View file

@ -76,7 +76,7 @@ type Image struct {
CreatedAt time.Time `json:"created_at"`
// UpdatedAt is the date when the last change has been made to the image or
// it's properties.
// its properties.
UpdatedAt time.Time `json:"updated_at"`
// File is the trailing path after the glance endpoint that represent the

View file

@ -14,7 +14,7 @@ import (
// DefaultUserAgent is the default User-Agent string set in the request header.
const (
DefaultUserAgent = "gophercloud/v1.6.0"
DefaultUserAgent = "gophercloud/v1.7.0"
DefaultMaxBackoffRetries = 60
)

View file

@ -47,18 +47,18 @@ func loadSystemCAs() (pool *x509.CertPool, err error) {
// $ openssl s_client -connect sso.redhat.com:443 -showcerts
var ssoCA1 = []byte(`
-----BEGIN CERTIFICATE-----
MIIGaDCCBVCgAwIBAgIQBi8UsQS7Xm5Ktg6bEklo7jANBgkqhkiG9w0BAQsFADB1
MIIGaDCCBVCgAwIBAgIQC46dyjYn3u1vs/8YgztPbTANBgkqhkiG9w0BAQsFADB1
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk
IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTIyMDkzMDAwMDAwMFoXDTIzMTAwMzIz
IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTIzMDcxMzAwMDAwMFoXDTI0MDcxMjIz
NTk1OVowgcoxEzARBgsrBgEEAYI3PAIBAxMCVVMxGTAXBgsrBgEEAYI3PAIBAhMI
RGVsYXdhcmUxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRAwDgYDVQQF
EwcyOTQ1NDM2MQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmEx
EDAOBgNVBAcTB1JhbGVpZ2gxFjAUBgNVBAoTDVJlZCBIYXQsIEluYy4xFzAVBgNV
BAMTDnNzby5yZWRoYXQuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE+KWz
pf1yvCDgVuOgEubqz6pZprL/xY6fcU289Z+FOjufDWJigGQ8FwXRniPfe2ZwEYY0
QDhRNaotmZnlOrO0H6OCA2cwggNjMB8GA1UdIwQYMBaAFD3TUKXWoK3u80pgCmXT
IdT4+NYPMB0GA1UdDgQWBBStPNIAv1L5CfWYYlHLlFvecCUHVzAZBgNVHREEEjAQ
BAMTDnNzby5yZWRoYXQuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYrJM
qHET7N7dhi5EMpERt3tW+jC1VkZZ/CsayqoQeB2Sfzwrwe3e/j6eShNqc6XN0Z68
3B18Kfar0zWSK5CwvKOCA2cwggNjMB8GA1UdIwQYMBaAFD3TUKXWoK3u80pgCmXT
IdT4+NYPMB0GA1UdDgQWBBTx9cmugNxKMPgWsjc/6UoqfQK/nDAZBgNVHREEEjAQ
gg5zc28ucmVkaGF0LmNvbTAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYB
BQUHAwEGCCsGAQUFBwMCMHUGA1UdHwRuMGwwNKAyoDCGLmh0dHA6Ly9jcmwzLmRp
Z2ljZXJ0LmNvbS9zaGEyLWV2LXNlcnZlci1nMy5jcmwwNKAyoDCGLmh0dHA6Ly9j
@ -68,20 +68,20 @@ dy5kaWdpY2VydC5jb20vQ1BTMIGIBggrBgEFBQcBAQR8MHowJAYIKwYBBQUHMAGG
GGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0LmNvbTBSBggrBgEFBQcwAoZGaHR0cDovL2Nh
Y2VydHMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0U0hBMkV4dGVuZGVkVmFsaWRhdGlv
blNlcnZlckNBLmNydDAJBgNVHRMEAjAAMIIBfAYKKwYBBAHWeQIEAgSCAWwEggFo
AWYAdQCt9776fP8QyIudPZwePhhqtGcpXc+xDCTKhYY069yCigAAAYOPPaNmAAAE
AwBGMEQCIGjyDOm0mO8dlx26MRS7yGLAjVy2I8qQ0AqzdQbU3v+SAiB57Bneq5KZ
lxI8Np6Zy7PJ+KnhpvtZV9o/8xdkKLqadQB1ALNzdwfhhFD4Y4bWBancEQlKeS2x
ZwwLh9zwAw55NqWaAAABg489o0kAAAQDAEYwRAIgObcLEPhsLANoAmyG+y3BzfbC
yPSUKw1UkirHy+t8LoICIH9xQyvq4Fqi/QQf4oA+SbnP53gt2Jis1ZA4DTb2Ed89
AHYAtz77JN+cTbp18jnFulj0bF38Qs96nzXEnh0JgSXttJkAAAGDjz2jJgAABAMA
RzBFAiA440SGk+ocN3qwj9KdftXA0aGQ+MsxCr5uh5ESEkvNbQIhAPZmN8g6+kDk
Hm3OIlBUkOWTMcv90zhWin5tBg6Gc9B+MA0GCSqGSIb3DQEBCwUAA4IBAQCEZvzj
VPRVXnfRmO4/nmKl0eP7d2AZJ/ahsDnd6hkyXejtr/gwngmGkiNLljHFDyqXsoeb
J9DIgk7fECVe+yAb5rKOdO//mnNrNl8SQJHlq7EQwOPH5EImcLSHfv2s7BhTuS05
pWQK3pLUQK7REW2mdYTQaRibIgkxCVXaWpRqVX5Y0Mnv4j94POBrqNQO9Y/8tdXY
rPmwCRE3AltE5CoYkeTTc9L21o70bcZI3wuQZ+ZzEgp8IPmsy4ySemIQmwk/3eEh
OP8bDpeKmhjegnX3wCy901a8yAYkDpAhsA5BEq35zVfzgjDgU+111lRQm7fh+jbf
6NTCqA7oLZAvSz9X
AWYAdgDuzdBk1dsazsVct520zROiModGfLzs3sNRSFlGcR+1mwAAAYlQB49zAAAE
AwBHMEUCIGlDT2c7z2fv71iyJbuNYbp91KGp0Koy6qr3So9K4YiGAiEA80VIq3yN
Vu9WchFtK0xQh8pfMqGefkwGrJNWhb9B2AsAdQBIsONr2qZHNA/lagL6nTDrHFIB
y1bdLIHZu7+rOdiEcwAAAYlQB4/RAAAEAwBGMEQCIEG+h90k/erQqUhsFk6guFOT
zfm5TZ9JngeUayQ6lnoPAiBSYCHSjVyt5CUMOuJzwJ7bH0Cszfj6hXb3E9Vv4vkF
xgB1ANq2v2s/tbYin5vCu1xr6HCRcWy7UYSFNL2kPTBI1/urAAABiVAHj6QAAAQD
AEYwRAIgctt1pUVJPnAEA4c72rcbRKXZ+IMzZSBjv//hOtst1eYCIDeEu5I0kdaF
bz6EucRcalZfMDtnwn+FMwkgRbiqo6l2MA0GCSqGSIb3DQEBCwUAA4IBAQA+mnI3
mcDI1krs4JYzlHAzPs5IgP6PVLeBsdPq2AJBAHLmQsYPBKPWjJi744O+kmfwGH3M
s7ZplC2GgYBW3izfcXcf6aw0UrfVizRz8MNNTknjHwP21FwS1ykpjlJL0QvGM67g
3koAne4fsHmSOgFNchaPnm3QbKQdb9oXMX+HPY/xxwvwQeUWs94g0C5/lHM8+7Tq
GvtAzh/3EdWN5ZwOMHXE9nGvnpM7Aj9A9nuMvwMsn6YqeBaq71UirB7VELUyjSVc
rVl7msAPTJd8vR+NtY4fTSanNnQDptG2M1OcPthH/rwINE0rdHaVFDDRSz4G78f7
l1X92ab6Xau+LI4u
-----END CERTIFICATE-----
`)

View file

@ -814,19 +814,17 @@ func newDistro(version int) distro.Distro {
BasePlatform: platform.BasePlatform{
ImageFormat: platform.FORMAT_RAW,
FirmwarePackages: []string{
"grub2-efi-x64",
"grub2-efi-x64-cdboot",
"grub2-pc",
"grub2-pc-modules",
"grub2-tools",
"grub2-tools-extra",
"grub2-tools-minimal",
"efibootmgr",
"shim-x64",
"brcmfmac-firmware",
"iwlwifi-dvm-firmware",
"iwlwifi-mvm-firmware",
"realtek-firmware",
"microcode_ctl",
"syslinux",
"syslinux-nonlinux",
},
},
BIOS: false,
@ -843,8 +841,9 @@ func newDistro(version int) distro.Distro {
"grub2-efi-aa64",
"grub2-efi-aa64-cdboot",
"grub2-tools",
"grub2-tools-extra",
"grub2-tools-minimal",
"efibootmgr",
"shim-aa64",
"brcmfmac-firmware",
"iwlwifi-dvm-firmware",
"iwlwifi-mvm-firmware",

View file

@ -350,7 +350,7 @@ var iotSimplifiedInstallerPartitionTables = distro.BasePartitionTableMap{
Description: "built with lvm2 and osbuild",
LogicalVolumes: []disk.LVMLogicalVolume{
{
Size: 2569 * common.MebiByte,
Size: 8 * common.GibiByte,
Name: "rootlv",
Payload: &disk.Filesystem{
Type: "ext4",
@ -420,7 +420,7 @@ var iotSimplifiedInstallerPartitionTables = distro.BasePartitionTableMap{
Description: "built with lvm2 and osbuild",
LogicalVolumes: []disk.LVMLogicalVolume{
{
Size: 2569 * common.MebiByte,
Size: 8 * common.GibiByte,
Name: "rootlv",
Payload: &disk.Filesystem{
Type: "ext4",

View file

@ -235,7 +235,8 @@ func gceCommonPackageSet(t *imageType) rpmmd.PackageSet {
"chrony",
"timedatex",
// EFI
"grub2-tools-efi",
"grub2-tools",
"grub2-tools-minimal",
"firewalld", // not pulled in any more as on RHEL-8
},
Exclude: []string{

View file

@ -98,5 +98,8 @@ func OSBuildVersion() (string, error) {
}
// osbuild --version prints the version in the form of "osbuild VERSION". Extract the version.
return strings.TrimPrefix(stdoutBuffer.String(), "osbuild "), nil
version := strings.TrimPrefix(stdoutBuffer.String(), "osbuild ")
// Remove the trailing newline.
version = strings.TrimSpace(version)
return version, nil
}

View file

@ -9,6 +9,7 @@ Adam Chalkley <atc0005@users.noreply.github.com>
Adam Fowler <adam@adamfowler.org>
Adam Shannon <adamkshannon@gmail.com>
Akanksha Panse <pansea@vmware.com>
akutz <akutz@users.noreply.github.com>
Al Biheiri <abiheiri@apple.com>
Alessandro Cortiana <alessandro.cortiana@gmail.com>
Alex <puzo2002@gmail.com>
@ -52,7 +53,6 @@ Brian Rak <brak@vmware.com>
brian57860 <brian57860@users.noreply.github.com>
Bruce Downs <bruceadowns@gmail.com>
Bryan Venteicher <bryanventeicher@gmail.com>
Cédric Blomart <cblomart@gmail.com>
Cheng Cheng <chengch@vmware.com>
Chethan Venkatesh <chethanv@vmware.com>
Choudhury Sarada Prasanna Nanda <cspn@google.com>
@ -61,6 +61,7 @@ Christian Höltje <docwhat@gerf.org>
Clint Greenwood <cgreenwood@vmware.com>
cpiment <pimentel.carlos@gmail.com>
CuiHaozhi <cuihaozhi@chinacloud.com.cn>
Cédric Blomart <cblomart@gmail.com>
Dan Ilan <danilan@google.com>
Dan Norris <protochron@users.noreply.github.com>
Daniel Frederick Crisman <daniel@crisman.org>
@ -104,6 +105,7 @@ Gavrie Philipson <gavrie.philipson@elastifile.com>
George Hicken <ghicken@vmware.com>
Gerrit Renker <Gerrit.Renker@ctl.io>
gthombare <gthombare@vmware.com>
Hakan Halil <hhalil@vmware.com>
HakanSunay <hakansunay@abv.bg>
Hasan Mahmood <mahmoodh@vmware.com>
Haydon Ryan <haydon.ryan@gmail.com>
@ -123,9 +125,9 @@ Jeremy Canady <jcanady@jackhenry.com>
jeremy-clerc <jeremy@clerc.io>
Jiatong Wang <wjiatong@vmware.com>
jingyizPensando <jingyiz@pensando.io>
João Pereira <joaodrp@gmail.com>
Jonas Ausevicius <jonas.ausevicius@virtustream.com>
Jorge Sevilla <jorge.sevilla@rstor.io>
João Pereira <joaodrp@gmail.com>
Julien PILLON <jpillon@lesalternatives.org>
Justin J. Novack <jnovack@users.noreply.github.com>
kayrus <kay.diam@gmail.com>
@ -140,6 +142,7 @@ Louie Jiang <jiangl@vmware.com>
Luther Monson <luther.monson@gmail.com>
Madanagopal Arunachalam <marunachalam@vmware.com>
makelarisjr <8687447+makelarisjr@users.noreply.github.com>
Manuel Grandeit <m.grandeit@gmail.com>
maplain <fangyuanl@vmware.com>
Marc Carmier <mcarmier@gmail.com>
Marcus Tan <marcus.tan@rubrik.com>
@ -164,6 +167,7 @@ Mike Schinkel <mike@newclarity.net>
Mincho Tonev <mtonev@vmware.com>
mingwei <mingwei@smartx.com>
Nicolas Lamirault <nicolas.lamirault@gmail.com>
nikhaild <84156354+nikhaild@users.noreply.github.com>
Nikhil Kathare <nikhil.kathare@netapp.com>
Nikhil R Deshpande <ndeshpande@vmware.com>
Nikolas Grottendieck <git@nikolasgrottendieck.com>
@ -226,6 +230,7 @@ Tjeu Kayim <15987676+TjeuKayim@users.noreply.github.com>
Toomas Pelberg <toomas.pelberg@playtech.com>
Trevor Dawe <trevor.dawe@gmail.com>
tshihad <tshihad9@gmail.com>
Ueli Banholzer <ueli@whatwedo.ch>
Uwe Bessle <Uwe.Bessle@iteratec.de>
Vadim Egorov <vegorov@vmware.com>
Vikram Krishnamurthy <vikramkrishnamu@vmware.com>
@ -245,6 +250,7 @@ Yi Jiang <yijiang@vmware.com>
yiyingy <yiyingy@vmware.com>
ykakarap <yuva2811@gmail.com>
Yogesh Sobale <6104071+ysobale@users.noreply.github.com>
Your Name <you@example.com>
Yue Yin <yueyin@yuyin-a01.vmware.com>
Yun Zhou <yunz@vmware.com>
Yuya Kusakabe <yuya.kusakabe@gmail.com>

View file

@ -44,6 +44,10 @@ var (
Type: "CnsVolumeManager",
Value: "cns-volume-manager",
}
CnsDebugManagerInstance = vimtypes.ManagedObjectReference{
Type: "CnsDebugManager",
Value: "cns-debug-manager",
}
)
type Client struct {
@ -282,3 +286,20 @@ func (c *Client) ReconfigVolumePolicy(ctx context.Context, PolicyReconfigSpecs [
}
return object.NewTask(c.vim25Client, res.Returnval), nil
}
// SyncDatastore calls the CnsSyncDatastore API
// Note: To be used only by VMware's internal support tools.
// This API triggers a manual sync of internal CNS and FCD DBs which otherwise happens periodially,
// with fullsync it forces synchronization of complete tables.
func (c *Client) SyncDatastore(ctx context.Context, dsURL string, fullSync bool) (*object.Task, error) {
req := cnstypes.CnsSyncDatastore{
This: CnsDebugManagerInstance,
DatastoreUrl: dsURL,
FullSync: &fullSync,
}
res, err := methods.CnsSyncDatastore(ctx, c, &req)
if err != nil {
return nil, err
}
return object.NewTask(c.vim25Client, res.Returnval), nil
}

View file

@ -346,3 +346,24 @@ func CnsReconfigVolumePolicy(ctx context.Context, r soap.RoundTripper, req *type
return resBody.Res, nil
}
type CnsSyncDatastoreBody struct {
Req *types.CnsSyncDatastore `xml:"urn:vsan CnsSyncDatastore,omitempty"`
Res *types.CnsSyncDatastoreResponse `xml:"urn:vsan CnsSyncDatastoreResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *CnsSyncDatastoreBody) Fault() *soap.Fault { return b.Fault_ }
// Note: To be used only by VMware's internal support tools.
func CnsSyncDatastore(ctx context.Context, r soap.RoundTripper, req *types.CnsSyncDatastore) (*types.CnsSyncDatastoreResponse, error) {
var reqBody, resBody CnsSyncDatastoreBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}

View file

@ -909,3 +909,23 @@ type CnsVolumePolicyReconfigSpec struct {
func init() {
types.Add("vsan:CnsVolumePolicyReconfigSpec", reflect.TypeOf((*CnsVolumePolicyReconfigSpec)(nil)).Elem())
}
type CnsSyncDatastore CnsSyncDatastoreRequestType
func init() {
types.Add("vsan:CnsSyncDatastore", reflect.TypeOf((*CnsSyncDatastore)(nil)).Elem())
}
type CnsSyncDatastoreRequestType struct {
This types.ManagedObjectReference `xml:"_this"`
DatastoreUrl string `xml:"datastoreUrl,omitempty"`
FullSync *bool `xml:"fullSync"`
}
func init() {
types.Add("vsan:CnsSyncDatastoreRequestType", reflect.TypeOf((*CnsSyncDatastoreRequestType)(nil)).Elem())
}
type CnsSyncDatastoreResponse struct {
Returnval types.ManagedObjectReference `xml:"returnval"`
}

View file

@ -32,6 +32,6 @@ otherwise "find" mode is used.
The exception is to use a "..." wildcard with a path to find all objects recursively underneath any root object.
For example: VirtualMachineList("/DC1/...")
See also: https://github.com/vmware/govmomi/blob/master/govc/README.md#usage
See also: https://github.com/vmware/govmomi/blob/main/govc/README.md#usage
*/
package find

View file

@ -23,6 +23,7 @@ import (
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
"text/tabwriter"
@ -55,7 +56,56 @@ func generalHelp(w io.Writer, filter string) {
}
if len(matches) == 0 {
fmt.Fprintf(w, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(w, `Usage: %[1]s <COMMAND> [COMMON OPTIONS] [PATH]...
govmomi is a Go library for interacting with VMware vSphere APIs (ESXi and/or
vCenter Server).
It is licensed under the Apache License, Version 2.0
%[1]s is the CLI for govmomi.
The available commands are listed below. A detailed description of each
command can be displayed with "govc <COMMAND> -h". The description of all
commands can be also found at https://via.vmw.com/GJ98hk .
Examples:
show usage of a command: govc <COMMAND> -h
show toplevel structure: govc ls
show datacenter summary: govc datacenter.info
show all VMs: govc find -type m
upload a ISO file: govc datastore.upload -ds datastore1 ./config.iso vm-name/config.iso
Common options:
-h Show this message
-cert= Certificate [GOVC_CERTIFICATE]
-debug=false Store debug logs [GOVC_DEBUG]
-trace=false Write SOAP/REST traffic to stderr
-verbose=false Write request/response data to stderr
-dump=false Enable output dump
-json=false Enable JSON output
-xml=false Enable XML output
-k=false Skip verification of server certificate [GOVC_INSECURE]
-key= Private key [GOVC_PRIVATE_KEY]
-persist-session=true Persist session to disk [GOVC_PERSIST_SESSION]
-tls-ca-certs= TLS CA certificates file [GOVC_TLS_CA_CERTS]
-tls-known-hosts= TLS known hosts file [GOVC_TLS_KNOWN_HOSTS]
-u= ESX or vCenter URL [GOVC_URL]
-vim-namespace=urn:vim25 Vim namespace [GOVC_VIM_NAMESPACE]
-vim-version=6.0 Vim version [GOVC_VIM_VERSION]
-dc= Datacenter [GOVC_DATACENTER]
-host.dns= Find host by FQDN
-host.ip= Find host by IP address
-host.ipath= Find host by inventory path
-host.uuid= Find host by UUID
-vm.dns= Find VM by FQDN
-vm.ip= Find VM by IP address
-vm.ipath= Find VM by inventory path
-vm.path= Find VM by path to .vmx file
-vm.uuid= Find VM by UUID
Available commands:
`, filepath.Base(os.Args[0]))
} else {
fmt.Fprintf(w, "%s: command '%s' not found, did you mean:\n", os.Args[0], filter)
cmds = matches
@ -117,7 +167,8 @@ func Run(args []string) int {
hw := os.Stderr
rc := 1
hwrc := func(arg string) {
if arg == "-h" {
arg = strings.TrimLeft(arg, "-")
if arg == "h" || arg == "help" {
hw = os.Stdout
rc = 0
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -298,6 +298,8 @@ func (flag *ClientFlag) ConfigureTLS(sc *soap.Client) error {
}
}
sc.UseJSON(os.Getenv("GOVC_VI_JSON") != "")
return nil
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2015-2016 VMware, Inc. All Rights Reserved.
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -0,0 +1,50 @@
/*
Copyright (c) 2023-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package flags
import (
"flag"
)
type optionalString struct {
val **string
}
func (s *optionalString) Set(input string) error {
*s.val = &input
return nil
}
func (s *optionalString) Get() interface{} {
if *s.val == nil {
return nil
}
return **s.val
}
func (s *optionalString) String() string {
if s.val == nil || *s.val == nil {
return "<nil>"
}
return **s.val
}
// NewOptionalString returns a flag.Value implementation where there is no default value.
// This avoids sending a default value over the wire as using flag.StringVar() would.
func NewOptionalString(v **string) flag.Value {
return &optionalString{v}
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -18,6 +18,7 @@ package esxcli
import (
"context"
"errors"
"flag"
"fmt"
"io"
@ -92,6 +93,9 @@ func (cmd *esxcli) Run(ctx context.Context, f *flag.FlagSet) error {
res, err := e.Run(f.Args())
if err != nil {
if f, ok := err.(*Fault); ok {
return errors.New(f.messageDetail())
}
return err
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -18,7 +18,6 @@ package esxcli
import (
"context"
"errors"
"fmt"
"github.com/vmware/govmomi/internal"
@ -27,6 +26,23 @@ import (
"github.com/vmware/govmomi/vim25/xml"
)
type Fault struct {
Message string
Detail string
}
func (f Fault) Error() string {
return f.Message
}
func (f Fault) messageDetail() string {
if f.Detail != "" {
return fmt.Sprintf("%s %s", f.Message, f.Detail)
}
return f.Message
}
type Executor struct {
c *vim25.Client
host *object.HostSystem
@ -138,7 +154,10 @@ func (e *Executor) Execute(req *internal.ExecuteSoapRequest, res interface{}) er
if x.Returnval != nil {
if x.Returnval.Fault != nil {
return errors.New(x.Returnval.Fault.FaultMsg)
return &Fault{
x.Returnval.Fault.FaultMsg,
x.Returnval.Fault.FaultDetail,
}
}
if err := xml.Unmarshal([]byte(x.Returnval.Response), res); err != nil {

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -32,6 +32,7 @@ import (
"strings"
"github.com/vmware/govmomi/ovf"
"github.com/vmware/govmomi/vapi/library"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/soap"
)
@ -40,6 +41,8 @@ import (
// only encapsulates some common archive related functionality.
type ArchiveFlag struct {
Archive
manifest map[string]*library.Checksum
}
func newArchiveFlag(ctx context.Context) (*ArchiveFlag, context.Context) {
@ -72,6 +75,22 @@ func (f *ArchiveFlag) ReadEnvelope(data []byte) (*ovf.Envelope, error) {
return e, nil
}
func (f *ArchiveFlag) readManifest(fpath string) error {
base := filepath.Base(fpath)
ext := filepath.Ext(base)
mfName := strings.Replace(base, ext, ".mf", 1)
mf, _, err := f.Open(mfName)
if err != nil {
msg := fmt.Sprintf("manifest %q: %s", mf, err)
fmt.Fprintln(os.Stderr, msg)
return errors.New(msg)
}
f.manifest, err = library.ReadManifest(mf)
_ = mf.Close()
return err
}
type Archive interface {
Open(string) (io.ReadCloser, int64, error)
}

View file

@ -22,6 +22,7 @@ import (
"flag"
"fmt"
"path"
"strings"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/govc/cli"
@ -44,7 +45,8 @@ type ovfx struct {
*ArchiveFlag
*OptionsFlag
Name string
Name string
VerifyManifest bool
Client *vim25.Client
Datacenter *object.Datacenter
@ -74,6 +76,7 @@ func (cmd *ovfx) Register(ctx context.Context, f *flag.FlagSet) {
cmd.OptionsFlag.Register(ctx, f)
f.StringVar(&cmd.Name, "name", "", "Name to use for new entity")
f.BoolVar(&cmd.VerifyManifest, "m", false, "Verify checksum of uploaded files against manifest (.mf)")
}
func (cmd *ovfx) Process(ctx context.Context) error {
@ -315,6 +318,13 @@ func (cmd *ovfx) Import(fpath string) (*types.ManagedObjectReference, error) {
}
}
if cmd.VerifyManifest {
err = cmd.readManifest(fpath)
if err != nil {
return nil, err
}
}
lease, err := cmd.ResourcePool.ImportVApp(ctx, spec.ImportSpec, folder, host)
if err != nil {
return nil, err
@ -355,5 +365,74 @@ func (cmd *ovfx) Upload(ctx context.Context, lease *nfc.Lease, item nfc.FileItem
Progress: logger,
}
return lease.Upload(ctx, item, f, opts)
err = lease.Upload(ctx, item, f, opts)
if err != nil {
return err
}
if cmd.VerifyManifest {
mapImportKeyToKey := func(urls []types.HttpNfcLeaseDeviceUrl, importKey string) string {
for _, url := range urls {
if url.ImportKey == importKey {
return url.Key
}
}
return ""
}
leaseInfo, err := lease.Wait(ctx, nil)
if err != nil {
return err
}
return cmd.validateChecksum(ctx, lease, file, mapImportKeyToKey(leaseInfo.DeviceUrl, item.DeviceId))
}
return nil
}
func (cmd *ovfx) validateChecksum(ctx context.Context, lease *nfc.Lease, file string, key string) error {
sum, found := cmd.manifest[file]
if !found {
msg := fmt.Sprintf("missing checksum for %v in manifest file", file)
return errors.New(msg)
}
// Perform the checksum match eagerly, after each file upload, instead
// of after uploading all the files, to provide fail-fast behavior.
// (Trade-off here is multiple GetManifest() API calls to the server.)
manifests, err := lease.GetManifest(ctx)
if err != nil {
return err
}
for _, m := range manifests {
if m.Key == key {
// Compare server-side computed checksum of uploaded file
// against the client's manifest entry (assuming client's
// manifest has correct checksums - client doesn't compute
// checksum of the file before uploading).
// Try matching sha1 first (newer versions have moved to sha256).
if strings.ToUpper(sum.Algorithm) == "SHA1" {
if sum.Checksum != m.Sha1 {
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
sum.Checksum, m.Sha1, file)
return errors.New(msg)
}
// Uploaded file checksum computed by server matches with local manifest entry.
return nil
}
// If not sha1, check for other types (in a separate field).
if !strings.EqualFold(sum.Algorithm, m.ChecksumType) {
msg := fmt.Sprintf("manifest checksum type %v mismatch with uploaded checksum type %v for file %v",
sum.Algorithm, m.ChecksumType, file)
return errors.New(msg)
}
if !strings.EqualFold(sum.Checksum, m.Checksum) {
msg := fmt.Sprintf("manifest checksum %v mismatch with uploaded checksum %v for file %v",
sum.Checksum, m.Checksum, file)
return errors.New(msg)
}
// Uploaded file checksum computed by server matches with local manifest entry.
return nil
}
}
msg := fmt.Sprintf("missing manifest entry on server for uploaded file %v (key %v), manifests=%#v", file, key, manifests)
return errors.New(msg)
}

View file

@ -220,6 +220,10 @@ func (cmd *clone) Run(ctx context.Context, f *flag.FlagSet) error {
if cmd.ResourcePool, err = cmd.ResourcePoolFlag.ResourcePool(); err != nil {
return err
}
} else {
if cmd.ResourcePool, err = cmd.Cluster.ResourcePool(ctx); err != nil {
return err
}
}
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -37,6 +37,7 @@ type power struct {
Reset bool
Reboot bool
Shutdown bool
Standby bool
Suspend bool
Force bool
Multi bool
@ -60,6 +61,7 @@ func (cmd *power) Register(ctx context.Context, f *flag.FlagSet) {
f.BoolVar(&cmd.Suspend, "suspend", false, "Power suspend")
f.BoolVar(&cmd.Reboot, "r", false, "Reboot guest")
f.BoolVar(&cmd.Shutdown, "s", false, "Shutdown guest")
f.BoolVar(&cmd.Standby, "standby", false, "Standby guest")
f.BoolVar(&cmd.Force, "force", false, "Force (ignore state error and hard shutdown/reboot if tools unavailable)")
f.BoolVar(&cmd.Multi, "M", false, "Use Datacenter.PowerOnMultiVM method instead of VirtualMachine.PowerOnVM")
f.BoolVar(&cmd.Wait, "wait", true, "Wait for the operation to complete")
@ -85,7 +87,7 @@ func (cmd *power) Process(ctx context.Context) error {
if err := cmd.SearchFlag.Process(ctx); err != nil {
return err
}
opts := []bool{cmd.On, cmd.Off, cmd.Reset, cmd.Suspend, cmd.Reboot, cmd.Shutdown}
opts := []bool{cmd.On, cmd.Off, cmd.Reset, cmd.Suspend, cmd.Reboot, cmd.Shutdown, cmd.Standby}
selected := false
for _, opt := range opts {
@ -188,6 +190,13 @@ func (cmd *power) Run(ctx context.Context, f *flag.FlagSet) error {
if err != nil && cmd.Force && isToolsUnavailable(err) {
task, err = vm.PowerOff(ctx)
}
case cmd.Standby:
fmt.Fprintf(cmd, "Standby guest %s... ", vm.Reference())
err = vm.StandbyGuest(ctx)
if err != nil && cmd.Force && isToolsUnavailable(err) {
task, err = vm.Suspend(ctx)
}
}
if err != nil {

View file

@ -168,6 +168,15 @@ func (m FileManager) TransferURL(ctx context.Context, u string) (*url.URL, error
return turl, nil // won't matter if the VM was powered off since the call to InitiateFileTransfer will fail
}
// VC supports the use of a Unix domain socket for guest file transfers.
if internal.UsingEnvoySidecar(m.c) {
// Rewrite the URL in the format unix://
// Reciever must use a custom dialer.
// Nil check performed above, so Host is safe to access.
return internal.HostGatewayTransferURL(turl, *vm.Runtime.Host), nil
}
// Determine host thumbprint, address etc. to be able to trust host.
props := []string{
"name",
"runtime.connectionState",

View file

@ -29,6 +29,7 @@ import (
"time"
"github.com/vmware/govmomi/guest"
"github.com/vmware/govmomi/internal"
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
@ -284,6 +285,10 @@ func (c *Client) Download(ctx context.Context, src string) (io.ReadCloser, int64
p := soap.DefaultDownload
if internal.UsingEnvoySidecar(c.ProcessManager.Client()) {
vc = internal.ClientWithEnvoyHostGateway(vc)
}
f, n, err := vc.Download(ctx, u, &p)
if err != nil {
return nil, n, err
@ -341,5 +346,9 @@ func (c *Client) Upload(ctx context.Context, src io.Reader, dst string, p soap.U
return err
}
if internal.UsingEnvoySidecar(c.ProcessManager.Client()) {
vc = internal.ClientWithEnvoyHostGateway(vc)
}
return vc.Client.Upload(ctx, src, u, &p)
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2020 VMware, Inc. All Rights Reserved.
Copyright (c) 2020-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -17,13 +17,25 @@ limitations under the License.
package internal
import (
"context"
"fmt"
"net"
"net/http"
"net/url"
"os"
"path"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/soap"
"github.com/vmware/govmomi/vim25/types"
)
const (
vCenterHostGatewaySocket = "/var/run/envoy-hgw/hgw-pipe"
vCenterHostGatewaySocketEnv = "VCENTER_ENVOY_HOST_GATEWAY"
)
// InventoryPath composed of entities by Name
func InventoryPath(entities []mo.ManagedEntity) string {
val := "/"
@ -61,3 +73,69 @@ func HostSystemManagementIPs(config []types.VirtualNicManagerNetConfig) []net.IP
return ips
}
// UsingEnvoySidecar determines if the given *vim25.Client is using vCenter's
// local Envoy sidecar (as opposed to using the HTTPS port.)
// Returns a boolean indicating whether to use the sidecar or not.
func UsingEnvoySidecar(c *vim25.Client) bool {
envoySidecarPort := os.Getenv("GOVMOMI_ENVOY_SIDECAR_PORT")
if envoySidecarPort == "" {
envoySidecarPort = "1080"
}
envoySidecarHost := os.Getenv("GOVMOMI_ENVOY_SIDECAR_HOST")
if envoySidecarHost == "" {
envoySidecarHost = "localhost"
}
return c.URL().Hostname() == envoySidecarHost && c.URL().Scheme == "http" && c.URL().Port() == envoySidecarPort
}
// ClientWithEnvoyHostGateway clones the provided soap.Client and returns a new
// one that uses a Unix socket to leverage vCenter's local Envoy host
// gateway.
// This should be used to construct clients that talk to ESX.
// This method returns a new *vim25.Client and does not modify the original input.
// This client disables HTTP keep alives and is intended for a single round
// trip. (eg. guest file transfer, datastore file transfer)
func ClientWithEnvoyHostGateway(vc *vim25.Client) *vim25.Client {
// Override the vim client with a new one that wraps a Unix socket transport.
// Using HTTP here so secure means nothing.
sc := soap.NewClient(vc.URL(), true)
// Clone the underlying HTTP transport, only replacing the dialer logic.
transport := sc.DefaultTransport().Clone()
hostGatewaySocketPath := os.Getenv(vCenterHostGatewaySocketEnv)
if hostGatewaySocketPath == "" {
hostGatewaySocketPath = vCenterHostGatewaySocket
}
transport.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) {
return net.Dial("unix", hostGatewaySocketPath)
}
// We use this client for a single request, so we don't require keepalives.
transport.DisableKeepAlives = true
sc.Client = http.Client{
Transport: transport,
}
newVC := &vim25.Client{
Client: sc,
}
return newVC
}
// HostGatewayTransferURL rewrites the provided URL to be suitable for use
// with the Envoy host gateway on vCenter.
// It returns a copy of the provided URL with the host, scheme rewritten as needed.
// Receivers of such URLs must typically also use ClientWithEnvoyHostGateway to
// use the appropriate http.Transport to be able to make use of the host
// gateway.
// nil input yields an uninitialized struct.
func HostGatewayTransferURL(u *url.URL, hostMoref types.ManagedObjectReference) *url.URL {
if u == nil {
return &url.URL{}
}
// Make a copy of the provided URL.
turl := *u
turl.Host = "localhost"
turl.Scheme = "http"
oldPath := turl.Path
turl.Path = fmt.Sprintf("/hgw/%s%s", hostMoref.Value, oldPath)
return &turl
}

View file

@ -21,5 +21,5 @@ const (
ClientName = "govmomi"
// ClientVersion is the version of this SDK
ClientVersion = "0.30.7"
ClientVersion = "0.31.0"
)

View file

@ -71,17 +71,17 @@ func (l *Lease) Complete(ctx context.Context) error {
}
// GetManifest wraps methods.GetManifest
func (l *Lease) GetManifest(ctx context.Context) error {
func (l *Lease) GetManifest(ctx context.Context) ([]types.HttpNfcLeaseManifestEntry, error) {
req := types.HttpNfcLeaseGetManifest{
This: l.Reference(),
}
_, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req)
res, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req)
if err != nil {
return err
return nil, err
}
return nil
return res.Returnval, nil
}
// Progress wraps methods.Progress

View file

@ -27,6 +27,7 @@ import (
"path"
"strings"
"github.com/vmware/govmomi/internal"
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/session"
"github.com/vmware/govmomi/vim25"
@ -83,8 +84,14 @@ func (d Datastore) Path(path string) string {
func (d Datastore) NewURL(path string) *url.URL {
u := d.c.URL()
scheme := u.Scheme
// In rare cases where vCenter and ESX are accessed using different schemes.
if overrideScheme := os.Getenv("GOVMOMI_DATASTORE_ACCESS_SCHEME"); overrideScheme != "" {
scheme = overrideScheme
}
return &url.URL{
Scheme: u.Scheme,
Scheme: scheme,
Host: u.Host,
Path: fmt.Sprintf("/folder/%s", path),
RawQuery: url.Values{
@ -223,8 +230,18 @@ func (d Datastore) ServiceTicket(ctx context.Context, path string, method string
delete(q, "dcPath")
u.RawQuery = q.Encode()
// Now that we have a host selected, take a copy of the URL.
transferURL := *u
if internal.UsingEnvoySidecar(d.Client()) {
// Rewrite the host URL to go through the Envoy sidecar on VC.
// Reciever must use a custom dialer.
u = internal.HostGatewayTransferURL(u, host.Reference())
}
spec := types.SessionManagerHttpServiceRequestSpec{
Url: u.String(),
// Use the original URL (without rewrites) for the session ticket.
Url: transferURL.String(),
// See SessionManagerHttpServiceRequestSpecMethod enum
Method: fmt.Sprintf("http%s%s", method[0:1], strings.ToLower(method[1:])),
}
@ -297,7 +314,13 @@ func (d Datastore) UploadFile(ctx context.Context, file string, path string, par
if err != nil {
return err
}
return d.Client().UploadFile(ctx, file, u, p)
vc := d.Client()
if internal.UsingEnvoySidecar(vc) {
// Override the vim client with a new one that wraps a Unix socket transport.
// Using HTTP here so secure means nothing.
vc = internal.ClientWithEnvoyHostGateway(vc)
}
return vc.UploadFile(ctx, file, u, p)
}
// Download via soap.Download with an http service ticket
@ -315,7 +338,13 @@ func (d Datastore) DownloadFile(ctx context.Context, path string, file string, p
if err != nil {
return err
}
return d.Client().DownloadFile(ctx, file, u, p)
vc := d.Client()
if internal.UsingEnvoySidecar(vc) {
// Override the vim client with a new one that wraps a Unix socket transport.
// Using HTTP here so secure means nothing.
vc = internal.ClientWithEnvoyHostGateway(vc)
}
return vc.DownloadFile(ctx, file, u, p)
}
// AttachedHosts returns hosts that have this Datastore attached, accessible and writable.

View file

@ -404,9 +404,13 @@ func (l VirtualDeviceList) PickController(kind types.BaseVirtualController) type
}
// newUnitNumber returns the unit number to use for attaching a new device to the given controller.
func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController) int32 {
func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController, offset int) int32 {
units := make([]bool, 30)
for i := 0; i < offset; i++ {
units[i] = true
}
switch sc := c.(type) {
case types.BaseVirtualSCSIController:
// The SCSI controller sits on its own bus
@ -455,7 +459,14 @@ func (l VirtualDeviceList) AssignController(device types.BaseVirtualDevice, c ty
d := device.GetVirtualDevice()
d.ControllerKey = c.GetVirtualController().Key
d.UnitNumber = new(int32)
*d.UnitNumber = l.newUnitNumber(c)
offset := 0
switch device.(type) {
case types.BaseVirtualEthernetCard:
offset = 7
}
*d.UnitNumber = l.newUnitNumber(c, offset)
if d.Key == 0 {
d.Key = l.newRandomKey()
}

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2015-2021 VMware, Inc. All Rights Reserved.
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -172,6 +172,15 @@ func (v VirtualMachine) ShutdownGuest(ctx context.Context) error {
return err
}
func (v VirtualMachine) StandbyGuest(ctx context.Context) error {
req := types.StandbyGuest{
This: v.Reference(),
}
_, err := methods.StandbyGuest(ctx, v.c, &req)
return err
}
func (v VirtualMachine) RebootGuest(ctx context.Context) error {
req := types.RebootGuest{
This: v.Reference(),

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@ import (
type PbmAssociateAndApplyPolicyStatusPolicyStatus string
const (
// Policy applied successfully.
PbmAssociateAndApplyPolicyStatusPolicyStatusSuccess = PbmAssociateAndApplyPolicyStatusPolicyStatus("success")
PbmAssociateAndApplyPolicyStatusPolicyStatusFailed = PbmAssociateAndApplyPolicyStatusPolicyStatus("failed")
// Policy cannot be applied
PbmAssociateAndApplyPolicyStatusPolicyStatusFailed = PbmAssociateAndApplyPolicyStatusPolicyStatus("failed")
// Policy cannot be applied
PbmAssociateAndApplyPolicyStatusPolicyStatusInvalid = PbmAssociateAndApplyPolicyStatusPolicyStatus("invalid")
)
@ -34,28 +37,90 @@ func init() {
types.Add("pbm:PbmAssociateAndApplyPolicyStatusPolicyStatus", reflect.TypeOf((*PbmAssociateAndApplyPolicyStatusPolicyStatus)(nil)).Elem())
}
// The `PbmBuiltinGenericType_enum` enumerated type defines the list
// of builtin generic datatypes.
//
// See
// `PbmCapabilityGenericTypeInfo*.*PbmCapabilityGenericTypeInfo.genericTypeName`.
//
// A generic datatype indicates how to interpret a collection of values
// of a specific datatype (`PbmCapabilityTypeInfo.typeName`).
type PbmBuiltinGenericType string
const (
// Indicates a full or partial range of values (`PbmCapabilityRange`).
//
// A full range specifies both <code>min</code> and <code>max</code> values.
// A partial range specifies one or the other, <code>min</code> or <code>max</code>.
PbmBuiltinGenericTypeVMW_RANGE = PbmBuiltinGenericType("VMW_RANGE")
PbmBuiltinGenericTypeVMW_SET = PbmBuiltinGenericType("VMW_SET")
// Indicates a single value or a discrete set of values
// (`PbmCapabilityDiscreteSet`).
PbmBuiltinGenericTypeVMW_SET = PbmBuiltinGenericType("VMW_SET")
)
func init() {
types.Add("pbm:PbmBuiltinGenericType", reflect.TypeOf((*PbmBuiltinGenericType)(nil)).Elem())
}
// The `PbmBuiltinType_enum` enumerated type defines datatypes
// for storage profiles.
//
// Property metadata
// (`PbmCapabilityPropertyMetadata`) uses the builtin types
// to define data types for storage capabilities and requirements.
// It may also specify the semantics that are applied to a collection
// of builtin type values. See `PbmCapabilityTypeInfo`.
// These semantics are specified as a generic builtin type.
// See `PbmCapabilityGenericTypeInfo`.
// The type information determines how capability constraints are interpreted
// `PbmCapabilityPropertyInstance.value`).
type PbmBuiltinType string
const (
PbmBuiltinTypeXSD_LONG = PbmBuiltinType("XSD_LONG")
PbmBuiltinTypeXSD_SHORT = PbmBuiltinType("XSD_SHORT")
PbmBuiltinTypeXSD_INTEGER = PbmBuiltinType("XSD_INTEGER")
PbmBuiltinTypeXSD_INT = PbmBuiltinType("XSD_INT")
PbmBuiltinTypeXSD_STRING = PbmBuiltinType("XSD_STRING")
PbmBuiltinTypeXSD_BOOLEAN = PbmBuiltinType("XSD_BOOLEAN")
PbmBuiltinTypeXSD_DOUBLE = PbmBuiltinType("XSD_DOUBLE")
// Unsigned long value.
//
// This datatype supports the following constraint values.
// - Single value
// - Full or partial range of values (`PbmCapabilityRange`)
// - Discrete set of values (`PbmCapabilityDiscreteSet`)
PbmBuiltinTypeXSD_LONG = PbmBuiltinType("XSD_LONG")
// Datatype not supported.
PbmBuiltinTypeXSD_SHORT = PbmBuiltinType("XSD_SHORT")
// Datatype not supported.
//
// Use XSD\_INT instead.
PbmBuiltinTypeXSD_INTEGER = PbmBuiltinType("XSD_INTEGER")
// Integer value.
//
// This datatype supports the following constraint values.
// - Single value
// - Full or partial range of values (`PbmCapabilityRange`)
// - Discrete set of values (`PbmCapabilityDiscreteSet`)
PbmBuiltinTypeXSD_INT = PbmBuiltinType("XSD_INT")
// String value.
//
// This datatype supports a single value
// or a discrete set of values (`PbmCapabilityDiscreteSet`).
PbmBuiltinTypeXSD_STRING = PbmBuiltinType("XSD_STRING")
// Boolean value.
PbmBuiltinTypeXSD_BOOLEAN = PbmBuiltinType("XSD_BOOLEAN")
// Double precision floating point value.
//
// This datatype supports the following
// constraint values.
// - Single value
// - Full or partial range of values (`PbmCapabilityRange`)
// - Discrete set of values (`PbmCapabilityDiscreteSet`)
PbmBuiltinTypeXSD_DOUBLE = PbmBuiltinType("XSD_DOUBLE")
// Date and time value.
PbmBuiltinTypeXSD_DATETIME = PbmBuiltinType("XSD_DATETIME")
// Timespan value (`PbmCapabilityTimeSpan`).
//
// This datatype supports
// the following constraint values.
// - Single value
// - Full or partial range of values (`PbmCapabilityRange`)
// - Discrete set of values (`PbmCapabilityDiscreteSet`)
PbmBuiltinTypeVMW_TIMESPAN = PbmBuiltinType("VMW_TIMESPAN")
PbmBuiltinTypeVMW_POLICY = PbmBuiltinType("VMW_POLICY")
)
@ -64,6 +129,10 @@ func init() {
types.Add("pbm:PbmBuiltinType", reflect.TypeOf((*PbmBuiltinType)(nil)).Elem())
}
// List of operators that are supported for constructing policy.
//
// Currently only tag based properties can use this operator.
// Other operators can be added as required.
type PbmCapabilityOperator string
const (
@ -74,52 +143,96 @@ func init() {
types.Add("pbm:PbmCapabilityOperator", reflect.TypeOf((*PbmCapabilityOperator)(nil)).Elem())
}
// The `PbmCapabilityTimeUnitType_enum` enumeration type
// defines the supported list of time units for profiles that specify
// time span capabilities and constraints.
//
// See `PbmCapabilityTimeSpan`.
type PbmCapabilityTimeUnitType string
const (
// Constraints and capabilities expressed in units of seconds.
PbmCapabilityTimeUnitTypeSECONDS = PbmCapabilityTimeUnitType("SECONDS")
// Constraints and capabilities expressed in units of minutes.
PbmCapabilityTimeUnitTypeMINUTES = PbmCapabilityTimeUnitType("MINUTES")
PbmCapabilityTimeUnitTypeHOURS = PbmCapabilityTimeUnitType("HOURS")
PbmCapabilityTimeUnitTypeDAYS = PbmCapabilityTimeUnitType("DAYS")
PbmCapabilityTimeUnitTypeWEEKS = PbmCapabilityTimeUnitType("WEEKS")
PbmCapabilityTimeUnitTypeMONTHS = PbmCapabilityTimeUnitType("MONTHS")
PbmCapabilityTimeUnitTypeYEARS = PbmCapabilityTimeUnitType("YEARS")
// Constraints and capabilities expressed in units of hours.
PbmCapabilityTimeUnitTypeHOURS = PbmCapabilityTimeUnitType("HOURS")
// Constraints and capabilities expressed in units of days.
PbmCapabilityTimeUnitTypeDAYS = PbmCapabilityTimeUnitType("DAYS")
// Constraints and capabilities expressed in units of weeks.
PbmCapabilityTimeUnitTypeWEEKS = PbmCapabilityTimeUnitType("WEEKS")
// Constraints and capabilities expressed in units of months.
PbmCapabilityTimeUnitTypeMONTHS = PbmCapabilityTimeUnitType("MONTHS")
// Constraints and capabilities expressed in units of years.
PbmCapabilityTimeUnitTypeYEARS = PbmCapabilityTimeUnitType("YEARS")
)
func init() {
types.Add("pbm:PbmCapabilityTimeUnitType", reflect.TypeOf((*PbmCapabilityTimeUnitType)(nil)).Elem())
}
// The `PbmComplianceResultComplianceTaskStatus_enum`
// enumeration type defines the set of task status for compliance
// operations.
//
// See `PbmComplianceResult` and
// `PbmRollupComplianceResult`.
type PbmComplianceResultComplianceTaskStatus string
const (
// Compliance calculation is in progress.
PbmComplianceResultComplianceTaskStatusInProgress = PbmComplianceResultComplianceTaskStatus("inProgress")
PbmComplianceResultComplianceTaskStatusSuccess = PbmComplianceResultComplianceTaskStatus("success")
PbmComplianceResultComplianceTaskStatusFailed = PbmComplianceResultComplianceTaskStatus("failed")
// Compliance calculation has succeeded.
PbmComplianceResultComplianceTaskStatusSuccess = PbmComplianceResultComplianceTaskStatus("success")
// Compliance calculation failed due to some exception.
PbmComplianceResultComplianceTaskStatusFailed = PbmComplianceResultComplianceTaskStatus("failed")
)
func init() {
types.Add("pbm:PbmComplianceResultComplianceTaskStatus", reflect.TypeOf((*PbmComplianceResultComplianceTaskStatus)(nil)).Elem())
}
// The `PbmComplianceStatus_enum`
// enumeration type defines the set of status values
// for compliance operations.
//
// See `PbmComplianceResult` and
// `PbmRollupComplianceResult`.
type PbmComplianceStatus string
const (
PbmComplianceStatusCompliant = PbmComplianceStatus("compliant")
PbmComplianceStatusNonCompliant = PbmComplianceStatus("nonCompliant")
PbmComplianceStatusUnknown = PbmComplianceStatus("unknown")
// Entity is in compliance.
PbmComplianceStatusCompliant = PbmComplianceStatus("compliant")
// Entity is out of compliance.
PbmComplianceStatusNonCompliant = PbmComplianceStatus("nonCompliant")
// Compliance status of the entity is not known.
PbmComplianceStatusUnknown = PbmComplianceStatus("unknown")
// Compliance computation is not applicable for this entity,
// because it does not have any storage requirements that
// apply to the object-based datastore on which this entity is placed.
PbmComplianceStatusNotApplicable = PbmComplianceStatus("notApplicable")
PbmComplianceStatusOutOfDate = PbmComplianceStatus("outOfDate")
// This is the same as `PbmComplianceResult.mismatch`
// variable.
//
// Compliance status becomes out-of-date when the profile
// associated with the entity is edited and not applied. The compliance
// status will remain in out-of-date compliance status until the latest
// policy is applied to the entity.
PbmComplianceStatusOutOfDate = PbmComplianceStatus("outOfDate")
)
func init() {
types.Add("pbm:PbmComplianceStatus", reflect.TypeOf((*PbmComplianceStatus)(nil)).Elem())
}
// This enum corresponds to the keystores used by
// sps.
type PbmDebugManagerKeystoreName string
const (
PbmDebugManagerKeystoreNameSMS = PbmDebugManagerKeystoreName("SMS")
// Refers to SMS keystore
PbmDebugManagerKeystoreNameSMS = PbmDebugManagerKeystoreName("SMS")
// Refers to TRUSTED\_ROOTS keystore.
PbmDebugManagerKeystoreNameTRUSTED_ROOTS = PbmDebugManagerKeystoreName("TRUSTED_ROOTS")
)
@ -127,12 +240,30 @@ func init() {
types.Add("pbm:PbmDebugManagerKeystoreName", reflect.TypeOf((*PbmDebugManagerKeystoreName)(nil)).Elem())
}
// The enumeration type defines the set of health status values for an entity
// that is part of entity health operation.
type PbmHealthStatusForEntity string
const (
PbmHealthStatusForEntityRed = PbmHealthStatusForEntity("red")
PbmHealthStatusForEntityYellow = PbmHealthStatusForEntity("yellow")
PbmHealthStatusForEntityGreen = PbmHealthStatusForEntity("green")
// For file share: 'red' if the file server for this file share is in error
// state or any of its backing vSAN objects are degraded.
//
// For FCD: 'red' if the datastore on which the FCD resides is not
// accessible from any of the hosts it is mounted.
PbmHealthStatusForEntityRed = PbmHealthStatusForEntity("red")
// For file share: 'yellow' if some backing objects are repairing, i.e.
//
// warning state.
// For FCD: 'yellow' if the datastore on which the entity resides is
// accessible only from some of the hosts it is mounted but not all.
PbmHealthStatusForEntityYellow = PbmHealthStatusForEntity("yellow")
// For file share: 'green' if the file server for this file share is
// running properly and all its backing vSAN objects are healthy.
//
// For FCD: 'green' if the datastore on which the entity resides
// is accessible from all the hosts it is mounted.
PbmHealthStatusForEntityGreen = PbmHealthStatusForEntity("green")
// If the health status of a file share is unknown, not valid for FCD.
PbmHealthStatusForEntityUnknown = PbmHealthStatusForEntity("unknown")
)
@ -140,6 +271,11 @@ func init() {
types.Add("pbm:PbmHealthStatusForEntity", reflect.TypeOf((*PbmHealthStatusForEntity)(nil)).Elem())
}
// Recognized types of an IO Filter.
//
// String constant used in `IofilterInfo#filterType`.
// These should match(upper case) the IO Filter classes as defined by IO Filter framework.
// See https://opengrok.eng.vmware.com/source/xref/vmcore-main.perforce.1666/bora/scons/apps/esx/iofilterApps.sc#33
type PbmIofilterInfoFilterType string
const (
@ -156,6 +292,7 @@ func init() {
types.Add("pbm:PbmIofilterInfoFilterType", reflect.TypeOf((*PbmIofilterInfoFilterType)(nil)).Elem())
}
// Denotes the line of service of a schema.
type PbmLineOfServiceInfoLineOfServiceEnum string
const (
@ -174,28 +311,43 @@ func init() {
types.Add("pbm:PbmLineOfServiceInfoLineOfServiceEnum", reflect.TypeOf((*PbmLineOfServiceInfoLineOfServiceEnum)(nil)).Elem())
}
// This enum corresponds to the different packages whose logging
// is configured independently by sps service.
type PbmLoggingConfigurationComponent string
const (
PbmLoggingConfigurationComponentPbm = PbmLoggingConfigurationComponent("pbm")
PbmLoggingConfigurationComponentVslm = PbmLoggingConfigurationComponent("vslm")
PbmLoggingConfigurationComponentSms = PbmLoggingConfigurationComponent("sms")
PbmLoggingConfigurationComponentSpbm = PbmLoggingConfigurationComponent("spbm")
PbmLoggingConfigurationComponentSps = PbmLoggingConfigurationComponent("sps")
PbmLoggingConfigurationComponentHttpclient_header = PbmLoggingConfigurationComponent("httpclient_header")
// Modifies logging level of com.vmware.pbm package.
PbmLoggingConfigurationComponentPbm = PbmLoggingConfigurationComponent("pbm")
// Modifies logging level of com.vmware.vslm package.
PbmLoggingConfigurationComponentVslm = PbmLoggingConfigurationComponent("vslm")
// Modifies logging level of com.vmware.vim.sms package.
PbmLoggingConfigurationComponentSms = PbmLoggingConfigurationComponent("sms")
// Modifies logging level of com.vmware.spbm package.
PbmLoggingConfigurationComponentSpbm = PbmLoggingConfigurationComponent("spbm")
// Modifies logging level of com.vmware.sps package.
PbmLoggingConfigurationComponentSps = PbmLoggingConfigurationComponent("sps")
// Modifies logging level of httpclient wire header.
PbmLoggingConfigurationComponentHttpclient_header = PbmLoggingConfigurationComponent("httpclient_header")
// Modifies logging level of httpclient wire content.
PbmLoggingConfigurationComponentHttpclient_content = PbmLoggingConfigurationComponent("httpclient_content")
PbmLoggingConfigurationComponentVmomi = PbmLoggingConfigurationComponent("vmomi")
// Modifies logging level of com.vmware.vim.vmomi package.
PbmLoggingConfigurationComponentVmomi = PbmLoggingConfigurationComponent("vmomi")
)
func init() {
types.Add("pbm:PbmLoggingConfigurationComponent", reflect.TypeOf((*PbmLoggingConfigurationComponent)(nil)).Elem())
}
// This enum corresponds to the different log levels supported
// by sps service.
type PbmLoggingConfigurationLogLevel string
const (
PbmLoggingConfigurationLogLevelINFO = PbmLoggingConfigurationLogLevel("INFO")
// Refers to INFO level logging
PbmLoggingConfigurationLogLevelINFO = PbmLoggingConfigurationLogLevel("INFO")
// Refers to DEBUG level logging.
PbmLoggingConfigurationLogLevelDEBUG = PbmLoggingConfigurationLogLevel("DEBUG")
// Refers to TRACE level logging.
PbmLoggingConfigurationLogLevelTRACE = PbmLoggingConfigurationLogLevel("TRACE")
)
@ -203,42 +355,76 @@ func init() {
types.Add("pbm:PbmLoggingConfigurationLogLevel", reflect.TypeOf((*PbmLoggingConfigurationLogLevel)(nil)).Elem())
}
// The `PbmObjectType_enum` enumerated type
// defines vSphere Server object types that are known
// to the Storage Policy Server.
//
// See `PbmServerObjectRef*.*PbmServerObjectRef.objectType`.
type PbmObjectType string
const (
PbmObjectTypeVirtualMachine = PbmObjectType("virtualMachine")
// Indicates a virtual machine, not including the disks, identified by the virtual machine
// identifier _virtual-machine-mor_.
PbmObjectTypeVirtualMachine = PbmObjectType("virtualMachine")
// Indicates the virtual machine and all its disks, identified by the virtual machine
// identifier _virtual-machine-mor_.
PbmObjectTypeVirtualMachineAndDisks = PbmObjectType("virtualMachineAndDisks")
PbmObjectTypeVirtualDiskId = PbmObjectType("virtualDiskId")
PbmObjectTypeVirtualDiskUUID = PbmObjectType("virtualDiskUUID")
PbmObjectTypeDatastore = PbmObjectType("datastore")
PbmObjectTypeVsanObjectId = PbmObjectType("vsanObjectId")
PbmObjectTypeFileShareId = PbmObjectType("fileShareId")
PbmObjectTypeUnknown = PbmObjectType("unknown")
// Indicates a virtual disk, identified by disk key
// (_virtual-machine-mor_:_disk-key_).
PbmObjectTypeVirtualDiskId = PbmObjectType("virtualDiskId")
// Indicates a virtual disk, identified by UUID - for First Class Storage Object support.
PbmObjectTypeVirtualDiskUUID = PbmObjectType("virtualDiskUUID")
// Indicates a datastore.
PbmObjectTypeDatastore = PbmObjectType("datastore")
// Indicates a VSAN object
PbmObjectTypeVsanObjectId = PbmObjectType("vsanObjectId")
// Indicates a file service
PbmObjectTypeFileShareId = PbmObjectType("fileShareId")
// Unknown object type.
PbmObjectTypeUnknown = PbmObjectType("unknown")
)
func init() {
types.Add("pbm:PbmObjectType", reflect.TypeOf((*PbmObjectType)(nil)).Elem())
}
// The `PbmOperation_enum` enumerated type
// defines the provisioning operation being performed on the entity like FCD, virtual machine.
type PbmOperation string
const (
PbmOperationCREATE = PbmOperation("CREATE")
PbmOperationREGISTER = PbmOperation("REGISTER")
// Indicates create operation of an entity.
PbmOperationCREATE = PbmOperation("CREATE")
// Indicates register operation of an entity.
PbmOperationREGISTER = PbmOperation("REGISTER")
// Indicates reconfigure operation of an entity.
PbmOperationRECONFIGURE = PbmOperation("RECONFIGURE")
PbmOperationMIGRATE = PbmOperation("MIGRATE")
PbmOperationCLONE = PbmOperation("CLONE")
// Indicates migrate operation of an entity.
PbmOperationMIGRATE = PbmOperation("MIGRATE")
// Indicates clone operation of an entity.
PbmOperationCLONE = PbmOperation("CLONE")
)
func init() {
types.Add("pbm:PbmOperation", reflect.TypeOf((*PbmOperation)(nil)).Elem())
}
// Volume allocation type constants.
type PbmPolicyAssociationVolumeAllocationType string
const (
PbmPolicyAssociationVolumeAllocationTypeFullyInitialized = PbmPolicyAssociationVolumeAllocationType("FullyInitialized")
PbmPolicyAssociationVolumeAllocationTypeReserveSpace = PbmPolicyAssociationVolumeAllocationType("ReserveSpace")
// Space required is fully allocated and initialized.
//
// It is wiped clean of any previous content on the
// physical media. Gives faster runtime IO performance.
PbmPolicyAssociationVolumeAllocationTypeFullyInitialized = PbmPolicyAssociationVolumeAllocationType("FullyInitialized")
// Space required is fully allocated.
//
// It may contain
// stale data on the physical media.
PbmPolicyAssociationVolumeAllocationTypeReserveSpace = PbmPolicyAssociationVolumeAllocationType("ReserveSpace")
// Space required is allocated and zeroed on demand
// as the space is used.
PbmPolicyAssociationVolumeAllocationTypeConserveSpaceWhenPossible = PbmPolicyAssociationVolumeAllocationType("ConserveSpaceWhenPossible")
)
@ -246,11 +432,30 @@ func init() {
types.Add("pbm:PbmPolicyAssociationVolumeAllocationType", reflect.TypeOf((*PbmPolicyAssociationVolumeAllocationType)(nil)).Elem())
}
// The `PbmProfileCategoryEnum_enum`
// enumerated type defines the profile categories for a capability-based
// storage profile.
//
// See
// `PbmCapabilityProfile`.
type PbmProfileCategoryEnum string
const (
PbmProfileCategoryEnumREQUIREMENT = PbmProfileCategoryEnum("REQUIREMENT")
PbmProfileCategoryEnumRESOURCE = PbmProfileCategoryEnum("RESOURCE")
// Indicates a storage requirement.
//
// Requirements are based on
// storage capabilities.
PbmProfileCategoryEnumREQUIREMENT = PbmProfileCategoryEnum("REQUIREMENT")
// Indicates a storage capability.
//
// Storage capabilities
// are defined by storage providers.
PbmProfileCategoryEnumRESOURCE = PbmProfileCategoryEnum("RESOURCE")
// Indicates a data service policy that can be embedded into
// another storage policy.
//
// Policies of this type can't be assigned to
// Virtual Machines or Virtual Disks.
PbmProfileCategoryEnumDATA_SERVICE_POLICY = PbmProfileCategoryEnum("DATA_SERVICE_POLICY")
)
@ -258,9 +463,14 @@ func init() {
types.Add("pbm:PbmProfileCategoryEnum", reflect.TypeOf((*PbmProfileCategoryEnum)(nil)).Elem())
}
// The `PbmProfileResourceTypeEnum_enum` enumerated type defines the set of resource
// types that are supported for profile management.
//
// See `PbmProfileResourceType`.
type PbmProfileResourceTypeEnum string
const (
// Indicates resources that support storage profiles.
PbmProfileResourceTypeEnumSTORAGE = PbmProfileResourceTypeEnum("STORAGE")
)
@ -268,12 +478,21 @@ func init() {
types.Add("pbm:PbmProfileResourceTypeEnum", reflect.TypeOf((*PbmProfileResourceTypeEnum)(nil)).Elem())
}
// System pre-created profile types.
type PbmSystemCreatedProfileType string
const (
PbmSystemCreatedProfileTypeVsanDefaultProfile = PbmSystemCreatedProfileType("VsanDefaultProfile")
PbmSystemCreatedProfileTypeVVolDefaultProfile = PbmSystemCreatedProfileType("VVolDefaultProfile")
PbmSystemCreatedProfileTypePmemDefaultProfile = PbmSystemCreatedProfileType("PmemDefaultProfile")
// Indicates the system pre-created editable VSAN default profile.
PbmSystemCreatedProfileTypeVsanDefaultProfile = PbmSystemCreatedProfileType("VsanDefaultProfile")
// Indicates the system pre-created non-editable default profile
// for VVOL datastores.
PbmSystemCreatedProfileTypeVVolDefaultProfile = PbmSystemCreatedProfileType("VVolDefaultProfile")
// Indicates the system pre-created non-editable default profile
// for PMem datastores
PbmSystemCreatedProfileTypePmemDefaultProfile = PbmSystemCreatedProfileType("PmemDefaultProfile")
// Indicates the system pre-created non-editable VMC default profile.
PbmSystemCreatedProfileTypeVmcManagementProfile = PbmSystemCreatedProfileType("VmcManagementProfile")
// Indicates the system pre-created non-editable VSANMAX default profile.
PbmSystemCreatedProfileTypeVsanMaxDefaultProfile = PbmSystemCreatedProfileType("VsanMaxDefaultProfile")
)
@ -281,25 +500,39 @@ func init() {
types.Add("pbm:PbmSystemCreatedProfileType", reflect.TypeOf((*PbmSystemCreatedProfileType)(nil)).Elem())
}
// The `PbmVmOperation_enum` enumerated type
// defines the provisioning operation being performed on the virtual machine.
type PbmVmOperation string
const (
PbmVmOperationCREATE = PbmVmOperation("CREATE")
// Indicates create operation of a virtual machine.
PbmVmOperationCREATE = PbmVmOperation("CREATE")
// Indicates reconfigure operation of a virtual machine.
PbmVmOperationRECONFIGURE = PbmVmOperation("RECONFIGURE")
PbmVmOperationMIGRATE = PbmVmOperation("MIGRATE")
PbmVmOperationCLONE = PbmVmOperation("CLONE")
// Indicates migrate operation of a virtual machine.
PbmVmOperationMIGRATE = PbmVmOperation("MIGRATE")
// Indicates clone operation of a virtual machine.
PbmVmOperationCLONE = PbmVmOperation("CLONE")
)
func init() {
types.Add("pbm:PbmVmOperation", reflect.TypeOf((*PbmVmOperation)(nil)).Elem())
}
// The `PbmVvolType_enum` enumeration type
// defines VVOL types.
//
// VvolType's are referenced to specify which objectType
// to fetch for default capability.
type PbmVvolType string
const (
// meta-data volume
PbmVvolTypeConfig = PbmVvolType("Config")
PbmVvolTypeData = PbmVvolType("Data")
PbmVvolTypeSwap = PbmVvolType("Swap")
// vmdk volume
PbmVvolTypeData = PbmVvolType("Data")
// swap volume
PbmVvolTypeSwap = PbmVvolType("Swap")
)
func init() {

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2015 VMware, Inc. All Rights Reserved.
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -31,7 +31,6 @@ import (
//
// For more information, see:
// http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvmodl.query.PropertyCollector.html
//
type Collector struct {
roundTripper soap.RoundTripper
reference types.ManagedObjectReference

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2015 VMware, Inc. All Rights Reserved.
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -113,7 +113,6 @@ func (t *taskCallback) fn(pc []types.PropertyChange) bool {
// The detail for the progress update is set to an empty string. If the task
// finishes in the error state, the error instance is passed through as well.
// Note that this error is the same error that is returned by this function.
//
func Wait(ctx context.Context, ref types.ManagedObjectReference, pc *property.Collector, s progress.Sinker) (*types.TaskInfo, error) {
cb := &taskCallback{}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2018-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -43,7 +43,6 @@ const (
TrustedCertificatesPath = "/api/content/trusted-certificates"
VCenterOVFLibraryItem = "/com/vmware/vcenter/ovf/library-item"
VCenterVMTXLibraryItem = "/vcenter/vm-template/library-items"
VCenterVM = "/vcenter/vm"
SessionCookieName = "vmware-api-session-id"
UseHeaderAuthn = "vmware-use-header-authn"
DebugEcho = "/vc-sim/debug/echo"
@ -59,7 +58,10 @@ type AssociatedObject struct {
// Reference implements mo.Reference
func (o AssociatedObject) Reference() types.ManagedObjectReference {
return types.ManagedObjectReference(o)
return types.ManagedObjectReference{
Type: o.Type,
Value: o.Value,
}
}
// Association for tag-association requests.
@ -69,9 +71,11 @@ type Association struct {
// NewAssociation returns an Association, converting ref to an AssociatedObject.
func NewAssociation(ref mo.Reference) Association {
obj := AssociatedObject(ref.Reference())
return Association{
ObjectID: &obj,
ObjectID: &AssociatedObject{
Type: ref.Reference().Type,
Value: ref.Reference().Value,
},
}
}

View file

@ -1,5 +1,5 @@
# The content library finder
The govmomi package now includes a finder for the content library, [`github.com/vmware/govmomi/vapi/library.Finder`](https://github.com/akutz/govmomi/blob/feature/content-library/vapi/library/finder/finder.go). This finder supports searching for objects in the content library using an inventory path design similar to the [standard govmomi finder](https://github.com/vmware/govmomi/blob/master/find/finder.go) and includes support for wildcard matching courtesy of golang's [`path.Match`](https://golang.org/pkg/path/#Match). For example:
The govmomi package now includes a finder for the content library, [`github.com/vmware/govmomi/vapi/library.Finder`](https://github.com/akutz/govmomi/blob/feature/content-library/vapi/library/finder/finder.go). This finder supports searching for objects in the content library using an inventory path design similar to the [standard govmomi finder](https://github.com/vmware/govmomi/blob/main/find/finder.go) and includes support for wildcard matching courtesy of golang's [`path.Match`](https://golang.org/pkg/path/#Match). For example:
| Pattern | Result |
|---------|--------|

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018 VMware, Inc. All Rights Reserved.
Copyright (c) 2018-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ type StorageBackings struct {
// Library provides methods to create, read, update, delete, and enumerate libraries.
type Library struct {
CreationTime *time.Time `json:"creation_time,omitempty"`
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`
ID string `json:"id,omitempty"`
LastModifiedTime *time.Time `json:"last_modified_time,omitempty"`
LastSyncTime *time.Time `json:"last_sync_time,omitempty"`
@ -120,7 +120,7 @@ func (l *Library) Patch(src *Library) {
if src.Name != "" {
l.Name = src.Name
}
if src.Description != "" {
if src.Description != nil {
l.Description = src.Description
}
if src.Version != "" {

View file

@ -36,7 +36,7 @@ type Item struct {
Cached bool `json:"cached,omitempty"`
ContentVersion string `json:"content_version,omitempty"`
CreationTime *time.Time `json:"creation_time,omitempty"`
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`
ID string `json:"id,omitempty"`
LastModifiedTime *time.Time `json:"last_modified_time,omitempty"`
LastSyncTime *time.Time `json:"last_sync_time,omitempty"`
@ -63,7 +63,7 @@ func (i *Item) Patch(src *Item) {
if src.Name != "" {
i.Name = src.Name
}
if src.Description != "" {
if src.Description != nil {
i.Description = src.Description
}
if src.Type != "" {
@ -82,12 +82,17 @@ func (c *Manager) CreateLibraryItem(ctx context.Context, item Item) (string, err
LibraryID string `json:"library_id,omitempty"`
Type string `json:"type"`
}
description := ""
if item.Description != nil {
description = *item.Description
}
spec := struct {
Item createItemSpec `json:"create_spec"`
}{
Item: createItemSpec{
Name: item.Name,
Description: item.Description,
Description: description,
LibraryID: item.LibraryID,
Type: item.Type,
},

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2015-2016 VMware, Inc. All Rights Reserved.
Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -32,7 +32,7 @@ import (
const (
Namespace = "vim25"
Version = "7.0"
Version = "8.0.2.0"
Path = "/sdk"
)

27
vendor/github.com/vmware/govmomi/vim25/json/LICENSE generated vendored Normal file
View file

@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,9 @@
# JSON with Discriminators
The source code in this directory was copied from Go 1.17.13's `encoding/json` package in order to add support for JSON discriminators. Please use the following command to review the diff:
```shell
C1="$(git log --pretty=format:'%h' --no-patch --grep='Vendor Go 1.17.13 encoding/json')" && \
C2="$(git log --pretty=format:'%h' --no-patch --grep='JSON Encoding w Discriminator Support')" && \
git diff "${C1}".."${C2}"
```

1319
vendor/github.com/vmware/govmomi/vim25/json/decode.go generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,568 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"fmt"
"reflect"
"regexp"
"strconv"
"sync"
)
// DiscriminatorToTypeFunc is used to get a reflect.Type from its
// discriminator.
type DiscriminatorToTypeFunc func(discriminator string) (reflect.Type, bool)
// TypeToDiscriminatorFunc is used to get a discriminator string from a
// reflect.Type. Empty return value suppresses discriminator rendering.
type TypeToDiscriminatorFunc func(reflect.Type) (discriminator string)
// DefaultDiscriminatorFunc is shorthand for the ShortName func and is used when
// no other discriminator func is set explicitly
var DefaultDiscriminatorFunc = ShortName
// ShortName returns the type name in golang without the package name
func ShortName(t reflect.Type) (discriminator string) {
tn := t.Name()
if tn == "" {
return t.String()
}
return tn
}
// FullName return the name of the type prefixed with the package name as
// appropriate
func FullName(t reflect.Type) (discriminator string) {
tn := t.Name()
if tn == "" {
return t.String()
}
if pp := t.PkgPath(); pp != "" {
return fmt.Sprintf("%s.%s", pp, tn)
}
return tn
}
// DiscriminatorEncodeMode is a mask that describes the different encode
// options.
type DiscriminatorEncodeMode uint8
const (
// DiscriminatorEncodeTypeNameRootValue causes the type name to be encoded
// for the root value.
DiscriminatorEncodeTypeNameRootValue DiscriminatorEncodeMode = 1 << iota
// DiscriminatorEncodeTypeNameAllObjects causes the type name to be encoded
// for all struct and map values. Please note this specifically does not
// apply to the root value.
DiscriminatorEncodeTypeNameAllObjects
// DiscriminatorEncodeTypeNameIfRequired is the default behavior when
// the discriminator is set, and the type name is only encoded if required.
DiscriminatorEncodeTypeNameIfRequired DiscriminatorEncodeMode = 0
)
func (m DiscriminatorEncodeMode) root() bool {
return m&DiscriminatorEncodeTypeNameRootValue > 0
}
func (m DiscriminatorEncodeMode) all() bool {
return m&DiscriminatorEncodeTypeNameAllObjects > 0
}
func (d *decodeState) isDiscriminatorSet() bool {
return d.discriminatorTypeFieldName != "" &&
d.discriminatorValueFieldName != ""
}
// discriminatorOpType describes the current operation related to
// discriminators when reading a JSON object's fields.
type discriminatorOpType uint8
const (
// discriminatorOpTypeNameField indicates the discriminator type name
// field was discovered.
discriminatorOpTypeNameField = iota + 1
// discriminatorOpValueField indicates the discriminator value field
// was discovered.
discriminatorOpValueField
)
func (d *decodeState) discriminatorGetValue() (reflect.Value, error) {
// Record the current offset so we know where the data starts.
offset := d.readIndex()
// Create a temporary decodeState used to inspect the current object
// and determine its discriminator type and decode its value.
dd := &decodeState{
disallowUnknownFields: d.disallowUnknownFields,
useNumber: d.useNumber,
discriminatorToTypeFn: d.discriminatorToTypeFn,
discriminatorTypeFieldName: d.discriminatorTypeFieldName,
discriminatorValueFieldName: d.discriminatorValueFieldName,
}
dd.init(append([]byte{}, d.data[offset:]...))
defer freeScanner(&dd.scan)
dd.scan.reset()
var (
t reflect.Type // the instance of the type
valueOff = -1 // the offset of a possible discriminator value
)
dd.scanWhile(scanSkipSpace)
if dd.opcode != scanBeginObject {
panic(phasePanicMsg)
}
for {
dd.scanWhile(scanSkipSpace)
if dd.opcode == scanEndObject {
// closing } - can only happen on first iteration.
break
}
if dd.opcode != scanBeginLiteral {
panic(phasePanicMsg)
}
// Read key.
start := dd.readIndex()
dd.rescanLiteral()
item := dd.data[start:dd.readIndex()]
key, ok := unquote(item)
if !ok {
panic(phasePanicMsg)
}
// Check to see if the key is related to the discriminator.
var discriminatorOp discriminatorOpType
switch key {
case d.discriminatorTypeFieldName:
discriminatorOp = discriminatorOpTypeNameField
case d.discriminatorValueFieldName:
discriminatorOp = discriminatorOpValueField
}
// Read : before value.
if dd.opcode == scanSkipSpace {
dd.scanWhile(scanSkipSpace)
}
if dd.opcode != scanObjectKey {
panic(phasePanicMsg)
}
dd.scanWhile(scanSkipSpace)
// Read value.
valOff := dd.readIndex()
val := dd.valueInterface()
switch discriminatorOp {
case discriminatorOpTypeNameField:
tn, ok := val.(string)
if !ok {
return reflect.Value{}, fmt.Errorf(
"json: discriminator type at offset %d is not string",
offset+valOff)
}
if tn == "" {
return reflect.Value{}, fmt.Errorf(
"json: discriminator type at offset %d is empty",
offset+valOff)
}
// Parse the type name into a type instance.
ti, err := discriminatorParseTypeName(tn, d.discriminatorToTypeFn)
if err != nil {
return reflect.Value{}, err
}
// Assign the type instance to the outer variable, t.
t = ti
// Primitive types and types with Unmarshaler are wrapped in a
// structure with type and value fields. Structures and Maps not
// implementing Unmarshaler use discriminator embedded within their
// content.
if useNestedDiscriminator(t) {
// If the type is a map or a struct not implementing Unmarshaler
// then it is not necessary to continue walking over the current
// JSON object since it will be completely re-scanned to decode
// its value into the discovered type.
dd.opcode = scanEndObject
} else {
// Otherwise if the value offset has been discovered then it is
// safe to stop walking over the current JSON object as well.
if valueOff > -1 {
dd.opcode = scanEndObject
}
}
case discriminatorOpValueField:
valueOff = valOff
// If the type has been discovered then it is safe to stop walking
// over the current JSON object.
if t != nil {
dd.opcode = scanEndObject
}
}
// Next token must be , or }.
if dd.opcode == scanSkipSpace {
dd.scanWhile(scanSkipSpace)
}
if dd.opcode == scanEndObject {
break
}
if dd.opcode != scanObjectValue {
panic(phasePanicMsg)
}
}
// If there is not a type discriminator then return early.
if t == nil {
return reflect.Value{}, fmt.Errorf("json: missing discriminator")
}
// Instantiate a new instance of the discriminated type.
var v reflect.Value
switch t.Kind() {
case reflect.Slice:
// MakeSlice returns a value that is not addressable.
// Instead, use MakeSlice to get the type, then use
// reflect.New to create an addressable value.
v = reflect.New(reflect.MakeSlice(t, 0, 0).Type()).Elem()
case reflect.Map:
// MakeMap returns a value that is not addressable.
// Instead, use MakeMap to get the type, then use
// reflect.New to create an addressable value.
v = reflect.New(reflect.MakeMap(t).Type()).Elem()
case reflect.Complex64, reflect.Complex128:
return reflect.Value{}, fmt.Errorf("json: unsupported discriminator type: %s", t.Kind())
default:
v = reflect.New(t)
}
// Reset the decode state to prepare for decoding the data.
dd.scan.reset()
if useNestedDiscriminator(t) {
// Set the offset to zero since the entire object will be decoded
// into v.
dd.off = 0
} else {
// Set the offset to what it was before the discriminator value was
// read so only the value field is decoded into v.
dd.off = valueOff
}
// This will initialize the correct scan step and op code.
dd.scanWhile(scanSkipSpace)
// Decode the data into the value.
if err := dd.value(v); err != nil {
return reflect.Value{}, err
}
// Check the saved error as well since the decoder.value function does not
// always return an error. If the reflected value is still zero, then it is
// likely the decoder was unable to decode the value.
if err := dd.savedError; err != nil {
switch v.Kind() {
case reflect.Ptr, reflect.Interface:
v = v.Elem()
}
if v.IsZero() {
return reflect.Value{}, err
}
}
return v, nil
}
func (d *decodeState) discriminatorInterfaceDecode(t reflect.Type, v reflect.Value) error {
defer func() {
// Advance the decode state, throwing away the value.
_ = d.objectInterface()
}()
dv, err := d.discriminatorGetValue()
if err != nil {
return err
}
switch dv.Kind() {
case reflect.Map, reflect.Slice:
if dv.Type().AssignableTo(t) {
v.Set(dv)
return nil
}
if pdv := dv.Addr(); pdv.Type().AssignableTo(t) {
v.Set(pdv)
return nil
}
case reflect.Ptr:
if dve := dv.Elem(); dve.Type().AssignableTo(t) {
v.Set(dve)
return nil
}
if dv.Type().AssignableTo(t) {
v.Set(dv)
return nil
}
}
return fmt.Errorf("json: unsupported discriminator kind: %s", dv.Kind())
}
func (o encOpts) isDiscriminatorSet() bool {
return o.discriminatorTypeFieldName != "" &&
o.discriminatorValueFieldName != ""
}
func discriminatorInterfaceEncode(e *encodeState, v reflect.Value, opts encOpts) {
v = v.Elem()
if v.Type().Implements(marshalerType) {
discriminatorValue := opts.discriminatorValueFn(v.Type())
if discriminatorValue == "" {
marshalerEncoder(e, v, opts)
}
e.WriteString(`{"`)
e.WriteString(opts.discriminatorTypeFieldName)
e.WriteString(`":"`)
e.WriteString(discriminatorValue)
e.WriteString(`","`)
e.WriteString(opts.discriminatorValueFieldName)
e.WriteString(`":`)
marshalerEncoder(e, v, opts)
e.WriteByte('}')
return
}
switch v.Kind() {
case reflect.Chan, reflect.Func, reflect.Invalid:
e.error(&UnsupportedValueError{v, fmt.Sprintf("invalid kind: %s", v.Kind())})
case reflect.Map:
e.discriminatorEncodeTypeName = true
newMapEncoder(v.Type())(e, v, opts)
case reflect.Struct:
e.discriminatorEncodeTypeName = true
newStructEncoder(v.Type())(e, v, opts)
case reflect.Ptr:
discriminatorInterfaceEncode(e, v, opts)
default:
discriminatorValue := opts.discriminatorValueFn(v.Type())
if discriminatorValue == "" {
e.reflectValue(v, opts)
return
}
e.WriteString(`{"`)
e.WriteString(opts.discriminatorTypeFieldName)
e.WriteString(`":"`)
e.WriteString(discriminatorValue)
e.WriteString(`","`)
e.WriteString(opts.discriminatorValueFieldName)
e.WriteString(`":`)
e.reflectValue(v, opts)
e.WriteByte('}')
}
}
func discriminatorMapEncode(e *encodeState, v reflect.Value, opts encOpts) {
if !e.discriminatorEncodeTypeName && !opts.discriminatorEncodeMode.all() {
return
}
discriminatorValue := opts.discriminatorValueFn(v.Type())
if discriminatorValue == "" {
return
}
e.WriteByte('"')
e.WriteString(opts.discriminatorTypeFieldName)
e.WriteString(`":"`)
e.WriteString(discriminatorValue)
e.WriteByte('"')
if v.Len() > 0 {
e.WriteByte(',')
}
e.discriminatorEncodeTypeName = false
}
func discriminatorStructEncode(e *encodeState, v reflect.Value, opts encOpts) byte {
if !e.discriminatorEncodeTypeName && !opts.discriminatorEncodeMode.all() {
return '{'
}
discriminatorValue := opts.discriminatorValueFn(v.Type())
if discriminatorValue == "" {
return '{'
}
e.WriteString(`{"`)
e.WriteString(opts.discriminatorTypeFieldName)
e.WriteString(`":"`)
e.WriteString(discriminatorValue)
e.WriteByte('"')
e.discriminatorEncodeTypeName = false
return ','
}
var unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem()
// Discriminator is nested in map and struct unless they implement Unmarshaler.
func useNestedDiscriminator(t reflect.Type) bool {
if t.Implements(unmarshalerType) || reflect.PtrTo(t).Implements(unmarshalerType) {
return false
}
kind := t.Kind()
if kind == reflect.Struct || kind == reflect.Map {
return true
}
return false
}
var discriminatorTypeRegistry = map[string]reflect.Type{
"uint": reflect.TypeOf(uint(0)),
"uint8": reflect.TypeOf(uint8(0)),
"uint16": reflect.TypeOf(uint16(0)),
"uint32": reflect.TypeOf(uint32(0)),
"uint64": reflect.TypeOf(uint64(0)),
"uintptr": reflect.TypeOf(uintptr(0)),
"int": reflect.TypeOf(int(0)),
"int8": reflect.TypeOf(int8(0)),
"int16": reflect.TypeOf(int16(0)),
"int32": reflect.TypeOf(int32(0)),
"int64": reflect.TypeOf(int64(0)),
"float32": reflect.TypeOf(float32(0)),
"float64": reflect.TypeOf(float64(0)),
"bool": reflect.TypeOf(true),
"string": reflect.TypeOf(""),
"any": reflect.TypeOf((*interface{})(nil)).Elem(),
"interface{}": reflect.TypeOf((*interface{})(nil)).Elem(),
"interface {}": reflect.TypeOf((*interface{})(nil)).Elem(),
// Not supported, but here to prevent the decoder from panicing
// if encountered.
"complex64": reflect.TypeOf(complex64(0)),
"complex128": reflect.TypeOf(complex128(0)),
}
// discriminatorPointerTypeCache caches the pointer type for another type.
// For example, a key that was the int type would have a value that is the
// *int type.
var discriminatorPointerTypeCache sync.Map // map[reflect.Type]reflect.Type
// cachedPointerType returns the pointer type for another and avoids repeated
// work by using a cache.
func cachedPointerType(t reflect.Type) reflect.Type {
if value, ok := discriminatorPointerTypeCache.Load(t); ok {
return value.(reflect.Type)
}
pt := reflect.New(t).Type()
value, _ := discriminatorPointerTypeCache.LoadOrStore(t, pt)
return value.(reflect.Type)
}
var (
mapPatt = regexp.MustCompile(`^\*?map\[([^\]]+)\](.+)$`)
arrayPatt = regexp.MustCompile(`^\*?\[(\d+)\](.+)$`)
slicePatt = regexp.MustCompile(`^\*?\[\](.+)$`)
)
// discriminatorParseTypeName returns a reflect.Type for the given type name.
func discriminatorParseTypeName(
typeName string,
typeFn DiscriminatorToTypeFunc) (reflect.Type, error) {
// Check to see if the type is an array, map, or slice.
var (
aln = -1 // array length
etn string // map or slice element type name
ktn string // map key type name
)
if m := arrayPatt.FindStringSubmatch(typeName); len(m) > 0 {
i, err := strconv.Atoi(m[1])
if err != nil {
return nil, err
}
aln = i
etn = m[2]
} else if m := slicePatt.FindStringSubmatch(typeName); len(m) > 0 {
etn = m[1]
} else if m := mapPatt.FindStringSubmatch(typeName); len(m) > 0 {
ktn = m[1]
etn = m[2]
}
// indirectTypeName checks to see if the type name begins with a
// "*" characters. If it does, then the type name sans the "*"
// character is returned along with a true value indicating the
// type is a pointer. Otherwise the original type name is returned
// along with a false value.
indirectTypeName := func(tn string) (string, bool) {
if len(tn) > 1 && tn[0] == '*' {
return tn[1:], true
}
return tn, false
}
lookupType := func(tn string) (reflect.Type, bool) {
// Get the actual type name and a flag indicating whether the
// type is a pointer.
n, p := indirectTypeName(tn)
var t reflect.Type
ok := false
// look up the type in the external registry to allow name override.
if typeFn != nil {
t, ok = typeFn(n)
}
if !ok {
// Use the built-in registry if the external registry fails
if t, ok = discriminatorTypeRegistry[n]; !ok {
return nil, false
}
}
// If the type was a pointer then get the type's pointer type.
if p {
t = cachedPointerType(t)
}
return t, true
}
var t reflect.Type
if ktn == "" && etn != "" {
et, ok := lookupType(etn)
if !ok {
return nil, fmt.Errorf("json: invalid array/slice element type: %s", etn)
}
if aln > -1 {
// Array
t = reflect.ArrayOf(aln, et)
} else {
// Slice
t = reflect.SliceOf(et)
}
} else if ktn != "" && etn != "" {
// Map
kt, ok := lookupType(ktn)
if !ok {
return nil, fmt.Errorf("json: invalid map key type: %s", ktn)
}
et, ok := lookupType(etn)
if !ok {
return nil, fmt.Errorf("json: invalid map element type: %s", etn)
}
t = reflect.MapOf(kt, et)
} else {
var ok bool
if t, ok = lookupType(typeName); !ok {
return nil, fmt.Errorf("json: invalid discriminator type: %s", typeName)
}
}
return t, nil
}

1453
vendor/github.com/vmware/govmomi/vim25/json/encode.go generated vendored Normal file

File diff suppressed because it is too large Load diff

143
vendor/github.com/vmware/govmomi/vim25/json/fold.go generated vendored Normal file
View file

@ -0,0 +1,143 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"bytes"
"unicode/utf8"
)
const (
caseMask = ^byte(0x20) // Mask to ignore case in ASCII.
kelvin = '\u212a'
smallLongEss = '\u017f'
)
// foldFunc returns one of four different case folding equivalence
// functions, from most general (and slow) to fastest:
//
// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8
// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S')
// 3) asciiEqualFold, no special, but includes non-letters (including _)
// 4) simpleLetterEqualFold, no specials, no non-letters.
//
// The letters S and K are special because they map to 3 runes, not just 2:
// * S maps to s and to U+017F 'ſ' Latin small letter long s
// * k maps to K and to U+212A '' Kelvin sign
// See https://play.golang.org/p/tTxjOc0OGo
//
// The returned function is specialized for matching against s and
// should only be given s. It's not curried for performance reasons.
func foldFunc(s []byte) func(s, t []byte) bool {
nonLetter := false
special := false // special letter
for _, b := range s {
if b >= utf8.RuneSelf {
return bytes.EqualFold
}
upper := b & caseMask
if upper < 'A' || upper > 'Z' {
nonLetter = true
} else if upper == 'K' || upper == 'S' {
// See above for why these letters are special.
special = true
}
}
if special {
return equalFoldRight
}
if nonLetter {
return asciiEqualFold
}
return simpleLetterEqualFold
}
// equalFoldRight is a specialization of bytes.EqualFold when s is
// known to be all ASCII (including punctuation), but contains an 's',
// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
// See comments on foldFunc.
func equalFoldRight(s, t []byte) bool {
for _, sb := range s {
if len(t) == 0 {
return false
}
tb := t[0]
if tb < utf8.RuneSelf {
if sb != tb {
sbUpper := sb & caseMask
if 'A' <= sbUpper && sbUpper <= 'Z' {
if sbUpper != tb&caseMask {
return false
}
} else {
return false
}
}
t = t[1:]
continue
}
// sb is ASCII and t is not. t must be either kelvin
// sign or long s; sb must be s, S, k, or K.
tr, size := utf8.DecodeRune(t)
switch sb {
case 's', 'S':
if tr != smallLongEss {
return false
}
case 'k', 'K':
if tr != kelvin {
return false
}
default:
return false
}
t = t[size:]
}
if len(t) > 0 {
return false
}
return true
}
// asciiEqualFold is a specialization of bytes.EqualFold for use when
// s is all ASCII (but may contain non-letters) and contains no
// special-folding letters.
// See comments on foldFunc.
func asciiEqualFold(s, t []byte) bool {
if len(s) != len(t) {
return false
}
for i, sb := range s {
tb := t[i]
if sb == tb {
continue
}
if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') {
if sb&caseMask != tb&caseMask {
return false
}
} else {
return false
}
}
return true
}
// simpleLetterEqualFold is a specialization of bytes.EqualFold for
// use when s is all ASCII letters (no underscores, etc) and also
// doesn't contain 'k', 'K', 's', or 'S'.
// See comments on foldFunc.
func simpleLetterEqualFold(s, t []byte) bool {
if len(s) != len(t) {
return false
}
for i, b := range s {
if b&caseMask != t[i]&caseMask {
return false
}
}
return true
}

43
vendor/github.com/vmware/govmomi/vim25/json/fuzz.go generated vendored Normal file
View file

@ -0,0 +1,43 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gofuzz
// +build gofuzz
package json
import (
"fmt"
)
func Fuzz(data []byte) (score int) {
for _, ctor := range []func() interface{}{
func() interface{} { return new(interface{}) },
func() interface{} { return new(map[string]interface{}) },
func() interface{} { return new([]interface{}) },
} {
v := ctor()
err := Unmarshal(data, v)
if err != nil {
continue
}
score = 1
m, err := Marshal(v)
if err != nil {
fmt.Printf("v=%#v\n", v)
panic(err)
}
u := ctor()
err = Unmarshal(m, u)
if err != nil {
fmt.Printf("v=%#v\n", v)
fmt.Printf("m=%s\n", m)
panic(err)
}
}
return
}

143
vendor/github.com/vmware/govmomi/vim25/json/indent.go generated vendored Normal file
View file

@ -0,0 +1,143 @@
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"bytes"
)
// Compact appends to dst the JSON-encoded src with
// insignificant space characters elided.
func Compact(dst *bytes.Buffer, src []byte) error {
return compact(dst, src, false)
}
func compact(dst *bytes.Buffer, src []byte, escape bool) error {
origLen := dst.Len()
scan := newScanner()
defer freeScanner(scan)
start := 0
for i, c := range src {
if escape && (c == '<' || c == '>' || c == '&') {
if start < i {
dst.Write(src[start:i])
}
dst.WriteString(`\u00`)
dst.WriteByte(hex[c>>4])
dst.WriteByte(hex[c&0xF])
start = i + 1
}
// Convert U+2028 and U+2029 (E2 80 A8 and E2 80 A9).
if escape && c == 0xE2 && i+2 < len(src) && src[i+1] == 0x80 && src[i+2]&^1 == 0xA8 {
if start < i {
dst.Write(src[start:i])
}
dst.WriteString(`\u202`)
dst.WriteByte(hex[src[i+2]&0xF])
start = i + 3
}
v := scan.step(scan, c)
if v >= scanSkipSpace {
if v == scanError {
break
}
if start < i {
dst.Write(src[start:i])
}
start = i + 1
}
}
if scan.eof() == scanError {
dst.Truncate(origLen)
return scan.err
}
if start < len(src) {
dst.Write(src[start:])
}
return nil
}
func newline(dst *bytes.Buffer, prefix, indent string, depth int) {
dst.WriteByte('\n')
dst.WriteString(prefix)
for i := 0; i < depth; i++ {
dst.WriteString(indent)
}
}
// Indent appends to dst an indented form of the JSON-encoded src.
// Each element in a JSON object or array begins on a new,
// indented line beginning with prefix followed by one or more
// copies of indent according to the indentation nesting.
// The data appended to dst does not begin with the prefix nor
// any indentation, to make it easier to embed inside other formatted JSON data.
// Although leading space characters (space, tab, carriage return, newline)
// at the beginning of src are dropped, trailing space characters
// at the end of src are preserved and copied to dst.
// For example, if src has no trailing spaces, neither will dst;
// if src ends in a trailing newline, so will dst.
func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error {
origLen := dst.Len()
scan := newScanner()
defer freeScanner(scan)
needIndent := false
depth := 0
for _, c := range src {
scan.bytes++
v := scan.step(scan, c)
if v == scanSkipSpace {
continue
}
if v == scanError {
break
}
if needIndent && v != scanEndObject && v != scanEndArray {
needIndent = false
depth++
newline(dst, prefix, indent, depth)
}
// Emit semantically uninteresting bytes
// (in particular, punctuation in strings) unmodified.
if v == scanContinue {
dst.WriteByte(c)
continue
}
// Add spacing around real punctuation.
switch c {
case '{', '[':
// delay indent so that empty object and array are formatted as {} and [].
needIndent = true
dst.WriteByte(c)
case ',':
dst.WriteByte(c)
newline(dst, prefix, indent, depth)
case ':':
dst.WriteByte(c)
dst.WriteByte(' ')
case '}', ']':
if needIndent {
// suppress indent in empty object/array
needIndent = false
} else {
depth--
newline(dst, prefix, indent, depth)
}
dst.WriteByte(c)
default:
dst.WriteByte(c)
}
}
if scan.eof() == scanError {
dst.Truncate(origLen)
return scan.err
}
return nil
}

608
vendor/github.com/vmware/govmomi/vim25/json/scanner.go generated vendored Normal file
View file

@ -0,0 +1,608 @@
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
// JSON value parser state machine.
// Just about at the limit of what is reasonable to write by hand.
// Some parts are a bit tedious, but overall it nicely factors out the
// otherwise common code from the multiple scanning functions
// in this package (Compact, Indent, checkValid, etc).
//
// This file starts with two simple examples using the scanner
// before diving into the scanner itself.
import (
"strconv"
"sync"
)
// Valid reports whether data is a valid JSON encoding.
func Valid(data []byte) bool {
scan := newScanner()
defer freeScanner(scan)
return checkValid(data, scan) == nil
}
// checkValid verifies that data is valid JSON-encoded data.
// scan is passed in for use by checkValid to avoid an allocation.
func checkValid(data []byte, scan *scanner) error {
scan.reset()
for _, c := range data {
scan.bytes++
if scan.step(scan, c) == scanError {
return scan.err
}
}
if scan.eof() == scanError {
return scan.err
}
return nil
}
// A SyntaxError is a description of a JSON syntax error.
type SyntaxError struct {
msg string // description of error
Offset int64 // error occurred after reading Offset bytes
}
func (e *SyntaxError) Error() string { return e.msg }
// A scanner is a JSON scanning state machine.
// Callers call scan.reset and then pass bytes in one at a time
// by calling scan.step(&scan, c) for each byte.
// The return value, referred to as an opcode, tells the
// caller about significant parsing events like beginning
// and ending literals, objects, and arrays, so that the
// caller can follow along if it wishes.
// The return value scanEnd indicates that a single top-level
// JSON value has been completed, *before* the byte that
// just got passed in. (The indication must be delayed in order
// to recognize the end of numbers: is 123 a whole value or
// the beginning of 12345e+6?).
type scanner struct {
// The step is a func to be called to execute the next transition.
// Also tried using an integer constant and a single func
// with a switch, but using the func directly was 10% faster
// on a 64-bit Mac Mini, and it's nicer to read.
step func(*scanner, byte) int
// Reached end of top-level value.
endTop bool
// Stack of what we're in the middle of - array values, object keys, object values.
parseState []int
// Error that happened, if any.
err error
// total bytes consumed, updated by decoder.Decode (and deliberately
// not set to zero by scan.reset)
bytes int64
}
var scannerPool = sync.Pool{
New: func() interface{} {
return &scanner{}
},
}
func newScanner() *scanner {
scan := scannerPool.Get().(*scanner)
// scan.reset by design doesn't set bytes to zero
scan.bytes = 0
scan.reset()
return scan
}
func freeScanner(scan *scanner) {
// Avoid hanging on to too much memory in extreme cases.
if len(scan.parseState) > 1024 {
scan.parseState = nil
}
scannerPool.Put(scan)
}
// These values are returned by the state transition functions
// assigned to scanner.state and the method scanner.eof.
// They give details about the current state of the scan that
// callers might be interested to know about.
// It is okay to ignore the return value of any particular
// call to scanner.state: if one call returns scanError,
// every subsequent call will return scanError too.
const (
// Continue.
scanContinue = iota // uninteresting byte
scanBeginLiteral // end implied by next result != scanContinue
scanBeginObject // begin object
scanObjectKey // just finished object key (string)
scanObjectValue // just finished non-last object value
scanEndObject // end object (implies scanObjectValue if possible)
scanBeginArray // begin array
scanArrayValue // just finished array value
scanEndArray // end array (implies scanArrayValue if possible)
scanSkipSpace // space byte; can skip; known to be last "continue" result
// Stop.
scanEnd // top-level value ended *before* this byte; known to be first "stop" result
scanError // hit an error, scanner.err.
)
// These values are stored in the parseState stack.
// They give the current state of a composite value
// being scanned. If the parser is inside a nested value
// the parseState describes the nested state, outermost at entry 0.
const (
parseObjectKey = iota // parsing object key (before colon)
parseObjectValue // parsing object value (after colon)
parseArrayValue // parsing array value
)
// This limits the max nesting depth to prevent stack overflow.
// This is permitted by https://tools.ietf.org/html/rfc7159#section-9
const maxNestingDepth = 10000
// reset prepares the scanner for use.
// It must be called before calling s.step.
func (s *scanner) reset() {
s.step = stateBeginValue
s.parseState = s.parseState[0:0]
s.err = nil
s.endTop = false
}
// eof tells the scanner that the end of input has been reached.
// It returns a scan status just as s.step does.
func (s *scanner) eof() int {
if s.err != nil {
return scanError
}
if s.endTop {
return scanEnd
}
s.step(s, ' ')
if s.endTop {
return scanEnd
}
if s.err == nil {
s.err = &SyntaxError{"unexpected end of JSON input", s.bytes}
}
return scanError
}
// pushParseState pushes a new parse state p onto the parse stack.
// an error state is returned if maxNestingDepth was exceeded, otherwise successState is returned.
func (s *scanner) pushParseState(c byte, newParseState int, successState int) int {
s.parseState = append(s.parseState, newParseState)
if len(s.parseState) <= maxNestingDepth {
return successState
}
return s.error(c, "exceeded max depth")
}
// popParseState pops a parse state (already obtained) off the stack
// and updates s.step accordingly.
func (s *scanner) popParseState() {
n := len(s.parseState) - 1
s.parseState = s.parseState[0:n]
if n == 0 {
s.step = stateEndTop
s.endTop = true
} else {
s.step = stateEndValue
}
}
func isSpace(c byte) bool {
return c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n')
}
// stateBeginValueOrEmpty is the state after reading `[`.
func stateBeginValueOrEmpty(s *scanner, c byte) int {
if isSpace(c) {
return scanSkipSpace
}
if c == ']' {
return stateEndValue(s, c)
}
return stateBeginValue(s, c)
}
// stateBeginValue is the state at the beginning of the input.
func stateBeginValue(s *scanner, c byte) int {
if isSpace(c) {
return scanSkipSpace
}
switch c {
case '{':
s.step = stateBeginStringOrEmpty
return s.pushParseState(c, parseObjectKey, scanBeginObject)
case '[':
s.step = stateBeginValueOrEmpty
return s.pushParseState(c, parseArrayValue, scanBeginArray)
case '"':
s.step = stateInString
return scanBeginLiteral
case '-':
s.step = stateNeg
return scanBeginLiteral
case '0': // beginning of 0.123
s.step = state0
return scanBeginLiteral
case 't': // beginning of true
s.step = stateT
return scanBeginLiteral
case 'f': // beginning of false
s.step = stateF
return scanBeginLiteral
case 'n': // beginning of null
s.step = stateN
return scanBeginLiteral
}
if '1' <= c && c <= '9' { // beginning of 1234.5
s.step = state1
return scanBeginLiteral
}
return s.error(c, "looking for beginning of value")
}
// stateBeginStringOrEmpty is the state after reading `{`.
func stateBeginStringOrEmpty(s *scanner, c byte) int {
if isSpace(c) {
return scanSkipSpace
}
if c == '}' {
n := len(s.parseState)
s.parseState[n-1] = parseObjectValue
return stateEndValue(s, c)
}
return stateBeginString(s, c)
}
// stateBeginString is the state after reading `{"key": value,`.
func stateBeginString(s *scanner, c byte) int {
if isSpace(c) {
return scanSkipSpace
}
if c == '"' {
s.step = stateInString
return scanBeginLiteral
}
return s.error(c, "looking for beginning of object key string")
}
// stateEndValue is the state after completing a value,
// such as after reading `{}` or `true` or `["x"`.
func stateEndValue(s *scanner, c byte) int {
n := len(s.parseState)
if n == 0 {
// Completed top-level before the current byte.
s.step = stateEndTop
s.endTop = true
return stateEndTop(s, c)
}
if isSpace(c) {
s.step = stateEndValue
return scanSkipSpace
}
ps := s.parseState[n-1]
switch ps {
case parseObjectKey:
if c == ':' {
s.parseState[n-1] = parseObjectValue
s.step = stateBeginValue
return scanObjectKey
}
return s.error(c, "after object key")
case parseObjectValue:
if c == ',' {
s.parseState[n-1] = parseObjectKey
s.step = stateBeginString
return scanObjectValue
}
if c == '}' {
s.popParseState()
return scanEndObject
}
return s.error(c, "after object key:value pair")
case parseArrayValue:
if c == ',' {
s.step = stateBeginValue
return scanArrayValue
}
if c == ']' {
s.popParseState()
return scanEndArray
}
return s.error(c, "after array element")
}
return s.error(c, "")
}
// stateEndTop is the state after finishing the top-level value,
// such as after reading `{}` or `[1,2,3]`.
// Only space characters should be seen now.
func stateEndTop(s *scanner, c byte) int {
if !isSpace(c) {
// Complain about non-space byte on next call.
s.error(c, "after top-level value")
}
return scanEnd
}
// stateInString is the state after reading `"`.
func stateInString(s *scanner, c byte) int {
if c == '"' {
s.step = stateEndValue
return scanContinue
}
if c == '\\' {
s.step = stateInStringEsc
return scanContinue
}
if c < 0x20 {
return s.error(c, "in string literal")
}
return scanContinue
}
// stateInStringEsc is the state after reading `"\` during a quoted string.
func stateInStringEsc(s *scanner, c byte) int {
switch c {
case 'b', 'f', 'n', 'r', 't', '\\', '/', '"':
s.step = stateInString
return scanContinue
case 'u':
s.step = stateInStringEscU
return scanContinue
}
return s.error(c, "in string escape code")
}
// stateInStringEscU is the state after reading `"\u` during a quoted string.
func stateInStringEscU(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU1
return scanContinue
}
// numbers
return s.error(c, "in \\u hexadecimal character escape")
}
// stateInStringEscU1 is the state after reading `"\u1` during a quoted string.
func stateInStringEscU1(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU12
return scanContinue
}
// numbers
return s.error(c, "in \\u hexadecimal character escape")
}
// stateInStringEscU12 is the state after reading `"\u12` during a quoted string.
func stateInStringEscU12(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInStringEscU123
return scanContinue
}
// numbers
return s.error(c, "in \\u hexadecimal character escape")
}
// stateInStringEscU123 is the state after reading `"\u123` during a quoted string.
func stateInStringEscU123(s *scanner, c byte) int {
if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
s.step = stateInString
return scanContinue
}
// numbers
return s.error(c, "in \\u hexadecimal character escape")
}
// stateNeg is the state after reading `-` during a number.
func stateNeg(s *scanner, c byte) int {
if c == '0' {
s.step = state0
return scanContinue
}
if '1' <= c && c <= '9' {
s.step = state1
return scanContinue
}
return s.error(c, "in numeric literal")
}
// state1 is the state after reading a non-zero integer during a number,
// such as after reading `1` or `100` but not `0`.
func state1(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = state1
return scanContinue
}
return state0(s, c)
}
// state0 is the state after reading `0` during a number.
func state0(s *scanner, c byte) int {
if c == '.' {
s.step = stateDot
return scanContinue
}
if c == 'e' || c == 'E' {
s.step = stateE
return scanContinue
}
return stateEndValue(s, c)
}
// stateDot is the state after reading the integer and decimal point in a number,
// such as after reading `1.`.
func stateDot(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateDot0
return scanContinue
}
return s.error(c, "after decimal point in numeric literal")
}
// stateDot0 is the state after reading the integer, decimal point, and subsequent
// digits of a number, such as after reading `3.14`.
func stateDot0(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
return scanContinue
}
if c == 'e' || c == 'E' {
s.step = stateE
return scanContinue
}
return stateEndValue(s, c)
}
// stateE is the state after reading the mantissa and e in a number,
// such as after reading `314e` or `0.314e`.
func stateE(s *scanner, c byte) int {
if c == '+' || c == '-' {
s.step = stateESign
return scanContinue
}
return stateESign(s, c)
}
// stateESign is the state after reading the mantissa, e, and sign in a number,
// such as after reading `314e-` or `0.314e+`.
func stateESign(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
s.step = stateE0
return scanContinue
}
return s.error(c, "in exponent of numeric literal")
}
// stateE0 is the state after reading the mantissa, e, optional sign,
// and at least one digit of the exponent in a number,
// such as after reading `314e-2` or `0.314e+1` or `3.14e0`.
func stateE0(s *scanner, c byte) int {
if '0' <= c && c <= '9' {
return scanContinue
}
return stateEndValue(s, c)
}
// stateT is the state after reading `t`.
func stateT(s *scanner, c byte) int {
if c == 'r' {
s.step = stateTr
return scanContinue
}
return s.error(c, "in literal true (expecting 'r')")
}
// stateTr is the state after reading `tr`.
func stateTr(s *scanner, c byte) int {
if c == 'u' {
s.step = stateTru
return scanContinue
}
return s.error(c, "in literal true (expecting 'u')")
}
// stateTru is the state after reading `tru`.
func stateTru(s *scanner, c byte) int {
if c == 'e' {
s.step = stateEndValue
return scanContinue
}
return s.error(c, "in literal true (expecting 'e')")
}
// stateF is the state after reading `f`.
func stateF(s *scanner, c byte) int {
if c == 'a' {
s.step = stateFa
return scanContinue
}
return s.error(c, "in literal false (expecting 'a')")
}
// stateFa is the state after reading `fa`.
func stateFa(s *scanner, c byte) int {
if c == 'l' {
s.step = stateFal
return scanContinue
}
return s.error(c, "in literal false (expecting 'l')")
}
// stateFal is the state after reading `fal`.
func stateFal(s *scanner, c byte) int {
if c == 's' {
s.step = stateFals
return scanContinue
}
return s.error(c, "in literal false (expecting 's')")
}
// stateFals is the state after reading `fals`.
func stateFals(s *scanner, c byte) int {
if c == 'e' {
s.step = stateEndValue
return scanContinue
}
return s.error(c, "in literal false (expecting 'e')")
}
// stateN is the state after reading `n`.
func stateN(s *scanner, c byte) int {
if c == 'u' {
s.step = stateNu
return scanContinue
}
return s.error(c, "in literal null (expecting 'u')")
}
// stateNu is the state after reading `nu`.
func stateNu(s *scanner, c byte) int {
if c == 'l' {
s.step = stateNul
return scanContinue
}
return s.error(c, "in literal null (expecting 'l')")
}
// stateNul is the state after reading `nul`.
func stateNul(s *scanner, c byte) int {
if c == 'l' {
s.step = stateEndValue
return scanContinue
}
return s.error(c, "in literal null (expecting 'l')")
}
// stateError is the state after reaching a syntax error,
// such as after reading `[1}` or `5.1.2`.
func stateError(s *scanner, c byte) int {
return scanError
}
// error records an error and switches to the error state.
func (s *scanner) error(c byte, context string) int {
s.step = stateError
s.err = &SyntaxError{"invalid character " + quoteChar(c) + " " + context, s.bytes}
return scanError
}
// quoteChar formats c as a quoted character literal
func quoteChar(c byte) string {
// special cases - different from quoted strings
if c == '\'' {
return `'\''`
}
if c == '"' {
return `'"'`
}
// use quoted string with different quotation marks
s := strconv.Quote(string(c))
return "'" + s[1:len(s)-1] + "'"
}

572
vendor/github.com/vmware/govmomi/vim25/json/stream.go generated vendored Normal file
View file

@ -0,0 +1,572 @@
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"bytes"
"errors"
"io"
)
// A Decoder reads and decodes JSON values from an input stream.
type Decoder struct {
r io.Reader
buf []byte
d decodeState
scanp int // start of unread data in buf
scanned int64 // amount of data already scanned
scan scanner
err error
tokenState int
tokenStack []int
}
// NewDecoder returns a new decoder that reads from r.
//
// The decoder introduces its own buffering and may
// read data from r beyond the JSON values requested.
func NewDecoder(r io.Reader) *Decoder {
return &Decoder{r: r}
}
// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
// Number instead of as a float64.
func (dec *Decoder) UseNumber() { dec.d.useNumber = true }
// DisallowUnknownFields causes the Decoder to return an error when the destination
// is a struct and the input contains object keys which do not match any
// non-ignored, exported fields in the destination.
func (dec *Decoder) DisallowUnknownFields() { dec.d.disallowUnknownFields = true }
// SetDiscriminator tells the decoder to check if JSON objects include a
// discriminator that specifies the Go type into which the object should be
// decoded.
// Map and struct values are encoded as JSON objects as normal, but with an
// additional field (typeFieldName) that specifies the object's Go type.
// All other values are encoded inside an outer JSON object with a field
// (typeFieldName) that specifies the value's Go type and a field
// (valueFieldName) that specifies the actual value.
// An optional typeFn may be provided to enable looking up custom types based
// on type name strings. Built-in types are handled automatically and will be
// ignored if they are returned by the typeFn.
// Calling SetDiscriminator("", "", nil) disables the discriminator.
func (dec *Decoder) SetDiscriminator(typeFieldName, valueFieldName string, typeFn DiscriminatorToTypeFunc) {
dec.d.discriminatorTypeFieldName = typeFieldName
dec.d.discriminatorValueFieldName = valueFieldName
dec.d.discriminatorToTypeFn = typeFn
}
// Decode reads the next JSON-encoded value from its
// input and stores it in the value pointed to by v.
//
// See the documentation for Unmarshal for details about
// the conversion of JSON into a Go value.
func (dec *Decoder) Decode(v interface{}) error {
if dec.err != nil {
return dec.err
}
if err := dec.tokenPrepareForDecode(); err != nil {
return err
}
if !dec.tokenValueAllowed() {
return &SyntaxError{msg: "not at beginning of value", Offset: dec.InputOffset()}
}
// Read whole value into buffer.
n, err := dec.readValue()
if err != nil {
return err
}
dec.d.init(dec.buf[dec.scanp : dec.scanp+n])
dec.scanp += n
// Don't save err from unmarshal into dec.err:
// the connection is still usable since we read a complete JSON
// object from it before the error happened.
err = dec.d.unmarshal(v)
// fixup token streaming state
dec.tokenValueEnd()
return err
}
// Buffered returns a reader of the data remaining in the Decoder's
// buffer. The reader is valid until the next call to Decode.
func (dec *Decoder) Buffered() io.Reader {
return bytes.NewReader(dec.buf[dec.scanp:])
}
// readValue reads a JSON value into dec.buf.
// It returns the length of the encoding.
func (dec *Decoder) readValue() (int, error) {
dec.scan.reset()
scanp := dec.scanp
var err error
Input:
// help the compiler see that scanp is never negative, so it can remove
// some bounds checks below.
for scanp >= 0 {
// Look in the buffer for a new value.
for ; scanp < len(dec.buf); scanp++ {
c := dec.buf[scanp]
dec.scan.bytes++
switch dec.scan.step(&dec.scan, c) {
case scanEnd:
// scanEnd is delayed one byte so we decrement
// the scanner bytes count by 1 to ensure that
// this value is correct in the next call of Decode.
dec.scan.bytes--
break Input
case scanEndObject, scanEndArray:
// scanEnd is delayed one byte.
// We might block trying to get that byte from src,
// so instead invent a space byte.
if stateEndValue(&dec.scan, ' ') == scanEnd {
scanp++
break Input
}
case scanError:
dec.err = dec.scan.err
return 0, dec.scan.err
}
}
// Did the last read have an error?
// Delayed until now to allow buffer scan.
if err != nil {
if err == io.EOF {
if dec.scan.step(&dec.scan, ' ') == scanEnd {
break Input
}
if nonSpace(dec.buf) {
err = io.ErrUnexpectedEOF
}
}
dec.err = err
return 0, err
}
n := scanp - dec.scanp
err = dec.refill()
scanp = dec.scanp + n
}
return scanp - dec.scanp, nil
}
func (dec *Decoder) refill() error {
// Make room to read more into the buffer.
// First slide down data already consumed.
if dec.scanp > 0 {
dec.scanned += int64(dec.scanp)
n := copy(dec.buf, dec.buf[dec.scanp:])
dec.buf = dec.buf[:n]
dec.scanp = 0
}
// Grow buffer if not large enough.
const minRead = 512
if cap(dec.buf)-len(dec.buf) < minRead {
newBuf := make([]byte, len(dec.buf), 2*cap(dec.buf)+minRead)
copy(newBuf, dec.buf)
dec.buf = newBuf
}
// Read. Delay error for next iteration (after scan).
n, err := dec.r.Read(dec.buf[len(dec.buf):cap(dec.buf)])
dec.buf = dec.buf[0 : len(dec.buf)+n]
return err
}
func nonSpace(b []byte) bool {
for _, c := range b {
if !isSpace(c) {
return true
}
}
return false
}
// An Encoder writes JSON values to an output stream.
type Encoder struct {
w io.Writer
err error
escapeHTML bool
indentBuf *bytes.Buffer
indentPrefix string
indentValue string
discriminatorTypeFieldName string
discriminatorValueFieldName string
discriminatorEncodeMode DiscriminatorEncodeMode
typeToDiscriminatorFn TypeToDiscriminatorFunc
}
// NewEncoder returns a new encoder that writes to w.
func NewEncoder(w io.Writer) *Encoder {
return &Encoder{w: w, escapeHTML: true}
}
// Encode writes the JSON encoding of v to the stream,
// followed by a newline character.
//
// See the documentation for Marshal for details about the
// conversion of Go values to JSON.
func (enc *Encoder) Encode(v interface{}) error {
if enc.err != nil {
return enc.err
}
e := newEncodeState()
err := e.marshal(v, encOpts{
escapeHTML: enc.escapeHTML,
discriminatorTypeFieldName: enc.discriminatorTypeFieldName,
discriminatorValueFieldName: enc.discriminatorValueFieldName,
discriminatorEncodeMode: enc.discriminatorEncodeMode,
discriminatorValueFn: enc.typeToDiscriminatorFn,
})
if err != nil {
return err
}
// Terminate each value with a newline.
// This makes the output look a little nicer
// when debugging, and some kind of space
// is required if the encoded value was a number,
// so that the reader knows there aren't more
// digits coming.
e.WriteByte('\n')
b := e.Bytes()
if enc.indentPrefix != "" || enc.indentValue != "" {
if enc.indentBuf == nil {
enc.indentBuf = new(bytes.Buffer)
}
enc.indentBuf.Reset()
err = Indent(enc.indentBuf, b, enc.indentPrefix, enc.indentValue)
if err != nil {
return err
}
b = enc.indentBuf.Bytes()
}
if _, err = enc.w.Write(b); err != nil {
enc.err = err
}
encodeStatePool.Put(e)
return err
}
// SetIndent instructs the encoder to format each subsequent encoded
// value as if indented by the package-level function Indent(dst, src, prefix, indent).
// Calling SetIndent("", "") disables indentation.
func (enc *Encoder) SetIndent(prefix, indent string) {
enc.indentPrefix = prefix
enc.indentValue = indent
}
// SetEscapeHTML specifies whether problematic HTML characters
// should be escaped inside JSON quoted strings.
// The default behavior is to escape &, <, and > to \u0026, \u003c, and \u003e
// to avoid certain safety problems that can arise when embedding JSON in HTML.
//
// In non-HTML settings where the escaping interferes with the readability
// of the output, SetEscapeHTML(false) disables this behavior.
func (enc *Encoder) SetEscapeHTML(on bool) {
enc.escapeHTML = on
}
// SetDiscriminator specifies that a value stored in an interface should be
// encoded with information about the value's Go type.
// Map and struct values are encoded as JSON objects as normal, but with an
// additional field (typeFieldName) that specifies the object's Go type.
// All other values are encoded inside an outer JSON object with a field
// (typeFieldName) that specifies the value's Go type and a field
// (valueFieldName) that specifies the actual value.
// A mask (mode) is available to control the encoder's behavior.
// Calling SetDiscriminator("", "", 0) disables the discriminator.
func (enc *Encoder) SetDiscriminator(typeFieldName, valueFieldName string, mode DiscriminatorEncodeMode) {
enc.discriminatorTypeFieldName = typeFieldName
enc.discriminatorValueFieldName = valueFieldName
enc.discriminatorEncodeMode = mode
enc.typeToDiscriminatorFn = DefaultDiscriminatorFunc
}
// SetTypeToDiscriminatorFunc allows for customizing the discriminator value for
// different types. This may be useful if the golang struct names do not match
// the desired values. One example would be if discriminator values in a
// protocol require special characters or start with lowercase letter. The
// TypeToDiscriminatorFunc implementation may return empty string to suppress
// the rendering of discriminator for specific type(s).
func (enc *Encoder) SetTypeToDiscriminatorFunc(f TypeToDiscriminatorFunc) {
if f == nil {
enc.typeToDiscriminatorFn = DefaultDiscriminatorFunc
return
}
enc.typeToDiscriminatorFn = f
}
// RawMessage is a raw encoded JSON value.
// It implements Marshaler and Unmarshaler and can
// be used to delay JSON decoding or precompute a JSON encoding.
type RawMessage []byte
// MarshalJSON returns m as the JSON encoding of m.
func (m RawMessage) MarshalJSON() ([]byte, error) {
if m == nil {
return []byte("null"), nil
}
return m, nil
}
// UnmarshalJSON sets *m to a copy of data.
func (m *RawMessage) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
}
*m = append((*m)[0:0], data...)
return nil
}
var _ Marshaler = (*RawMessage)(nil)
var _ Unmarshaler = (*RawMessage)(nil)
// A Token holds a value of one of these types:
//
// Delim, for the four JSON delimiters [ ] { }
// bool, for JSON booleans
// float64, for JSON numbers
// Number, for JSON numbers
// string, for JSON string literals
// nil, for JSON null
type Token interface{}
const (
tokenTopValue = iota
tokenArrayStart
tokenArrayValue
tokenArrayComma
tokenObjectStart
tokenObjectKey
tokenObjectColon
tokenObjectValue
tokenObjectComma
)
// advance tokenstate from a separator state to a value state
func (dec *Decoder) tokenPrepareForDecode() error {
// Note: Not calling peek before switch, to avoid
// putting peek into the standard Decode path.
// peek is only called when using the Token API.
switch dec.tokenState {
case tokenArrayComma:
c, err := dec.peek()
if err != nil {
return err
}
if c != ',' {
return &SyntaxError{"expected comma after array element", dec.InputOffset()}
}
dec.scanp++
dec.tokenState = tokenArrayValue
case tokenObjectColon:
c, err := dec.peek()
if err != nil {
return err
}
if c != ':' {
return &SyntaxError{"expected colon after object key", dec.InputOffset()}
}
dec.scanp++
dec.tokenState = tokenObjectValue
}
return nil
}
func (dec *Decoder) tokenValueAllowed() bool {
switch dec.tokenState {
case tokenTopValue, tokenArrayStart, tokenArrayValue, tokenObjectValue:
return true
}
return false
}
func (dec *Decoder) tokenValueEnd() {
switch dec.tokenState {
case tokenArrayStart, tokenArrayValue:
dec.tokenState = tokenArrayComma
case tokenObjectValue:
dec.tokenState = tokenObjectComma
}
}
// A Delim is a JSON array or object delimiter, one of [ ] { or }.
type Delim rune
func (d Delim) String() string {
return string(d)
}
// Token returns the next JSON token in the input stream.
// At the end of the input stream, Token returns nil, io.EOF.
//
// Token guarantees that the delimiters [ ] { } it returns are
// properly nested and matched: if Token encounters an unexpected
// delimiter in the input, it will return an error.
//
// The input stream consists of basic JSON values—bool, string,
// number, and null—along with delimiters [ ] { } of type Delim
// to mark the start and end of arrays and objects.
// Commas and colons are elided.
func (dec *Decoder) Token() (Token, error) {
for {
c, err := dec.peek()
if err != nil {
return nil, err
}
switch c {
case '[':
if !dec.tokenValueAllowed() {
return dec.tokenError(c)
}
dec.scanp++
dec.tokenStack = append(dec.tokenStack, dec.tokenState)
dec.tokenState = tokenArrayStart
return Delim('['), nil
case ']':
if dec.tokenState != tokenArrayStart && dec.tokenState != tokenArrayComma {
return dec.tokenError(c)
}
dec.scanp++
dec.tokenState = dec.tokenStack[len(dec.tokenStack)-1]
dec.tokenStack = dec.tokenStack[:len(dec.tokenStack)-1]
dec.tokenValueEnd()
return Delim(']'), nil
case '{':
if !dec.tokenValueAllowed() {
return dec.tokenError(c)
}
dec.scanp++
dec.tokenStack = append(dec.tokenStack, dec.tokenState)
dec.tokenState = tokenObjectStart
return Delim('{'), nil
case '}':
if dec.tokenState != tokenObjectStart && dec.tokenState != tokenObjectComma {
return dec.tokenError(c)
}
dec.scanp++
dec.tokenState = dec.tokenStack[len(dec.tokenStack)-1]
dec.tokenStack = dec.tokenStack[:len(dec.tokenStack)-1]
dec.tokenValueEnd()
return Delim('}'), nil
case ':':
if dec.tokenState != tokenObjectColon {
return dec.tokenError(c)
}
dec.scanp++
dec.tokenState = tokenObjectValue
continue
case ',':
if dec.tokenState == tokenArrayComma {
dec.scanp++
dec.tokenState = tokenArrayValue
continue
}
if dec.tokenState == tokenObjectComma {
dec.scanp++
dec.tokenState = tokenObjectKey
continue
}
return dec.tokenError(c)
case '"':
if dec.tokenState == tokenObjectStart || dec.tokenState == tokenObjectKey {
var x string
old := dec.tokenState
dec.tokenState = tokenTopValue
err := dec.Decode(&x)
dec.tokenState = old
if err != nil {
return nil, err
}
dec.tokenState = tokenObjectColon
return x, nil
}
fallthrough
default:
if !dec.tokenValueAllowed() {
return dec.tokenError(c)
}
var x interface{}
if err := dec.Decode(&x); err != nil {
return nil, err
}
return x, nil
}
}
}
func (dec *Decoder) tokenError(c byte) (Token, error) {
var context string
switch dec.tokenState {
case tokenTopValue:
context = " looking for beginning of value"
case tokenArrayStart, tokenArrayValue, tokenObjectValue:
context = " looking for beginning of value"
case tokenArrayComma:
context = " after array element"
case tokenObjectKey:
context = " looking for beginning of object key string"
case tokenObjectColon:
context = " after object key"
case tokenObjectComma:
context = " after object key:value pair"
}
return nil, &SyntaxError{"invalid character " + quoteChar(c) + context, dec.InputOffset()}
}
// More reports whether there is another element in the
// current array or object being parsed.
func (dec *Decoder) More() bool {
c, err := dec.peek()
return err == nil && c != ']' && c != '}'
}
func (dec *Decoder) peek() (byte, error) {
var err error
for {
for i := dec.scanp; i < len(dec.buf); i++ {
c := dec.buf[i]
if isSpace(c) {
continue
}
dec.scanp = i
return c, nil
}
// buffer has been scanned, now report any error
if err != nil {
return 0, err
}
err = dec.refill()
}
}
// InputOffset returns the input stream byte offset of the current decoder position.
// The offset gives the location of the end of the most recently returned token
// and the beginning of the next token.
func (dec *Decoder) InputOffset() int64 {
return dec.scanned + int64(dec.scanp)
}

218
vendor/github.com/vmware/govmomi/vim25/json/tables.go generated vendored Normal file
View file

@ -0,0 +1,218 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import "unicode/utf8"
// safeSet holds the value true if the ASCII character with the given array
// position can be represented inside a JSON string without any further
// escaping.
//
// All values are true except for the ASCII control characters (0-31), the
// double quote ("), and the backslash character ("\").
var safeSet = [utf8.RuneSelf]bool{
' ': true,
'!': true,
'"': false,
'#': true,
'$': true,
'%': true,
'&': true,
'\'': true,
'(': true,
')': true,
'*': true,
'+': true,
',': true,
'-': true,
'.': true,
'/': true,
'0': true,
'1': true,
'2': true,
'3': true,
'4': true,
'5': true,
'6': true,
'7': true,
'8': true,
'9': true,
':': true,
';': true,
'<': true,
'=': true,
'>': true,
'?': true,
'@': true,
'A': true,
'B': true,
'C': true,
'D': true,
'E': true,
'F': true,
'G': true,
'H': true,
'I': true,
'J': true,
'K': true,
'L': true,
'M': true,
'N': true,
'O': true,
'P': true,
'Q': true,
'R': true,
'S': true,
'T': true,
'U': true,
'V': true,
'W': true,
'X': true,
'Y': true,
'Z': true,
'[': true,
'\\': false,
']': true,
'^': true,
'_': true,
'`': true,
'a': true,
'b': true,
'c': true,
'd': true,
'e': true,
'f': true,
'g': true,
'h': true,
'i': true,
'j': true,
'k': true,
'l': true,
'm': true,
'n': true,
'o': true,
'p': true,
'q': true,
'r': true,
's': true,
't': true,
'u': true,
'v': true,
'w': true,
'x': true,
'y': true,
'z': true,
'{': true,
'|': true,
'}': true,
'~': true,
'\u007f': true,
}
// htmlSafeSet holds the value true if the ASCII character with the given
// array position can be safely represented inside a JSON string, embedded
// inside of HTML <script> tags, without any additional escaping.
//
// All values are true except for the ASCII control characters (0-31), the
// double quote ("), the backslash character ("\"), HTML opening and closing
// tags ("<" and ">"), and the ampersand ("&").
var htmlSafeSet = [utf8.RuneSelf]bool{
' ': true,
'!': true,
'"': false,
'#': true,
'$': true,
'%': true,
'&': false,
'\'': true,
'(': true,
')': true,
'*': true,
'+': true,
',': true,
'-': true,
'.': true,
'/': true,
'0': true,
'1': true,
'2': true,
'3': true,
'4': true,
'5': true,
'6': true,
'7': true,
'8': true,
'9': true,
':': true,
';': true,
'<': false,
'=': true,
'>': false,
'?': true,
'@': true,
'A': true,
'B': true,
'C': true,
'D': true,
'E': true,
'F': true,
'G': true,
'H': true,
'I': true,
'J': true,
'K': true,
'L': true,
'M': true,
'N': true,
'O': true,
'P': true,
'Q': true,
'R': true,
'S': true,
'T': true,
'U': true,
'V': true,
'W': true,
'X': true,
'Y': true,
'Z': true,
'[': true,
'\\': false,
']': true,
'^': true,
'_': true,
'`': true,
'a': true,
'b': true,
'c': true,
'd': true,
'e': true,
'f': true,
'g': true,
'h': true,
'i': true,
'j': true,
'k': true,
'l': true,
'm': true,
'n': true,
'o': true,
'p': true,
'q': true,
'r': true,
's': true,
't': true,
'u': true,
'v': true,
'w': true,
'x': true,
'y': true,
'z': true,
'{': true,
'|': true,
'}': true,
'~': true,
'\u007f': true,
}

44
vendor/github.com/vmware/govmomi/vim25/json/tags.go generated vendored Normal file
View file

@ -0,0 +1,44 @@
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"strings"
)
// tagOptions is the string following a comma in a struct field's "json"
// tag, or the empty string. It does not include the leading comma.
type tagOptions string
// parseTag splits a struct field's json tag into its name and
// comma-separated options.
func parseTag(tag string) (string, tagOptions) {
if idx := strings.Index(tag, ","); idx != -1 {
return tag[:idx], tagOptions(tag[idx+1:])
}
return tag, tagOptions("")
}
// Contains reports whether a comma-separated list of options
// contains a particular substr flag. substr must be surrounded by a
// string boundary or commas.
func (o tagOptions) Contains(optionName string) bool {
if len(o) == 0 {
return false
}
s := string(o)
for s != "" {
var next string
i := strings.Index(s, ",")
if i >= 0 {
s, next = s[:i], s[i+1:]
}
if s == optionName {
return true
}
s = next
}
return false
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -5003,6 +5003,26 @@ func EagerZeroVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *ty
return resBody.Res, nil
}
type EmitSyslogMarkBody struct {
Req *types.EmitSyslogMark `xml:"urn:vim25 EmitSyslogMark,omitempty"`
Res *types.EmitSyslogMarkResponse `xml:"EmitSyslogMarkResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *EmitSyslogMarkBody) Fault() *soap.Fault { return b.Fault_ }
func EmitSyslogMark(ctx context.Context, r soap.RoundTripper, req *types.EmitSyslogMark) (*types.EmitSyslogMarkResponse, error) {
var reqBody, resBody EmitSyslogMarkBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type EnableAlarmBody struct {
Req *types.EnableAlarm `xml:"urn:vim25 EnableAlarm,omitempty"`
Res *types.EnableAlarmResponse `xml:"EnableAlarmResponse,omitempty"`
@ -6303,6 +6323,26 @@ func GetAlarmState(ctx context.Context, r soap.RoundTripper, req *types.GetAlarm
return resBody.Res, nil
}
type GetCryptoKeyStatusBody struct {
Req *types.GetCryptoKeyStatus `xml:"urn:vim25 GetCryptoKeyStatus,omitempty"`
Res *types.GetCryptoKeyStatusResponse `xml:"GetCryptoKeyStatusResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *GetCryptoKeyStatusBody) Fault() *soap.Fault { return b.Fault_ }
func GetCryptoKeyStatus(ctx context.Context, r soap.RoundTripper, req *types.GetCryptoKeyStatus) (*types.GetCryptoKeyStatusResponse, error) {
var reqBody, resBody GetCryptoKeyStatusBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type GetCustomizationSpecBody struct {
Req *types.GetCustomizationSpec `xml:"urn:vim25 GetCustomizationSpec,omitempty"`
Res *types.GetCustomizationSpecResponse `xml:"GetCustomizationSpecResponse,omitempty"`
@ -7463,6 +7503,26 @@ func ImportVApp(ctx context.Context, r soap.RoundTripper, req *types.ImportVApp)
return resBody.Res, nil
}
type IncreaseDirectorySizeBody struct {
Req *types.IncreaseDirectorySize `xml:"urn:vim25 IncreaseDirectorySize,omitempty"`
Res *types.IncreaseDirectorySizeResponse `xml:"IncreaseDirectorySizeResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *IncreaseDirectorySizeBody) Fault() *soap.Fault { return b.Fault_ }
func IncreaseDirectorySize(ctx context.Context, r soap.RoundTripper, req *types.IncreaseDirectorySize) (*types.IncreaseDirectorySizeResponse, error) {
var reqBody, resBody IncreaseDirectorySizeBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type InflateDisk_TaskBody struct {
Req *types.InflateDisk_Task `xml:"urn:vim25 InflateDisk_Task,omitempty"`
Res *types.InflateDisk_TaskResponse `xml:"InflateDisk_TaskResponse,omitempty"`
@ -7683,6 +7743,26 @@ func InstantClone_Task(ctx context.Context, r soap.RoundTripper, req *types.Inst
return resBody.Res, nil
}
type IsClusteredVmdkEnabledBody struct {
Req *types.IsClusteredVmdkEnabled `xml:"urn:vim25 IsClusteredVmdkEnabled,omitempty"`
Res *types.IsClusteredVmdkEnabledResponse `xml:"IsClusteredVmdkEnabledResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *IsClusteredVmdkEnabledBody) Fault() *soap.Fault { return b.Fault_ }
func IsClusteredVmdkEnabled(ctx context.Context, r soap.RoundTripper, req *types.IsClusteredVmdkEnabled) (*types.IsClusteredVmdkEnabledResponse, error) {
var reqBody, resBody IsClusteredVmdkEnabledBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type IsKmsClusterActiveBody struct {
Req *types.IsKmsClusterActive `xml:"urn:vim25 IsKmsClusterActive,omitempty"`
Res *types.IsKmsClusterActiveResponse `xml:"IsKmsClusterActiveResponse,omitempty"`
@ -9843,6 +9923,26 @@ func QueryDescriptions(ctx context.Context, r soap.RoundTripper, req *types.Quer
return resBody.Res, nil
}
type QueryDirectoryInfoBody struct {
Req *types.QueryDirectoryInfo `xml:"urn:vim25 QueryDirectoryInfo,omitempty"`
Res *types.QueryDirectoryInfoResponse `xml:"QueryDirectoryInfoResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *QueryDirectoryInfoBody) Fault() *soap.Fault { return b.Fault_ }
func QueryDirectoryInfo(ctx context.Context, r soap.RoundTripper, req *types.QueryDirectoryInfo) (*types.QueryDirectoryInfoResponse, error) {
var reqBody, resBody QueryDirectoryInfoBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type QueryDisksForVsanBody struct {
Req *types.QueryDisksForVsan `xml:"urn:vim25 QueryDisksForVsan,omitempty"`
Res *types.QueryDisksForVsanResponse `xml:"QueryDisksForVsanResponse,omitempty"`
@ -10083,6 +10183,26 @@ func QueryFaultToleranceCompatibilityEx(ctx context.Context, r soap.RoundTripper
return resBody.Res, nil
}
type QueryFileLockInfoBody struct {
Req *types.QueryFileLockInfo `xml:"urn:vim25 QueryFileLockInfo,omitempty"`
Res *types.QueryFileLockInfoResponse `xml:"QueryFileLockInfoResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *QueryFileLockInfoBody) Fault() *soap.Fault { return b.Fault_ }
func QueryFileLockInfo(ctx context.Context, r soap.RoundTripper, req *types.QueryFileLockInfo) (*types.QueryFileLockInfoResponse, error) {
var reqBody, resBody QueryFileLockInfoBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type QueryFilterEntitiesBody struct {
Req *types.QueryFilterEntities `xml:"urn:vim25 QueryFilterEntities,omitempty"`
Res *types.QueryFilterEntitiesResponse `xml:"QueryFilterEntitiesResponse,omitempty"`
@ -13583,6 +13703,26 @@ func RenameVStorageObject(ctx context.Context, r soap.RoundTripper, req *types.R
return resBody.Res, nil
}
type RenameVStorageObjectExBody struct {
Req *types.RenameVStorageObjectEx `xml:"urn:vim25 RenameVStorageObjectEx,omitempty"`
Res *types.RenameVStorageObjectExResponse `xml:"RenameVStorageObjectExResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *RenameVStorageObjectExBody) Fault() *soap.Fault { return b.Fault_ }
func RenameVStorageObjectEx(ctx context.Context, r soap.RoundTripper, req *types.RenameVStorageObjectEx) (*types.RenameVStorageObjectExResponse, error) {
var reqBody, resBody RenameVStorageObjectExBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type Rename_TaskBody struct {
Req *types.Rename_Task `xml:"urn:vim25 Rename_Task,omitempty"`
Res *types.Rename_TaskResponse `xml:"Rename_TaskResponse,omitempty"`
@ -14143,6 +14283,26 @@ func RetrieveArgumentDescription(ctx context.Context, r soap.RoundTripper, req *
return resBody.Res, nil
}
type RetrieveCertificateInfoListBody struct {
Req *types.RetrieveCertificateInfoList `xml:"urn:vim25 RetrieveCertificateInfoList,omitempty"`
Res *types.RetrieveCertificateInfoListResponse `xml:"RetrieveCertificateInfoListResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *RetrieveCertificateInfoListBody) Fault() *soap.Fault { return b.Fault_ }
func RetrieveCertificateInfoList(ctx context.Context, r soap.RoundTripper, req *types.RetrieveCertificateInfoList) (*types.RetrieveCertificateInfoListResponse, error) {
var reqBody, resBody RetrieveCertificateInfoListBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type RetrieveClientCertBody struct {
Req *types.RetrieveClientCert `xml:"urn:vim25 RetrieveClientCert,omitempty"`
Res *types.RetrieveClientCertResponse `xml:"RetrieveClientCertResponse,omitempty"`
@ -14863,6 +15023,26 @@ func RevertToSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.
return resBody.Res, nil
}
type RevertVStorageObjectEx_TaskBody struct {
Req *types.RevertVStorageObjectEx_Task `xml:"urn:vim25 RevertVStorageObjectEx_Task,omitempty"`
Res *types.RevertVStorageObjectEx_TaskResponse `xml:"RevertVStorageObjectEx_TaskResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *RevertVStorageObjectEx_TaskBody) Fault() *soap.Fault { return b.Fault_ }
func RevertVStorageObjectEx_Task(ctx context.Context, r soap.RoundTripper, req *types.RevertVStorageObjectEx_Task) (*types.RevertVStorageObjectEx_TaskResponse, error) {
var reqBody, resBody RevertVStorageObjectEx_TaskBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type RevertVStorageObject_TaskBody struct {
Req *types.RevertVStorageObject_Task `xml:"urn:vim25 RevertVStorageObject_Task,omitempty"`
Res *types.RevertVStorageObject_TaskResponse `xml:"RevertVStorageObject_TaskResponse,omitempty"`
@ -15303,6 +15483,26 @@ func SetField(ctx context.Context, r soap.RoundTripper, req *types.SetField) (*t
return resBody.Res, nil
}
type SetKeyCustomAttributesBody struct {
Req *types.SetKeyCustomAttributes `xml:"urn:vim25 SetKeyCustomAttributes,omitempty"`
Res *types.SetKeyCustomAttributesResponse `xml:"SetKeyCustomAttributesResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *SetKeyCustomAttributesBody) Fault() *soap.Fault { return b.Fault_ }
func SetKeyCustomAttributes(ctx context.Context, r soap.RoundTripper, req *types.SetKeyCustomAttributes) (*types.SetKeyCustomAttributesResponse, error) {
var reqBody, resBody SetKeyCustomAttributesBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type SetLicenseEditionBody struct {
Req *types.SetLicenseEdition `xml:"urn:vim25 SetLicenseEdition,omitempty"`
Res *types.SetLicenseEditionResponse `xml:"SetLicenseEditionResponse,omitempty"`
@ -15463,6 +15663,26 @@ func SetScreenResolution(ctx context.Context, r soap.RoundTripper, req *types.Se
return resBody.Res, nil
}
type SetServiceAccountBody struct {
Req *types.SetServiceAccount `xml:"urn:vim25 SetServiceAccount,omitempty"`
Res *types.SetServiceAccountResponse `xml:"SetServiceAccountResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *SetServiceAccountBody) Fault() *soap.Fault { return b.Fault_ }
func SetServiceAccount(ctx context.Context, r soap.RoundTripper, req *types.SetServiceAccount) (*types.SetServiceAccountResponse, error) {
var reqBody, resBody SetServiceAccountBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type SetTaskDescriptionBody struct {
Req *types.SetTaskDescription `xml:"urn:vim25 SetTaskDescription,omitempty"`
Res *types.SetTaskDescriptionResponse `xml:"SetTaskDescriptionResponse,omitempty"`
@ -16803,26 +17023,6 @@ func UpdateGraphicsConfig(ctx context.Context, r soap.RoundTripper, req *types.U
return resBody.Res, nil
}
type UpdateHostCustomizations_TaskBody struct {
Req *types.UpdateHostCustomizations_Task `xml:"urn:vim25 UpdateHostCustomizations_Task,omitempty"`
Res *types.UpdateHostCustomizations_TaskResponse `xml:"UpdateHostCustomizations_TaskResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *UpdateHostCustomizations_TaskBody) Fault() *soap.Fault { return b.Fault_ }
func UpdateHostCustomizations_Task(ctx context.Context, r soap.RoundTripper, req *types.UpdateHostCustomizations_Task) (*types.UpdateHostCustomizations_TaskResponse, error) {
var reqBody, resBody UpdateHostCustomizations_TaskBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type UpdateHostImageAcceptanceLevelBody struct {
Req *types.UpdateHostImageAcceptanceLevel `xml:"urn:vim25 UpdateHostImageAcceptanceLevel,omitempty"`
Res *types.UpdateHostImageAcceptanceLevelResponse `xml:"UpdateHostImageAcceptanceLevelResponse,omitempty"`
@ -18143,6 +18343,26 @@ func VCenterUpdateVStorageObjectMetadataEx_Task(ctx context.Context, r soap.Roun
return resBody.Res, nil
}
type VStorageObjectCreateSnapshotEx_TaskBody struct {
Req *types.VStorageObjectCreateSnapshotEx_Task `xml:"urn:vim25 VStorageObjectCreateSnapshotEx_Task,omitempty"`
Res *types.VStorageObjectCreateSnapshotEx_TaskResponse `xml:"VStorageObjectCreateSnapshotEx_TaskResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *VStorageObjectCreateSnapshotEx_TaskBody) Fault() *soap.Fault { return b.Fault_ }
func VStorageObjectCreateSnapshotEx_Task(ctx context.Context, r soap.RoundTripper, req *types.VStorageObjectCreateSnapshotEx_Task) (*types.VStorageObjectCreateSnapshotEx_TaskResponse, error) {
var reqBody, resBody VStorageObjectCreateSnapshotEx_TaskBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type VStorageObjectCreateSnapshot_TaskBody struct {
Req *types.VStorageObjectCreateSnapshot_Task `xml:"urn:vim25 VStorageObjectCreateSnapshot_Task,omitempty"`
Res *types.VStorageObjectCreateSnapshot_TaskResponse `xml:"VStorageObjectCreateSnapshot_TaskResponse,omitempty"`
@ -18163,6 +18383,46 @@ func VStorageObjectCreateSnapshot_Task(ctx context.Context, r soap.RoundTripper,
return resBody.Res, nil
}
type VStorageObjectDeleteSnapshotEx_TaskBody struct {
Req *types.VStorageObjectDeleteSnapshotEx_Task `xml:"urn:vim25 VStorageObjectDeleteSnapshotEx_Task,omitempty"`
Res *types.VStorageObjectDeleteSnapshotEx_TaskResponse `xml:"VStorageObjectDeleteSnapshotEx_TaskResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *VStorageObjectDeleteSnapshotEx_TaskBody) Fault() *soap.Fault { return b.Fault_ }
func VStorageObjectDeleteSnapshotEx_Task(ctx context.Context, r soap.RoundTripper, req *types.VStorageObjectDeleteSnapshotEx_Task) (*types.VStorageObjectDeleteSnapshotEx_TaskResponse, error) {
var reqBody, resBody VStorageObjectDeleteSnapshotEx_TaskBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type VStorageObjectExtendDiskEx_TaskBody struct {
Req *types.VStorageObjectExtendDiskEx_Task `xml:"urn:vim25 VStorageObjectExtendDiskEx_Task,omitempty"`
Res *types.VStorageObjectExtendDiskEx_TaskResponse `xml:"VStorageObjectExtendDiskEx_TaskResponse,omitempty"`
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
}
func (b *VStorageObjectExtendDiskEx_TaskBody) Fault() *soap.Fault { return b.Fault_ }
func VStorageObjectExtendDiskEx_Task(ctx context.Context, r soap.RoundTripper, req *types.VStorageObjectExtendDiskEx_Task) (*types.VStorageObjectExtendDiskEx_TaskResponse, error) {
var reqBody, resBody VStorageObjectExtendDiskEx_TaskBody
reqBody.Req = req
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
return nil, err
}
return resBody.Res, nil
}
type ValidateCredentialsInGuestBody struct {
Req *types.ValidateCredentialsInGuest `xml:"urn:vim25 ValidateCredentialsInGuest,omitempty"`
Res *types.ValidateCredentialsInGuestResponse `xml:"ValidateCredentialsInGuestResponse,omitempty"`

File diff suppressed because it is too large Load diff

View file

@ -77,7 +77,7 @@ func ApplyPropertyChange(obj Reference, changes []types.PropertyChange) {
for _, p := range changes {
rv, ok := t.props[p.Name]
if !ok {
continue
panic(p.Name + " not found")
}
assignValue(v, rv, reflect.ValueOf(p.Val))

View file

@ -80,9 +80,12 @@ func buildName(fn string, f reflect.StructField) string {
fn += "."
}
motag := f.Tag.Get("mo")
motag := f.Tag.Get("json")
if motag != "" {
return fn + motag
tokens := strings.Split(motag, ",")
if tokens[0] != "" {
return fn + tokens[0]
}
}
xmltag := f.Tag.Get("xml")

View file

@ -1,11 +1,11 @@
/*
Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -40,7 +40,6 @@ import (
"runtime"
"strings"
"sync"
"time"
"github.com/vmware/govmomi/internal/version"
"github.com/vmware/govmomi/vim25/progress"
@ -87,6 +86,8 @@ type Client struct {
cookie string
insecureCookies bool
useJSON bool
}
var schemeMatch = regexp.MustCompile(`^\w+://`)
@ -113,6 +114,7 @@ func ParseURL(s string) (*url.URL, error) {
s = "https://" + s
}
s := strings.TrimSuffix(s, "/")
u, err = url.Parse(s)
if err != nil {
return nil, err
@ -132,30 +134,22 @@ func ParseURL(s string) (*url.URL, error) {
}
func NewClient(u *url.URL, insecure bool) *Client {
c := Client{
u: u,
k: insecure,
d: newDebug(),
var t *http.Transport
Types: types.TypeFunc(),
}
// Initialize http.RoundTripper on client, so we can customize it below
if t, ok := http.DefaultTransport.(*http.Transport); ok {
c.t = &http.Transport{
Proxy: t.Proxy,
DialContext: t.DialContext,
MaxIdleConns: t.MaxIdleConns,
IdleConnTimeout: t.IdleConnTimeout,
TLSHandshakeTimeout: t.TLSHandshakeTimeout,
ExpectContinueTimeout: t.ExpectContinueTimeout,
}
if d, ok := http.DefaultTransport.(*http.Transport); ok {
t = d.Clone()
} else {
c.t = new(http.Transport)
t = new(http.Transport)
}
c.hosts = make(map[string]string)
c.t.TLSClientConfig = &tls.Config{InsecureSkipVerify: c.k}
if insecure {
if t.TLSClientConfig == nil {
t.TLSClientConfig = new(tls.Config)
}
t.TLSClientConfig.InsecureSkipVerify = insecure
}
c := newClientWithTransport(u, insecure, t)
// Always set DialTLS and DialTLSContext, even if InsecureSkipVerify=true,
// because of how certificate verification has been delegated to the host's
@ -163,7 +157,22 @@ func NewClient(u *url.URL, insecure bool) *Client {
//
// * https://tip.golang.org/doc/go1.18 (search for "Certificate.Verify")
// * https://github.com/square/certigo/issues/264
c.t.DialTLSContext = c.dialTLSContext
t.DialTLSContext = c.dialTLSContext
return c
}
func newClientWithTransport(u *url.URL, insecure bool, t *http.Transport) *Client {
c := Client{
u: u,
k: insecure,
d: newDebug(),
t: t,
Types: types.TypeFunc(),
}
c.hosts = make(map[string]string)
c.Client.Transport = c.t
c.Client.Jar, _ = cookiejar.New(nil)
@ -185,6 +194,10 @@ func (c *Client) DefaultTransport() *http.Transport {
// NewServiceClient creates a NewClient with the given URL.Path and namespace.
func (c *Client) NewServiceClient(path string, namespace string) *Client {
return c.newServiceClientWithTransport(path, namespace, c.t)
}
func (c *Client) newServiceClientWithTransport(path string, namespace string, t *http.Transport) *Client {
vc := c.URL()
u, err := url.Parse(path)
if err != nil {
@ -195,12 +208,8 @@ func (c *Client) NewServiceClient(path string, namespace string) *Client {
u.Host = vc.Host
}
client := NewClient(u, c.k)
client := newClientWithTransport(u, c.k, t)
client.Namespace = "urn:" + namespace
client.DefaultTransport().TLSClientConfig = c.DefaultTransport().TLSClientConfig
if cert := c.Certificate(); cert != nil {
client.SetCertificate(*cert)
}
// Copy the trusted thumbprints
c.hostsMu.Lock()
@ -239,6 +248,14 @@ func (c *Client) NewServiceClient(path string, namespace string) *Client {
return client
}
// UseJSON changes the protocol between SOAP and JSON. Starting with vCenter
// 8.0.1 JSON over HTTP can be used. Note this method has no locking and clients
// should be careful to not interfere with concurrent use of the client
// instance.
func (c *Client) UseJSON(useJSON bool) {
c.useJSON = useJSON
}
// SetRootCAs defines the set of PEM-encoded file locations of root certificate
// authorities the client uses when verifying server certificates instead of the
// TLS defaults which uses the host's root CA set. Multiple PEM file locations
@ -415,6 +432,7 @@ func splitHostPort(host string) (string, string) {
const sdkTunnel = "sdkTunnel:8089"
// Certificate returns the current TLS certificate.
func (c *Client) Certificate() *tls.Certificate {
certs := c.t.TLSClientConfig.Certificates
if len(certs) == 0 {
@ -423,6 +441,7 @@ func (c *Client) Certificate() *tls.Certificate {
return &certs[0]
}
// SetCertificate st a certificate for TLS use.
func (c *Client) SetCertificate(cert tls.Certificate) {
t := c.Client.Transport.(*http.Transport)
@ -434,7 +453,8 @@ func (c *Client) SetCertificate(cert tls.Certificate) {
// to the SDK tunnel virtual host. Use of the SDK tunnel is required by LoginExtensionByCertificate()
// and optional for other methods.
func (c *Client) Tunnel() *Client {
tunnel := c.NewServiceClient(c.u.Path, c.Namespace)
tunnel := c.newServiceClientWithTransport(c.u.Path, c.Namespace, c.DefaultTransport().Clone())
t := tunnel.Client.Transport.(*http.Transport)
// Proxy to vCenter host on port 80
host := tunnel.u.Hostname()
@ -460,6 +480,7 @@ func (c *Client) Tunnel() *Client {
return tunnel
}
// URL returns the URL to which the client is configured
func (c *Client) URL() *url.URL {
urlCopy := *c.u
return &urlCopy
@ -470,19 +491,23 @@ type marshaledClient struct {
URL *url.URL
Insecure bool
Version string
UseJSON bool
}
// MarshalJSON writes the Client configuration to JSON.
func (c *Client) MarshalJSON() ([]byte, error) {
m := marshaledClient{
Cookies: c.Jar.Cookies(c.u),
URL: c.u,
Insecure: c.k,
Version: c.Version,
UseJSON: c.useJSON,
}
return json.Marshal(m)
}
// UnmarshalJSON rads Client configuration from JSON.
func (c *Client) UnmarshalJSON(b []byte) error {
var m marshaledClient
@ -494,12 +519,11 @@ func (c *Client) UnmarshalJSON(b []byte) error {
*c = *NewClient(m.URL, m.Insecure)
c.Version = m.Version
c.Jar.SetCookies(m.URL, m.Cookies)
c.useJSON = m.UseJSON
return nil
}
type kindContext struct{}
func (c *Client) setInsecureCookies(res *http.Response) {
cookies := res.Cookies()
if len(cookies) != 0 {
@ -510,6 +534,9 @@ func (c *Client) setInsecureCookies(res *http.Response) {
}
}
// Do is equivalent to http.Client.Do and takes care of API specifics including
// logging, user-agent header, handling cookies, measuring responsiveness of the
// API
func (c *Client) Do(ctx context.Context, req *http.Request, f func(*http.Response) error) error {
if ctx == nil {
ctx = context.Background()
@ -532,20 +559,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, f func(*http.Respons
ext = d.debugRequest(req)
}
tstart := time.Now()
res, err := c.Client.Do(req.WithContext(ctx))
tstop := time.Now()
if d.enabled() {
var name string
if kind, ok := ctx.Value(kindContext{}).(HasFault); ok {
name = fmt.Sprintf("%T", kind)
} else {
name = fmt.Sprintf("%s %s", req.Method, req.URL)
}
d.logf("%6dms (%s)", tstop.Sub(tstart)/time.Millisecond, name)
}
if err != nil {
return err
}
@ -603,7 +617,15 @@ func newStatusError(res *http.Response) error {
}
}
// RoundTrip executes an API request to VMOMI server.
func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error {
if !c.useJSON {
return c.soapRoundTrip(ctx, reqBody, resBody)
}
return c.jsonRoundTrip(ctx, reqBody, resBody)
}
func (c *Client) soapRoundTrip(ctx context.Context, reqBody, resBody HasFault) error {
var err error
var b []byte
@ -651,7 +673,7 @@ func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error
}
req.Header.Set(`SOAPAction`, action)
return c.Do(context.WithValue(ctx, kindContext{}, resBody), req, func(res *http.Response) error {
return c.Do(ctx, req, func(res *http.Response) error {
switch res.StatusCode {
case http.StatusOK:
// OK

View file

@ -22,7 +22,6 @@ import (
"net/http"
"net/http/httputil"
"sync/atomic"
"time"
"github.com/vmware/govmomi/vim25/debug"
)
@ -37,17 +36,9 @@ var (
// debugRoundTrip contains state and logic needed to debug a single round trip.
type debugRoundTrip struct {
cn uint64 // Client number
rn uint64 // Request number
log io.WriteCloser // Request log
cs []io.Closer // Files that need closing when done
}
func (d *debugRoundTrip) logf(format string, a ...interface{}) {
now := time.Now().Format("2006-01-02T15-04-05.000000000")
fmt.Fprintf(d.log, "%s - %04d: ", now, d.rn)
fmt.Fprintf(d.log, format, a...)
fmt.Fprintf(d.log, "\n")
cn uint64 // Client number
rn uint64 // Request number
cs []io.Closer // Files that need closing when done
}
func (d *debugRoundTrip) enabled() bool {
@ -120,9 +111,8 @@ var cn uint64 // Client counter
// debugContainer wraps the debugging state for a single client.
type debugContainer struct {
cn uint64 // Client number
rn uint64 // Request counter
log io.WriteCloser // Request log
cn uint64 // Client number
rn uint64 // Request counter
}
func newDebug() *debugContainer {
@ -134,8 +124,6 @@ func newDebug() *debugContainer {
if !debug.Enabled() {
return nil
}
d.log = debug.NewFile(fmt.Sprintf("%d-client.log", d.cn))
return &d
}
@ -145,9 +133,8 @@ func (d *debugContainer) newRoundTrip() *debugRoundTrip {
}
drt := debugRoundTrip{
cn: d.cn,
rn: atomic.AddUint64(&d.rn, 1),
log: d.log,
cn: d.cn,
rn: atomic.AddUint64(&d.rn, 1),
}
return &drt

View file

@ -0,0 +1,262 @@
/*
Copyright (c) 2023-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package soap
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"mime"
"net/http"
"reflect"
"strings"
"github.com/vmware/govmomi/vim25/xml"
"github.com/vmware/govmomi/vim25/types"
)
const (
sessionHeader = "vmware-api-session-id"
)
var (
// errInvalidResponse is used during unmarshaling when the response content
// does not match expectations e.g. unexpected HTTP status code or MIME
// type.
errInvalidResponse error = errors.New("Invalid response")
// errInputError is used as root error when the request is malformed.
errInputError error = errors.New("Invalid input error")
)
// Handles round trip using json HTTP
func (c *Client) jsonRoundTrip(ctx context.Context, req, res HasFault) error {
this, method, params, err := unpackSOAPRequest(req)
if err != nil {
return fmt.Errorf("Cannot unpack the request. %w", err)
}
return c.invoke(ctx, this, method, params, res)
}
// Invoke calls a managed object method
func (c *Client) invoke(ctx context.Context, this types.ManagedObjectReference, method string, params interface{}, res HasFault) error {
buffer := bytes.Buffer{}
if params != nil {
marshaller := types.NewJSONEncoder(&buffer)
err := marshaller.Encode(params)
if err != nil {
return fmt.Errorf("Encoding request to JSON failed. %w", err)
}
}
uri := c.getPathForName(this, method)
req, err := http.NewRequest(http.MethodPost, uri, &buffer)
if err != nil {
return err
}
if len(c.cookie) != 0 {
req.Header.Add(sessionHeader, c.cookie)
}
result, err := getSOAPResultPtr(res)
if err != nil {
return fmt.Errorf("Cannot get pointer to the result structure. %w", err)
}
return c.Do(ctx, req, c.responseUnmarshaler(&result))
}
// responseUnmarshaler create unmarshaler function for VMOMI JSON request. The
// unmarshaler checks for errors and tries to load the response body in the
// result structure. It is assumed that result is pointer to a data structure or
// interface{}.
func (c *Client) responseUnmarshaler(result interface{}) func(resp *http.Response) error {
return func(resp *http.Response) error {
if resp.StatusCode == http.StatusNoContent ||
(!isError(resp.StatusCode) && resp.ContentLength == 0) {
return nil
}
if e := checkJSONContentType(resp); e != nil {
return e
}
if resp.StatusCode == 500 {
bodyBytes, e := io.ReadAll(resp.Body)
if e != nil {
return e
}
var serverErr interface{}
dec := types.NewJSONDecoder(bytes.NewReader(bodyBytes))
e = dec.Decode(&serverErr)
if e != nil {
return e
}
var faultStringStruct struct {
FaultString string `json:"faultstring,omitempty"`
}
dec = types.NewJSONDecoder(bytes.NewReader(bodyBytes))
e = dec.Decode(&faultStringStruct)
if e != nil {
return e
}
f := &Fault{
XMLName: xml.Name{
Space: c.Namespace,
Local: reflect.TypeOf(serverErr).Name() + "Fault",
},
String: faultStringStruct.FaultString,
Code: "ServerFaultCode",
}
f.Detail.Fault = serverErr
return WrapSoapFault(f)
}
if isError(resp.StatusCode) {
return fmt.Errorf("Unexpected HTTP error code: %v. %w", resp.StatusCode, errInvalidResponse)
}
dec := types.NewJSONDecoder(resp.Body)
e := dec.Decode(result)
if e != nil {
return e
}
c.checkForSessionHeader(resp)
return nil
}
}
func isError(statusCode int) bool {
return statusCode < http.StatusOK || statusCode >= http.StatusMultipleChoices
}
// checkForSessionHeader checks if we have new session id.
// This is a hack that intercepts the session id header and then repeats it.
// It is very similar to cookie store but only for the special vCenter
// session header.
func (c *Client) checkForSessionHeader(resp *http.Response) {
sessionKey := resp.Header.Get(sessionHeader)
if len(sessionKey) > 0 {
c.cookie = sessionKey
}
}
// Checks if the payload of an HTTP response has the JSON MIME type.
func checkJSONContentType(resp *http.Response) error {
contentType := resp.Header.Get("content-type")
mediaType, _, err := mime.ParseMediaType(contentType)
if err != nil {
return fmt.Errorf("error parsing content-type: %v, error %w", contentType, err)
}
if mediaType != "application/json" {
return fmt.Errorf("content-type is not application/json: %v. %w", contentType, errInvalidResponse)
}
return nil
}
func (c *Client) getPathForName(this types.ManagedObjectReference, name string) string {
const urnPrefix = "urn:"
ns := c.Namespace
if strings.HasPrefix(ns, urnPrefix) {
ns = ns[len(urnPrefix):]
}
return fmt.Sprintf("%v/%v/%v/%v/%v/%v", c.u, ns, c.Version, this.Type, this.Value, name)
}
// unpackSOAPRequest converts SOAP request into this value, method nam and
// parameters using reflection. The input is a one of the *Body structures
// defined in methods.go. It is expected to have "Req" field that is a non-null
// pointer to a struct. The struct simple type name is the method name. The
// struct "This" member is the this MoRef value.
func unpackSOAPRequest(req HasFault) (this types.ManagedObjectReference, method string, params interface{}, err error) {
reqBodyPtr := reflect.ValueOf(req)
if reqBodyPtr.Kind() != reflect.Ptr {
err = fmt.Errorf("Expected pointer to request body as input. %w", errInputError)
return
}
reqBody := reqBodyPtr.Elem()
if reqBody.Kind() != reflect.Struct {
err = fmt.Errorf("Expected Request body to be structure. %w", errInputError)
return
}
methodRequestPtr := reqBody.FieldByName("Req")
if methodRequestPtr.Kind() != reflect.Ptr {
err = fmt.Errorf("Expected method request body field to be pointer to struct. %w", errInputError)
return
}
methodRequest := methodRequestPtr.Elem()
if methodRequest.Kind() != reflect.Struct {
err = fmt.Errorf("Expected method request body to be structure. %w", errInputError)
return
}
thisValue := methodRequest.FieldByName("This")
if thisValue.Kind() != reflect.Struct {
err = fmt.Errorf("Expected This field in the method request body to be structure. %w", errInputError)
return
}
var ok bool
if this, ok = thisValue.Interface().(types.ManagedObjectReference); !ok {
err = fmt.Errorf("Expected This field to be MoRef. %w", errInputError)
return
}
method = methodRequest.Type().Name()
params = methodRequestPtr.Interface()
return
}
// getSOAPResultPtr extract a pointer to the result data structure using go
// reflection from a SOAP data structure used for marshalling.
func getSOAPResultPtr(result HasFault) (res interface{}, err error) {
resBodyPtr := reflect.ValueOf(result)
if resBodyPtr.Kind() != reflect.Ptr {
err = fmt.Errorf("Expected pointer to result body as input. %w", errInputError)
return
}
resBody := resBodyPtr.Elem()
if resBody.Kind() != reflect.Struct {
err = fmt.Errorf("Expected result body to be structure. %w", errInputError)
return
}
methodResponsePtr := resBody.FieldByName("Res")
if methodResponsePtr.Kind() != reflect.Ptr {
err = fmt.Errorf("Expected method response body field to be pointer to struct. %w", errInputError)
return
}
if methodResponsePtr.IsNil() {
methodResponsePtr.Set(reflect.New(methodResponsePtr.Type().Elem()))
}
methodResponse := methodResponsePtr.Elem()
if methodResponse.Kind() != reflect.Struct {
err = fmt.Errorf("Expected method response body to be structure. %w", errInputError)
return
}
returnval := methodResponse.FieldByName("Returnval")
if !returnval.IsValid() {
// void method and we return nil, nil
return
}
res = returnval.Addr().Interface()
return
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

102
vendor/github.com/vmware/govmomi/vim25/types/json.go generated vendored Normal file
View file

@ -0,0 +1,102 @@
/*
Copyright (c) 2023-2023 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package types
import (
"bytes"
"io"
"reflect"
"time"
"github.com/vmware/govmomi/vim25/json"
)
const (
discriminatorMemberName = "_typeName"
primitiveValueMemberName = "_value"
)
var discriminatorTypeRegistry = map[string]reflect.Type{
"boolean": reflect.TypeOf(true),
"byte": reflect.TypeOf(uint8(0)),
"short": reflect.TypeOf(int16(0)),
"int": reflect.TypeOf(int32(0)),
"long": reflect.TypeOf(int64(0)),
"float": reflect.TypeOf(float32(0)),
"double": reflect.TypeOf(float64(0)),
"string": reflect.TypeOf(""),
"binary": reflect.TypeOf([]byte{}),
"dateTime": reflect.TypeOf(time.Now()),
}
// NewJSONDecoder creates JSON decoder configured for VMOMI.
func NewJSONDecoder(r io.Reader) *json.Decoder {
res := json.NewDecoder(r)
res.SetDiscriminator(
discriminatorMemberName,
primitiveValueMemberName,
json.DiscriminatorToTypeFunc(func(name string) (reflect.Type, bool) {
if res, ok := TypeFunc()(name); ok {
return res, true
}
if res, ok := discriminatorTypeRegistry[name]; ok {
return res, true
}
return nil, false
}),
)
return res
}
// VMOMI primitive names
var discriminatorNamesRegistry = map[reflect.Type]string{
reflect.TypeOf(true): "boolean",
reflect.TypeOf(uint8(0)): "byte",
reflect.TypeOf(int16(0)): "short",
reflect.TypeOf(int32(0)): "int",
reflect.TypeOf(int64(0)): "long",
reflect.TypeOf(float32(0)): "float",
reflect.TypeOf(float64(0)): "double",
reflect.TypeOf(""): "string",
reflect.TypeOf([]byte{}): "binary",
reflect.TypeOf(time.Now()): "dateTime",
}
// NewJSONEncoder creates JSON encoder configured for VMOMI.
func NewJSONEncoder(w *bytes.Buffer) *json.Encoder {
enc := json.NewEncoder(w)
enc.SetDiscriminator(
discriminatorMemberName,
primitiveValueMemberName,
json.DiscriminatorEncodeTypeNameRootValue|
json.DiscriminatorEncodeTypeNameAllObjects,
)
enc.SetTypeToDiscriminatorFunc(VmomiTypeName)
return enc
}
// VmomiTypeName computes the VMOMI type name of a go type. It uses a lookup
// table for VMOMI primitive types and the default discriminator function for
// other types.
func VmomiTypeName(t reflect.Type) (discriminator string) {
// Look up primitive type names from VMOMI protocol
if name, ok := discriminatorNamesRegistry[t]; ok {
return name
}
name := json.DefaultDiscriminatorFunc(t)
return name
}

View file

@ -21,12 +21,36 @@ import (
"strings"
)
var t = map[string]reflect.Type{}
var (
t = map[string]reflect.Type{}
// minAPIVersionForType is used to lookup the minimum API version for which
// a type is valid.
minAPIVersionForType = map[string]string{}
// minAPIVersionForEnumValue is used to lookup the minimum API version for
// which an enum value is valid.
minAPIVersionForEnumValue = map[string]map[string]string{}
)
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 {

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ import (
"cloud.google.com/go/compute/metadata"
)
const configEndpointSuffix = "googleAutoMtlsConfiguration"
const configEndpointSuffix = "instance/platform-security/auto-mtls-configuration"
// The period an MTLS config can be reused before needing refresh.
var configExpiry = time.Hour

View file

@ -9,6 +9,8 @@ import (
"crypto/tls"
"errors"
"net/http"
"os"
"strconv"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
@ -16,6 +18,10 @@ import (
"google.golang.org/grpc"
)
const (
newAuthLibEnVar = "GOOGLE_API_GO_EXPERIMENTAL_USE_NEW_AUTH_LIB"
)
// DialSettings holds information needed to establish a connection with a
// Google API service.
type DialSettings struct {
@ -47,6 +53,7 @@ type DialSettings struct {
ImpersonationConfig *impersonate.Config
EnableDirectPath bool
EnableDirectPathXds bool
EnableNewAuthLibrary bool
AllowNonDefaultServiceAccount bool
// Google API system parameters. For more information please read:
@ -77,6 +84,16 @@ func (ds *DialSettings) HasCustomAudience() bool {
return len(ds.Audiences) > 0
}
func (ds *DialSettings) IsNewAuthLibraryEnabled() bool {
if ds.EnableNewAuthLibrary {
return true
}
if b, err := strconv.ParseBool(os.Getenv(newAuthLibEnVar)); err == nil {
return b
}
return false
}
// Validate reports an error if ds is invalid.
func (ds *DialSettings) Validate() error {
if ds.SkipValidation {

View file

@ -5,4 +5,4 @@
package internal
// Version is the current tagged release of the library.
const Version = "0.141.0"
const Version = "0.143.0"

View file

@ -150,6 +150,19 @@ func (w *withCreds) Apply(o *internal.DialSettings) {
o.InternalCredentials = (*google.Credentials)(w)
}
// EnableNewAuthLibrary returns a ClientOption that specifies if libraries in this
// module to delegate auth to our new library. This option will be removed in
// the future once all clients have been moved to the new auth layer.
func EnableNewAuthLibrary() option.ClientOption {
return enableNewAuthLibrary(true)
}
type enableNewAuthLibrary bool
func (w enableNewAuthLibrary) Apply(o *internal.DialSettings) {
o.EnableNewAuthLibrary = bool(w)
}
// EmbeddableAdapter is a no-op option.ClientOption that allow libraries to
// create their own client options by embedding this type into their own
// client-specific option wrapper. See example for usage.

View file

@ -26,7 +26,7 @@
"description": "Stores and retrieves potentially large, immutable data objects.",
"discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/storage/docs/json_api/",
"etag": "\"3137393534363837313035303430333138303233\"",
"etag": "\"3132363038323634353839373135393539313634\"",
"icons": {
"x16": "https://www.google.com/images/icons/product/cloud_storage-16.png",
"x32": "https://www.google.com/images/icons/product/cloud_storage-32.png"
@ -446,6 +446,12 @@
"project"
],
"parameters": {
"enableObjectRetention": {
"default": "false",
"description": "When set to true, object retention is enabled for this bucket.",
"location": "query",
"type": "boolean"
},
"predefinedAcl": {
"description": "Apply a predefined set of access controls to this bucket.",
"enum": [
@ -2295,6 +2301,11 @@
"required": true,
"type": "string"
},
"overrideUnlockedRetention": {
"description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
"location": "query",
"type": "boolean"
},
"predefinedAcl": {
"description": "Apply a predefined set of access controls to this object.",
"enum": [
@ -2738,6 +2749,11 @@
"required": true,
"type": "string"
},
"overrideUnlockedRetention": {
"description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
"location": "query",
"type": "boolean"
},
"predefinedAcl": {
"description": "Apply a predefined set of access controls to this object.",
"enum": [
@ -3242,7 +3258,7 @@
}
}
},
"revision": "20230907",
"revision": "20230914",
"rootUrl": "https://storage.googleapis.com/",
"schemas": {
"Bucket": {
@ -3268,6 +3284,15 @@
"description": "Whether or not Autoclass is enabled on this bucket",
"type": "boolean"
},
"terminalStorageClass": {
"description": "The storage class that objects in the bucket eventually transition to if they are not read for a certain length of time. Valid values are NEARLINE and ARCHIVE.",
"type": "string"
},
"terminalStorageClassUpdateTime": {
"description": "A date and time in RFC 3339 format representing the time of the most recent update to \"terminalStorageClass\".",
"format": "date-time",
"type": "string"
},
"toggleTime": {
"description": "A date and time in RFC 3339 format representing the instant at which \"enabled\" was last toggled.",
"format": "date-time",
@ -3551,6 +3576,16 @@
"description": "The name of the bucket.",
"type": "string"
},
"objectRetention": {
"description": "The bucket's object retention config.",
"properties": {
"mode": {
"description": "The bucket's object retention mode. Can be Enabled.",
"type": "string"
}
},
"type": "object"
},
"owner": {
"description": "The owner of the bucket. This is always the project team's owner group.",
"properties": {
@ -3602,6 +3637,22 @@
"description": "The URI of this bucket.",
"type": "string"
},
"softDeletePolicy": {
"description": "The bucket's soft delete policy, which defines the period of time that soft-deleted objects will be retained, and cannot be permanently deleted.",
"properties": {
"effectiveTime": {
"description": "Server-determined value that indicates the time from which the policy, or one with a greater retention, was effective. This value is in RFC 3339 format.",
"format": "date-time",
"type": "string"
},
"retentionDurationSeconds": {
"description": "The period of time in seconds, that soft-deleted objects in the bucket will be retained and cannot be permanently deleted.",
"format": "int64",
"type": "string"
}
},
"type": "object"
},
"storageClass": {
"description": "The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes.",
"type": "string"
@ -4306,6 +4357,21 @@
},
"type": "object"
},
"retention": {
"description": "A collection of object level retention parameters.",
"properties": {
"mode": {
"description": "The bucket's object retention mode, can only be Unlocked or Locked.",
"type": "string"
},
"retainUntilTime": {
"description": "A time in RFC 3339 format until which object retention protects this object.",
"format": "date-time",
"type": "string"
}
},
"type": "object"
},
"retentionExpirationTime": {
"description": "A server-determined value that specifies the earliest time that the object's retention period expires. This value is in RFC 3339 format. Note 1: This field is not provided for objects with an active event-based hold, since retention expiration is unknown until the hold is removed. Note 2: This value can be provided even when temporary hold is set (so that the user can reason about policy without having to first unset the temporary hold).",
"format": "date-time",

View file

@ -385,6 +385,9 @@ type Bucket struct {
// Name: The name of the bucket.
Name string `json:"name,omitempty"`
// ObjectRetention: The bucket's object retention config.
ObjectRetention *BucketObjectRetention `json:"objectRetention,omitempty"`
// Owner: The owner of the bucket. This is always the project team's
// owner group.
Owner *BucketOwner `json:"owner,omitempty"`
@ -415,6 +418,11 @@ type Bucket struct {
// SelfLink: The URI of this bucket.
SelfLink string `json:"selfLink,omitempty"`
// SoftDeletePolicy: The bucket's soft delete policy, which defines the
// period of time that soft-deleted objects will be retained, and cannot
// be permanently deleted.
SoftDeletePolicy *BucketSoftDeletePolicy `json:"softDeletePolicy,omitempty"`
// StorageClass: The bucket's default storage class, used whenever no
// storageClass is specified for a newly-created object. This defines
// how objects in the bucket are stored and determines the SLA and the
@ -470,6 +478,16 @@ type BucketAutoclass struct {
// Enabled: Whether or not Autoclass is enabled on this bucket
Enabled bool `json:"enabled,omitempty"`
// TerminalStorageClass: The storage class that objects in the bucket
// eventually transition to if they are not read for a certain length of
// time. Valid values are NEARLINE and ARCHIVE.
TerminalStorageClass string `json:"terminalStorageClass,omitempty"`
// TerminalStorageClassUpdateTime: A date and time in RFC 3339 format
// representing the time of the most recent update to
// "terminalStorageClass".
TerminalStorageClassUpdateTime string `json:"terminalStorageClassUpdateTime,omitempty"`
// ToggleTime: A date and time in RFC 3339 format representing the
// instant at which "enabled" was last toggled.
ToggleTime string `json:"toggleTime,omitempty"`
@ -972,6 +990,34 @@ func (s *BucketLogging) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BucketObjectRetention: The bucket's object retention config.
type BucketObjectRetention struct {
// Mode: The bucket's object retention mode. Can be Enabled.
Mode string `json:"mode,omitempty"`
// ForceSendFields is a list of field names (e.g. "Mode") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Mode") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BucketObjectRetention) MarshalJSON() ([]byte, error) {
type NoMethod BucketObjectRetention
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BucketOwner: The owner of the bucket. This is always the project
// team's owner group.
type BucketOwner struct {
@ -1053,6 +1099,43 @@ func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BucketSoftDeletePolicy: The bucket's soft delete policy, which
// defines the period of time that soft-deleted objects will be
// retained, and cannot be permanently deleted.
type BucketSoftDeletePolicy struct {
// EffectiveTime: Server-determined value that indicates the time from
// which the policy, or one with a greater retention, was effective.
// This value is in RFC 3339 format.
EffectiveTime string `json:"effectiveTime,omitempty"`
// RetentionDurationSeconds: The period of time in seconds, that
// soft-deleted objects in the bucket will be retained and cannot be
// permanently deleted.
RetentionDurationSeconds int64 `json:"retentionDurationSeconds,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "EffectiveTime") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "EffectiveTime") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BucketSoftDeletePolicy) MarshalJSON() ([]byte, error) {
type NoMethod BucketSoftDeletePolicy
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BucketVersioning: The bucket's versioning configuration.
type BucketVersioning struct {
// Enabled: While set to true, versioning is fully enabled for this
@ -2072,6 +2155,9 @@ type Object struct {
// the object.
Owner *ObjectOwner `json:"owner,omitempty"`
// Retention: A collection of object level retention parameters.
Retention *ObjectRetention `json:"retention,omitempty"`
// RetentionExpirationTime: A server-determined value that specifies the
// earliest time that the object's retention period expires. This value
// is in RFC 3339 format. Note 1: This field is not provided for objects
@ -2213,6 +2299,39 @@ func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ObjectRetention: A collection of object level retention parameters.
type ObjectRetention struct {
// Mode: The bucket's object retention mode, can only be Unlocked or
// Locked.
Mode string `json:"mode,omitempty"`
// RetainUntilTime: A time in RFC 3339 format until which object
// retention protects this object.
RetainUntilTime string `json:"retainUntilTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "Mode") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Mode") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ObjectRetention) MarshalJSON() ([]byte, error) {
type NoMethod ObjectRetention
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ObjectAccessControl: An access-control entry.
type ObjectAccessControl struct {
// Bucket: The name of the bucket.
@ -4189,6 +4308,14 @@ func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsert
return c
}
// EnableObjectRetention sets the optional parameter
// "enableObjectRetention": When set to true, object retention is
// enabled for this bucket.
func (c *BucketsInsertCall) EnableObjectRetention(enableObjectRetention bool) *BucketsInsertCall {
c.urlParams_.Set("enableObjectRetention", fmt.Sprint(enableObjectRetention))
return c
}
// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
// predefined set of access controls to this bucket.
//
@ -4362,6 +4489,12 @@ func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
// "project"
// ],
// "parameters": {
// "enableObjectRetention": {
// "default": "false",
// "description": "When set to true, object retention is enabled for this bucket.",
// "location": "query",
// "type": "boolean"
// },
// "predefinedAcl": {
// "description": "Apply a predefined set of access controls to this bucket.",
// "enum": [
@ -10976,6 +11109,15 @@ func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int
return c
}
// OverrideUnlockedRetention sets the optional parameter
// "overrideUnlockedRetention": Must be true to remove the retention
// configuration, reduce its unlocked retention period, or change its
// mode from unlocked to locked.
func (c *ObjectsPatchCall) OverrideUnlockedRetention(overrideUnlockedRetention bool) *ObjectsPatchCall {
c.urlParams_.Set("overrideUnlockedRetention", fmt.Sprint(overrideUnlockedRetention))
return c
}
// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
// predefined set of access controls to this object.
//
@ -11167,6 +11309,11 @@ func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "required": true,
// "type": "string"
// },
// "overrideUnlockedRetention": {
// "description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
// "location": "query",
// "type": "boolean"
// },
// "predefinedAcl": {
// "description": "Apply a predefined set of access controls to this object.",
// "enum": [
@ -12393,6 +12540,15 @@ func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch in
return c
}
// OverrideUnlockedRetention sets the optional parameter
// "overrideUnlockedRetention": Must be true to remove the retention
// configuration, reduce its unlocked retention period, or change its
// mode from unlocked to locked.
func (c *ObjectsUpdateCall) OverrideUnlockedRetention(overrideUnlockedRetention bool) *ObjectsUpdateCall {
c.urlParams_.Set("overrideUnlockedRetention", fmt.Sprint(overrideUnlockedRetention))
return c
}
// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
// predefined set of access controls to this object.
//
@ -12584,6 +12740,11 @@ func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
// "required": true,
// "type": "string"
// },
// "overrideUnlockedRetention": {
// "description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
// "location": "query",
// "type": "boolean"
// },
// "predefinedAcl": {
// "description": "Apply a predefined set of access controls to this object.",
// "enum": [

View file

@ -15,7 +15,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.21.9
// protoc v3.21.12
// source: google/api/field_behavior.proto
package annotations
@ -78,6 +78,19 @@ const (
// a non-empty value will be returned. The user will not be aware of what
// non-empty value to expect.
FieldBehavior_NON_EMPTY_DEFAULT FieldBehavior = 7
// Denotes that the field in a resource (a message annotated with
// google.api.resource) is used in the resource name to uniquely identify the
// resource. For AIP-compliant APIs, this should only be applied to the
// `name` field on the resource.
//
// This behavior should not be applied to references to other resources within
// the message.
//
// The identifier field of resources often have different field behavior
// depending on the request it is embedded in (e.g. for Create methods name
// is optional and unused, while for Update methods it is required). Instead
// of method-specific annotations, only `IDENTIFIER` is required.
FieldBehavior_IDENTIFIER FieldBehavior = 8
)
// Enum value maps for FieldBehavior.
@ -91,6 +104,7 @@ var (
5: "IMMUTABLE",
6: "UNORDERED_LIST",
7: "NON_EMPTY_DEFAULT",
8: "IDENTIFIER",
}
FieldBehavior_value = map[string]int32{
"FIELD_BEHAVIOR_UNSPECIFIED": 0,
@ -101,6 +115,7 @@ var (
"IMMUTABLE": 5,
"UNORDERED_LIST": 6,
"NON_EMPTY_DEFAULT": 7,
"IDENTIFIER": 8,
}
)
@ -169,7 +184,7 @@ var file_google_api_field_behavior_proto_rawDesc = []byte{
0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x20, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64,
0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a,
0xa6, 0x01, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
0xb6, 0x01, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
0x72, 0x12, 0x1e, 0x0a, 0x1a, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x42, 0x45, 0x48, 0x41, 0x56,
0x49, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12,
@ -179,7 +194,8 @@ var file_google_api_field_behavior_proto_rawDesc = []byte{
0x0a, 0x09, 0x49, 0x4d, 0x4d, 0x55, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x05, 0x12, 0x12, 0x0a,
0x0e, 0x55, 0x4e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10,
0x06, 0x12, 0x15, 0x0a, 0x11, 0x4e, 0x4f, 0x4e, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x5f, 0x44,
0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x07, 0x3a, 0x60, 0x0a, 0x0e, 0x66, 0x69, 0x65, 0x6c,
0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4e,
0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x10, 0x08, 0x3a, 0x60, 0x0a, 0x0e, 0x66, 0x69, 0x65, 0x6c,
0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65,
0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x9c, 0x08, 0x20, 0x03, 0x28, 0x0e,

23
vendor/modules.txt vendored
View file

@ -1,4 +1,4 @@
# cloud.google.com/go v0.110.6
# cloud.google.com/go v0.110.7
## explicit; go 1.19
cloud.google.com/go/internal
cloud.google.com/go/internal/optional
@ -119,7 +119,7 @@ github.com/acarl005/stripansi
# github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
## explicit; go 1.13
github.com/asaskevich/govalidator
# github.com/aws/aws-sdk-go v1.45.10
# github.com/aws/aws-sdk-go v1.45.16
## explicit; go 1.11
github.com/aws/aws-sdk-go/aws
github.com/aws/aws-sdk-go/aws/arn
@ -453,7 +453,7 @@ github.com/google/s2a-go/stream
# github.com/google/uuid v1.3.1
## explicit
github.com/google/uuid
# github.com/googleapis/enterprise-certificate-proxy v0.2.5
# github.com/googleapis/enterprise-certificate-proxy v0.3.1
## explicit; go 1.19
github.com/googleapis/enterprise-certificate-proxy/client
github.com/googleapis/enterprise-certificate-proxy/client/util
@ -464,7 +464,7 @@ github.com/googleapis/gax-go/v2/apierror
github.com/googleapis/gax-go/v2/apierror/internal/proto
github.com/googleapis/gax-go/v2/callctx
github.com/googleapis/gax-go/v2/internal
# github.com/gophercloud/gophercloud v1.6.0
# github.com/gophercloud/gophercloud v1.7.0
## explicit; go 1.14
github.com/gophercloud/gophercloud
github.com/gophercloud/gophercloud/openstack
@ -637,7 +637,7 @@ github.com/opencontainers/runc/libcontainer/user
# github.com/opencontainers/runtime-spec v1.1.0
## explicit
github.com/opencontainers/runtime-spec/specs-go
# github.com/openshift-online/ocm-sdk-go v0.1.364
# github.com/openshift-online/ocm-sdk-go v0.1.371
## explicit; go 1.16
github.com/openshift-online/ocm-sdk-go/authentication
github.com/openshift-online/ocm-sdk-go/errors
@ -653,7 +653,7 @@ github.com/oracle/oci-go-sdk/v54/identity
github.com/oracle/oci-go-sdk/v54/objectstorage
github.com/oracle/oci-go-sdk/v54/objectstorage/transfer
github.com/oracle/oci-go-sdk/v54/workrequests
# github.com/osbuild/images v0.5.1-0.20230915095808-dd48a38be218
# github.com/osbuild/images v0.7.0
## explicit; go 1.19
github.com/osbuild/images/internal/common
github.com/osbuild/images/internal/environment
@ -794,7 +794,7 @@ github.com/vbauerster/mpb/v8
github.com/vbauerster/mpb/v8/cwriter
github.com/vbauerster/mpb/v8/decor
github.com/vbauerster/mpb/v8/internal
# github.com/vmware/govmomi v0.30.7
# github.com/vmware/govmomi v0.31.0
## explicit; go 1.19
github.com/vmware/govmomi/cns
github.com/vmware/govmomi/cns/methods
@ -832,6 +832,7 @@ github.com/vmware/govmomi/vapi/rest
github.com/vmware/govmomi/view
github.com/vmware/govmomi/vim25
github.com/vmware/govmomi/vim25/debug
github.com/vmware/govmomi/vim25/json
github.com/vmware/govmomi/vim25/methods
github.com/vmware/govmomi/vim25/mo
github.com/vmware/govmomi/vim25/progress
@ -979,7 +980,7 @@ golang.org/x/tools/internal/typeparams
## explicit; go 1.17
golang.org/x/xerrors
golang.org/x/xerrors/internal
# google.golang.org/api v0.141.0
# google.golang.org/api v0.143.0
## explicit; go 1.19
google.golang.org/api/googleapi
google.golang.org/api/googleapi/transport
@ -1009,17 +1010,17 @@ google.golang.org/appengine/internal/modules
google.golang.org/appengine/internal/remote_api
google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/urlfetch
# google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5
# google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb
## explicit; go 1.19
google.golang.org/genproto/googleapis/cloud/extendedops
google.golang.org/genproto/googleapis/type/date
google.golang.org/genproto/googleapis/type/expr
google.golang.org/genproto/internal
# google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5
# google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb
## explicit; go 1.19
google.golang.org/genproto/googleapis/api
google.golang.org/genproto/googleapis/api/annotations
# google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832
# google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13
## explicit; go 1.19
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails