// export
        public string GetBlueprintDefinitionJsonFromObject(PSBlueprintBase blueprintObject, string version)
        {
            if (string.IsNullOrEmpty(version))
            {
                var blueprint = blueprintManagementClient.Blueprints.Get(blueprintObject.Scope, blueprintObject.Name);

                return(JsonConvert.SerializeObject(blueprint, DefaultJsonSettings.SerializerSettings));
            }

            var publishedBlueprint = blueprintManagementClient.PublishedBlueprints.Get(blueprintObject.Scope, blueprintObject.Name, version);

            return(JsonConvert.SerializeObject(publishedBlueprint, DefaultJsonSettings.SerializerSettings));
        }
Example #2
0
        protected bool BlueprintExists(string scope, string blueprintName)
        {
            PSBlueprintBase blueprint = null;

            try
            {
                blueprint = BlueprintClient.GetBlueprint(scope, blueprintName);
            }
            catch (Exception ex)
            {
                if (ex is CloudException cex && cex.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    // Blueprint doesn't exists. Ignore the exception and continue.
                }