func NewExistingResources()

in pkg/brownfield/types.go [45:104]


func NewExistingResources(appGw n.ApplicationGateway, prohibitedTargets []*ptv1.AzureIngressProhibitedTarget, defaultPool *n.ApplicationGatewayBackendAddressPool) ExistingResources {
	var allExistingSettings []n.ApplicationGatewayBackendHTTPSettings
	if appGw.BackendHTTPSettingsCollection != nil {
		allExistingSettings = *appGw.BackendHTTPSettingsCollection
	}

	var allExistingRequestRoutingRules []n.ApplicationGatewayRequestRoutingRule
	if appGw.RequestRoutingRules != nil {
		allExistingRequestRoutingRules = *appGw.RequestRoutingRules
	}

	var allExistingListeners []n.ApplicationGatewayHTTPListener
	if appGw.HTTPListeners != nil {
		allExistingListeners = *appGw.HTTPListeners
	}

	var allExistingURLPathMap []n.ApplicationGatewayURLPathMap
	if appGw.URLPathMaps != nil {
		allExistingURLPathMap = *appGw.URLPathMaps
	}

	var allExistingPorts []n.ApplicationGatewayFrontendPort
	if appGw.FrontendPorts != nil {
		allExistingPorts = *appGw.FrontendPorts
	}

	var allExistingCertificates []n.ApplicationGatewaySslCertificate
	if appGw.SslCertificates != nil {
		allExistingCertificates = *appGw.SslCertificates
	}

	var allExistingHealthProbes []n.ApplicationGatewayProbe
	if appGw.Probes != nil {
		allExistingHealthProbes = *appGw.Probes
	}

	var allExistingBackendPools []n.ApplicationGatewayBackendAddressPool
	if appGw.BackendAddressPools != nil {
		allExistingBackendPools = *appGw.BackendAddressPools
	}

	var allExistingRedirects []n.ApplicationGatewayRedirectConfiguration
	if appGw.RedirectConfigurations != nil {
		allExistingRedirects = *appGw.RedirectConfigurations
	}

	return ExistingResources{
		BackendPools:       allExistingBackendPools,
		Certificates:       allExistingCertificates,
		RoutingRules:       allExistingRequestRoutingRules,
		Listeners:          allExistingListeners,
		URLPathMaps:        allExistingURLPathMap,
		HTTPSettings:       allExistingSettings,
		Ports:              allExistingPorts,
		Probes:             allExistingHealthProbes,
		Redirects:          allExistingRedirects,
		ProhibitedTargets:  prohibitedTargets,
		DefaultBackendPool: defaultPool,
	}
}