public async override Task <IPolicyDefinition> CreateResourceAsync(CancellationToken cancellationToken) { PolicyDefinitionInner inner = new PolicyDefinitionInner { DisplayName = DisplayName, Description = Description, Mode = Mode, PolicyRule = PolicyRule, PolicyType = PolicyType }; await client.CreateOrUpdateAsync(Name, inner, cancellationToken); return(this); }
/// <summary> /// Creates or updates a policy definition in a subscription. /// </summary> /// <remarks> /// This operation creates or updates a policy definition in the given /// subscription with the given name. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='policyDefinitionName'> /// The name of the policy definition to create. /// </param> /// <param name='parameters'> /// The policy definition properties. /// </param> public static PolicyDefinition CreateOrUpdate(this IPolicyDefinitionsOperations operations, string policyDefinitionName, PolicyDefinition parameters) { return(operations.CreateOrUpdateAsync(policyDefinitionName, parameters).GetAwaiter().GetResult()); }