public async Task CreateResourcePolicy() { using (var session = await StartSession()) { var client = await session.GetClient(ApiPortals.SOC); await RemovePolicyIfExists(client); var newPolicy = new EnrichedResourcePolicy() { AllowDeployment = true, IsActive = true, CpuCores = 1, CpuLimitInMegahertz = 500, MemoryLimitInMegabytes = 500, Name = PolicyName, Type = ComputePolicyType.Presentation }; bool policyCreated = client.CreateResourcePolicy(newPolicy).Result; if (policyCreated) { var resourcePolicies = (await client.GetResourcePolicies()).resourcePolicies; var createdPolicy = resourcePolicies.First(t => t.Name == newPolicy.Name && t.MemoryLimitInMegabytes == newPolicy.MemoryLimitInMegabytes && t.CpuLimitInMegahertz == newPolicy.CpuLimitInMegahertz); Assert.NotNull(createdPolicy); } else { throw (new Exception("There was an error creating your resource policy")); } } }
public Task UpdateResourcePolicy(EnrichedResourcePolicy policy) { return(PutVoid("resourcepolicies", policy, SOC)); }
public Task <bool> CreateResourcePolicy(EnrichedResourcePolicy policy) { return(PostAsync <bool>("resourcepolicies", policy, SOC)); }