public ValidatePublishing(HttpClient httpClient, LogicTokenProviderFactory tokenProviderFactory, GatewayOptions options) { this.options = options; this.gatewayClientFactory = new GatewayClientFactory(tokenProviderFactory, httpClient, options); this.httpClient = httpClient; this.logicTokenProviderFactory = tokenProviderFactory; }
internal PublishPolicies(HttpClient httpClient, LogicTokenProviderFactory tokenProviderFactory, GatewayOptions options, List <GatewayAutomationResult> publishResults) { this.options = options ?? throw new ArgumentNullException(nameof(options)); if (tokenProviderFactory == null) { throw new ArgumentNullException(nameof(tokenProviderFactory)); } if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } this.gatewayClientFactory = new GatewayClientFactory(tokenProviderFactory, httpClient, options); this.publishResults = publishResults; }
/// <summary> /// Initializes a new instance of the <see cref="Publish"/> class. /// </summary> /// <param name="httpClient">The HTTP client to use. The caller is expected to manage this resource and it will not be disposed.</param> /// <param name="tokenProviderFactory">The Logic access token provider factory.</param> /// <param name="options">The required configuration options.</param> public Publish(HttpClient httpClient, LogicTokenProviderFactory tokenProviderFactory, GatewayOptions options) { this.options = options ?? throw new ArgumentNullException(nameof(options)); if (tokenProviderFactory == null) { throw new ArgumentNullException(nameof(tokenProviderFactory)); } if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } this.gatewayClientFactory = new GatewayClientFactory(tokenProviderFactory, httpClient, options); this.validatePublishing = new ValidatePublishing(httpClient, tokenProviderFactory, options); this.publishResults = new List <GatewayAutomationResult>(); }
private static IEnumerable <GatewayAutomationResult> PreValidateEntities(string folderPath, PublishFileModel publishFileModel, HttpClient httpClient, GatewayOptions options, LogicTokenProviderFactory logicTokenProvider) { var preValidations = new List <IPreValidation> { new ProductsPreValidation(folderPath), new ApisPreValidation(folderPath, httpClient, logicTokenProvider, options), }; var publishResults = new List <GatewayAutomationResult>(); foreach (var validation in preValidations) { var results = validation.ValidateAsync(publishFileModel); publishResults.AddRange(results); } return(publishResults); }
public GatewayAutomation(HttpClient httpClient, LogicTokenProviderFactory tokenProviderFactory, GatewayOptions options) { if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } if (tokenProviderFactory == null) { throw new ArgumentNullException(nameof(tokenProviderFactory)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (!options.ProviderId.HasValue || options.ProviderId.Value == Guid.Empty) { using var client = new GatewayClientFactory(tokenProviderFactory, httpClient, options).CreateClient(); var provider = client.GetGatewayProviders(options.SubscriptionId.ToString())?.SingleOrDefault(x => x.SubscriptionId == options.SubscriptionId); if (provider == null) { throw new ArgumentException("providerId not found"); } options.ProviderId = provider.Id; } this.validatePublishing = new ValidatePublishing(httpClient, tokenProviderFactory, options); this.publish = new Publish(httpClient, tokenProviderFactory, options); }
public GatewayAutomation(HttpClient httpClient, LogicTokenProviderFactory tokenProviderFactory, GatewayOptions options) { if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } if (tokenProviderFactory == null) { throw new ArgumentNullException(nameof(tokenProviderFactory)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } this.validatePublishing = new ValidatePublishing(httpClient, tokenProviderFactory, options); this.publish = new Publish(httpClient, tokenProviderFactory, options); }