Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 82edf48

Browse files
committed
extract all backends for single api by default for time being
1 parent a4ad193 commit 82edf48

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/APIM_ARMTemplate/apimtemplate/Extractor/EntityExtractors/BackendExtractor.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,32 @@ public async Task<Template> GenerateBackendsARMTemplate(string apimname, string
5656
backendTemplateResource.name = $"[concat(parameters('ApimServiceName'), '/{backendName}')]";
5757
backendTemplateResource.apiVersion = GlobalConstants.APIVersion;
5858

59-
//only extract the backend if this is a full extraction, or in the case of a single api, if it is referenced by one of the policies
60-
if (singleApiName == null)
61-
{
62-
// if the user is extracting all apis, extract all the backends
63-
Console.WriteLine("'{0}' Backend found", backendName);
64-
templateResources.Add(backendTemplateResource);
65-
}
66-
else
67-
{
68-
bool isReferencedInPolicy = false;
69-
foreach (PolicyTemplateResource policyTemplateResource in policyResources)
70-
{
71-
// the backend is used in a policy if the xml contains a set-backend-service policy, which will reference the backend's url or id
72-
string policyContent = policyTemplateResource.properties.policyContent;
73-
isReferencedInPolicy = DoesPolicyReferenceBackend(policyContent, namedValueResources, backendName, backendTemplateResource);
74-
}
75-
if (isReferencedInPolicy == true)
76-
{
77-
// backend was used in policy, extract it
78-
Console.WriteLine("'{0}' Backend found", backendName);
79-
templateResources.Add(backendTemplateResource);
80-
}
81-
}
59+
////only extract the backend if this is a full extraction, or in the case of a single api, if it is referenced by one of the policies
60+
//if (singleApiName == null)
61+
//{
62+
// // if the user is extracting all apis, extract all the backends
63+
// Console.WriteLine("'{0}' Backend found", backendName);
64+
// templateResources.Add(backendTemplateResource);
65+
//}
66+
//else
67+
//{
68+
// bool isReferencedInPolicy = false;
69+
// foreach (PolicyTemplateResource policyTemplateResource in policyResources)
70+
// {
71+
// // the backend is used in a policy if the xml contains a set-backend-service policy, which will reference the backend's url or id
72+
// string policyContent = policyTemplateResource.properties.policyContent;
73+
// isReferencedInPolicy = DoesPolicyReferenceBackend(policyContent, namedValueResources, backendName, backendTemplateResource);
74+
// }
75+
// if (isReferencedInPolicy == true)
76+
// {
77+
// // backend was used in policy, extract it
78+
// Console.WriteLine("'{0}' Backend found", backendName);
79+
// templateResources.Add(backendTemplateResource);
80+
// }
81+
//}
82+
83+
Console.WriteLine("'{0}' Backend found", backendName);
84+
templateResources.Add(backendTemplateResource);
8285
}
8386

8487
armTemplate.resources = templateResources.ToArray();

0 commit comments

Comments
 (0)