Example #1
0
        public void TestInit()
        {
            client   = TestUtil.GetClient();
            v3client = TestUtil.GetV3Client();
            CloudCredentials credentials = new CloudCredentials();

            credentials.User     = TestUtil.User;
            credentials.Password = TestUtil.Password;
            try
            {
                client.Login(credentials).Wait();
            }
            catch (Exception ex)
            {
                Assert.Fail("Error while logging in" + ex.ToString());
            }

            try
            {
                v3client.Login(credentials).Wait();
            }
            catch (Exception ex)
            {
                Assert.Fail("Error while logging in" + ex.ToString());
            }

            PagedResponseCollection <ListAllSpacesResponse> spaces = client.Spaces.ListAllSpaces().Result;

            Guid spaceGuid = Guid.Empty;

            foreach (ListAllSpacesResponse space in spaces)
            {
                spaceGuid = space.EntityMetadata.Guid;
                break;
            }

            if (spaceGuid == Guid.Empty)
            {
                throw new Exception("No spaces found");
            }

            CCV3.PagedResponseCollection <CCV3.Data.ListAllAppsResponse> apps = v3client.AppsExperimental.ListAllApps().Result;

            foreach (CCV3.Data.ListAllAppsResponse app in apps)
            {
                if (app.Name.StartsWith("simplePushTest"))
                {
                    v3client.AppsExperimental.DeleteApp(app.Guid).Wait();
                    break;
                }
            }

            apprequest = new CCV3.Data.CreateAppRequest();
            Dictionary <string, object> s = new Dictionary <string, object>();

            s["guid"] = spaceGuid;
            apprequest.Relationships          = new Dictionary <string, dynamic>();
            apprequest.Relationships["space"] = s;
            client.Apps.PushProgress         += Apps_PushProgress;
        }
Example #2
0
        internal static CCV3.CloudFoundryClient GetV3Client(CancellationToken cancellationToken)
        {
            if (IgnoreCertificate)
            {
                IngoreGlobalCertificateValidation();
            }

            var cfclient = GetClient(cancellationToken);

            string authEndpoint = cfclient.Info.GetInfo().Result.AuthorizationEndpoint;

            CCV3.CloudFoundryClient client = new CCV3.CloudFoundryClient(new Uri(ServerUrl), cancellationToken, null, true, new Uri(authEndpoint));
            return(client);
        }
 /// <summary>
 /// Initializes the class
 /// </summary>
 internal DropletsExperimentalEndpoint(CloudFoundryClient client) : base()
 {
     this.Client = client;
 }
Example #4
0
 internal AppsEndpoint(CloudFoundryClient client) : base()
 {
     this.Client = client;
 }
Example #5
0
 internal ProcessesExperimentalEndpoint(CloudFoundryClient client) : base()
 {
     this.Client = client;
 }
Example #6
0
 public TaskResourceEndPoint(CloudFoundryClient client)
 {
     this.Client = client;
 }
 internal AppRoutesExperimentalEndpoint(CloudFoundryClient client) : base()
 {
     this.Client = client;
 }
Example #8
0
        internal static PagedResponseCollection <T> DeserializePage <T>(string value, CloudFoundryClient client)
        {
            PagedResponseCollection <T> page = new PagedResponseCollection <T>();

            page.Client = client;

            using (StringReader stringReader = new StringReader(value))
            {
                using (JsonReader reader = new JsonTextReader(stringReader))
                {
                    reader.DateParseHandling = DateParseHandling.None;
                    var obj = JObject.Load(reader);
                    if (obj["pagination"] == null)
                    {
                        throw new CloudFoundryException("Value contains no pagination info");
                    }

                    page.Pagination = JsonConvert.DeserializeObject <Pagination>(obj["pagination"].ToString(), jsonSettings);
                }
            }

            page.Resources = DeserializeJsonResources <T>(value).ToList <T>();
            return(page);
        }
Example #9
0
 internal PackagesEndpoint(CloudFoundryClient client) : base()
 {
     this.Client = client;
 }