Make404Exception() static private method

static private Make404Exception ( ) : CloudException
return CloudException
Esempio n. 1
0
        private Task <DeploymentGetResponse> CreateDeploymentGetResponse(string serviceName, DeploymentSlot slot)
        {
            var service        = Services.FirstOrDefault(s => s.Name == serviceName);
            var failedResponse = Tasks.FromException <DeploymentGetResponse>(ClientMocks.Make404Exception());

            if (service == null)
            {
                return(failedResponse);
            }

            if (slot == DeploymentSlot.Production && service.ProductionDeployment == null ||
                slot == DeploymentSlot.Staging && service.StagingDeployment == null)
            {
                return(failedResponse);
            }

            var response = new DeploymentGetResponse
            {
                Name                 = serviceName,
                Configuration        = "config",
                DeploymentSlot       = slot,
                Status               = DeploymentStatus.Starting,
                PersistentVMDowntime = new PersistentVMDowntime
                {
                    EndTime   = DateTime.Now,
                    StartTime = DateTime.Now,
                    Status    = "",
                },
                LastModifiedTime = DateTime.Now
            };

            return(Tasks.FromResult(response));
        }
Esempio n. 2
0
        private Task <StorageAccountGetResponse> CreateGetResponse(string serviceName)
        {
            Task <StorageAccountGetResponse> resultTask;
            var data = accounts.FirstOrDefault(a => a.Name == serviceName);

            if (data != null)
            {
                var storageServiceGetResponse = new StorageAccountGetResponse
                {
                    StorageAccount = new StorageAccount
                    {
                        Name       = data.Name,
                        Properties = new StorageAccountProperties
                        {
                            Endpoints =
                            {
                                new Uri(data.BlobEndpoint),
                                new Uri(data.QueueEndpoint),
                                new Uri(data.TableEndpoint)
                            }
                        }
                    }
                };
                resultTask = Tasks.FromResult(storageServiceGetResponse);
            }
            else
            {
                resultTask = Tasks.FromException <StorageAccountGetResponse>(ClientMocks.Make404Exception());
            }
            return(resultTask);
        }
Esempio n. 3
0
        private Task <HostedServiceGetDetailedResponse> CreateGetDetailedResponse(string serviceName)
        {
            var service = Services.FirstOrDefault(s => s.Name == serviceName);
            Task <HostedServiceGetDetailedResponse> resultTask;

            if (service != null)
            {
                var response = new HostedServiceGetDetailedResponse
                {
                    ServiceName = service.Name,
                    StatusCode  = HttpStatusCode.OK,
                };
                if (service.ProductionDeployment != null)
                {
                    response.Deployments.Add(CreateDeploymentResponse(service.ProductionDeployment));
                }

                if (service.StagingDeployment != null)
                {
                    response.Deployments.Add(CreateDeploymentResponse(service.StagingDeployment));
                }
                resultTask = Tasks.FromResult(response);
            }
            else
            {
                resultTask = Tasks.FromException <HostedServiceGetDetailedResponse>(ClientMocks.Make404Exception());
            }
            return(resultTask);
        }
Esempio n. 4
0
        private Task <StorageAccountGetKeysResponse> CreateGetKeysResponse(string serviceName)
        {
            Task <StorageAccountGetKeysResponse> resultTask;
            var data = accounts.FirstOrDefault(a => a.Name == serviceName);

            if (data != null)
            {
                var response = new StorageAccountGetKeysResponse
                {
                    PrimaryKey   = data.PrimaryKey,
                    SecondaryKey = data.SecondaryKey,
                    StatusCode   = HttpStatusCode.OK
                };
                resultTask = Tasks.FromResult(response);
            }
            else
            {
                resultTask = Tasks.FromException <StorageAccountGetKeysResponse>(ClientMocks.Make404Exception());
            }
            return(resultTask);
        }