protected override void ProcessRecord() { base.ProcessRecord(); if (Detection != null) { var url = ApiV2.GetShardUrl(ApiV2.ShardUrl.PROTECT, "euc1", $"/Optics#/detect/{Detection.id}"); Process.Start(url); } }
public Api(ApiConfig config) { this.Config = config; this.Game = this.Config.Game; switch (this.Config.Version) { case ApiVersion.V2: this.V2 = new ApiV2(this); this.Authentication = this.V2.Authentication; break; } }
private void SetupApis() { Error = new ErrorApi { Client = this }; Account = new AccountApi { Client = this }; Application = new ApplicationApi { Client = this }; AvailableNumber = new AvailableNumberApi { Client = this }; Bridge = new BridgeApi { Client = this }; Domain = new DomainApi { Client = this }; Call = new CallApi { Client = this }; Conference = new ConferenceApi { Client = this }; Message = new MessageApi { Client = this }; NumberInfo = new NumberInfoApi { Client = this }; PhoneNumber = new PhoneNumberApi { Client = this }; Recording = new RecordingApi { Client = this }; Transcription = new TranscriptionApi { Client = this }; Media = new MediaApi { Client = this }; Endpoint = new EndpointApi { Client = this }; V2 = new ApiV2 { Message = new Bandwidth.Net.ApiV2.MessageApi { Client = this } }; }
protected override void BeginProcessing() { base.BeginProcessing(); var TDRUrl = "https://protect.cylance.com/Reports/ThreatDataReportV1/"; var APIAuthUrl = "https://protectapi.cylance.com/auth/v2/token"; switch (Region) { case "apne1": case "au": case "euc1": case "sae1": TDRUrl = $"https://protect-{Region}.cylance.com/Reports/ThreatDataReportV1/"; APIAuthUrl = $"https://protectapi-{Region}.cylance.com/auth/v2/token"; break; case "us-gov": TDRUrl = "https://protect.us.cylance.com/Reports/ThreatDataReportV1/"; APIAuthUrl = "https://protectapi.us.cylance.com/auth/v2/token"; break; } var apiSecret = ConvertToSecureString("APISecret", APISecret); var console = ConfigurationManager.Default.New(); console.ConsoleId = Console; console.APIId = APIId; console.SetAPISecret(apiSecret); console.APITenantId = APITenantId; console.APIUrl = APIAuthUrl; console.TDRUrl = TDRUrl; var apiSession = new ApiV2Session { APIId = console.APIId, APISecret = console.APISecret.Value, APITenantId = console.APITenantId, APIBaseUrl = console.APIUrl, Proxy = (string.IsNullOrEmpty(ProxyServer)) ? null : new System.Net.WebProxy(ProxyServer) }; ApiConnectionHandle session = new ApiConnectionHandle(apiSession); ApiV2 Connection = new ApiV2(apiSession); Connection.ConnectAsync().Wait(); if (null != LoginPassword) { var loginPassword = ConvertToSecureString("LoginPassword", LoginPassword); console.SetLoginPassword(loginPassword); } if (!string.IsNullOrEmpty(LoginUser)) { console.LoginUser = LoginUser; } WriteVerbose($"Writing new console entry '{console.ConsoleId}' for API ID {console.APIId}, Tenant ID {console.APITenantId}, API auth URL {console.APIUrl}, TDR URL {console.TDRUrl}"); ConfigurationManager.Default.Write(console); }