public RmAccessGroupView(RMResourceGroupEntiry view,string roleName):this(view) { this.RoleName = roleName; }
static void RetrieveResourceGroups() { Console.WriteLine("Start to sync RM resource groups ..."); string _subscriptionId = ConfigurationSettings.AppSettings["azureSubscriptionID"]; var client = new HttpClient(); var header = AuthenticationHelper.GetAuthorizationHeader(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", header); try { var myTask = client.GetStringAsync( String.Format( "https://management.chinacloudapi.cn/subscriptions/{0}/resourcegroups?api-version=2015-01-01", _subscriptionId)); var result = myTask.Result; JObject jObj = JObject.Parse(result); JToken jTk = jObj.GetValue("value").First; while (jTk != null) { var rmResourceGroup = new RMResourceGroupEntiry(jTk["name"].ToString(), jTk["location"].ToString()); rmResourceGroup.resourceGroupID = jTk["id"].ToString(); if (jTk["tags"] != null) { rmResourceGroup.tags = jTk["tags"].ToString(); } rmResourceGroup.properties = jTk["properties"].ToString(); rmResourceGroupOper.InsertEntity(rmResourceGroup); jTk = jTk.Next; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public RmAccessGroupView(RMResourceGroupEntiry view) { this.PartitionKey = view.PartitionKey; this.RowKey = view.RowKey; this.resourceGroupID = view.resourceGroupID; this.resourceGroupName = view.resourceGroupName; this.tags = view.tags; this.properties = view.properties; }
public bool InsertEntity(RMResourceGroupEntiry resourceGroup) { var operation = TableOperation.InsertOrReplace(resourceGroup); _table.Execute(operation); return true; }