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:
78
vendor/github.com/vmware/govmomi/govc/fields/add.go
generated
vendored
Normal file
78
vendor/github.com/vmware/govmomi/govc/fields/add.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
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 fields
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
type add struct {
|
||||
*flags.ClientFlag
|
||||
}
|
||||
|
||||
func init() {
|
||||
cli.Register("fields.add", &add{})
|
||||
}
|
||||
|
||||
func (cmd *add) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
|
||||
cmd.ClientFlag.Register(ctx, f)
|
||||
}
|
||||
|
||||
func (cmd *add) Process(ctx context.Context) error {
|
||||
if err := cmd.ClientFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *add) Usage() string {
|
||||
return "NAME"
|
||||
}
|
||||
|
||||
func (cmd *add) Run(ctx context.Context, f *flag.FlagSet) error {
|
||||
if f.NArg() != 1 {
|
||||
return flag.ErrHelp
|
||||
}
|
||||
|
||||
c, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m, err := object.GetCustomFieldsManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
name := f.Arg(0)
|
||||
|
||||
def, err := m.Add(ctx, name, "", nil, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("%d\n", def.Key)
|
||||
|
||||
return nil
|
||||
}
|
74
vendor/github.com/vmware/govmomi/govc/fields/ls.go
generated
vendored
Normal file
74
vendor/github.com/vmware/govmomi/govc/fields/ls.go
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
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 fields
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
type ls struct {
|
||||
*flags.ClientFlag
|
||||
}
|
||||
|
||||
func init() {
|
||||
cli.Register("fields.ls", &ls{})
|
||||
}
|
||||
|
||||
func (cmd *ls) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
|
||||
cmd.ClientFlag.Register(ctx, f)
|
||||
}
|
||||
|
||||
func (cmd *ls) Process(ctx context.Context) error {
|
||||
if err := cmd.ClientFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *ls) Run(ctx context.Context, f *flag.FlagSet) error {
|
||||
c, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m, err := object.GetCustomFieldsManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
field, err := m.Field(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tw := tabwriter.NewWriter(os.Stdout, 2, 0, 2, ' ', 0)
|
||||
|
||||
for _, def := range field {
|
||||
fmt.Fprintf(tw, "%d\t%s\n", def.Key, def.Name)
|
||||
}
|
||||
|
||||
return tw.Flush()
|
||||
}
|
75
vendor/github.com/vmware/govmomi/govc/fields/rename.go
generated
vendored
Normal file
75
vendor/github.com/vmware/govmomi/govc/fields/rename.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
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 fields
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
type rename struct {
|
||||
*flags.ClientFlag
|
||||
}
|
||||
|
||||
func init() {
|
||||
cli.Register("fields.rename", &rename{})
|
||||
}
|
||||
|
||||
func (cmd *rename) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
|
||||
cmd.ClientFlag.Register(ctx, f)
|
||||
}
|
||||
|
||||
func (cmd *rename) Process(ctx context.Context) error {
|
||||
if err := cmd.ClientFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *rename) Usage() string {
|
||||
return "KEY NAME"
|
||||
}
|
||||
|
||||
func (cmd *rename) Run(ctx context.Context, f *flag.FlagSet) error {
|
||||
if f.NArg() != 2 {
|
||||
return flag.ErrHelp
|
||||
}
|
||||
|
||||
c, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m, err := object.GetCustomFieldsManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
key, err := m.FindKey(ctx, f.Arg(0))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
name := f.Arg(1)
|
||||
|
||||
return m.Rename(ctx, key, name)
|
||||
}
|
75
vendor/github.com/vmware/govmomi/govc/fields/rm.go
generated
vendored
Normal file
75
vendor/github.com/vmware/govmomi/govc/fields/rm.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
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 fields
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
type rm struct {
|
||||
*flags.ClientFlag
|
||||
}
|
||||
|
||||
func init() {
|
||||
cli.Register("fields.rm", &rm{})
|
||||
}
|
||||
|
||||
func (cmd *rm) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
|
||||
cmd.ClientFlag.Register(ctx, f)
|
||||
}
|
||||
|
||||
func (cmd *rm) Process(ctx context.Context) error {
|
||||
if err := cmd.ClientFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *rm) Usage() string {
|
||||
return "KEY..."
|
||||
}
|
||||
|
||||
func (cmd *rm) Run(ctx context.Context, f *flag.FlagSet) error {
|
||||
c, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m, err := object.GetCustomFieldsManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, name := range f.Args() {
|
||||
key, err := m.FindKey(ctx, name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := m.Remove(ctx, key); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
89
vendor/github.com/vmware/govmomi/govc/fields/set.go
generated
vendored
Normal file
89
vendor/github.com/vmware/govmomi/govc/fields/set.go
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
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 fields
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"github.com/vmware/govmomi/govc/cli"
|
||||
"github.com/vmware/govmomi/govc/flags"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
type set struct {
|
||||
*flags.DatacenterFlag
|
||||
}
|
||||
|
||||
func init() {
|
||||
cli.Register("fields.set", &set{})
|
||||
}
|
||||
|
||||
func (cmd *set) Register(ctx context.Context, f *flag.FlagSet) {
|
||||
cmd.DatacenterFlag, ctx = flags.NewDatacenterFlag(ctx)
|
||||
cmd.DatacenterFlag.Register(ctx, f)
|
||||
}
|
||||
|
||||
func (cmd *set) Process(ctx context.Context) error {
|
||||
if err := cmd.DatacenterFlag.Process(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *set) Usage() string {
|
||||
return "KEY VALUE PATH..."
|
||||
}
|
||||
|
||||
func (cmd *set) Run(ctx context.Context, f *flag.FlagSet) error {
|
||||
if f.NArg() < 3 {
|
||||
return flag.ErrHelp
|
||||
}
|
||||
|
||||
c, err := cmd.Client()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m, err := object.GetCustomFieldsManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
args := f.Args()
|
||||
|
||||
key, err := m.FindKey(ctx, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val := args[1]
|
||||
|
||||
objs, err := cmd.ManagedObjects(ctx, args[2:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, ref := range objs {
|
||||
err := m.Set(ctx, ref, key, val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user