Beispiel #1
0
        /// <summary>
        /// Reads Catalog data from CF envrionment variable. Usage:
        /// 1. set-env <SERVICEBROKER_NAME> CatalogData {JSON Blob}
        /// </summary>
        /// <returns></returns>
        public async Task <ServiceCatalogResponse> GetServiceCatalog()
        {
            ServiceCatalogResponse response = new ServiceCatalogResponse();
            // Read the environment variable from CF
            string catalogData = Environment.GetEnvironmentVariable(ENV_KEY);

            if (string.IsNullOrEmpty(catalogData))
            {
                response.IsSuccess   = false;
                response.Description = "Either CatalogData environment variable not set or empty";
                Console.WriteLine(response.Description);
            }
            response.CatalogData = catalogData;
            return(response);
        }
Beispiel #2
0
        public async Task <ServiceCatalogResponse> GetServiceCatalog()
        {
            ServiceCatalogResponse response = new ServiceCatalogResponse();

            if (string.IsNullOrEmpty(Options.File) || !(File.Exists(Options.File)))
            {
                response.IsSuccess   = false;
                response.Description = string.Format("Invalid Catalog File Path : {0}", string.IsNullOrEmpty(Options.File)? "" : Options.File);
                Console.WriteLine("Invalid Catalog File Path");
                return(response);
            }

            response.CatalogData = await File.ReadAllTextAsync(Options.File);

            return(response);
        }
Beispiel #3
0
        public async Task <ServiceCatalogResponse> GetServiceCatalog()
        {
            ServiceCatalogResponse response = new ServiceCatalogResponse();

            ServiceCatalogs services = new ServiceCatalogs();
            Catalog         catalog  = new Catalog();

            catalog.Bindable        = true;
            catalog.DashboardClient = null;
            catalog.Description     = "Sample Service Broker";
            catalog.Id       = Guid.NewGuid();
            catalog.Metadata = new ServiceMetadata
            {
                DisplayName         = "Sample Service Broker",
                DocumentationUrl    = "http://google.com",
                ImageUrl            = "http://example.com/image.png",
                LongDescription     = "Sample Service Broker built using a cool framework",
                ProviderDisplayName = "FPService",
                SupportUrl          = "https://dell.com"
            };
            catalog.Name  = "FP Service";
            catalog.Plans = new System.Collections.Generic.List <Plan>
            {
                new Plan
                {
                    Id          = Guid.NewGuid(),
                    Name        = "Standard Plan",
                    Bindable    = true,
                    Description = "Standard Plan includes 30 days of free service",
                    Free        = true,
                    Metadata    = new PlanMetadata
                    {
                        DisplayName = "Standard Plan",
                        Bullets     = new System.Collections.Generic.List <string>
                        {
                            "30 days free trial",
                            "No credit card required",
                            "Awesome Plan"
                        },
                        Costs = new System.Collections.Generic.List <CostMetadata>
                        {
                            new CostMetadata
                            {
                                Unit   = CostUnitEnum.Monthly,
                                Amount = new AmountMetadata
                                {
                                    CurrencyCode = "USD",
                                    Value        = 0
                                }
                            }
                        }
                    }
                }
            };
            catalog.PlanUpdateable = false;
            catalog.Tags           = new string[]
            {
                "NoSql",
                "Distributed"
            };
            services.AddCatalog(catalog);

            response.CatalogData = services;
            return(response);
        }