github.com/vmware/govmomi@v0.51.0/vapi/internal/internal.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 internal 6 7 import ( 8 "github.com/vmware/govmomi/vim25/mo" 9 "github.com/vmware/govmomi/vim25/types" 10 ) 11 12 // VAPI REST Paths 13 const ( 14 SessionPath = "/com/vmware/cis/session" 15 CategoryPath = "/com/vmware/cis/tagging/category" 16 TagPath = "/com/vmware/cis/tagging/tag" 17 AssociationPath = "/com/vmware/cis/tagging/tag-association" 18 LibraryPath = "/com/vmware/content/library" 19 LibraryItemFileData = "/com/vmware/cis/data" 20 LibraryItemPath = "/com/vmware/content/library/item" 21 LibraryItemFilePath = "/com/vmware/content/library/item/file" 22 LibraryItemStoragePath = "/com/vmware/content/library/item/storage" 23 LibraryItemUpdateSession = "/com/vmware/content/library/item/update-session" 24 LibraryItemUpdateSessionFile = "/com/vmware/content/library/item/updatesession/file" 25 LibraryItemDownloadSession = "/com/vmware/content/library/item/download-session" 26 LibraryItemDownloadSessionFile = "/com/vmware/content/library/item/downloadsession/file" 27 LocalLibraryPath = "/com/vmware/content/local-library" 28 SubscribedLibraryPath = "/com/vmware/content/subscribed-library" 29 SecurityPoliciesPath = "/api/content/security-policies" 30 SubscribedLibraryItem = "/com/vmware/content/library/subscribed-item" 31 Subscriptions = "/com/vmware/content/library/subscriptions" 32 TrustedCertificatesPath = "/api/content/trusted-certificates" 33 VCenterOVFLibraryItem = "/com/vmware/vcenter/ovf/library-item" 34 VCenterVMTXLibraryItem = "/vcenter/vm-template/library-items" 35 SessionCookieName = "vmware-api-session-id" 36 UseHeaderAuthn = "vmware-use-header-authn" 37 DebugEcho = "/vc-sim/debug/echo" 38 ) 39 40 // AssociatedObject is the same structure as types.ManagedObjectReference, 41 // just with a different field name (ID instead of Value). 42 // In the API we use mo.Reference, this type is only used for wire transfer. 43 type AssociatedObject struct { 44 Type string `json:"type"` 45 Value string `json:"id"` 46 } 47 48 // Reference implements mo.Reference 49 func (o AssociatedObject) Reference() types.ManagedObjectReference { 50 return types.ManagedObjectReference{ 51 Type: o.Type, 52 Value: o.Value, 53 } 54 } 55 56 // Association for tag-association requests. 57 type Association struct { 58 ObjectID *AssociatedObject `json:"object_id,omitempty"` 59 } 60 61 // NewAssociation returns an Association, converting ref to an AssociatedObject. 62 func NewAssociation(ref mo.Reference) Association { 63 return Association{ 64 ObjectID: &AssociatedObject{ 65 Type: ref.Reference().Type, 66 Value: ref.Reference().Value, 67 }, 68 } 69 } 70 71 type SubscriptionDestination struct { 72 ID string `json:"subscription"` 73 } 74 75 type SubscriptionDestinationSpec struct { 76 Subscriptions []SubscriptionDestination `json:"subscriptions,omitempty"` 77 } 78 79 type SubscriptionItemDestinationSpec struct { 80 Force bool `json:"force_sync_content"` 81 Subscriptions []SubscriptionDestination `json:"subscriptions,omitempty"` 82 }