1
0
mirror of https://github.com/Oxalide/vsphere-influxdb-go.git synced 2023-10-10 11:36:51 +00:00

add vendoring with go dep

This commit is contained in:
Adrian Todorov
2017-10-25 20:52:40 +00:00
parent 704f4d20d1
commit a59409f16b
1627 changed files with 489673 additions and 0 deletions

80
vendor/github.com/vmware/govmomi/guest/auth_manager.go generated vendored Normal file
View File

@@ -0,0 +1,80 @@
/*
Copyright (c) 2015 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 guest
import (
"context"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
)
type AuthManager struct {
types.ManagedObjectReference
vm types.ManagedObjectReference
c *vim25.Client
}
func (m AuthManager) Reference() types.ManagedObjectReference {
return m.ManagedObjectReference
}
func (m AuthManager) AcquireCredentials(ctx context.Context, requestedAuth types.BaseGuestAuthentication, sessionID int64) (types.BaseGuestAuthentication, error) {
req := types.AcquireCredentialsInGuest{
This: m.Reference(),
Vm: m.vm,
RequestedAuth: requestedAuth,
SessionID: sessionID,
}
res, err := methods.AcquireCredentialsInGuest(ctx, m.c, &req)
if err != nil {
return nil, err
}
return res.Returnval, nil
}
func (m AuthManager) ReleaseCredentials(ctx context.Context, auth types.BaseGuestAuthentication) error {
req := types.ReleaseCredentialsInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
}
_, err := methods.ReleaseCredentialsInGuest(ctx, m.c, &req)
return err
}
func (m AuthManager) ValidateCredentials(ctx context.Context, auth types.BaseGuestAuthentication) error {
req := types.ValidateCredentialsInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
}
_, err := methods.ValidateCredentialsInGuest(ctx, m.c, &req)
if err != nil {
return err
}
return nil
}

216
vendor/github.com/vmware/govmomi/guest/file_manager.go generated vendored Normal file
View File

@@ -0,0 +1,216 @@
/*
Copyright (c) 2015-2017 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 guest
import (
"context"
"net/url"
"strings"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
)
type FileManager struct {
types.ManagedObjectReference
vm types.ManagedObjectReference
c *vim25.Client
}
func (m FileManager) Reference() types.ManagedObjectReference {
return m.ManagedObjectReference
}
func (m FileManager) ChangeFileAttributes(ctx context.Context, auth types.BaseGuestAuthentication, guestFilePath string, fileAttributes types.BaseGuestFileAttributes) error {
req := types.ChangeFileAttributesInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
GuestFilePath: guestFilePath,
FileAttributes: fileAttributes,
}
_, err := methods.ChangeFileAttributesInGuest(ctx, m.c, &req)
return err
}
func (m FileManager) CreateTemporaryDirectory(ctx context.Context, auth types.BaseGuestAuthentication, prefix, suffix string, path string) (string, error) {
req := types.CreateTemporaryDirectoryInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Prefix: prefix,
Suffix: suffix,
DirectoryPath: path,
}
res, err := methods.CreateTemporaryDirectoryInGuest(ctx, m.c, &req)
if err != nil {
return "", err
}
return res.Returnval, nil
}
func (m FileManager) CreateTemporaryFile(ctx context.Context, auth types.BaseGuestAuthentication, prefix, suffix string, path string) (string, error) {
req := types.CreateTemporaryFileInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Prefix: prefix,
Suffix: suffix,
DirectoryPath: path,
}
res, err := methods.CreateTemporaryFileInGuest(ctx, m.c, &req)
if err != nil {
return "", err
}
return res.Returnval, nil
}
func (m FileManager) DeleteDirectory(ctx context.Context, auth types.BaseGuestAuthentication, directoryPath string, recursive bool) error {
req := types.DeleteDirectoryInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
DirectoryPath: directoryPath,
Recursive: recursive,
}
_, err := methods.DeleteDirectoryInGuest(ctx, m.c, &req)
return err
}
func (m FileManager) DeleteFile(ctx context.Context, auth types.BaseGuestAuthentication, filePath string) error {
req := types.DeleteFileInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
FilePath: filePath,
}
_, err := methods.DeleteFileInGuest(ctx, m.c, &req)
return err
}
func (m FileManager) InitiateFileTransferFromGuest(ctx context.Context, auth types.BaseGuestAuthentication, guestFilePath string) (*types.FileTransferInformation, error) {
req := types.InitiateFileTransferFromGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
GuestFilePath: guestFilePath,
}
res, err := methods.InitiateFileTransferFromGuest(ctx, m.c, &req)
if err != nil {
return nil, err
}
if strings.HasSuffix(guestFilePath, "/") {
// Propagate the trailing '/' for directory download support, see soap.directoryReader
u, err := url.Parse(res.Returnval.Url)
if err == nil {
u.Path += "/"
res.Returnval.Url = u.String()
}
}
return &res.Returnval, nil
}
func (m FileManager) InitiateFileTransferToGuest(ctx context.Context, auth types.BaseGuestAuthentication, guestFilePath string, fileAttributes types.BaseGuestFileAttributes, fileSize int64, overwrite bool) (string, error) {
req := types.InitiateFileTransferToGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
GuestFilePath: guestFilePath,
FileAttributes: fileAttributes,
FileSize: fileSize,
Overwrite: overwrite,
}
res, err := methods.InitiateFileTransferToGuest(ctx, m.c, &req)
if err != nil {
return "", err
}
return res.Returnval, nil
}
func (m FileManager) ListFiles(ctx context.Context, auth types.BaseGuestAuthentication, filePath string, index int32, maxResults int32, matchPattern string) (*types.GuestListFileInfo, error) {
req := types.ListFilesInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
FilePath: filePath,
Index: index,
MaxResults: maxResults,
MatchPattern: matchPattern,
}
res, err := methods.ListFilesInGuest(ctx, m.c, &req)
if err != nil {
return nil, err
}
return &res.Returnval, nil
}
func (m FileManager) MakeDirectory(ctx context.Context, auth types.BaseGuestAuthentication, directoryPath string, createParentDirectories bool) error {
req := types.MakeDirectoryInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
DirectoryPath: directoryPath,
CreateParentDirectories: createParentDirectories,
}
_, err := methods.MakeDirectoryInGuest(ctx, m.c, &req)
return err
}
func (m FileManager) MoveDirectory(ctx context.Context, auth types.BaseGuestAuthentication, srcDirectoryPath string, dstDirectoryPath string) error {
req := types.MoveDirectoryInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
SrcDirectoryPath: srcDirectoryPath,
DstDirectoryPath: dstDirectoryPath,
}
_, err := methods.MoveDirectoryInGuest(ctx, m.c, &req)
return err
}
func (m FileManager) MoveFile(ctx context.Context, auth types.BaseGuestAuthentication, srcFilePath string, dstFilePath string, overwrite bool) error {
req := types.MoveFileInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
SrcFilePath: srcFilePath,
DstFilePath: dstFilePath,
Overwrite: overwrite,
}
_, err := methods.MoveFileInGuest(ctx, m.c, &req)
return err
}

View File

@@ -0,0 +1,73 @@
/*
Copyright (c) 2015 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 guest
import (
"context"
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
)
type OperationsManager struct {
c *vim25.Client
vm types.ManagedObjectReference
}
func NewOperationsManager(c *vim25.Client, vm types.ManagedObjectReference) *OperationsManager {
return &OperationsManager{c, vm}
}
func (m OperationsManager) retrieveOne(ctx context.Context, p string, dst *mo.GuestOperationsManager) error {
pc := property.DefaultCollector(m.c)
return pc.RetrieveOne(ctx, *m.c.ServiceContent.GuestOperationsManager, []string{p}, dst)
}
func (m OperationsManager) AuthManager(ctx context.Context) (*AuthManager, error) {
var g mo.GuestOperationsManager
err := m.retrieveOne(ctx, "authManager", &g)
if err != nil {
return nil, err
}
return &AuthManager{*g.AuthManager, m.vm, m.c}, nil
}
func (m OperationsManager) FileManager(ctx context.Context) (*FileManager, error) {
var g mo.GuestOperationsManager
err := m.retrieveOne(ctx, "fileManager", &g)
if err != nil {
return nil, err
}
return &FileManager{*g.FileManager, m.vm, m.c}, nil
}
func (m OperationsManager) ProcessManager(ctx context.Context) (*ProcessManager, error) {
var g mo.GuestOperationsManager
err := m.retrieveOne(ctx, "processManager", &g)
if err != nil {
return nil, err
}
return &ProcessManager{*g.ProcessManager, m.vm, m.c}, nil
}

View File

@@ -0,0 +1,97 @@
/*
Copyright (c) 2015 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 guest
import (
"context"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
)
type ProcessManager struct {
types.ManagedObjectReference
vm types.ManagedObjectReference
c *vim25.Client
}
func (m ProcessManager) Reference() types.ManagedObjectReference {
return m.ManagedObjectReference
}
func (m ProcessManager) ListProcesses(ctx context.Context, auth types.BaseGuestAuthentication, pids []int64) ([]types.GuestProcessInfo, error) {
req := types.ListProcessesInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Pids: pids,
}
res, err := methods.ListProcessesInGuest(ctx, m.c, &req)
if err != nil {
return nil, err
}
return res.Returnval, err
}
func (m ProcessManager) ReadEnvironmentVariable(ctx context.Context, auth types.BaseGuestAuthentication, names []string) ([]string, error) {
req := types.ReadEnvironmentVariableInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Names: names,
}
res, err := methods.ReadEnvironmentVariableInGuest(ctx, m.c, &req)
if err != nil {
return nil, err
}
return res.Returnval, err
}
func (m ProcessManager) StartProgram(ctx context.Context, auth types.BaseGuestAuthentication, spec types.BaseGuestProgramSpec) (int64, error) {
req := types.StartProgramInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Spec: spec,
}
res, err := methods.StartProgramInGuest(ctx, m.c, &req)
if err != nil {
return 0, err
}
return res.Returnval, err
}
func (m ProcessManager) TerminateProcess(ctx context.Context, auth types.BaseGuestAuthentication, pid int64) error {
req := types.TerminateProcessInGuest{
This: m.Reference(),
Vm: m.vm,
Auth: auth,
Pid: pid,
}
_, err := methods.TerminateProcessInGuest(ctx, m.c, &req)
return err
}