go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/_motor/providers/vcd/platform.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package vcd
     5  
     6  import (
     7  	"fmt"
     8  	"strconv"
     9  
    10  	"go.mondoo.com/cnquery/motor/platform"
    11  )
    12  
    13  func (p *Provider) PlatformInfo() (*platform.Platform, error) {
    14  	vcdVersion, err := p.client.Client.GetVcdFullVersion()
    15  	if err != nil {
    16  		return nil, err
    17  	}
    18  
    19  	digits := vcdVersion.Version.Segments()
    20  
    21  	return &platform.Platform{
    22  		Name:    "vcd",
    23  		Title:   "VMware Cloud Director " + p.host,
    24  		Version: fmt.Sprintf("%d.%d.%d", digits[0], digits[1], digits[2]),
    25  		Build:   strconv.Itoa(digits[3]),
    26  		Runtime: p.Runtime(),
    27  		Kind:    p.Kind(),
    28  		Labels: map[string]string{
    29  			"vcd.vmware.com/api-version": p.client.Client.APIVersion,
    30  		},
    31  	}, nil
    32  }
    33  
    34  func (p *Provider) Identifier() (string, error) {
    35  	return "//platformid.api.mondoo.app/runtime/vcd/host/" + p.host, nil
    36  }