-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1187 from vmware/fix-vm-tags
Several fixes for vm tags resource
- Loading branch information
Showing
3 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//nolint:revive | ||
package segments | ||
|
||
// The following file has been autogenerated. Please avoid any changes! | ||
import ( | ||
"errors" | ||
|
||
vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" | ||
client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments" | ||
model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" | ||
client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/segments" | ||
|
||
utl "github.com/vmware/terraform-provider-nsxt/api/utl" | ||
) | ||
|
||
type SegmentPortClientContext utl.ClientContext | ||
|
||
func NewPortsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentPortClientContext { | ||
var client interface{} | ||
|
||
switch sessionContext.ClientType { | ||
|
||
case utl.Local: | ||
client = client0.NewPortsClient(connector) | ||
|
||
case utl.Multitenancy: | ||
client = client1.NewPortsClient(connector) | ||
|
||
default: | ||
return nil | ||
} | ||
return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} | ||
} | ||
|
||
func (c SegmentPortClientContext) List(tier1IdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentPortListResult, error) { | ||
var err error | ||
var obj model0.SegmentPortListResult | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.PortsClient) | ||
obj, err = client.List(tier1IdParam, segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client1.PortsClient) | ||
obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return obj, err | ||
} | ||
|
||
func (c SegmentPortClientContext) Update(tier1IdParam string, segmentIdParam string, portIdParam string, segmentPortParam model0.SegmentPort) (model0.SegmentPort, error) { | ||
var err error | ||
var obj model0.SegmentPort | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.PortsClient) | ||
obj, err = client.Update(tier1IdParam, segmentIdParam, portIdParam, segmentPortParam) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client1.PortsClient) | ||
obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam, portIdParam, segmentPortParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return obj, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters