From ca042cea6f72eed98dd44a2b7d1a1a1098e2466f Mon Sep 17 00:00:00 2001 From: Fumigatus Date: Wed, 17 Jul 2024 11:02:32 +0300 Subject: [PATCH] lint action fixed --- config/beta/config.go | 23 ++--- config/deprecated/config.go | 121 +++++++++++++------------- config/dhcp/config.go | 2 +- config/evpn/config.go | 2 +- config/firewall/config.go | 41 +++++---- config/gateways_and_routing/config.go | 69 ++++++++------- config/ipam/config.go | 23 ++--- config/load_balancer/config.go | 2 +- config/multitenancy/config.go | 2 +- config/ospf/config.go | 2 +- config/segments/config.go | 34 ++++---- config/vpn/config.go | 22 ++--- 12 files changed, 179 insertions(+), 164 deletions(-) diff --git a/config/beta/config.go b/config/beta/config.go index 23cd19b..87f54b2 100644 --- a/config/beta/config.go +++ b/config/beta/config.go @@ -4,61 +4,62 @@ import ( "github.com/upbound/upjet/pkg/config" ) -// ExternalNameConfigured returns a list of all external name resources -// configured for this provider. +const version string = "v1alpha1" + +// Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_cluster_virtual_ip", func(r *config.Resource) { r.ShortGroup = "nsxtclustervirtualip" r.Kind = "ClusterVirtualIp" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_compute_manager", func(r *config.Resource) { r.ShortGroup = "nsxtcomputemanager" r.Kind = "ComputeManager" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_edge_cluster", func(r *config.Resource) { r.ShortGroup = "nsxtedgecluster" r.Kind = "EdgeCluster" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_failure_domain", func(r *config.Resource) { r.ShortGroup = "nsxtfailuredomain" r.Kind = "FailureDomain" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_manager_cluster", func(r *config.Resource) { r.ShortGroup = "nsxtmanagercluster" r.Kind = "ManagerCluster" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_host_transport_node_profile", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyhosttransportnodeprofile" r.Kind = "PolicyHostTransportNodeProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_transport_zone", func(r *config.Resource) { r.ShortGroup = "nsxtpolicytransportzone" r.Kind = "PolicyTransportZone" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_transport_node", func(r *config.Resource) { r.ShortGroup = "nsxttransportnode" r.Kind = "TransportNode" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_uplink_host_switch_profile", func(r *config.Resource) { r.ShortGroup = "nsxtuplinkhostswitchprofile" r.Kind = "UplinkHostSwitchProfile" - r.Version = "v1alpha1" + r.Version = version }) } diff --git a/config/deprecated/config.go b/config/deprecated/config.go index 11f0ae5..e23dc0e 100644 --- a/config/deprecated/config.go +++ b/config/deprecated/config.go @@ -4,299 +4,300 @@ import ( "github.com/upbound/upjet/pkg/config" ) -// ExternalNameConfigured returns a list of all external name resources -// configured for this provider. +const version = "v1alpha1" + +// Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_algorithm_type_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxtalgorithmtypensservice" r.Kind = "AlgorithmTypeNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_dhcp_relay_profile", func(r *config.Resource) { r.ShortGroup = "nsxtdhcprelayprofile" r.Kind = "DhcpRelayProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_dhcp_relay_service", func(r *config.Resource) { r.ShortGroup = "nsxtdhcprelayservice" r.Kind = "DhcpRelayService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_dhcp_server_ip_pool", func(r *config.Resource) { r.ShortGroup = "nsxtdhcpserverippool" r.Kind = "DhcpServerIpPool" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_dhcp_server_profile", func(r *config.Resource) { r.ShortGroup = "nsxtdhcpserverprofile" r.Kind = "DhcpServerProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ether_type_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxtethertypensservice" r.Kind = "EtherTypeNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_firewall_section", func(r *config.Resource) { r.ShortGroup = "nsxtfirewallsection" r.Kind = "FirewallSection" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_icmp_type_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxticmptypensservice" r.Kind = "IcmpTypeNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_igmp_type_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxtigmptypensservice" r.Kind = "IgmpTypeNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_block", func(r *config.Resource) { r.ShortGroup = "nsxtipblock" r.Kind = "IpBlock" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_block_subnet", func(r *config.Resource) { r.ShortGroup = "nsxtipblocksubnet" r.Kind = "IpBlockSubnet" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_discovery_switching_profile", func(r *config.Resource) { r.ShortGroup = "nsxtipdiscoveryswitchingprofile" r.Kind = "IpDiscoverySwitchingProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_pool", func(r *config.Resource) { r.ShortGroup = "nsxtippool" r.Kind = "IpPool" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_pool_allocation_ip_address", func(r *config.Resource) { r.ShortGroup = "nsxtippoolallocationipaddress" r.Kind = "IpPoolAllocationIpAddress" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_protocol_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxtipprotocolnsservice" r.Kind = "IpProtocolNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ip_set", func(r *config.Resource) { r.ShortGroup = "nsxtipset" r.Kind = "IpSet" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_l4_port_set_ns_service", func(r *config.Resource) { r.ShortGroup = "nsxtl4portsetnsservice" r.Kind = "L4PortSetNsService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_client_ssl_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbclientsslprofile" r.Kind = "LbClientSslProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_cookie_persistence_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbcookiepersistenceprofile" r.Kind = "LbCookiePersistenceProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_fast_tcp_application_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbfasttcpapplicationprofile" r.Kind = "LbFastTcpApplicationProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_fast_udp_application_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbfastudpapplicationprofile" r.Kind = "LbFastUdpApplicationProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_application_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpapplicationprofile" r.Kind = "LbHttpApplicationProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_forwarding_rule", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpforwardingrule" r.Kind = "LbHttpForwardingRule" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpmonitor" r.Kind = "LbHttpMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_request_rewrite_rule", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttprequestrewriterule" r.Kind = "LbHttpRequestRewriteRule" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_response_rewrite_rule", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpresponserewriterule" r.Kind = "LbHttpResponseRewriteRule" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_http_virtual_server", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpvirtualserver" r.Kind = "LbHttpVirtualServer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_https_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbhttpsmonitor" r.Kind = "LbHttpsMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_icmp_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbicmpmonitor" r.Kind = "LbIcmpMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_passive_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbpassivemonitor" r.Kind = "LbPassiveMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_pool", func(r *config.Resource) { r.ShortGroup = "nsxtlbpool" r.Kind = "LbPool" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_server_ssl_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbserversslprofile" r.Kind = "LbServerSslProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_service", func(r *config.Resource) { r.ShortGroup = "nsxtlbservice" r.Kind = "LbService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_source_ip_persistence_profile", func(r *config.Resource) { r.ShortGroup = "nsxtlbsourceippersistenceprofile" r.Kind = "LbSourceIpPersistenceProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_tcp_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbtcpmonitor" r.Kind = "LbTcpMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_tcp_virtual_server", func(r *config.Resource) { r.ShortGroup = "nsxtlbtcpvirtualserver" r.Kind = "LbTcpVirtualServer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_udp_monitor", func(r *config.Resource) { r.ShortGroup = "nsxtlbudpmonitor" r.Kind = "LbUdpMonitor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_lb_udp_virtual_server", func(r *config.Resource) { r.ShortGroup = "nsxtlbudpvirtualserver" r.Kind = "LbUdpVirtualServer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_dhcp_port", func(r *config.Resource) { r.ShortGroup = "nsxtlogicaldhcpport" r.Kind = "LogicalDhcpPort" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_dhcp_server", func(r *config.Resource) { r.ShortGroup = "nsxtlogicaldhcpserver" r.Kind = "LogicalDhcpServer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_port", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalport" r.Kind = "LogicalPort" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_router_centralized_service_port", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalroutercentralizedserviceport" r.Kind = "LogicalRouterCentralizedServicePort" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_router_downlink_port", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalrouterdownlinkport" r.Kind = "LogicalRouterDownlinkPort" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_router_link_port_on_tier0", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalrouterlinkportontier0" r.Kind = "LogicalRouterLinkPortOnTier0" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_router_link_port_on_tier1", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalrouterlinkportontier1" r.Kind = "LogicalRouterLinkPortOnTier1" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_switch", func(r *config.Resource) { r.ShortGroup = "nsxtlogicalswitch" r.Kind = "LogicalSwitch" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_tier0_router", func(r *config.Resource) { r.ShortGroup = "nsxtlogicaltier0router" r.Kind = "LogicalTier0Router" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_logical_tier1_router", func(r *config.Resource) { r.ShortGroup = "nsxtlogicaltier1router" r.Kind = "LogicalTier1Router" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_mac_management_switching_profile", func(r *config.Resource) { r.ShortGroup = "nsxtmacmanagementswitchingprofile" r.Kind = "MacManagementSwitchingProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_nat_rule", func(r *config.Resource) { r.ShortGroup = "nsxtnatrule" r.Kind = "NatRule" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ns_group", func(r *config.Resource) { r.ShortGroup = "nsxtnsgroup" r.Kind = "NsGroup" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_ns_service_group", func(r *config.Resource) { r.ShortGroup = "nsxtnsservicegroup" r.Kind = "NsServiceGroup" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_qos_switching_profile", func(r *config.Resource) { r.ShortGroup = "nsxtqosswitchingprofile" r.Kind = "QosSwitchingProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_spoofguard_switching_profile", func(r *config.Resource) { r.ShortGroup = "nsxtspoofguardswitchingprofile" r.Kind = "SpoofguardSwitchingProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_static_route", func(r *config.Resource) { r.ShortGroup = "nsxtstaticroute" r.Kind = "StaticRoute" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_switch_security_switching_profile", func(r *config.Resource) { r.ShortGroup = "nsxtswitchsecurityswitchingprofile" r.Kind = "SwitchSecuritySwitchingProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_vlan_logical_switch", func(r *config.Resource) { r.ShortGroup = "nsxtvlanlogicalswitch" r.Kind = "VlanLogicalSwitch" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_vm_tags", func(r *config.Resource) { r.ShortGroup = "nsxtvmtags" r.Kind = "VmTags" - r.Version = "v1alpha1" + r.Version = version }) } diff --git a/config/dhcp/config.go b/config/dhcp/config.go index bcc4f55..b2e42f2 100644 --- a/config/dhcp/config.go +++ b/config/dhcp/config.go @@ -21,7 +21,7 @@ func Configure(p *config.Provider) { r.Kind = "PolicyDhcpV4StaticBinding" r.Version = "v1alpha1" }) - + p.AddResourceConfigurator("nsxt_policy_dhcp_v6_static_binding", func(r *config.Resource) { r.ShortGroup = "dhcp" r.Kind = "PolicyDhcpV6StaticBinding" diff --git a/config/evpn/config.go b/config/evpn/config.go index 915fd23..65ea011 100644 --- a/config/evpn/config.go +++ b/config/evpn/config.go @@ -21,7 +21,7 @@ func Configure(p *config.Provider) { r.Kind = "PolicyEvpnTunnelEndPoint" r.Version = "v1alpha1" }) - + p.AddResourceConfigurator("nsxt_policy_vni_pool", func(r *config.Resource) { r.ShortGroup = "evpn" r.Kind = "PolicyVniPool" diff --git a/config/firewall/config.go b/config/firewall/config.go index 74933f4..4dc1101 100644 --- a/config/firewall/config.go +++ b/config/firewall/config.go @@ -2,54 +2,57 @@ package firewall import "github.com/upbound/upjet/pkg/config" +const shortGroup string = "firewall" +const version string = "v1alpha1" + // Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_policy_context_profile", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyContextProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_context_profile_custom_attribute", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyContextProfileCustomAttribute" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_gateway_policy", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayPolicy" - r.Version = "v1alpha1" + r.Version = version }) - + p.AddResourceConfigurator("nsxt_policy_intrusion_service_policy", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyInstrusionServicePolicy" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_intrusion_service_profile", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyInstrusionServiceProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_predefined_gateway_policy", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyPredefinedGatewayPolicy" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_predefined_security_policy", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyPredefinedSecurityPolicy" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_security_policy", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicySecurityPolicy" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_service", func(r *config.Resource) { - r.ShortGroup = "firewall" + r.ShortGroup = shortGroup r.Kind = "PolicyService" - r.Version = "v1alpha1" + r.Version = version }) } diff --git a/config/gateways_and_routing/config.go b/config/gateways_and_routing/config.go index be42367..14c3960 100644 --- a/config/gateways_and_routing/config.go +++ b/config/gateways_and_routing/config.go @@ -2,89 +2,92 @@ package gatewaysandrouting import "github.com/upbound/upjet/pkg/config" +const shortGroup = "gatewaysandrouting" +const version = "v1alpha1" + // Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_policy_bgp_config", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyBgpConfig" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_bgp_neighbor", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyBgpMeighbor" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_gateway_community_list", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayCommunityList" - r.Version = "v1alpha1" + r.Version = version }) - + p.AddResourceConfigurator("nsxt_policy_gateway_prefix_list", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayPrefixList" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_gateway_qos_profile", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayQosProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_gateway_redistribution_config", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayRedistributionConfig" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_gateway_route_map", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyGatewayRouteMap" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_static_route_bfd_peer", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyStaticRouteBfdPeer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_nat_rule", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyNatRule" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ospf_config", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyOspfConfig" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_static_route", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyStaticRoute" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_tier0_gateway", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyTier0Gateway" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_tier0_gateway_ha_vip_config", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyTier0GatewayHaVipConfig" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_tier0_gateway_interface", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyTier0GatewayInterface" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_tier1_gateway", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyTier1Gateway" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_tier1_gateway_interface", func(r *config.Resource) { - r.ShortGroup = "gatewaysandrouting" + r.ShortGroup = shortGroup r.Kind = "PolicyTier1GatewayInterface" - r.Version = "v1alpha1" + r.Version = version }) } diff --git a/config/ipam/config.go b/config/ipam/config.go index f9a360e..fe9bf3f 100644 --- a/config/ipam/config.go +++ b/config/ipam/config.go @@ -2,34 +2,37 @@ package ipam import "github.com/upbound/upjet/pkg/config" +const shortGroup = "ipam" +const version = "v1alpha1" + // Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_policy_ip_address_allocation", func(r *config.Resource) { - r.ShortGroup = "ipam" + r.ShortGroup = shortGroup r.Kind = "PolicyIpAddressAllocation" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ip_block", func(r *config.Resource) { - r.ShortGroup = "ipam" + r.ShortGroup = shortGroup r.Kind = "PolicyIpBlock" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ip_pool", func(r *config.Resource) { - r.ShortGroup = "ipam" + r.ShortGroup = shortGroup r.Kind = "PolicyIpPool" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ip_pool_block_subnet", func(r *config.Resource) { - r.ShortGroup = "ipam" + r.ShortGroup = shortGroup r.Kind = "PolicyIpPoolBlockSubnet" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ip_pool_static_subnet", func(r *config.Resource) { - r.ShortGroup = "ipam" + r.ShortGroup = shortGroup r.Kind = "PolicyIpPoolStaticSubnet" - r.Version = "v1alpha1" + r.Version = version }) } diff --git a/config/load_balancer/config.go b/config/load_balancer/config.go index c4064fe..6ffa2e5 100644 --- a/config/load_balancer/config.go +++ b/config/load_balancer/config.go @@ -21,5 +21,5 @@ func Configure(p *config.Provider) { r.Kind = "PolicyLbVirtualServer" r.Version = "v1alpha1" }) - + } diff --git a/config/multitenancy/config.go b/config/multitenancy/config.go index be95fa6..5fc46b6 100644 --- a/config/multitenancy/config.go +++ b/config/multitenancy/config.go @@ -9,5 +9,5 @@ func Configure(p *config.Provider) { r.Kind = "PolicyProject" r.Version = "v1alpha1" }) - + } diff --git a/config/ospf/config.go b/config/ospf/config.go index 919a746..2015b0a 100644 --- a/config/ospf/config.go +++ b/config/ospf/config.go @@ -9,5 +9,5 @@ func Configure(p *config.Provider) { r.Kind = "PolicyOspfArea" r.Version = "v1alpha1" }) - + } diff --git a/config/segments/config.go b/config/segments/config.go index db5c413..3741403 100644 --- a/config/segments/config.go +++ b/config/segments/config.go @@ -2,53 +2,55 @@ package segments import "github.com/upbound/upjet/pkg/config" +const shortGroup = "segments" +const version = "v1alpha1" + // Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_policy_fixed_segment", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicyFixedSegment" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ip_discovery_profile", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicyIpDiscoveryProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_mac_discovery_profile", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicyMacDiscoveryProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_qos_profile", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicyQosProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_segment", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicySegment" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_segment_security_profile", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicySegmentSecurityProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_spoof_guard_profile", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicySpoofGuardProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_vlan_segment", func(r *config.Resource) { - r.ShortGroup = "segments" + r.ShortGroup = shortGroup r.Kind = "PolicyVlanSegment" r.Version = "v1alpha1" }) - } diff --git a/config/vpn/config.go b/config/vpn/config.go index 2e3ab4e..386339f 100644 --- a/config/vpn/config.go +++ b/config/vpn/config.go @@ -2,56 +2,58 @@ package vpn import "github.com/upbound/upjet/pkg/config" -func Configure(p *config.Provider) { +const version = "v1alpha1" +// Configure configures individual resources by adding custom ResourceConfigurators. +func Configure(p *config.Provider) { p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_dpd_profile", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpndpdprofile" r.Kind = "PolicyIpsecVpnDpdProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_local_endpoint", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpnlocalendpoint" r.Kind = "PolicyIpsecVpnLocalEndpoint" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_ike_profile", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpnikeprofile" r.Kind = "PolicyIpsecVpnIkeProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_session", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpnsession" r.Kind = "PolicyIpsecVpnSession" - r.Version = "v1alpha1" - + r.Version = version + }) p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_service", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpnservice" r.Kind = "PolicyIpsecVpnService" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_ipsec_vpn_tunnel_profile", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyipsecvpntunnelprofile" r.Kind = "PolicyIpsecVpnTunnelProfile" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_l2_vpn_server", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyl2vpnserver" r.Kind = "PolicyL2VpnServer" - r.Version = "v1alpha1" + r.Version = version }) p.AddResourceConfigurator("nsxt_policy_l2_vpn_session", func(r *config.Resource) { r.ShortGroup = "nsxtpolicyl2vpnsession" r.Kind = "PolicyL2VpnSession" - r.Version = "v1alpha1" + r.Version = version }) }