1/*
2Copyright (c) 2015 VMware, Inc. All Rights Reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package object
18
19import (
20	"context"
21
22	"github.com/vmware/govmomi/vim25"
23	"github.com/vmware/govmomi/vim25/methods"
24	"github.com/vmware/govmomi/vim25/types"
25)
26
27type HistoryCollector struct {
28	Common
29}
30
31func NewHistoryCollector(c *vim25.Client, ref types.ManagedObjectReference) *HistoryCollector {
32	return &HistoryCollector{
33		Common: NewCommon(c, ref),
34	}
35}
36
37func (h HistoryCollector) Destroy(ctx context.Context) error {
38	req := types.DestroyCollector{
39		This: h.Reference(),
40	}
41
42	_, err := methods.DestroyCollector(ctx, h.c, &req)
43	return err
44}
45
46func (h HistoryCollector) Reset(ctx context.Context) error {
47	req := types.ResetCollector{
48		This: h.Reference(),
49	}
50
51	_, err := methods.ResetCollector(ctx, h.c, &req)
52	return err
53}
54
55func (h HistoryCollector) Rewind(ctx context.Context) error {
56	req := types.RewindCollector{
57		This: h.Reference(),
58	}
59
60	_, err := methods.RewindCollector(ctx, h.c, &req)
61	return err
62}
63
64func (h HistoryCollector) SetPageSize(ctx context.Context, maxCount int32) error {
65	req := types.SetCollectorPageSize{
66		This:     h.Reference(),
67		MaxCount: maxCount,
68	}
69
70	_, err := methods.SetCollectorPageSize(ctx, h.c, &req)
71	return err
72}
73