public void Create() { var service = GaoApi.Create <ICommonService>(); Assert.NotNull(service); this.output.WriteLine("using GaoApi.Create to get a instance of client proxy"); }
public void GetApiUrlByRegion(Region region) { this.output.WriteLine("GetApiUrlByRegion testing"); var usGovDatacentre = GaoApi.GetApiUrlByRegion(region); Assert.Equal("https://gausgovapi.avepointonlineservices.com", usGovDatacentre); }
public void Init001(Region region, String username, String password) { Assert.Equal(1, this.fixtrue.ExecutionCount); Assert.True(this.fixtrue.InitStatus); this.output.WriteLine("GaoApi class should be initialized once"); GaoApi.Init(region, username, password); }
public void CombineGaoApi(Region region, String username, String password) { GaoApi.Init(region, username, password); var service = GaoApi.Create <ICommonService>(); Assert.NotNull(service); this.output.WriteLine("using GaoApi.Create to get a instance of client proxy"); }
/// <summary> /// Initialize the API client /// </summary> private void Initialize() { //Your Cloud Governance user name var username = ""; //Your Cloud Governance password var password = ""; GaoApi.Init(Region.EastUS, username, password); this.commonService = GaoApi.Create <ICommonService>(); this.requestService = GaoApi.Create <IRequestService>(); }
public void IsUrlValid( String requestId, String securityToken) { try { Trace.TraceInformation( $"Start checking if site collection.requestId:{requestId}, " + "securityToken:{securityToken}"); //Cloud Governance Client Sdk need a Region url and security token //to callback the Cloud Governance web api. //New method is a instance level api, that means you get a clear object each time var requestService = GaoApi.New <IRequestService>(Region.EastUS, securityToken); //In Cloud Governance Client Sdk, everty request id link to one request type, //In this case, the request is a ProvSite request. var request = requestService.Get(new Guid(requestId)) as APIRequestProvSite; var url = (request?.Url.ManagedPath + request?.Url.Url).TrimStart('/'); //A url repository which hold the block urls var blockedUrLs = UrlStore.Get(); if (blockedUrLs.Contains(url.ToLower())) { Trace.TraceInformation("The request url {0} is blocked", url); throw new WebException("The request site collection url is not valid"); } Trace.TraceInformation("The request url {0} is valid", url); } catch (Exception ex) { Trace.TraceError("An error occurred while validating the " + $"site collection url, reason {ex}"); throw; } }
public GaoApiClassFixtrue() { this.InitStatus = true; GaoApi.Init(Region.SoutheastAsia, "*****@*****.**", "*****@*****.**"); this.ExecutionCount++; }