/// <inheritdoc/>
        public OpenStackServiceCatalog Convert(string payload)
        {
            payload.AssertIsNotNull("payload", "A null service catalog payload cannot be converted.");

            var catalog = new OpenStackServiceCatalog();

            if (String.IsNullOrEmpty(payload))
            {
                return(catalog);
            }

            try
            {
                var obj      = JObject.Parse(payload);
                var defArray = obj["access"]["serviceCatalog"];
                catalog.AddRange(defArray.Select(ConvertServiceDefinition));
            }
            catch (FormatException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new FormatException(string.Format("Service catalog payload could not be parsed. Payload: '{0}'", payload), ex);
            }

            return(catalog);
        }
        internal void Init(Uri endpoint, string userName, string password, string tenantId, string region)
        {
            this.AuthenticationEndpoint = endpoint;
            this.UserName = userName;
            this.Password = password;
            this.TenantId = tenantId;
            this.Region   = region;

            this.ServiceCatalog = new OpenStackServiceCatalog();
        }
 /// <inheritdoc/>
 public void SetServiceCatalog(OpenStackServiceCatalog catalog)
 {
     catalog.AssertIsNotNull("catalog", "Service catalog cannot be null or empty.");
     this.ServiceCatalog = catalog;
 }