2
Copyright (c) 2015 VMware, Inc. All Rights Reserved.
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
8
http://www.apache.org/licenses/LICENSE-2.0
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
20
"github.com/vmware/govmomi/vim25"
21
"github.com/vmware/govmomi/vim25/methods"
22
"github.com/vmware/govmomi/vim25/types"
23
"golang.org/x/net/context"
26
type CustomizationSpecManager struct {
30
func NewCustomizationSpecManager(c *vim25.Client) *CustomizationSpecManager {
31
cs := CustomizationSpecManager{
32
Common: NewCommon(c, *c.ServiceContent.CustomizationSpecManager),
38
func (cs CustomizationSpecManager) DoesCustomizationSpecExist(ctx context.Context, name string) (bool, error) {
39
req := types.DoesCustomizationSpecExist{
44
res, err := methods.DoesCustomizationSpecExist(ctx, cs.c, &req)
50
return res.Returnval, nil
53
func (cs CustomizationSpecManager) GetCustomizationSpec(ctx context.Context, name string) (*types.CustomizationSpecItem, error) {
54
req := types.GetCustomizationSpec{
59
res, err := methods.GetCustomizationSpec(ctx, cs.c, &req)
65
return &res.Returnval, nil
68
func (cs CustomizationSpecManager) CreateCustomizationSpec(ctx context.Context, item types.CustomizationSpecItem) error {
69
req := types.CreateCustomizationSpec{
74
_, err := methods.CreateCustomizationSpec(ctx, cs.c, &req)
82
func (cs CustomizationSpecManager) OverwriteCustomizationSpec(ctx context.Context, item types.CustomizationSpecItem) error {
83
req := types.OverwriteCustomizationSpec{
88
_, err := methods.OverwriteCustomizationSpec(ctx, cs.c, &req)
96
func (cs CustomizationSpecManager) DeleteCustomizationSpec(ctx context.Context, name string) error {
97
req := types.DeleteCustomizationSpec{
102
_, err := methods.DeleteCustomizationSpec(ctx, cs.c, &req)
110
func (cs CustomizationSpecManager) DuplicateCustomizationSpec(ctx context.Context, name string, newName string) error {
111
req := types.DuplicateCustomizationSpec{
112
This: cs.Reference(),
117
_, err := methods.DuplicateCustomizationSpec(ctx, cs.c, &req)
125
func (cs CustomizationSpecManager) RenameCustomizationSpec(ctx context.Context, name string, newName string) error {
126
req := types.RenameCustomizationSpec{
127
This: cs.Reference(),
132
_, err := methods.RenameCustomizationSpec(ctx, cs.c, &req)
140
func (cs CustomizationSpecManager) CustomizationSpecItemToXml(ctx context.Context, item types.CustomizationSpecItem) (string, error) {
141
req := types.CustomizationSpecItemToXml{
142
This: cs.Reference(),
146
res, err := methods.CustomizationSpecItemToXml(ctx, cs.c, &req)
151
return res.Returnval, nil
154
func (cs CustomizationSpecManager) XmlToCustomizationSpecItem(ctx context.Context, xml string) (*types.CustomizationSpecItem, error) {
155
req := types.XmlToCustomizationSpecItem{
156
This: cs.Reference(),
160
res, err := methods.XmlToCustomizationSpecItem(ctx, cs.c, &req)
164
return &res.Returnval, nil