Skip to content

Commit

Permalink
check if saas
Browse files Browse the repository at this point in the history
  • Loading branch information
blrobl committed Feb 19, 2024
1 parent bd1231c commit 94e85ea
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ codeunit 2515 "AppSource Product Manager" implements "AppSource Product Manager
NextPageLink := ConstructProductListUri();

RestClient.Initialize();
if not AppSourceProductManagerDependencies.IsSaas() then
Error(NotSupportedOnPremisesErrorLbl);

if AppSourceProductManagerDependencies.ShouldSetCommonHeaders() then
SetCommonHeaders(RestClient);

Expand All @@ -360,8 +363,12 @@ codeunit 2515 "AppSource Product Manager" implements "AppSource Product Manager
Session.LogMessage('AL:AppSource-GetProduct', 'Requesting product details.', Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All, TelemetryDictionary);

RestClient.Initialize();
if not AppSourceProductManagerDependencies.IsSaas() then
Error(NotSupportedOnPremisesErrorLbl);

if AppSourceProductManagerDependencies.ShouldSetCommonHeaders() then
SetCommonHeaders(RestClient);

RestClient.SetDefaultRequestHeader('client-request-id', ClientRequestID);

exit(AppSourceProductManagerDependencies.GetAsJSon(RestClient, RequestUri).AsObject());
Expand Down Expand Up @@ -399,10 +406,6 @@ codeunit 2515 "AppSource Product Manager" implements "AppSource Product Manager
AzureAdTenant: Codeunit "Azure AD Tenant";
ApiKey: SecretText;
begin
Init();
if not AppSourceProductManagerDependencies.IsSaas() then
Error(NotSupportedOnPremisesErrorLbl);

AzureKeyVault.GetAzureKeyVaultSecret('MS-AppSource-ApiKey', ApiKey);

RestClient.SetDefaultRequestHeader('X-API-Key', ApiKey);
Expand Down

0 comments on commit 94e85ea

Please sign in to comment.