diff --git a/api/api_list.yaml b/api/api_list.yaml index 1f21d5ad1..80cc82ba8 100644 --- a/api/api_list.yaml +++ b/api/api_list.yaml @@ -452,6 +452,9 @@ - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model type: Multitenancy + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/vpcs + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: VPC model_name: SecurityPolicy obj_name: SecurityPolicy client_name: SecurityPoliciesClient @@ -986,7 +989,6 @@ - New - Get - Delete - - List - Patch - Update - List diff --git a/api/api_templates.yaml b/api/api_templates.yaml index e5cac2249..a9e04d54b 100644 --- a/api/api_templates.yaml +++ b/api/api_templates.yaml @@ -17,7 +17,7 @@ New: default: return nil } - return &${model_name}ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &${model_name}ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } Get: Convert: |2 diff --git a/api/infra.go b/api/infra.go index 1adbdf962..a5b8f3e19 100644 --- a/api/infra.go +++ b/api/infra.go @@ -29,7 +29,7 @@ func NewInfraClient(sessionContext utl.SessionContext, connector vapiProtocolCli default: return nil } - return &InfraClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &InfraClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c InfraClientContext) Get(basePathParam *string, filterParam *string, typeFilterParam *string) (model0.Infra, error) { diff --git a/api/infra/context_profiles/attribute.go b/api/infra/context_profiles/attribute.go index 48e40f27c..1112ba0af 100644 --- a/api/infra/context_profiles/attribute.go +++ b/api/infra/context_profiles/attribute.go @@ -34,7 +34,7 @@ func NewAttributesClient(sessionContext utl.SessionContext, connector vapiProtoc default: return nil } - return &AttributeClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &AttributeClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c AttributeClientContext) List(attributeKeyParam *string, attributeSourceParam *string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyContextProfileListResult, error) { diff --git a/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go b/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go index 3f1876f1e..f5072710b 100644 --- a/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go +++ b/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go @@ -34,7 +34,7 @@ func NewDefaultClient(sessionContext utl.SessionContext, connector vapiProtocolC default: return nil } - return &PolicyCustomAttributesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyCustomAttributesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyCustomAttributesClientContext) Create(policyCustomAttributesParam model0.PolicyCustomAttributes, actionParam string) error { diff --git a/api/infra/dhcp_relay_config.go b/api/infra/dhcp_relay_config.go index a8c70cc6b..b2210cf56 100644 --- a/api/infra/dhcp_relay_config.go +++ b/api/infra/dhcp_relay_config.go @@ -34,7 +34,7 @@ func NewDhcpRelayConfigsClient(sessionContext utl.SessionContext, connector vapi default: return nil } - return &DhcpRelayConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &DhcpRelayConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c DhcpRelayConfigClientContext) Get(dhcpRelayConfigIdParam string) (model0.DhcpRelayConfig, error) { diff --git a/api/infra/dhcp_server_config.go b/api/infra/dhcp_server_config.go index 76f573bc5..34107d74a 100644 --- a/api/infra/dhcp_server_config.go +++ b/api/infra/dhcp_server_config.go @@ -34,7 +34,7 @@ func NewDhcpServerConfigsClient(sessionContext utl.SessionContext, connector vap default: return nil } - return &DhcpServerConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &DhcpServerConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c DhcpServerConfigClientContext) Get(dhcpServerConfigIdParam string) (model0.DhcpServerConfig, error) { diff --git a/api/infra/domains/gateway_policy.go b/api/infra/domains/gateway_policy.go index 14c23b068..5bced1e1a 100644 --- a/api/infra/domains/gateway_policy.go +++ b/api/infra/domains/gateway_policy.go @@ -34,7 +34,7 @@ func NewGatewayPoliciesClient(sessionContext utl.SessionContext, connector vapiP default: return nil } - return &GatewayPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &GatewayPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c GatewayPolicyClientContext) Get(domainIdParam string, gatewayPolicyIdParam string) (model0.GatewayPolicy, error) { diff --git a/api/infra/domains/group.go b/api/infra/domains/group.go index 980707cd3..6fad70aa3 100644 --- a/api/infra/domains/group.go +++ b/api/infra/domains/group.go @@ -34,7 +34,7 @@ func NewGroupsClient(sessionContext utl.SessionContext, connector vapiProtocolCl default: return nil } - return &GroupClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &GroupClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c GroupClientContext) Get(domainIdParam string, groupIdParam string) (model0.Group, error) { diff --git a/api/infra/domains/groups/policy_firewall_flood_protection_profile_binding_map.go b/api/infra/domains/groups/policy_firewall_flood_protection_profile_binding_map.go index 375763991..3b9f11e30 100644 --- a/api/infra/domains/groups/policy_firewall_flood_protection_profile_binding_map.go +++ b/api/infra/domains/groups/policy_firewall_flood_protection_profile_binding_map.go @@ -34,7 +34,7 @@ func NewFirewallFloodProtectionProfileBindingMapsClient(sessionContext utl.Sessi default: return nil } - return &PolicyFirewallFloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyFirewallFloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) Get(domainIdParam string, groupIdParam string, firewallFloodProtectionProfileBindingMapIdParam string) (model0.PolicyFirewallFloodProtectionProfileBindingMap, error) { diff --git a/api/infra/domains/ids_security_policy.go b/api/infra/domains/ids_security_policy.go index 170d30d9c..9dfa77b1a 100644 --- a/api/infra/domains/ids_security_policy.go +++ b/api/infra/domains/ids_security_policy.go @@ -29,7 +29,7 @@ func NewIntrusionServicePoliciesClient(sessionContext utl.SessionContext, connec default: return nil } - return &IdsSecurityPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IdsSecurityPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IdsSecurityPolicyClientContext) Get(domainIdParam string, policyIdParam string) (model0.IdsSecurityPolicy, error) { diff --git a/api/infra/domains/security_policies/rule.go b/api/infra/domains/security_policies/rule.go index 214820ab1..0f21716ed 100644 --- a/api/infra/domains/security_policies/rule.go +++ b/api/infra/domains/security_policies/rule.go @@ -34,7 +34,7 @@ func NewRulesClient(sessionContext utl.SessionContext, connector vapiProtocolCli default: return nil } - return &RuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &RuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c RuleClientContext) Get(domainIdParam string, securityPolicyIdParam string, ruleIdParam string) (model0.Rule, error) { diff --git a/api/infra/domains/security_policy.go b/api/infra/domains/security_policy.go index 32cbaf7cd..9409f4ead 100644 --- a/api/infra/domains/security_policy.go +++ b/api/infra/domains/security_policy.go @@ -11,6 +11,7 @@ import ( client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains" + client3 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/vpcs" utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) @@ -31,10 +32,13 @@ func NewSecurityPoliciesClient(sessionContext utl.SessionContext, connector vapi case utl.Multitenancy: client = client2.NewSecurityPoliciesClient(connector) + case utl.VPC: + client = client3.NewSecurityPoliciesClient(connector) + default: return nil } - return &SecurityPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SecurityPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SecurityPolicyClientContext) Get(domainIdParam string, securityPolicyIdParam string) (model0.SecurityPolicy, error) { @@ -67,6 +71,13 @@ func (c SecurityPolicyClientContext) Get(domainIdParam string, securityPolicyIdP return obj, err } + case utl.VPC: + client := c.Client.(client3.SecurityPoliciesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, c.VPCID, securityPolicyIdParam) + if err != nil { + return obj, err + } + default: return obj, errors.New("invalid infrastructure for model") } @@ -94,6 +105,10 @@ func (c SecurityPolicyClientContext) Patch(domainIdParam string, securityPolicyI client := c.Client.(client2.SecurityPoliciesClient) err = client.Patch(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam, securityPolicyParam) + case utl.VPC: + client := c.Client.(client3.SecurityPoliciesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, c.VPCID, securityPolicyIdParam, securityPolicyParam) + default: err = errors.New("invalid infrastructure for model") } @@ -130,6 +145,10 @@ func (c SecurityPolicyClientContext) Update(domainIdParam string, securityPolicy client := c.Client.(client2.SecurityPoliciesClient) obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam, securityPolicyParam) + case utl.VPC: + client := c.Client.(client3.SecurityPoliciesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, c.VPCID, securityPolicyIdParam, securityPolicyParam) + default: err = errors.New("invalid infrastructure for model") } @@ -153,6 +172,10 @@ func (c SecurityPolicyClientContext) Delete(domainIdParam string, securityPolicy client := c.Client.(client2.SecurityPoliciesClient) err = client.Delete(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam) + case utl.VPC: + client := c.Client.(client3.SecurityPoliciesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, c.VPCID, securityPolicyIdParam) + default: err = errors.New("invalid infrastructure for model") } @@ -185,6 +208,10 @@ func (c SecurityPolicyClientContext) List(domainIdParam string, cursorParam *str client := c.Client.(client2.SecurityPoliciesClient) obj, err = client.List(utl.DefaultOrgID, c.ProjectID, domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + case utl.VPC: + client := c.Client.(client3.SecurityPoliciesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, c.VPCID, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + default: err = errors.New("invalid infrastructure for model") } diff --git a/api/infra/flood_protection_profiles_client.go b/api/infra/flood_protection_profiles_client.go index bc3cf8e6e..6e1bbe33d 100644 --- a/api/infra/flood_protection_profiles_client.go +++ b/api/infra/flood_protection_profiles_client.go @@ -35,7 +35,7 @@ func NewFloodProtectionProfilesClient(sessionContext utl.SessionContext, connect default: return nil } - return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StructValueClientContext) Get(floodProtectionProfileIdParam string) (*model0.StructValue, error) { diff --git a/api/infra/gateway_qos_profile.go b/api/infra/gateway_qos_profile.go index 0c3686cfe..e2cb15408 100644 --- a/api/infra/gateway_qos_profile.go +++ b/api/infra/gateway_qos_profile.go @@ -34,7 +34,7 @@ func NewGatewayQosProfilesClient(sessionContext utl.SessionContext, connector va default: return nil } - return &GatewayQosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &GatewayQosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c GatewayQosProfileClientContext) Get(qosProfileIdParam string) (model0.GatewayQosProfile, error) { diff --git a/api/infra/ip_address_block.go b/api/infra/ip_address_block.go index b71657282..d970791fc 100644 --- a/api/infra/ip_address_block.go +++ b/api/infra/ip_address_block.go @@ -29,7 +29,7 @@ func NewIpBlocksClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &IpAddressBlockClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IpAddressBlockClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IpAddressBlockClientContext) Get(ipBlockIdParam string, ignoreIpblockUsageParam *bool) (model0.IpAddressBlock, error) { diff --git a/api/infra/ip_address_pool.go b/api/infra/ip_address_pool.go index 82deae791..a93b26902 100644 --- a/api/infra/ip_address_pool.go +++ b/api/infra/ip_address_pool.go @@ -29,7 +29,7 @@ func NewIpPoolsClient(sessionContext utl.SessionContext, connector vapiProtocolC default: return nil } - return &IpAddressPoolClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IpAddressPoolClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IpAddressPoolClientContext) Get(ipPoolIdParam string) (model0.IpAddressPool, error) { diff --git a/api/infra/ip_discovery_profile.go b/api/infra/ip_discovery_profile.go index 3e0e34403..0de183e7e 100644 --- a/api/infra/ip_discovery_profile.go +++ b/api/infra/ip_discovery_profile.go @@ -34,7 +34,7 @@ func NewIpDiscoveryProfilesClient(sessionContext utl.SessionContext, connector v default: return nil } - return &IPDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IPDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IPDiscoveryProfileClientContext) Get(ipDiscoveryProfileIdParam string) (model0.IPDiscoveryProfile, error) { diff --git a/api/infra/ip_pools/ip_address_allocation.go b/api/infra/ip_pools/ip_address_allocation.go index ff2acf141..0b95e74a2 100644 --- a/api/infra/ip_pools/ip_address_allocation.go +++ b/api/infra/ip_pools/ip_address_allocation.go @@ -29,7 +29,7 @@ func NewIpAllocationsClient(sessionContext utl.SessionContext, connector vapiPro default: return nil } - return &IpAddressAllocationClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IpAddressAllocationClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IpAddressAllocationClientContext) Get(ipPoolIdParam string, ipAllocationIdParam string) (model0.IpAddressAllocation, error) { diff --git a/api/infra/ip_pools/ip_subnets_client.go b/api/infra/ip_pools/ip_subnets_client.go index ee7d1ee0e..b16640678 100644 --- a/api/infra/ip_pools/ip_subnets_client.go +++ b/api/infra/ip_pools/ip_subnets_client.go @@ -30,7 +30,7 @@ func NewIpSubnetsClient(sessionContext utl.SessionContext, connector vapiProtoco default: return nil } - return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StructValueClientContext) Get(ipPoolIdParam string, ipSubnetIdParam string) (*model0.StructValue, error) { diff --git a/api/infra/ipv6_dad_profile.go b/api/infra/ipv6_dad_profile.go index 019411027..877d4596f 100644 --- a/api/infra/ipv6_dad_profile.go +++ b/api/infra/ipv6_dad_profile.go @@ -34,7 +34,7 @@ func NewIpv6DadProfilesClient(sessionContext utl.SessionContext, connector vapiP default: return nil } - return &Ipv6DadProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &Ipv6DadProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c Ipv6DadProfileClientContext) Get(dadProfileIdParam string) (model0.Ipv6DadProfile, error) { diff --git a/api/infra/ipv6_ndra_profile.go b/api/infra/ipv6_ndra_profile.go index 87545a120..d1bb256fb 100644 --- a/api/infra/ipv6_ndra_profile.go +++ b/api/infra/ipv6_ndra_profile.go @@ -34,7 +34,7 @@ func NewIpv6NdraProfilesClient(sessionContext utl.SessionContext, connector vapi default: return nil } - return &Ipv6NdraProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &Ipv6NdraProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c Ipv6NdraProfileClientContext) Get(ndraProfileIdParam string) (model0.Ipv6NdraProfile, error) { diff --git a/api/infra/mac_discovery_profile.go b/api/infra/mac_discovery_profile.go index 4339db3dc..86745178e 100644 --- a/api/infra/mac_discovery_profile.go +++ b/api/infra/mac_discovery_profile.go @@ -34,7 +34,7 @@ func NewMacDiscoveryProfilesClient(sessionContext utl.SessionContext, connector default: return nil } - return &MacDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &MacDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c MacDiscoveryProfileClientContext) Get(macDiscoveryProfileIdParam string) (model0.MacDiscoveryProfile, error) { diff --git a/api/infra/policy_context_profile.go b/api/infra/policy_context_profile.go index 67d8a1a2f..8053d9c70 100644 --- a/api/infra/policy_context_profile.go +++ b/api/infra/policy_context_profile.go @@ -34,7 +34,7 @@ func NewContextProfilesClient(sessionContext utl.SessionContext, connector vapiP default: return nil } - return &PolicyContextProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyContextProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyContextProfileClientContext) Get(contextProfileIdParam string) (model0.PolicyContextProfile, error) { diff --git a/api/infra/policy_dns_forwarder_zone.go b/api/infra/policy_dns_forwarder_zone.go index e83d7afde..b9b89b7fa 100644 --- a/api/infra/policy_dns_forwarder_zone.go +++ b/api/infra/policy_dns_forwarder_zone.go @@ -34,7 +34,7 @@ func NewDnsForwarderZonesClient(sessionContext utl.SessionContext, connector vap default: return nil } - return &PolicyDnsForwarderZoneClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyDnsForwarderZoneClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyDnsForwarderZoneClientContext) Get(dnsForwarderZoneIdParam string) (model0.PolicyDnsForwarderZone, error) { diff --git a/api/infra/qos_profile.go b/api/infra/qos_profile.go index 91876b623..a65326fe4 100644 --- a/api/infra/qos_profile.go +++ b/api/infra/qos_profile.go @@ -34,7 +34,7 @@ func NewQosProfilesClient(sessionContext utl.SessionContext, connector vapiProto default: return nil } - return &QosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &QosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c QosProfileClientContext) Get(qosProfileIdParam string) (model0.QosProfile, error) { diff --git a/api/infra/realized_state/realized_entity.go b/api/infra/realized_state/realized_entity.go index 3e4ccc2c7..4876c006d 100644 --- a/api/infra/realized_state/realized_entity.go +++ b/api/infra/realized_state/realized_entity.go @@ -34,7 +34,7 @@ func NewRealizedEntitiesClient(sessionContext utl.SessionContext, connector vapi default: return nil } - return &RealizedEntityClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &RealizedEntityClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c RealizedEntityClientContext) List(intentPathParam string, sitePathParam *string) (model0.GenericPolicyRealizedResourceListResult, error) { diff --git a/api/infra/realized_state/virtual_machine.go b/api/infra/realized_state/virtual_machine.go index 6a4ef88d0..b82c813ce 100644 --- a/api/infra/realized_state/virtual_machine.go +++ b/api/infra/realized_state/virtual_machine.go @@ -29,7 +29,7 @@ func NewVirtualMachinesClient(sessionContext utl.SessionContext, connector vapiP default: return nil } - return &VirtualMachineClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &VirtualMachineClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c VirtualMachineClientContext) List(cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.VirtualMachineListResult, error) { diff --git a/api/infra/segment.go b/api/infra/segment.go index 4539d3394..73bac5480 100644 --- a/api/infra/segment.go +++ b/api/infra/segment.go @@ -34,7 +34,7 @@ func NewSegmentsClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentClientContext) Get(segmentIdParam string) (model0.Segment, error) { diff --git a/api/infra/segment_security_profile.go b/api/infra/segment_security_profile.go index a453a461a..c3ca760ab 100644 --- a/api/infra/segment_security_profile.go +++ b/api/infra/segment_security_profile.go @@ -34,7 +34,7 @@ func NewSegmentSecurityProfilesClient(sessionContext utl.SessionContext, connect default: return nil } - return &SegmentSecurityProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentSecurityProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentSecurityProfileClientContext) Get(segmentSecurityProfileIdParam string) (model0.SegmentSecurityProfile, error) { diff --git a/api/infra/segments/dhcp_static_binding_config.go b/api/infra/segments/dhcp_static_binding_config.go index 01715eb80..17ee40e85 100644 --- a/api/infra/segments/dhcp_static_binding_config.go +++ b/api/infra/segments/dhcp_static_binding_config.go @@ -35,7 +35,7 @@ func NewDhcpStaticBindingConfigsClient(sessionContext utl.SessionContext, connec default: return nil } - return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StructValueClientContext) Get(segmentIdParam string, bindingIdParam string) (*model0.StructValue, error) { diff --git a/api/infra/segments/segment_configuration_state.go b/api/infra/segments/segment_configuration_state.go index f98c8b2a5..9cabe3bf2 100644 --- a/api/infra/segments/segment_configuration_state.go +++ b/api/infra/segments/segment_configuration_state.go @@ -34,7 +34,7 @@ func NewStateClient(sessionContext utl.SessionContext, connector vapiProtocolCli default: return nil } - return &SegmentConfigurationStateClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentConfigurationStateClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentConfigurationStateClientContext) Get(segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, statsTypeParam *string, transportNodeIdParam *string) (model0.SegmentConfigurationState, error) { diff --git a/api/infra/segments/segment_discovery_profile_binding_map.go b/api/infra/segments/segment_discovery_profile_binding_map.go index 7c56fdd4b..1bd1b8c15 100644 --- a/api/infra/segments/segment_discovery_profile_binding_map.go +++ b/api/infra/segments/segment_discovery_profile_binding_map.go @@ -29,7 +29,7 @@ func NewSegmentDiscoveryProfileBindingMapsClient(sessionContext utl.SessionConte default: return nil } - return &SegmentDiscoveryProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentDiscoveryProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentDiscoveryProfileBindingMapClientContext) Get(infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) (model0.SegmentDiscoveryProfileBindingMap, error) { diff --git a/api/infra/segments/segment_port.go b/api/infra/segments/segment_port.go index d3686282e..b048f1b03 100644 --- a/api/infra/segments/segment_port.go +++ b/api/infra/segments/segment_port.go @@ -29,7 +29,7 @@ func NewPortsClient(sessionContext utl.SessionContext, connector vapiProtocolCli default: return nil } - return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentPortClientContext) Get(segmentIdParam string, portIdParam string) (model0.SegmentPort, error) { diff --git a/api/infra/segments/segment_qos_profile_binding_map.go b/api/infra/segments/segment_qos_profile_binding_map.go index aa8910155..47c3a964d 100644 --- a/api/infra/segments/segment_qos_profile_binding_map.go +++ b/api/infra/segments/segment_qos_profile_binding_map.go @@ -29,7 +29,7 @@ func NewSegmentQosProfileBindingMapsClient(sessionContext utl.SessionContext, co default: return nil } - return &SegmentQosProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentQosProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentQosProfileBindingMapClientContext) Get(segmentIdParam string, segmentQosProfileBindingMapIdParam string) (model0.SegmentQosProfileBindingMap, error) { diff --git a/api/infra/segments/segment_security_profile_binding_map.go b/api/infra/segments/segment_security_profile_binding_map.go index c844cb244..fedb9bd2d 100644 --- a/api/infra/segments/segment_security_profile_binding_map.go +++ b/api/infra/segments/segment_security_profile_binding_map.go @@ -29,7 +29,7 @@ func NewSegmentSecurityProfileBindingMapsClient(sessionContext utl.SessionContex default: return nil } - return &SegmentSecurityProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentSecurityProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentSecurityProfileBindingMapClientContext) Get(segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) (model0.SegmentSecurityProfileBindingMap, error) { diff --git a/api/infra/service.go b/api/infra/service.go index 5ec75a02f..d9479923d 100644 --- a/api/infra/service.go +++ b/api/infra/service.go @@ -34,7 +34,7 @@ func NewServicesClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &ServiceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &ServiceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c ServiceClientContext) Get(serviceIdParam string) (model0.Service, error) { diff --git a/api/infra/settings/firewall/security/intrusion_services/ids_profile.go b/api/infra/settings/firewall/security/intrusion_services/ids_profile.go index 7a6b2e4e7..c5bc504b4 100644 --- a/api/infra/settings/firewall/security/intrusion_services/ids_profile.go +++ b/api/infra/settings/firewall/security/intrusion_services/ids_profile.go @@ -29,7 +29,7 @@ func NewProfilesClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &IdsProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &IdsProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c IdsProfileClientContext) Get(profileIdParam string) (model0.IdsProfile, error) { diff --git a/api/infra/settings/firewall/security/policy_exclude_list.go b/api/infra/settings/firewall/security/policy_exclude_list.go index 0f27fae93..b980daa08 100644 --- a/api/infra/settings/firewall/security/policy_exclude_list.go +++ b/api/infra/settings/firewall/security/policy_exclude_list.go @@ -30,7 +30,7 @@ func NewExcludeListClient(sessionContext utl.SessionContext, connector vapiProto default: return nil } - return &PolicyExcludeListClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyExcludeListClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyExcludeListClientContext) Get() (model0.PolicyExcludeList, error) { diff --git a/api/infra/spoof_guard_profile.go b/api/infra/spoof_guard_profile.go index 386ebb56a..85e581e73 100644 --- a/api/infra/spoof_guard_profile.go +++ b/api/infra/spoof_guard_profile.go @@ -34,7 +34,7 @@ func NewSpoofguardProfilesClient(sessionContext utl.SessionContext, connector va default: return nil } - return &SpoofGuardProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SpoofGuardProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SpoofGuardProfileClientContext) Get(spoofguardProfileIdParam string) (model0.SpoofGuardProfile, error) { diff --git a/api/infra/tier0.go b/api/infra/tier0.go index 5ed714881..1573e85b5 100644 --- a/api/infra/tier0.go +++ b/api/infra/tier0.go @@ -30,7 +30,7 @@ func NewTier0sClient(sessionContext utl.SessionContext, connector vapiProtocolCl default: return nil } - return &Tier0ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &Tier0ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c Tier0ClientContext) Get(tier0IdParam string) (model0.Tier0, error) { diff --git a/api/infra/tier1.go b/api/infra/tier1.go index 9622353c6..2005b502c 100644 --- a/api/infra/tier1.go +++ b/api/infra/tier1.go @@ -34,7 +34,7 @@ func NewTier1sClient(sessionContext utl.SessionContext, connector vapiProtocolCl default: return nil } - return &Tier1ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &Tier1ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c Tier1ClientContext) Get(tier1IdParam string) (model0.Tier1, error) { diff --git a/api/infra/tier_0s/flood_protection_profile_binding_map.go b/api/infra/tier_0s/flood_protection_profile_binding_map.go index bb40590bc..92d913c7c 100644 --- a/api/infra/tier_0s/flood_protection_profile_binding_map.go +++ b/api/infra/tier_0s/flood_protection_profile_binding_map.go @@ -30,7 +30,7 @@ func NewFloodProtectionProfileBindingsClient(sessionContext utl.SessionContext, default: return nil } - return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c FloodProtectionProfileBindingMapClientContext) Get(tier0IdParam string, floodProtectionProfileBindingIdParam string) (model0.FloodProtectionProfileBindingMap, error) { diff --git a/api/infra/tier_0s/locale_services.go b/api/infra/tier_0s/locale_services.go index b04e2c42e..b476aa71d 100644 --- a/api/infra/tier_0s/locale_services.go +++ b/api/infra/tier_0s/locale_services.go @@ -30,7 +30,7 @@ func NewLocaleServicesClient(sessionContext utl.SessionContext, connector vapiPr default: return nil } - return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c LocaleServicesClientContext) Get(tier0IdParam string, localeServicesIdParam string) (model0.LocaleServices, error) { diff --git a/api/infra/tier_0s/locale_services/flood_protection_profile_binding_map.go b/api/infra/tier_0s/locale_services/flood_protection_profile_binding_map.go index d269f48fb..6ce3f5208 100644 --- a/api/infra/tier_0s/locale_services/flood_protection_profile_binding_map.go +++ b/api/infra/tier_0s/locale_services/flood_protection_profile_binding_map.go @@ -30,7 +30,7 @@ func NewFloodProtectionProfileBindingsClient(sessionContext utl.SessionContext, default: return nil } - return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c FloodProtectionProfileBindingMapClientContext) Get(tier0IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) (model0.FloodProtectionProfileBindingMap, error) { diff --git a/api/infra/tier_0s/nat/policy_nat_rule.go b/api/infra/tier_0s/nat/policy_nat_rule.go index 964df0482..3c2b51590 100644 --- a/api/infra/tier_0s/nat/policy_nat_rule.go +++ b/api/infra/tier_0s/nat/policy_nat_rule.go @@ -30,7 +30,7 @@ func NewNatRulesClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyNatRuleClientContext) Get(tier0IdParam string, natIdParam string, natRuleIdParam string) (model0.PolicyNatRule, error) { diff --git a/api/infra/tier_0s/policy_dns_forwarder.go b/api/infra/tier_0s/policy_dns_forwarder.go index 2cfa9224d..75c3f118b 100644 --- a/api/infra/tier_0s/policy_dns_forwarder.go +++ b/api/infra/tier_0s/policy_dns_forwarder.go @@ -30,7 +30,7 @@ func NewDnsForwarderClient(sessionContext utl.SessionContext, connector vapiProt default: return nil } - return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyDnsForwarderClientContext) Get(tier0IdParam string) (model0.PolicyDnsForwarder, error) { diff --git a/api/infra/tier_0s/static_routes.go b/api/infra/tier_0s/static_routes.go index 248a3c53c..1ca78abae 100644 --- a/api/infra/tier_0s/static_routes.go +++ b/api/infra/tier_0s/static_routes.go @@ -30,7 +30,7 @@ func NewStaticRoutesClient(sessionContext utl.SessionContext, connector vapiProt default: return nil } - return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StaticRoutesClientContext) Get(tier0IdParam string, routeIdParam string) (model0.StaticRoutes, error) { diff --git a/api/infra/tier_1s/flood_protection_profile_binding_map.go b/api/infra/tier_1s/flood_protection_profile_binding_map.go index 72ce15a03..110860369 100644 --- a/api/infra/tier_1s/flood_protection_profile_binding_map.go +++ b/api/infra/tier_1s/flood_protection_profile_binding_map.go @@ -34,7 +34,7 @@ func NewFloodProtectionProfileBindingsClient(sessionContext utl.SessionContext, default: return nil } - return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c FloodProtectionProfileBindingMapClientContext) Get(tier1IdParam string, floodProtectionProfileBindingIdParam string) (model0.FloodProtectionProfileBindingMap, error) { diff --git a/api/infra/tier_1s/locale_services.go b/api/infra/tier_1s/locale_services.go index e00173082..8a345fe6f 100644 --- a/api/infra/tier_1s/locale_services.go +++ b/api/infra/tier_1s/locale_services.go @@ -34,7 +34,7 @@ func NewLocaleServicesClient(sessionContext utl.SessionContext, connector vapiPr default: return nil } - return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c LocaleServicesClientContext) Get(tier1IdParam string, localeServicesIdParam string) (model0.LocaleServices, error) { diff --git a/api/infra/tier_1s/locale_services/flood_protection_profile_binding_map.go b/api/infra/tier_1s/locale_services/flood_protection_profile_binding_map.go index a8c7a0aa1..6677ac138 100644 --- a/api/infra/tier_1s/locale_services/flood_protection_profile_binding_map.go +++ b/api/infra/tier_1s/locale_services/flood_protection_profile_binding_map.go @@ -34,7 +34,7 @@ func NewFloodProtectionProfileBindingsClient(sessionContext utl.SessionContext, default: return nil } - return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &FloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c FloodProtectionProfileBindingMapClientContext) Get(tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) (model0.FloodProtectionProfileBindingMap, error) { diff --git a/api/infra/tier_1s/locale_services/tier1_interface.go b/api/infra/tier_1s/locale_services/tier1_interface.go index 85514dab0..30ee97244 100644 --- a/api/infra/tier_1s/locale_services/tier1_interface.go +++ b/api/infra/tier_1s/locale_services/tier1_interface.go @@ -34,7 +34,7 @@ func NewInterfacesClient(sessionContext utl.SessionContext, connector vapiProtoc default: return nil } - return &Tier1InterfaceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &Tier1InterfaceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c Tier1InterfaceClientContext) Get(tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) (model0.Tier1Interface, error) { diff --git a/api/infra/tier_1s/nat/policy_nat_rule.go b/api/infra/tier_1s/nat/policy_nat_rule.go index 041473ab7..9ce7d06a5 100644 --- a/api/infra/tier_1s/nat/policy_nat_rule.go +++ b/api/infra/tier_1s/nat/policy_nat_rule.go @@ -34,7 +34,7 @@ func NewNatRulesClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyNatRuleClientContext) Get(tier1IdParam string, natIdParam string, natRuleIdParam string) (model0.PolicyNatRule, error) { diff --git a/api/infra/tier_1s/policy_dns_forwarder.go b/api/infra/tier_1s/policy_dns_forwarder.go index fc528f055..80e89530a 100644 --- a/api/infra/tier_1s/policy_dns_forwarder.go +++ b/api/infra/tier_1s/policy_dns_forwarder.go @@ -34,7 +34,7 @@ func NewDnsForwarderClient(sessionContext utl.SessionContext, connector vapiProt default: return nil } - return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c PolicyDnsForwarderClientContext) Get(tier1IdParam string) (model0.PolicyDnsForwarder, error) { diff --git a/api/infra/tier_1s/segment.go b/api/infra/tier_1s/segment.go index 8bbb60c7e..8f1edad78 100644 --- a/api/infra/tier_1s/segment.go +++ b/api/infra/tier_1s/segment.go @@ -34,7 +34,7 @@ func NewSegmentsClient(sessionContext utl.SessionContext, connector vapiProtocol default: return nil } - return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentClientContext) Get(tier1IdParam string, segmentIdParam string) (model0.Segment, error) { diff --git a/api/infra/tier_1s/segments/dhcp_static_binding_config.go b/api/infra/tier_1s/segments/dhcp_static_binding_config.go index 1ac41c966..b6c450c0d 100644 --- a/api/infra/tier_1s/segments/dhcp_static_binding_config.go +++ b/api/infra/tier_1s/segments/dhcp_static_binding_config.go @@ -35,7 +35,7 @@ func NewDhcpStaticBindingConfigsClient(sessionContext utl.SessionContext, connec default: return nil } - return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StructValueClientContext) Get(tier1IdParam string, segmentIdParam string, bindingIdParam string) (*model0.StructValue, error) { diff --git a/api/infra/tier_1s/segments/segment_port.go b/api/infra/tier_1s/segments/segment_port.go index 739c3c69c..a9be19c4b 100644 --- a/api/infra/tier_1s/segments/segment_port.go +++ b/api/infra/tier_1s/segments/segment_port.go @@ -29,7 +29,7 @@ func NewPortsClient(sessionContext utl.SessionContext, connector vapiProtocolCli default: return nil } - return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c SegmentPortClientContext) List(tier1IdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentPortListResult, error) { diff --git a/api/infra/tier_1s/static_routes.go b/api/infra/tier_1s/static_routes.go index b17b1118a..80b5fcfe0 100644 --- a/api/infra/tier_1s/static_routes.go +++ b/api/infra/tier_1s/static_routes.go @@ -34,7 +34,7 @@ func NewStaticRoutesClient(sessionContext utl.SessionContext, connector vapiProt default: return nil } - return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} } func (c StaticRoutesClientContext) Get(tier1IdParam string, routeIdParam string) (model0.StaticRoutes, error) { diff --git a/api/utl/api_util.go b/api/utl/api_util.go index 1dbd217a2..94fc0a368 100644 --- a/api/utl/api_util.go +++ b/api/utl/api_util.go @@ -11,16 +11,19 @@ const ( Global = 0 Local = 1 Multitenancy = 2 + VPC = 3 ) type SessionContext struct { ClientType ClientType ProjectID string + VPCID string } type ClientContext struct { Client interface{} ClientType ClientType ProjectID string + VPCID string } func ConvertModelBindingType(obj interface{}, sourceType bindings.BindingType, destType bindings.BindingType) (interface{}, error) { diff --git a/api/utl_file_template.yaml b/api/utl_file_template.yaml index f60be64a7..5fecfdf6b 100644 --- a/api/utl_file_template.yaml +++ b/api/utl_file_template.yaml @@ -15,11 +15,13 @@ type SessionContext struct { ClientType ClientType ProjectID string + VPCID string } type ClientContext struct { Client interface{} ClientType ClientType ProjectID string + VPCID string } func ConvertModelBindingType(obj interface{}, sourceType bindings.BindingType, destType bindings.BindingType) (interface{}, error) { diff --git a/nsxt/data_source_nsxt_policy_context_profile.go b/nsxt/data_source_nsxt_policy_context_profile.go index 012acae31..61589d6d4 100644 --- a/nsxt/data_source_nsxt_policy_context_profile.go +++ b/nsxt/data_source_nsxt_policy_context_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyContextProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_dhcp_server.go b/nsxt/data_source_nsxt_policy_dhcp_server.go index 7df02cfc7..a2a9d8964 100644 --- a/nsxt/data_source_nsxt_policy_dhcp_server.go +++ b/nsxt/data_source_nsxt_policy_dhcp_server.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyDhcpServer() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_distributed_flood_protection_profile.go b/nsxt/data_source_nsxt_policy_distributed_flood_protection_profile.go index d8daafc1b..e3226c34d 100644 --- a/nsxt/data_source_nsxt_policy_distributed_flood_protection_profile.go +++ b/nsxt/data_source_nsxt_policy_distributed_flood_protection_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyDistributedFloodProtectionProfile() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_gateway_dns_forwarder.go b/nsxt/data_source_nsxt_policy_gateway_dns_forwarder.go index 927d00cca..3b3d2c96b 100644 --- a/nsxt/data_source_nsxt_policy_gateway_dns_forwarder.go +++ b/nsxt/data_source_nsxt_policy_gateway_dns_forwarder.go @@ -19,7 +19,7 @@ func dataSourceNsxtPolicyGatewayDNSForwarder() *schema.Resource { "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), "gateway_path": getPolicyPathSchema(false, false, "Gateway path"), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_gateway_flood_protection_profile.go b/nsxt/data_source_nsxt_policy_gateway_flood_protection_profile.go index 9e40cc2fa..31c99a76c 100644 --- a/nsxt/data_source_nsxt_policy_gateway_flood_protection_profile.go +++ b/nsxt/data_source_nsxt_policy_gateway_flood_protection_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyGatewayFloodProtectionProfile() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_gateway_interface_realization.go b/nsxt/data_source_nsxt_policy_gateway_interface_realization.go index 1b3b46e1a..b4c7864fe 100644 --- a/nsxt/data_source_nsxt_policy_gateway_interface_realization.go +++ b/nsxt/data_source_nsxt_policy_gateway_interface_realization.go @@ -22,7 +22,7 @@ func dataSourceNsxtPolicyGatewayInterfaceRealization() *schema.Resource { Schema: map[string]*schema.Schema{ "id": getDataSourceIDSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "gateway_path": { Type: schema.TypeString, Description: "The path for the gateway", diff --git a/nsxt/data_source_nsxt_policy_gateway_locale_service.go b/nsxt/data_source_nsxt_policy_gateway_locale_service.go index 459655b7f..bb14d4e29 100644 --- a/nsxt/data_source_nsxt_policy_gateway_locale_service.go +++ b/nsxt/data_source_nsxt_policy_gateway_locale_service.go @@ -28,7 +28,7 @@ func dataSourceNsxtPolicyGatewayLocaleService() *schema.Resource { Optional: true, Computed: true, }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_gateway_policy.go b/nsxt/data_source_nsxt_policy_gateway_policy.go index 7777e1527..4b5adacd9 100644 --- a/nsxt/data_source_nsxt_policy_gateway_policy.go +++ b/nsxt/data_source_nsxt_policy_gateway_policy.go @@ -30,7 +30,7 @@ func dataSourceNsxtPolicyGatewayPolicy() *schema.Resource { "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), "domain": getDataSourceDomainNameSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "category": { Type: schema.TypeString, Description: "Category", diff --git a/nsxt/data_source_nsxt_policy_gateway_qos_profile.go b/nsxt/data_source_nsxt_policy_gateway_qos_profile.go index 5e2d7d12c..d3846cebe 100644 --- a/nsxt/data_source_nsxt_policy_gateway_qos_profile.go +++ b/nsxt/data_source_nsxt_policy_gateway_qos_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyGatewayQosProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_group.go b/nsxt/data_source_nsxt_policy_group.go index d61636ff0..1a66ed36c 100644 --- a/nsxt/data_source_nsxt_policy_group.go +++ b/nsxt/data_source_nsxt_policy_group.go @@ -17,7 +17,7 @@ func dataSourceNsxtPolicyGroup() *schema.Resource { "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), "domain": getDomainNameSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_intrusion_service_profile.go b/nsxt/data_source_nsxt_policy_intrusion_service_profile.go index a001d04c4..68fe51178 100644 --- a/nsxt/data_source_nsxt_policy_intrusion_service_profile.go +++ b/nsxt/data_source_nsxt_policy_intrusion_service_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyIntrusionServiceProfile() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_ip_block.go b/nsxt/data_source_nsxt_policy_ip_block.go index 90d80112f..b171cb2ce 100644 --- a/nsxt/data_source_nsxt_policy_ip_block.go +++ b/nsxt/data_source_nsxt_policy_ip_block.go @@ -22,7 +22,7 @@ func dataSourceNsxtPolicyIPBlock() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_ip_discovery_profile.go b/nsxt/data_source_nsxt_policy_ip_discovery_profile.go index 2043f0748..739222002 100644 --- a/nsxt/data_source_nsxt_policy_ip_discovery_profile.go +++ b/nsxt/data_source_nsxt_policy_ip_discovery_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_ip_pool.go b/nsxt/data_source_nsxt_policy_ip_pool.go index e52e8251c..0de9a4bc8 100644 --- a/nsxt/data_source_nsxt_policy_ip_pool.go +++ b/nsxt/data_source_nsxt_policy_ip_pool.go @@ -19,7 +19,7 @@ func dataSourceNsxtPolicyIPPool() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "realized_id": { Type: schema.TypeString, Description: "The ID of the realized resource", diff --git a/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go b/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go index 7bfdaf0c7..c2432f9c4 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go +++ b/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyIpv6DadProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go index aae7d1dba..b0890b911 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go +++ b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyIpv6NdraProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_mac_discovery_profile.go b/nsxt/data_source_nsxt_policy_mac_discovery_profile.go index 8bce8ae8c..6aafbd9ff 100644 --- a/nsxt/data_source_nsxt_policy_mac_discovery_profile.go +++ b/nsxt/data_source_nsxt_policy_mac_discovery_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyMacDiscoveryProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_qos_profile.go b/nsxt/data_source_nsxt_policy_qos_profile.go index 11cb37a3e..1f236b7cd 100644 --- a/nsxt/data_source_nsxt_policy_qos_profile.go +++ b/nsxt/data_source_nsxt_policy_qos_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyQosProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_realization_info.go b/nsxt/data_source_nsxt_policy_realization_info.go index d438cf38d..039931e07 100644 --- a/nsxt/data_source_nsxt_policy_realization_info.go +++ b/nsxt/data_source_nsxt_policy_realization_info.go @@ -27,7 +27,7 @@ func dataSourceNsxtPolicyRealizationInfo() *schema.Resource { Required: true, ValidateFunc: validatePolicyPath(), }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "entity_type": { Type: schema.TypeString, Description: "The entity type of the realized resource", diff --git a/nsxt/data_source_nsxt_policy_security_policy.go b/nsxt/data_source_nsxt_policy_security_policy.go index 9a269120d..1714a79e5 100644 --- a/nsxt/data_source_nsxt_policy_security_policy.go +++ b/nsxt/data_source_nsxt_policy_security_policy.go @@ -25,7 +25,7 @@ func dataSourceNsxtPolicySecurityPolicy() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "domain": getDataSourceDomainNameSchema(), "is_default": { Type: schema.TypeBool, diff --git a/nsxt/data_source_nsxt_policy_segment.go b/nsxt/data_source_nsxt_policy_segment.go index 3c0a5396e..430e47fac 100644 --- a/nsxt/data_source_nsxt_policy_segment.go +++ b/nsxt/data_source_nsxt_policy_segment.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicySegment() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_segment_realization.go b/nsxt/data_source_nsxt_policy_segment_realization.go index 8d1d3ac1a..0240a4027 100644 --- a/nsxt/data_source_nsxt_policy_segment_realization.go +++ b/nsxt/data_source_nsxt_policy_segment_realization.go @@ -22,7 +22,7 @@ func dataSourceNsxtPolicySegmentRealization() *schema.Resource { Schema: map[string]*schema.Schema{ "id": getDataSourceIDSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "path": { Type: schema.TypeString, Description: "The path for the policy segment", diff --git a/nsxt/data_source_nsxt_policy_segment_security_profile.go b/nsxt/data_source_nsxt_policy_segment_security_profile.go index 9120159a0..48ba9fef4 100644 --- a/nsxt/data_source_nsxt_policy_segment_security_profile.go +++ b/nsxt/data_source_nsxt_policy_segment_security_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicySegmentSecurityProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_service.go b/nsxt/data_source_nsxt_policy_service.go index 5e38c80c6..b2ef330fa 100644 --- a/nsxt/data_source_nsxt_policy_service.go +++ b/nsxt/data_source_nsxt_policy_service.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicyService() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_spoofguard_profile.go b/nsxt/data_source_nsxt_policy_spoofguard_profile.go index ccacfc936..2dd1d540e 100644 --- a/nsxt/data_source_nsxt_policy_spoofguard_profile.go +++ b/nsxt/data_source_nsxt_policy_spoofguard_profile.go @@ -16,7 +16,7 @@ func dataSourceNsxtPolicySpoofGuardProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_tier1_gateway.go b/nsxt/data_source_nsxt_policy_tier1_gateway.go index 7463d4ba2..8035d64ef 100644 --- a/nsxt/data_source_nsxt_policy_tier1_gateway.go +++ b/nsxt/data_source_nsxt_policy_tier1_gateway.go @@ -26,7 +26,7 @@ func dataSourceNsxtPolicyTier1Gateway() *schema.Resource { Optional: true, Computed: true, }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_vm.go b/nsxt/data_source_nsxt_policy_vm.go index 04606baa0..4ac6aa002 100644 --- a/nsxt/data_source_nsxt_policy_vm.go +++ b/nsxt/data_source_nsxt_policy_vm.go @@ -26,7 +26,7 @@ func dataSourceNsxtPolicyVM() *schema.Resource { "external_id": getDataSourceStringSchema("External ID of the Virtual Machine"), "bios_id": getDataSourceStringSchema("BIOS UUID of the Virtual Machine"), "instance_id": getDataSourceStringSchema("Instance UUID of the Virtual Machine"), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_vms.go b/nsxt/data_source_nsxt_policy_vms.go index 3f9040396..3ee1cd002 100644 --- a/nsxt/data_source_nsxt_policy_vms.go +++ b/nsxt/data_source_nsxt_policy_vms.go @@ -58,7 +58,7 @@ func dataSourceNsxtPolicyVMs() *schema.Resource { Type: schema.TypeString, }, }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/data_source_nsxt_policy_vpc.go b/nsxt/data_source_nsxt_policy_vpc.go index 701cb5d71..036ed07d5 100644 --- a/nsxt/data_source_nsxt_policy_vpc.go +++ b/nsxt/data_source_nsxt_policy_vpc.go @@ -17,7 +17,7 @@ func dataSourceNsxtPolicyVPC() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), - "context": getContextSchema(true, false), + "context": getContextSchema(true, false, false), "short_id": { Type: schema.TypeString, Optional: true, diff --git a/nsxt/policy_common.go b/nsxt/policy_common.go index 9e3bf1597..1a32f6312 100644 --- a/nsxt/policy_common.go +++ b/nsxt/policy_common.go @@ -298,7 +298,7 @@ func getSecurityPolicyAndGatewayRuleSchema(scopeRequired bool, isIds bool, nsxID } // Using computed context here, because context is required for consistency and // if it's not provided it can be derived from policy_path. - ruleSchema["context"] = getContextSchema(false, true) + ruleSchema["context"] = getContextSchema(false, true, false) } else { ruleSchema["sequence_number"] = &schema.Schema{ Type: schema.TypeInt, @@ -328,7 +328,7 @@ func getPolicySecurityPolicySchema(isIds, withContext, withRule bool) map[string "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "domain": getDomainNameSchema(), "category": { Type: schema.TypeString, diff --git a/nsxt/policy_utils.go b/nsxt/policy_utils.go index df0fdb997..ab27f291c 100644 --- a/nsxt/policy_utils.go +++ b/nsxt/policy_utils.go @@ -308,11 +308,12 @@ func nsxtPolicyPathResourceImporterHelper(d *schema.ResourceData, m interface{}) } // pathSegs[2] should contain the organization. Once we support multiple organization, it should be // assigned into the context as well - contexts := make([]interface{}, 1) ctxMap := make(map[string]interface{}) ctxMap["project_id"] = pathSegs[4] - contexts[0] = ctxMap - d.Set("context", contexts) + if pathSegs[5] == "vpcs" { + ctxMap["vpc_id"] = pathSegs[6] + } + d.Set("context", []interface{}{ctxMap}) d.SetId(pathSegs[len(pathSegs)-1]) } return []*schema.ResourceData{d}, nil diff --git a/nsxt/provider.go b/nsxt/provider.go index 5dfda4fb1..957b30949 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -1209,28 +1209,35 @@ func getGlobalPolicyEnforcementPointPath(m interface{}, sitePath *string) string return fmt.Sprintf("%s/enforcement-points/%s", *sitePath, getPolicyEnforcementPoint(m)) } -func getProjectIDFromSchema(d *schema.ResourceData) string { +func getContextDataFromSchema(d *schema.ResourceData) (string, string) { ctxPtr := d.Get("context") if ctxPtr != nil { contexts := ctxPtr.([]interface{}) for _, context := range contexts { data := context.(map[string]interface{}) + vpcID := "" + if data["vpc_id"] != nil { + vpcID = data["vpc_id"].(string) + } - return data["project_id"].(string) + return data["project_id"].(string), vpcID } } - return "" + return "", "" } func getSessionContext(d *schema.ResourceData, m interface{}) tf_api.SessionContext { var clientType tf_api.ClientType - projectID := getProjectIDFromSchema(d) + projectID, vpcID := getContextDataFromSchema(d) if projectID != "" { clientType = tf_api.Multitenancy + if vpcID != "" { + clientType = tf_api.VPC + } } else if isPolicyGlobalManager(m) { clientType = tf_api.Global } else { clientType = tf_api.Local } - return tf_api.SessionContext{ProjectID: projectID, ClientType: clientType} + return tf_api.SessionContext{ProjectID: projectID, VPCID: vpcID, ClientType: clientType} } diff --git a/nsxt/resource_nsxt_policy_context_profile.go b/nsxt/resource_nsxt_policy_context_profile.go index da19f5f50..474019b1a 100644 --- a/nsxt/resource_nsxt_policy_context_profile.go +++ b/nsxt/resource_nsxt_policy_context_profile.go @@ -61,7 +61,7 @@ func resourceNsxtPolicyContextProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "app_id": getContextProfilePolicyAppIDAttributesSchema(), "custom_url": getContextProfilePolicyCustomURLAttributesSchema(), "domain_name": getContextProfilePolicyOtherAttributesSchema(), diff --git a/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go b/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go index 19623432e..b59681dec 100644 --- a/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go +++ b/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go @@ -42,7 +42,7 @@ func resourceNsxtPolicyContextProfileCustomAttribute() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "key": { Type: schema.TypeString, Description: "Key for attribute", diff --git a/nsxt/resource_nsxt_policy_dhcp_relay.go b/nsxt/resource_nsxt_policy_dhcp_relay.go index cfbdf794f..d77a08be2 100644 --- a/nsxt/resource_nsxt_policy_dhcp_relay.go +++ b/nsxt/resource_nsxt_policy_dhcp_relay.go @@ -32,7 +32,7 @@ func resourceNsxtPolicyDhcpRelayConfig() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "server_addresses": { Type: schema.TypeList, Required: true, diff --git a/nsxt/resource_nsxt_policy_dhcp_server.go b/nsxt/resource_nsxt_policy_dhcp_server.go index a0d295b64..89741b515 100644 --- a/nsxt/resource_nsxt_policy_dhcp_server.go +++ b/nsxt/resource_nsxt_policy_dhcp_server.go @@ -33,7 +33,7 @@ func resourceNsxtPolicyDhcpServer() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "edge_cluster_path": getPolicyPathSchema(false, false, "Edge Cluster path"), "lease_time": { Type: schema.TypeInt, diff --git a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go index 77213a8cf..3de0a969b 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go +++ b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go @@ -38,7 +38,7 @@ func resourceNsxtPolicyDhcpV4StaticBinding() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "segment_path": getPolicyPathSchema(true, true, "segment path"), "gateway_address": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go index ac314af33..1982565be 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go +++ b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go @@ -34,7 +34,7 @@ func resourceNsxtPolicyDhcpV6StaticBinding() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "segment_path": getPolicyPathSchema(true, true, "segment path"), "dns_nameservers": { Type: schema.TypeList, diff --git a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile.go b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile.go index ae643c4ca..7b7da185c 100644 --- a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile.go +++ b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile.go @@ -39,7 +39,7 @@ func getFloodProtectionProfile() map[string]*schema.Schema { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "icmp_active_flow_limit": { Type: schema.TypeInt, Description: "Active ICMP connections limit", diff --git a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding.go b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding.go index 3ad961366..9ea95e17c 100644 --- a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding.go +++ b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding.go @@ -30,7 +30,7 @@ func resourceNsxtPolicyDistributedFloodProtectionProfileBinding() *schema.Resour "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "profile_path": { Type: schema.TypeString, Description: "The path of the flood protection profile", diff --git a/nsxt/resource_nsxt_policy_dns_forwarder_zone.go b/nsxt/resource_nsxt_policy_dns_forwarder_zone.go index 1534710e7..d619a1e64 100644 --- a/nsxt/resource_nsxt_policy_dns_forwarder_zone.go +++ b/nsxt/resource_nsxt_policy_dns_forwarder_zone.go @@ -33,7 +33,7 @@ func resourceNsxtPolicyDNSForwarderZone() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "dns_domain_names": getDomainNamesSchema(), "source_ip": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go b/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go index 3186a6097..50c642b36 100644 --- a/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go +++ b/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go @@ -42,7 +42,7 @@ func resourceNsxtPolicyGatewayDNSForwarder() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "gateway_path": getPolicyPathSchema(true, true, "Policy path for the Gateway"), "listener_ip": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding.go b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding.go index 85d405981..7461bc6f0 100644 --- a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding.go +++ b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding.go @@ -33,7 +33,7 @@ func resourceNsxtPolicyGatewayFloodProtectionProfileBinding() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "profile_path": { Type: schema.TypeString, Description: "The path of the flood protection profile", diff --git a/nsxt/resource_nsxt_policy_group.go b/nsxt/resource_nsxt_policy_group.go index 73b48b399..666fac7a0 100644 --- a/nsxt/resource_nsxt_policy_group.go +++ b/nsxt/resource_nsxt_policy_group.go @@ -101,7 +101,7 @@ func resourceNsxtPolicyGroup() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "domain": getDomainNameSchema(), "group_type": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_intrusion_service_profile.go b/nsxt/resource_nsxt_policy_intrusion_service_profile.go index 46d1a4907..8c58bdaa1 100644 --- a/nsxt/resource_nsxt_policy_intrusion_service_profile.go +++ b/nsxt/resource_nsxt_policy_intrusion_service_profile.go @@ -56,7 +56,7 @@ func resourceNsxtPolicyIntrusionServiceProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "criteria": { Type: schema.TypeList, Description: "Filtering criteria for the IDS Profile", diff --git a/nsxt/resource_nsxt_policy_ip_address_allocation.go b/nsxt/resource_nsxt_policy_ip_address_allocation.go index fda553ac2..324fb7a2f 100644 --- a/nsxt/resource_nsxt_policy_ip_address_allocation.go +++ b/nsxt/resource_nsxt_policy_ip_address_allocation.go @@ -39,7 +39,7 @@ func resourceNsxtPolicyIPAddressAllocation() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "pool_path": getPolicyPathSchema(true, true, "The path of the IP Pool for this allocation"), "allocation_ip": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_ip_block.go b/nsxt/resource_nsxt_policy_ip_block.go index 87d3f0596..7e9a24008 100644 --- a/nsxt/resource_nsxt_policy_ip_block.go +++ b/nsxt/resource_nsxt_policy_ip_block.go @@ -39,7 +39,7 @@ func resourceNsxtPolicyIPBlock() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "cidr": { Type: schema.TypeString, Description: "Network address and the prefix length which will be associated with a layer-2 broadcast domain", diff --git a/nsxt/resource_nsxt_policy_ip_discovery_profile.go b/nsxt/resource_nsxt_policy_ip_discovery_profile.go index 54cd73753..dc2ed7aa8 100644 --- a/nsxt/resource_nsxt_policy_ip_discovery_profile.go +++ b/nsxt/resource_nsxt_policy_ip_discovery_profile.go @@ -33,7 +33,7 @@ func resourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "arp_nd_binding_timeout": { Type: schema.TypeInt, Description: "ARP and ND cache timeout (in minutes)", diff --git a/nsxt/resource_nsxt_policy_ip_pool.go b/nsxt/resource_nsxt_policy_ip_pool.go index abc5a47b8..ad7c0cda4 100644 --- a/nsxt/resource_nsxt_policy_ip_pool.go +++ b/nsxt/resource_nsxt_policy_ip_pool.go @@ -32,7 +32,7 @@ func resourceNsxtPolicyIPPool() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "realized_id": { Type: schema.TypeString, Description: "The ID of the realized resource", diff --git a/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go b/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go index e82e46987..adc522649 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go +++ b/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go @@ -40,7 +40,7 @@ func resourceNsxtPolicyIPPoolBlockSubnet() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "auto_assign_gateway": { Type: schema.TypeBool, Description: "If true, the first IP in the range will be reserved for gateway", diff --git a/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go b/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go index 76908251b..64d95df3a 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go +++ b/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go @@ -31,7 +31,7 @@ func resourceNsxtPolicyIPPoolStaticSubnet() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "pool_path": getPolicyPathSchema(true, true, "Policy path to the IP Pool for this Subnet"), "allocation_range": getAllocationRangeListSchema(true, "A collection of IPv4 or IPv6 IP ranges"), "cidr": { diff --git a/nsxt/resource_nsxt_policy_mac_discovery_profile.go b/nsxt/resource_nsxt_policy_mac_discovery_profile.go index 68ab3216f..f2df7d2da 100644 --- a/nsxt/resource_nsxt_policy_mac_discovery_profile.go +++ b/nsxt/resource_nsxt_policy_mac_discovery_profile.go @@ -30,7 +30,7 @@ var macDiscoveryProfileSchema = map[string]*metadata.ExtendedSchema{ "description": metadata.GetExtendedSchema(getDescriptionSchema()), "revision": metadata.GetExtendedSchema(getRevisionSchema()), "tag": metadata.GetExtendedSchema(getTagsSchema()), - "context": metadata.GetExtendedSchema(getContextSchema(false, false)), + "context": metadata.GetExtendedSchema(getContextSchema(false, false, false)), "mac_change_enabled": { Schema: schema.Schema{ Type: schema.TypeBool, diff --git a/nsxt/resource_nsxt_policy_nat_rule.go b/nsxt/resource_nsxt_policy_nat_rule.go index fc4cc32ba..f4285dcc2 100644 --- a/nsxt/resource_nsxt_policy_nat_rule.go +++ b/nsxt/resource_nsxt_policy_nat_rule.go @@ -57,7 +57,7 @@ func resourceNsxtPolicyNATRule() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "gateway_path": getPolicyGatewayPathSchema(), "action": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_predefined_gateway_policy.go b/nsxt/resource_nsxt_policy_predefined_gateway_policy.go index f47c294d3..4e9a9b3fe 100644 --- a/nsxt/resource_nsxt_policy_predefined_gateway_policy.go +++ b/nsxt/resource_nsxt_policy_predefined_gateway_policy.go @@ -42,7 +42,7 @@ func getPolicyPredefinedGatewayPolicySchema() map[string]*schema.Schema { "rule": getSecurityPolicyAndGatewayRulesSchema(true, false, false), "default_rule": getGatewayPolicyDefaultRulesSchema(), "revision": getRevisionSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), } } diff --git a/nsxt/resource_nsxt_policy_predefined_security_policy.go b/nsxt/resource_nsxt_policy_predefined_security_policy.go index cda88613d..0fcc65fe1 100644 --- a/nsxt/resource_nsxt_policy_predefined_security_policy.go +++ b/nsxt/resource_nsxt_policy_predefined_security_policy.go @@ -39,7 +39,7 @@ func getSecurityPolicyDefaultRulesSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "nsx_id": getComputedNsxIDSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "scope": { Type: schema.TypeString, Description: "Scope for this rule", @@ -85,7 +85,7 @@ func getPolicyPredefinedSecurityPolicySchema() map[string]*schema.Schema { "rule": getSecurityPolicyAndGatewayRulesSchema(false, false, false), "default_rule": getSecurityPolicyDefaultRulesSchema(), "revision": getRevisionSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), } } diff --git a/nsxt/resource_nsxt_policy_qos_profile.go b/nsxt/resource_nsxt_policy_qos_profile.go index 6742ad0f8..d58dbb043 100644 --- a/nsxt/resource_nsxt_policy_qos_profile.go +++ b/nsxt/resource_nsxt_policy_qos_profile.go @@ -37,7 +37,7 @@ func resourceNsxtPolicyQosProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "class_of_service": { Type: schema.TypeInt, Description: "Class of service", diff --git a/nsxt/resource_nsxt_policy_security_policy_rule.go b/nsxt/resource_nsxt_policy_security_policy_rule.go index 2ff54f1d1..a8855737d 100644 --- a/nsxt/resource_nsxt_policy_security_policy_rule.go +++ b/nsxt/resource_nsxt_policy_security_policy_rule.go @@ -62,7 +62,7 @@ func resourceNsxtPolicySecurityPolicyRuleCreate(d *schema.ResourceData, m interf } func setSecurityPolicyRuleContext(d *schema.ResourceData, projectID string) error { - providedProjectID := getProjectIDFromSchema(d) + providedProjectID, _ := getContextDataFromSchema(d) if providedProjectID == "" { contexts := make([]interface{}, 1) ctxMap := make(map[string]interface{}) diff --git a/nsxt/resource_nsxt_policy_segment_security_profile.go b/nsxt/resource_nsxt_policy_segment_security_profile.go index 1cf0d5a0c..a12b95d63 100644 --- a/nsxt/resource_nsxt_policy_segment_security_profile.go +++ b/nsxt/resource_nsxt_policy_segment_security_profile.go @@ -25,7 +25,7 @@ var segmentSecurityProfileSchema = map[string]*metadata.ExtendedSchema{ "description": metadata.GetExtendedSchema(getDescriptionSchema()), "revision": metadata.GetExtendedSchema(getRevisionSchema()), "tag": metadata.GetExtendedSchema(getTagsSchema()), - "context": metadata.GetExtendedSchema(getContextSchema(false, false)), + "context": metadata.GetExtendedSchema(getContextSchema(false, false, false)), "bpdu_filter_allow": { Schema: schema.Schema{ Type: schema.TypeSet, diff --git a/nsxt/resource_nsxt_policy_service.go b/nsxt/resource_nsxt_policy_service.go index 87bb1be88..bf516cf2a 100644 --- a/nsxt/resource_nsxt_policy_service.go +++ b/nsxt/resource_nsxt_policy_service.go @@ -36,7 +36,7 @@ func resourceNsxtPolicyService() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "icmp_entry": { Type: schema.TypeSet, diff --git a/nsxt/resource_nsxt_policy_spoof_guard_profile.go b/nsxt/resource_nsxt_policy_spoof_guard_profile.go index bb89103b2..9184c35a5 100644 --- a/nsxt/resource_nsxt_policy_spoof_guard_profile.go +++ b/nsxt/resource_nsxt_policy_spoof_guard_profile.go @@ -32,7 +32,7 @@ func resourceNsxtPolicySpoofGuardProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "address_binding_allowlist": { Type: schema.TypeBool, Optional: true, diff --git a/nsxt/resource_nsxt_policy_static_route.go b/nsxt/resource_nsxt_policy_static_route.go index 3619f4e3e..b147d4862 100644 --- a/nsxt/resource_nsxt_policy_static_route.go +++ b/nsxt/resource_nsxt_policy_static_route.go @@ -37,7 +37,7 @@ func resourceNsxtPolicyStaticRoute() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "gateway_path": getPolicyGatewayPathSchema(), "network": { Type: schema.TypeString, diff --git a/nsxt/resource_nsxt_policy_tier1_gateway.go b/nsxt/resource_nsxt_policy_tier1_gateway.go index bd2437f1c..a4616c7fb 100644 --- a/nsxt/resource_nsxt_policy_tier1_gateway.go +++ b/nsxt/resource_nsxt_policy_tier1_gateway.go @@ -144,7 +144,7 @@ func resourceNsxtPolicyTier1Gateway() *schema.Resource { ValidateFunc: validation.StringInSlice(t1TypeValues, false), Optional: true, }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/resource_nsxt_policy_tier1_gateway_interface.go b/nsxt/resource_nsxt_policy_tier1_gateway_interface.go index 050703019..88a9861d0 100644 --- a/nsxt/resource_nsxt_policy_tier1_gateway_interface.go +++ b/nsxt/resource_nsxt_policy_tier1_gateway_interface.go @@ -38,7 +38,7 @@ func resourceNsxtPolicyTier1GatewayInterface() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "gateway_path": getPolicyPathSchema(true, true, "Policy path for tier1 gateway"), "segment_path": getPolicyPathSchema(true, true, "Policy path for connected segment"), "subnets": getGatewayInterfaceSubnetsSchema(), diff --git a/nsxt/resource_nsxt_policy_vm_tags.go b/nsxt/resource_nsxt_policy_vm_tags.go index b0d041d85..88f8c76d5 100644 --- a/nsxt/resource_nsxt_policy_vm_tags.go +++ b/nsxt/resource_nsxt_policy_vm_tags.go @@ -57,7 +57,7 @@ func resourceNsxtPolicyVMTags() *schema.Resource { }, }, }, - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), }, } } diff --git a/nsxt/segment_common.go b/nsxt/segment_common.go index 3ffea9de8..bba9b45ec 100644 --- a/nsxt/segment_common.go +++ b/nsxt/segment_common.go @@ -267,7 +267,7 @@ func getPolicyCommonSegmentSchema(vlanRequired bool, isFixed bool) map[string]*s "revision": getRevisionSchema(), "tag": getTagsSchema(), "ignore_tags": getIgnoreTagsSchema(), - "context": getContextSchema(false, false), + "context": getContextSchema(false, false, false), "advanced_config": { Type: schema.TypeList, Description: "Advanced segment configuration", diff --git a/nsxt/utils.go b/nsxt/utils.go index c797c3fb8..64d8da185 100644 --- a/nsxt/utils.go +++ b/nsxt/utils.go @@ -680,7 +680,25 @@ func handlePagination(lister func(*paginationInfo) error) (int64, error) { return total, nil } -func getContextSchema(isRequired, isComputed bool) *schema.Schema { +func getContextSchema(isRequired, isComputed, isVPC bool) *schema.Schema { + elemSchema := map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Description: "Id of the project which the resource belongs to.", + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotWhiteSpace, + }, + } + if isVPC { + elemSchema["vpc_id"] = &schema.Schema{ + Type: schema.TypeString, + Description: "Id of the VPC which the resource belongs to.", + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotWhiteSpace, + } + } return &schema.Schema{ Type: schema.TypeList, Description: "Resource context", @@ -690,15 +708,7 @@ func getContextSchema(isRequired, isComputed bool) *schema.Schema { MaxItems: 1, ForceNew: true, Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "project_id": { - Type: schema.TypeString, - Description: "Id of the project which the resource belongs to.", - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotWhiteSpace, - }, - }, + Schema: elemSchema, }, } } diff --git a/nsxt/utils_test.go b/nsxt/utils_test.go index 95e886eef..9a118df83 100644 --- a/nsxt/utils_test.go +++ b/nsxt/utils_test.go @@ -243,15 +243,29 @@ func testAccIsMultitenancy() bool { return os.Getenv("NSXT_PROJECT_ID") != "" } +func testAccIsVPC() bool { + return os.Getenv("NSXT_VPC_PROJECT_ID") != "" && os.Getenv("NSXT_VPC_ID") != "" +} + func testAccIsFabric() bool { return os.Getenv("NSXT_TEST_FABRIC") != "" } func testAccGetSessionContext() tf_api.SessionContext { - return tf_api.SessionContext{ProjectID: os.Getenv("NSXT_PROJECT_ID"), ClientType: testAccIsGlobalManager2()} + clientType := testAccIsGlobalManager2() + projectID := os.Getenv("NSXT_PROJECT_ID") + vpcID := "" + if clientType == tf_api.VPC { + projectID = os.Getenv("NSXT_VPC_PROJECT_ID") + vpcID = os.Getenv("NSXT_VPC_ID") + } + return tf_api.SessionContext{ProjectID: projectID, ClientType: clientType, VPCID: vpcID} } func testAccIsGlobalManager2() tf_api.ClientType { + if testAccIsVPC() { + return tf_api.VPC + } if os.Getenv("NSXT_PROJECT_ID") != "" { return tf_api.Multitenancy } @@ -677,6 +691,16 @@ func testAccNsxtPolicyResourceCheckDestroy(context tf_api.SessionContext, state } func testAccNsxtPolicyMultitenancyContext() string { + if testAccIsVPC() { + projectID := os.Getenv("NSXT_VPC_PROJECT_ID") + vpcID := os.Getenv("NSXT_VPC_ID") + return fmt.Sprintf(` + context { + project_id = "%s" + vpc_id = "%s" + } +`, projectID, vpcID) + } projectID := os.Getenv("NSXT_PROJECT_ID") if projectID != "" { return fmt.Sprintf(` diff --git a/tools/api-wrapper-generator.py b/tools/api-wrapper-generator.py index 3a8e1d14c..eae9fa9a7 100644 --- a/tools/api-wrapper-generator.py +++ b/tools/api-wrapper-generator.py @@ -76,6 +76,9 @@ def api_func_call_setup(api, subs_dict): arg_list = get_arglist(g[2]) if subs_dict['type'] == "Multitenancy": arg_list = ['utl.DefaultOrgID', 'c.ProjectID'] + arg_list + elif subs_dict['type'] == "VPC": + arg_list = ['utl.DefaultOrgID', 'c.ProjectID', 'c.VPCID'] + arg_list + arg_list.remove('domainIdParam') return '%s(%s)' % (g[1], ', '.join(arg_list)) @@ -88,6 +91,9 @@ def patch_func_call_setup(api, subs_dict): arg_list[n] = 'gmObj.(%s.%s)' % (subs_dict['model_import'], subs_dict['model_name']) elif subs_dict['type'] == "Multitenancy": arg_list = ['utl.DefaultOrgID', 'c.ProjectID'] + arg_list + elif subs_dict['type'] == "VPC": + arg_list = ['utl.DefaultOrgID', 'c.ProjectID', 'c.VPCID'] + arg_list + arg_list.remove('domainIdParam') return '%s(%s)' % (g[1], ', '.join(arg_list))