public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { if (binder.Name.Equals("ConfigureLogin", StringComparison.OrdinalIgnoreCase)) { this._loginType = (LoginType)args[0]; switch (this._loginType) { case LoginType.Spn: this._tenantId = args[1].ToString(); this._appId = args[2].ToString(); this._appKey = args[3].ToString(); break; case LoginType.Upn: this._userName = args[1].ToString(); this._password = args[2].ToString(); break; } GetAuthorizationHeader().Wait(); result = this; } else if (binder.Name.Equals("Query", StringComparison.OrdinalIgnoreCase)) { var query = this._query + "&" + args[0]; result = new ARMLib(this, this._url, query); } else { result = InvokeDynamicMember(binder.Name, args); } return(true); }
private bool TryHandleDynamicCall(string name, out object result) { if (this._tokenCacheInfo == null) { GetAuthorizationHeader().Wait(); } var url = string.Format("{0}/{1}", _url, name); result = new ARMLib(this, url, this._query); return(true); }
private ARMLib(ARMLib oldClient, string url, string query) { this._loginType = oldClient._loginType; this._apiVersion = oldClient._apiVersion; this._appId = oldClient._appId; this._appKey = oldClient._appKey; this._authHelper = oldClient._authHelper; this._tokenCacheInfo = oldClient._tokenCacheInfo; this._azureEnvironment = oldClient._azureEnvironment; this._loginType = oldClient._loginType; this._password = oldClient._password; this._tenantId = oldClient._tenantId; this._userName = oldClient._userName; this._query = query; this._url = url; }