/// <summary> /// Extract deployment output into dictionary. /// </summary> /// <param name="deployment"></param> /// <returns></returns> public static IDictionary <string, string> ExtractDeploymentOutput( DeploymentExtendedInner deployment ) { const string valueKey = "value"; var output = new Dictionary <string, string>(); if (deployment.Properties.Outputs is null) { return(output); } if (!(deployment.Properties.Outputs is JObject)) { throw new ArgumentException("deployment.Properties.Outputs is not of type Newtonsoft.Json.Linq.JObject"); } var deploymentOutput = (JObject)deployment.Properties.Outputs; foreach (var keyValuePair in deploymentOutput) { var key = keyValuePair.Key; var valueJToket = keyValuePair.Value[valueKey]; if (valueJToket is null) { throw new NullReferenceException($"value object for '{key}' key does not contain '{valueKey}' key"); } var value = valueJToket.ToString(); output.Add(key, value); } return(output); }
private DeploymentImpl WrapModel(DeploymentExtendedInner deploymentExtendedInner) { return(new DeploymentImpl(deploymentExtendedInner, resourceManager)); }