public IHttpActionResult GetVeeamTenant(string vbrHost, string tenantUid)
        {
            logger.Info("Received request to retrieve veeam tenant");
            String command = "Get-VBRCloudTenant -Id '" + tenantUid + "'";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            logger.Info("Checking response from veeam ");
            if (response.status.Equals("Error"))
            {
                logger.Info("Error retreiving veeam tenant");
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> taskOutput = (Collection <PSObject>)response.message;

            VeeamTenant tenant = new VeeamTenant();

            tenant.uid      = taskOutput[0].Properties["Id"].Value.ToString();
            tenant.username = taskOutput[0].Properties["Name"].Value.ToString();
            tenant.password = taskOutput[0].Properties["Password"].Value.ToString();
            if (bool.Parse(taskOutput[0].Properties["LeaseExpirationEnabled"].Value.ToString()) == true)
            {
                tenant.leaseExpiration = taskOutput[0].Properties["LeaseExpirationDate"].Value.ToString();
            }

            return(Ok(tenant));
        }
Esempio n. 2
0
        public IHttpActionResult GetBackupRepository(string vbrHost, string repoName)
        {
            logger.Info("Received request to retrieve Veeam Backup Repository Info for " + repoName + " from VBR " + vbrHost);

            string command = "$repo = Get-VBRBackupRepository -Name '" + repoName + "'; $repoInfo = $repo.Info; $repo; $repoInfo;";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> veeamBackupRepo = (Collection <PSObject>)response.message;

            // Quick check if a valid backup repo name was specified
            if (veeamBackupRepo[0] == null)
            {
                return(NotFound());
            }

            VeeamBackupRepository backupRepo = new VeeamBackupRepository
            {
                id          = veeamBackupRepo[0].Properties["Id"].Value.ToString(),
                name        = veeamBackupRepo[0].Properties["Name"].Value.ToString(),
                description = veeamBackupRepo[0].Properties["Description"].Value.ToString(),
                path        = veeamBackupRepo[1].Properties["Path"].Value.ToString(),
                capacity    = Int64.Parse(veeamBackupRepo[1].Properties["CachedTotalSpace"].Value.ToString()),
                freeSpace   = Int64.Parse(veeamBackupRepo[1].Properties["CachedFreeSpace"].Value.ToString()),
            };

            return(Ok(backupRepo));
        }
        public IHttpActionResult GetAllTenants(string vbrHost)
        {
            logger.Info("Recevied request to get all Veeam tenants");

            String command = "Get-VBRCloudTenant";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                logger.Error("Error retrieving all Veeam tenants");
                logger.Error((string)response.message);
            }

            Collection <VeeamTenant> veeamTenants = new Collection <VeeamTenant>();
            Collection <PSObject>    tenants      = (Collection <PSObject>)response.message;

            foreach (PSObject tenant in tenants)
            {
                VeeamTenant veeamTenant = new VeeamTenant();

                veeamTenant.uid      = tenant.Properties["Id"].Value.ToString();
                veeamTenant.username = tenant.Properties["Name"].Value.ToString();
                veeamTenant.password = tenant.Properties["Password"].Value.ToString();
                if (tenant.Properties["LeaseExpirationDate"].Value != null)
                {
                    veeamTenant.leaseExpiration = tenant.Properties["LeaseExpirationDate"].Value.ToString();
                }

                veeamTenants.Add(veeamTenant);
            }

            return(Ok(veeamTenants));
        }
        public IHttpActionResult GetBackupResource(string vbrHost, string tenantUid, string resourceUid)
        {
            logger.Info("Received request to get Veeam Backup resource: " + resourceUid + " for tenant: " + tenantUid);

            String command = "$cloudRepo = Get-VBRCloudTenant -Id '" + tenantUid +
                             "' | Select -ExpandProperty Resources | Where-Object {$_.Id -eq '" +
                             resourceUid + "'}; $buRepo = $cloudRepo.Repository.Name; $cloudRepo; $buRepo;";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> buRepo = (Collection <PSObject>)response.message;

            if (buRepo[0] == null)
            {
                return(NotFound());
            }

            VeeamBackupResource buResource = null;

            if (Boolean.Parse(buRepo[0].Properties["WanAccelerationEnabled"].Value.ToString()))
            {
                buResource = new VeeamBackupResource
                {
                    uid = buRepo[0].Properties["Id"].Value.ToString(),
                    backupRepositoryName  = buRepo[1].ToString(),
                    repositoryDisplayName = buRepo[0].Properties["RepositoryFriendlyName"].Value.ToString(),
                    repositoryQuota       = Int32.Parse(buRepo[0].Properties["RepositoryQuota"].Value.ToString()),
                    repositoryPath        = buRepo[0].Properties["RepositoryQuotaPath"].Value.ToString(),
                    usedSpace             = Int32.Parse(buRepo[0].Properties["UsedSpace"].Value.ToString()),
                    usedPercentage        = Double.Parse(buRepo[0].Properties["UsedSpacePercentage"].Value.ToString()),
                    enableWanAccelerator  = true,
                    wanAcceleratorName    = buRepo[0].Properties["WanAccelerator"].Value.ToString()
                };
            }
            else
            {
                buResource = new VeeamBackupResource
                {
                    uid = buRepo[0].Properties["Id"].Value.ToString(),
                    backupRepositoryName  = buRepo[1].ToString(),
                    repositoryDisplayName = buRepo[0].Properties["RepositoryFriendlyName"].Value.ToString(),
                    repositoryQuota       = Int32.Parse(buRepo[0].Properties["RepositoryQuota"].Value.ToString()),
                    repositoryPath        = buRepo[0].Properties["RepositoryQuotaPath"].Value.ToString(),
                    usedSpace             = Int32.Parse(buRepo[0].Properties["UsedSpace"].Value.ToString()),
                    usedPercentage        = Double.Parse(buRepo[0].Properties["UssedSpacePercentage"].Value.ToString()),
                };
            }

            return(Ok(buResource));
        }
        public IHttpActionResult EnableVeeamTenant(string vbrHost, string tenantUid)
        {
            logger.Info("Recieved request to enable veeam tenant");
            String command = "Get-VBRCloudTenant -Id '" + tenantUid + "' | Enable-VBRCloudTenant";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 6
0
        private void throwUnauthorized(HttpActionContext actionContext, String message)
        {
            HttpResponseMessage   response       = new HttpResponseMessage();
            VeeamTransportMessage responseObject = new VeeamTransportMessage();

            responseObject.status  = "Failed";
            responseObject.message = message;
            var responseMessage = JsonConvert.SerializeObject(responseObject);

            response.Content       = new StringContent(responseMessage, Encoding.UTF8, "application/json");
            response.StatusCode    = HttpStatusCode.Forbidden;
            actionContext.Response = response;
        }
        public IHttpActionResult GetBackupResources(string vbrHost, string tenantUid)
        {
            logger.Info("Received request to get all Veeam Backup resources for tenant: " + tenantUid);

            String command = "Get-VBRCloudTenant -Id '" + tenantUid + "' | Select -ExpandProperty Resources";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> buRepos = (Collection <PSObject>)response.message;

            Collection <VeeamBackupResource> backupRepos = new Collection <VeeamBackupResource>();

            foreach (PSObject buRepo in buRepos)
            {
                VeeamBackupResource buResource = null;
                if (Boolean.Parse(buRepo.Properties["WanAccelerationEnabled"].Value.ToString()))
                {
                    buResource = new VeeamBackupResource
                    {
                        uid = buRepo.Properties["Id"].Value.ToString(),
                        repositoryDisplayName = buRepo.Properties["RepositoryFriendlyName"].Value.ToString(),
                        repositoryQuota       = Int32.Parse(buRepo.Properties["RepositoryQuota"].Value.ToString()),
                        repositoryPath        = buRepo.Properties["RepositoryQuotaPath"].Value.ToString(),
                        usedSpace             = Int32.Parse(buRepo.Properties["UsedSpace"].Value.ToString()),
                        usedPercentage        = Double.Parse(buRepo.Properties["UsedSpacePercentage"].Value.ToString()),
                        enableWanAccelerator  = true,
                        wanAcceleratorName    = buRepo.Properties["WanAccelerator"].Value.ToString()
                    };
                }
                else
                {
                    buResource = new VeeamBackupResource
                    {
                        uid = buRepo.Properties["Id"].Value.ToString(),
                        repositoryDisplayName = buRepo.Properties["RepositoryFriendlyName"].Value.ToString(),
                        repositoryQuota       = Int32.Parse(buRepo.Properties["RepositoryQuota"].Value.ToString()),
                        repositoryPath        = buRepo.Properties["RepositoryQuotaPath"].Value.ToString(),
                        usedSpace             = Int32.Parse(buRepo.Properties["UsedSpace"].Value.ToString()),
                        usedPercentage        = Double.Parse(buRepo.Properties["UsedSpacePercentage"].Value.ToString()),
                    };
                }

                backupRepos.Add(buResource);
            }

            return(Ok(backupRepos));
        }
        public HttpResponseMessage PostVeeamTenant(string vbrHost, [FromBody] dynamic newTenant)
        {
            logger.Info("Received request to create new veeam tenant");
            dynamic validate = schemaValidator.verifyJSONPayload("NewTenant", newTenant);

            // Check if VeeamTransportMessage type is returned. If so, schema filter found an
            // error with the JSON payload so return the error message back.
            if (validate is VeeamTransportMessage)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, (String)validate.message));
            }

            VeeamTenant tenant  = null;
            String      command = "";

            if (newTenant.leaseExpiration != null)
            {
                command = "Add-VBRCloudTenant -Name '" + newTenant.username + "' -Password '" + newTenant.password +
                          "' -Description 'Created from PSVeeamRestPowerShell' -EnableLeaseExpiration -LeaseExpirationDate '" + newTenant.leaseExpiration + "'";
            }
            else
            {
                command = "Add-VBRCloudTenant -Name '" + newTenant.username + "' -Password '" + newTenant.password +
                          "' -Description 'Created from PSVeeamRestPowerShell'";
            }
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, (String)response.message));
            }

            Collection <PSObject> taskOutput = (Collection <PSObject>)response.message;

            tenant          = new VeeamTenant();
            tenant.uid      = taskOutput[0].Properties["Id"].Value.ToString();
            tenant.username = taskOutput[0].Properties["Name"].Value.ToString();
            tenant.password = taskOutput[0].Properties["Password"].Value.ToString();

            if (bool.Parse(taskOutput[0].Properties["LeaseExpirationEnabled"].Value.ToString()) == true)
            {
                tenant.leaseExpiration = taskOutput[0].Properties["LeaseExpirationDate"].Value.ToString();
            }

            return(Request.CreateResponse(HttpStatusCode.Created, tenant));
        }
        public IHttpActionResult EditBackupResource(string vbrHost, string tenantUid, string resourceUid, [FromBody] dynamic resource)
        {
            logger.Info("Received request to edit Veeam Backup resource: " + resourceUid + " for tenant: " + tenantUid);

            dynamic validate = schemaValidator.verifyJSONPayload("EditBackupResource", resource);

            // Check if VeeamTransportMessage type is returned. If so, schema filter found an
            // error with the JSON payload so return the error message back.
            if (validate is VeeamTransportMessage)
            {
                return(BadRequest((String)validate.message));
            }

            String command = "";

            if (resource.enableWanAccelerator == true)
            {
                command = "$wanAccel = Get-VBRWANAccelerator -Name " + resource.wanAcceleratorName + "; $tenant = Get-VBRCloudTenant -Id '" + tenantUid + "'; " +
                          "$buResource = $tenant | Select -ExpandProperty Resources | Where-Object {$_.Id -eq '" +
                          resourceUid + "'}; $buResources = [System.Collections.ArrayList](@($tenant | Select -ExpandProperty Resources)); " +
                          "$buResources.Remove($buResource); $newResource = Set-VBRCloudTenantResource -CloudTenantResource $buResource " +
                          "-RepositoryFriendlyName '" + resource.repositoryDisplayName + "' -Repository $buResource.Repository " +
                          "-Quota " + resource.repositoryQuota + " -EnableWanAccelerator -WanAccelerator $wanAccel; $buResources.Add($newResource); " +
                          " Set-VBRCloudTenant -CloudTenant $tenant -Resources $buResources;";
            }
            else
            {
                command = "$tenant = Get-VBRCloudTenant -Id '" + tenantUid + "'; " +
                          "$buResource = $tenant | Select -ExpandProperty Resources | Where-Object {$_.Id -eq '" +
                          resourceUid + "'}; $buResources = [System.Collections.ArrayList](@($tenant | Select -ExpandProperty Resources)); " +
                          "$buResources.Remove($buResource); $newResource = Set-VBRCloudTenantResource -CloudTenantResource $buResource " +
                          "-RepositoryFriendlyName '" + resource.repositoryDisplayName + "' -Repository $buResource.Repository " +
                          "-Quota " + resource.repositoryQuota + "; $buResources.Add($newResource); " +
                          " Set-VBRCloudTenant -CloudTenant $tenant -Resources $buResources;";
            }

            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult CreateReplicationResource(string vbrHost, string tenantUid, [FromBody] dynamic resource)
        {
            dynamic validate = schemaValidator.verifyJSONPayload("CreateReplicationResource", resource);

            // Check if VeeamTransportMessage type is returned. If so, schema filter found an
            // error with the JSON payload so return the error message back.
            if (validate is VeeamTransportMessage)
            {
                return(BadRequest((String)validate.message));
            }

            String command = "";

            if (resource.platform == "VMWare")
            {
                command = ("$repCluster = (Find-VBRViEntity -Name 'V9-Replication')[1]; " +
                           "$ds = Get-VBRServer -Name 10.10.1.41 | Find-VBRViDatastore -Name '" + resource.datastoreName + "'; " +
                           "$cloudDatastore = New-VBRViCloudHWPlanDatastore -Datastore $ds -FriendlyName '" + resource.datastoreDisplayName +
                           "' -Quota " + resource.datastoreQuota + "; " +
                           "$cloudHwPlan = Add-VBRViCloudHardwarePlan -Name '" + resource.hwPlanName + "' -Description 'Created by PSVeeam PS RestAPI' " +
                           "-Server $repCluster -CPU " + resource.cpuQuota + " -Memory " + resource.memoryQuota +
                           " -NumberOfNetWithInternet " + resource.netWithInternet + " -NumberOfNetWithoutInternet " + resource.netWithoutInternet +
                           " -Datastore $cloudDatastore; " +
                           "$hwPlanOptions = New-VBRCloudTenantHwPlanOptions -HardwarePlan $cloudHwPlan; " +
                           "$repResource = New-VBRCloudTenantReplicationResources -HardwarePlanOptions $hwPlanOptions -EnablePublicIp " +
                           "-NumberOfPublicIp " + resource.publicIpCount + "; " +
                           "$tenant = Get-VBRCloudTenant -Id '" + tenantUid + "'; " +
                           "Set-VBRCloudTenant -CloudTenant $tenant -ReplicationResources $repResource;");
            }
            else
            {
                command = "";
            }
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            return(StatusCode(HttpStatusCode.Created));
        }
        public IHttpActionResult GetReplicationResource(string vbrHost, string tenantUid, string resourceUid)
        {
            String command = ("$hwResourceOption = Get-VBRCloudTenant -Id '" + tenantUid + "' | " +
                              "Select -ExpandProperty ReplicationResources | " + "Select -ExpandProperty HardwarePlanOptions | " +
                              "Where-Object {$_.Id -eq'" + resourceUid + "'}; $hwResourceOption; " +
                              "$hwResource = Get-VBRCloudHardwarePlan -Id $hwResourceOption.HardwarePlanId; $hwResource; " +
                              "$datastore = $hwResourceOption | Select -ExpandProperty DatastoreQuota; $datastore");
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> replicationResponse = (Collection <PSObject>)response.message;

            // Construct Replication Resource Object
            VeeamReplicationResource replicationResource = new VeeamReplicationResource();

            replicationResource.hwPlanOptionUid      = replicationResponse[0].Properties["Id"].Value.ToString();
            replicationResource.hwPlanUid            = replicationResponse[1].Properties["Id"].Value.ToString();
            replicationResource.hwPlanName           = replicationResponse[1].Properties["Name"].Value.ToString();
            replicationResource.platform             = replicationResponse[1].Properties["Platform"].Value.ToString();
            replicationResource.cpuQuota             = Int32.Parse(replicationResponse[1].Properties["CPU"].Value.ToString());
            replicationResource.cpuUsed              = Int32.Parse(replicationResponse[0].Properties["UsedCPU"].Value.ToString());
            replicationResource.memoryQuota          = Int32.Parse(replicationResponse[1].Properties["Memory"].Value.ToString());
            replicationResource.memoryUsed           = Int32.Parse(replicationResponse[0].Properties["UsedMemory"].Value.ToString());
            replicationResource.netWithInternet      = Int32.Parse(replicationResponse[1].Properties["NumberOfNetWithInternet"].Value.ToString());
            replicationResource.netWithoutInternet   = Int32.Parse(replicationResponse[1].Properties["NumberOfNetWithoutInternet"].Value.ToString());
            replicationResource.datastoreName        = replicationResponse[2].Properties["DatastoreId"].Value.ToString();
            replicationResource.datastoreDisplayName = replicationResponse[2].Properties["FriendlyName"].Value.ToString();
            replicationResource.datastoreQuota       = Int32.Parse(replicationResponse[2].Properties["Quota"].Value.ToString());
            replicationResource.datastoreUsed        = Int32.Parse(replicationResponse[2].Properties["UsedSpace"].Value.ToString());

            if ((Boolean)replicationResponse[0].Properties["WanAccelerationEnabled"].Value)
            {
                replicationResource.wanAcceleratorId = replicationResponse[0].Properties["WanAccelerator"].Value.ToString();
            }

            return(Ok(replicationResource));
        }
Esempio n. 12
0
        // Validate incoming JSON payload with appropriate JSON Schema.
        public dynamic verifyJSONPayload(String jsonSchemaFileName, dynamic payload)
        {
            VeeamTransportMessage returnMessage = new VeeamTransportMessage();

            // Get JSON from Schema file
            String jsonSchemaFile = HttpContext.Current.Server.MapPath("~/Schemas/" + jsonSchemaFileName + ".json");
            String jsonSchema     = System.IO.File.ReadAllText(jsonSchemaFile);

            JSchema schema        = JSchema.Parse(jsonSchema);
            JObject payloadObject = JObject.Parse(payload.ToString());

            try
            {
                IList <ValidationError> errors;
                bool isValidPayload = payloadObject.IsValid(schema, out errors);

                if (payloadObject.IsValid(schema))
                {
                    return(payload);
                }
                else
                {
                    var sb = new StringBuilder();
                    foreach (ValidationError error in errors)
                    {
                        sb.AppendLine("Element: " + error.Path + ". Message: " + error.Message);
                    }

                    returnMessage.status  = "False";
                    returnMessage.message = sb.ToString();

                    return(returnMessage);
                }
            } catch (Exception e)
            {
                returnMessage.status  = "False";
                returnMessage.message = "Unknown error trying to validate payload. Exception: " + e.ToString();
                return(returnMessage);
            }
        }
        public IHttpActionResult EditTenantPassword(string vbrHost, string tenantUid, [FromBody] dynamic tenant)
        {
            logger.Info("Received request to edit tenant password");
            dynamic validate = schemaValidator.verifyJSONPayload("EditTenantPass", tenant);

            // Check if VeeamTransportMessage type is returned. If so, schema filter found an
            // error with the JSON payload so return the error message back.
            if (validate is VeeamTransportMessage)
            {
                return(BadRequest((String)validate.message));
            }

            String command = "$tenant = Get-VBRCloudTenant -Id '" + tenantUid +
                             "'; Set-VBRCloudTenant -CloudTenant $tenant -Password '" + tenant.password + "';";
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult NewBackupResource(string vbrHost, string tenantUid, [FromBody] dynamic resource)
        {
            logger.Info("Received request to add backup resource for tenant: " + tenantUid);
            dynamic validate = schemaValidator.verifyJSONPayload("NewBackupResource", resource);

            // Check if VeeamTransportMessage type is returned. If so, schema filter found an
            // error with the JSON payload so return the error message back.
            if (validate is VeeamTransportMessage)
            {
                return(BadRequest((String)validate.message));
            }

            String command = ("$tenant = Get-VBRCloudTenant -Id '" + tenantUid + "'; " +
                              "$repo = Get-VBRBackupRepository -Name '" + resource.backupRepositoryName + "'; " +
                              "$buResources = New-Object System.Collections.ArrayList;" +
                              "$currentResources = $tenant | Select -ExpandProperty Resources; " +
                              "foreach($currentResource in $currentResources) {[void]$buResources.Add($currentResource)}; " +
                              "$cloudRepo = New-VBRCloudTenantResource -Repository $repo -RepositoryFriendlyName '" +
                              resource.repositoryDisplayName + "' -Quota " + resource.repositoryQuota + "; " +
                              "[void]$buResources.Add($cloudRepo); " +
                              "$tenantNewResource = Set-VBRCloudTenant -CloudTenant $tenant -Resources $buResources;" +
                              "Get-VBRCloudTenant -Id '" + tenantUid + "' | Select -ExpandProperty Resources | " +
                              "Where-Object {$_.RepositoryFriendlyName -eq '" + resource.repositoryDisplayName + "'};");
            VeeamTransportMessage response = psAgent.runCommand(vbrHost, command);

            if (response.status.Equals("Error"))
            {
                return(BadRequest((String)response.message));
            }

            Collection <PSObject> buRepo = (Collection <PSObject>)response.message;

            VeeamBackupResource buResource = null;

            if (Boolean.Parse(buRepo[0].Properties["WanAccelerationEnabled"].Value.ToString()))
            {
                buResource = new VeeamBackupResource
                {
                    uid = buRepo[0].Properties["Id"].Value.ToString(),
                    backupRepositoryName  = resource.backupRepositoryName,
                    repositoryDisplayName = buRepo[0].Properties["RepositoryFriendlyName"].Value.ToString(),
                    repositoryQuota       = Int32.Parse(buRepo[0].Properties["RepositoryQuota"].Value.ToString()),
                    repositoryPath        = buRepo[0].Properties["RepositoryQuotaPath"].Value.ToString(),
                    usedSpace             = Int32.Parse(buRepo[0].Properties["UsedSpace"].Value.ToString()),
                    usedPercentage        = Double.Parse(buRepo[0].Properties["UsedSpacePercentage"].Value.ToString()),
                    wanAcceleratorName    = buRepo[0].Properties["WanAccelerator"].Value.ToString(),
                };
            }
            else
            {
                buResource = new VeeamBackupResource
                {
                    uid = buRepo[0].Properties["Id"].Value.ToString(),
                    backupRepositoryName  = resource.backupRepositoryName,
                    repositoryDisplayName = buRepo[0].Properties["RepositoryFriendlyName"].Value.ToString(),
                    repositoryQuota       = Int32.Parse(buRepo[0].Properties["RepositoryQuota"].Value.ToString()),
                    repositoryPath        = buRepo[0].Properties["RepositoryQuotaPath"].Value.ToString(),
                    usedSpace             = Int32.Parse(buRepo[0].Properties["UsedSpace"].Value.ToString()),
                    usedPercentage        = Double.Parse(buRepo[0].Properties["UsedSpacePercentage"].Value.ToString())
                };
            }

            // Build Code 201 Response Message
            HttpResponseMessage returnMessage = Request.CreateResponse <VeeamBackupResource>(HttpStatusCode.Created, buResource);

            return(ResponseMessage(returnMessage));
        }