github.com/vmware/govmomi@v0.51.0/vim25/methods/service_content.go (about)

     1  // © Broadcom. All Rights Reserved.
     2  // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package methods
     6  
     7  import (
     8  	"context"
     9  	"time"
    10  
    11  	"github.com/vmware/govmomi/vim25/soap"
    12  	"github.com/vmware/govmomi/vim25/types"
    13  )
    14  
    15  // copy of vim25.ServiceInstance to avoid import cycle
    16  var serviceInstance = types.ManagedObjectReference{
    17  	Type:  "ServiceInstance",
    18  	Value: "ServiceInstance",
    19  }
    20  
    21  func GetServiceContent(ctx context.Context, r soap.RoundTripper) (types.ServiceContent, error) {
    22  	req := types.RetrieveServiceContent{
    23  		This: serviceInstance,
    24  	}
    25  
    26  	res, err := RetrieveServiceContent(ctx, r, &req)
    27  	if err != nil {
    28  		return types.ServiceContent{}, err
    29  	}
    30  
    31  	return res.Returnval, nil
    32  }
    33  
    34  func GetCurrentTime(ctx context.Context, r soap.RoundTripper) (*time.Time, error) {
    35  	req := types.CurrentTime{
    36  		This: serviceInstance,
    37  	}
    38  
    39  	res, err := CurrentTime(ctx, r, &req)
    40  	if err != nil {
    41  		return nil, err
    42  	}
    43  
    44  	return &res.Returnval, nil
    45  }