Пример #1
0
        public Endpoint BuildEndpoint(IDictionary <string, string> messageProperties,
                                      VariableDictionary variables,
                                      Func <string, string> accountIdResolver,
                                      Func <string, string> certificateIdResolver,
                                      Func <string, string> workerPoolIdResolver,
                                      Func <string, AccountType> accountTypeResolver,
                                      Func <string, string> feedIdResolver,
                                      ITaskLog taskLog)
        {
            var endpoint = new AzureWebAppEndpoint
            {
                AccountId = GetAccountId(messageProperties, variables, accountIdResolver, taskLog),
            };

            messageProperties.TryGetValue(AzureWebAppServiceMessageNames.WebAppNameAttribute, out var wepAppName);
            messageProperties.TryGetValue(AzureWebAppServiceMessageNames.ResourceGroupNameAttribute, out var resourceGroupName);

            if (wepAppName is null)
            {
                throw new ControlledActionFailedException("App Service name was not provided");
            }
            if (resourceGroupName is null)
            {
                throw new ControlledActionFailedException("Resource group name was not provided");
            }

            endpoint.WebAppName        = wepAppName;
            endpoint.ResourceGroupName = resourceGroupName;

            if (messageProperties.TryGetValue(AzureWebAppServiceMessageNames.WebAppSlotNameAttribute, out var webAppSlotName) &&
                !string.IsNullOrWhiteSpace(webAppSlotName))
            {
                endpoint.WebAppSlotName = webAppSlotName;
            }

            endpoint.DefaultWorkerPoolId = GetWorkerPoolId(messageProperties, variables, workerPoolIdResolver);

            return(endpoint);
        }
Пример #2
0
 public void Setup()
 {
     sut      = new AzureWebAppEndpointValidator();
     endpoint = new AzureWebAppEndpoint();
 }