Add ForceNew and Computed schema support.

This commit is contained in:
Junyi Yi 2018-04-13 11:58:02 -07:00
Родитель 0b903ec5f1
Коммит 1171ff63da
4 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -54,10 +54,6 @@
"source": "{:**:}",
"target": "/",
"priority": "Lowest"
}],
"import": [{
"type": "{:**:}",
"package": "hdinsight"
}]
},
"setId": true

Просмотреть файл

@ -47,6 +47,14 @@
Indentation.Indent();
@:@(Indentation)@(subField.IsRequired ? "Required" : "Optional"): true,
if (subField.IsReadOnly)
{
@:@(Indentation)Computed: true,
}
if (subField.IsCreateOnly)
{
@:@(Indentation)ForceNew: true,
}
Indentation.Outdent();
var goType = subField.GoType;

Просмотреть файл

@ -40,7 +40,7 @@ namespace AutoRest.Terraform
public IEnumerable<GoSDKTypedData> Children => Properties;
private GoSDKInvocation Invocation { get; }
public GoSDKInvocation Invocation { get; }
public void AddProperties(IEnumerable<GoSDKTypedData> props)
{

Просмотреть файл

@ -36,6 +36,9 @@ namespace AutoRest.Terraform
select f;
public bool IsRoot => Parent == null;
public bool IsRequired => OriginalVariable?.IsRequired ?? SubFields.Any(sf => sf.IsRequired);
public bool IsReadOnly => updatedBy.Count > 0 && usedBy.Count == 0;
public bool IsCreateOnly => usedBy.Any(d => d.Invocation.Category == InvocationCategory.Creation) &&
usedBy.All(d => d.Invocation.Category != InvocationCategory.Update);
public string DefaultValue => OriginalVariable.DefaultValue;
public bool MightBeEmpty => !IsRequired && string.IsNullOrEmpty(DefaultValue);