public static Kind <T> Build <T>( string groupName, string apiVersion, string kindName, string kindNamePlural, Func <T, ResourceDocument?> convertToDocument, Func <ResourceDocument, T?> convertToResource, Action <Builder> metadata, Action <Builder> definition, Action <Builder>?spec = null, Action <Builder>?state = null, Kind?extendsKind = null) where T : class, IResource { var metadataBuilder = new Builder(); var definitionBuilder = new Builder(); var specBuilder = spec != null ? new Builder() : default; var stateBuilder = state != null ? new Builder() : default; metadata(metadataBuilder); definition(definitionBuilder); #pragma warning disable CS8604 // Possible null reference argument. spec?.Invoke(specBuilder); state?.Invoke(stateBuilder); #pragma warning restore CS8604 // Possible null reference argument. var schema = new KindSchema( metadataBuilder.BuildSchema(), definitionBuilder.BuildSchema(), specBuilder?.BuildSchema(), stateBuilder?.BuildSchema() ); return(new Kind <T>(kindName, kindNamePlural, groupName, apiVersion, schema, extendsKind, convertToDocument, convertToResource)); }
public Kind(string kindName, string kindNamePlural, string group, string apiVersion, KindSchema schema, Kind?extendsKind) { KindName = kindName; KindNamePlural = kindNamePlural; Group = group; ApiVersion = apiVersion; Schema = schema; ExtendsKind = extendsKind; }
public SchemaDrivenKind(string kindName, string kindNamePlural, string group, string apiVersion, KindSchema schema, Kind?extendsKind) : base(kindName, kindNamePlural, group, apiVersion, schema, extendsKind, ConvertToDocument, ConvertToResource) { }