public static ResourceDocumentDefinition FromDefinition(ResourceDefinition resourceDefinition) { var ret = new ResourceDocumentDefinition(); foreach (var field in resourceDefinition.Fields) { ret.Fields.Add(ResourceDocumentField.FromField(field)); } return(ret); }
public static ResourceDocument FromResourceDocument(Kinds.Resources.ResourceDocument resourceDocument) { var document = new ResourceDocument { Metadata = ResourceDocumentMetadata.FromMetadata(resourceDocument.Metadata), Definition = ResourceDocumentDefinition.FromDefinition(resourceDocument.Definition), Spec = ResourceDocumentSpec.FromSpec(resourceDocument.Spec), State = ResourceDocumentState.FromState(resourceDocument.State) }; if (resourceDocument.Kind != null) { document.Kind = new KindIdentifier { KindName = resourceDocument.Kind.Value.KindName, KindGroup = resourceDocument.Kind.Value.Group, KindApiVersion = resourceDocument.Kind.Value.ApiVersion }; } return(document); }