Skip to content

Commit

Permalink
Adjust types
Browse files Browse the repository at this point in the history
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
  • Loading branch information
Didainius committed Dec 4, 2024
1 parent d35c975 commit 08e00d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 58 deletions.
22 changes: 0 additions & 22 deletions govcd/tm_provider_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,6 @@ import (
"github.com/vmware/go-vcloud-director/v3/types/v56"
)

// This is a template of how a "standard" outer entity implementation can be done when using generic
// functions. It might not cover all scenarios, but is a skeleton for quicker bootstraping of a new
// entity.
//
// "Search and replace the following entries"
//
// TmProviderGateway - outer type (e.g. IpSpace2)
// This should be a non existing new type to create in 'govcd' package
//
// types.TmProviderGateway - inner type (e.g. types.IpSpace)
// This should be an already existing inner type in `types` package
//
// TM Provider Gateway - constant name for entity label (the lower case prefix 'label' prefix is hardcoded)
// The 'label' prefix is hardcoded in the example so that we have autocompletion working for all labelXXXX. (e.g. IpSpace2)
//
// TM Provider Gateway - text for entity label (e.g. Ip Space 2)
// This will be the entity label (used for logging purposes in generic functions)
//
// types.OpenApiPathVcf + types.OpenApiEndpointTmProviderGateways (e.g. types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointIpSpaces)
// An OpenAPI endpoint that is defined in `endpointMinApiVersions` map and in `constants.go`
// NOTE. While this example REPLACES ALL ENDPOINTS to be THE SAME, in reality they can be DIFFERENT

const labelTmProviderGateway = "TM Provider Gateway"

type TmProviderGateway struct {
Expand Down
27 changes: 3 additions & 24 deletions govcd/tm_provider_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func (vcd *TestVCD) Test_TmProviderGateway(check *C) {
Name: check.TestName(),
Description: check.TestName(),
BackingType: "NSX_TIER0",
BackingRef: &types.OpenApiReference{ID: t0ByNameInRegion.TmTier0Gateway.ID},
RegionRef: &types.OpenApiReference{ID: region.Region.ID},
IPSpaceRefs: []*types.OpenApiReference{{
BackingRef: types.OpenApiReference{ID: t0ByNameInRegion.TmTier0Gateway.ID},
RegionRef: types.OpenApiReference{ID: region.Region.ID},
IPSpaceRefs: []types.OpenApiReference{{
ID: ipSpace.TmIpSpace.ID,
}},
}
Expand All @@ -60,24 +60,3 @@ func (vcd *TestVCD) Test_TmProviderGateway(check *C) {
panic(err)

}

// {
// "name": "test-provider-gw",
// "description": "",
// "orgRef": null,
// "backingRef": {
// "id": "37273049-ecda-4974-baf6-5c107f30a969",
// "name": "vcfcons-mgt-vc03-Tier0"
// },
// "backingType": "NSX_TIER0",
// "regionRef": {
// "id": "urn:vcloud:region:7544b246-84c6-40ad-8c3b-beed9fe145cd",
// "name": "Terraform demo Region"
// },
// "ipSpaceRefs": [
// {
// "id": "urn:vcloud:ipSpace:feb3d26d-08e7-4e3f-90cc-f54f13a45697",
// "name": "demo-ip-space"
// }
// ]
// }
4 changes: 0 additions & 4 deletions govcd/tm_tier0_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import (
"github.com/vmware/go-vcloud-director/v3/types/v56"
)

// Sample query
// https://vcfa.10.162.145.191.vcfd.broadcom.net/tm/cloudapi/1.0.0/nsxTResources/importableTier0Routers
// ?page=1&pageSize=128&filterEncoded=true&filter=(alreadyImported==false;_context==urn:vcloud:region:7544b246-84c6-40ad-8c3b-beed9fe145cd)&links=true

const labelTmTier0Gateway = "TM Tier0 Gateway"

type TmTier0Gateway struct {
Expand Down
16 changes: 8 additions & 8 deletions types/v56/tm.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ type TmTier0Gateway struct {
}

type TmProviderGateway struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
OrgRef *OpenApiReference `json:"orgRef,omitempty"`
BackingRef *OpenApiReference `json:"backingRef,omitempty"`
BackingType string `json:"backingType,omitempty"`
RegionRef *OpenApiReference `json:"regionRef,omitempty"`
IPSpaceRefs []*OpenApiReference `json:"ipSpaceRefs,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
OrgRef *OpenApiReference `json:"orgRef,omitempty"`
BackingRef OpenApiReference `json:"backingRef,omitempty"`
BackingType string `json:"backingType,omitempty"`
RegionRef OpenApiReference `json:"regionRef,omitempty"`
IPSpaceRefs []OpenApiReference `json:"ipSpaceRefs,omitempty"`
}

0 comments on commit 08e00d0

Please sign in to comment.