Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/console/console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SimpleRESTServices, Version=1.0.6.3, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="SimpleRESTServices, Version=1.0.6.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll</HintPath>
<HintPath>..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion src/console/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="SimpleRESTServices" version="1.0.6.3" targetFramework="net40" />
<package id="SimpleRESTServices" version="1.0.6.6" targetFramework="net40" />
</packages>
18 changes: 16 additions & 2 deletions src/corelib/Core/Providers/IObjectStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,33 @@ public interface IObjectStorageProvider
/// <param name="sourceObjectName">Name of the source object.<remarks>Example image_name.jpeg</remarks></param>
/// <param name="destinationContainer">The destination container name.</param>
/// <param name="destinationObjectName">Name of the destination object.<remarks>Example image_name.jpeg</remarks></param>
/// <param name="headers">The headers. </param>
/// <param name="headers">A list of HTTP headers to send to the service. </param>
/// <param name="region">The region in which to execute this action.<remarks>If not specified, the user’s default region will be used.</remarks></param>
///<param name="useInternalUrl">If set to <c>true</c> uses ServiceNet URL.</param>
/// <param name="identity">The users Cloud Identity. <see cref="CloudIdentity"/> <remarks>If not specified, the default identity given in the constructor will be used.</remarks> </param>
/// <returns><see cref="ObjectStore"/></returns>
ObjectStore CopyObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary<string, string> headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null);

/// <summary>
/// Moves an object. <remarks>The original source object will be deleted only if the move is successful.</remarks>
/// </summary>
/// <param name="sourceContainer">The source container name.</param>
/// <param name="sourceObjectName">Name of the source object.<remarks>Example image_name.jpeg</remarks></param>
/// <param name="destinationContainer">The destination container name.</param>
/// <param name="destinationObjectName">Name of the destination object.<remarks>Example image_name.jpeg</remarks></param>
/// <param name="headers">A list of HTTP headers to send to the service. </param>
/// <param name="region">The region in which to execute this action.<remarks>If not specified, the user’s default region will be used.</remarks></param>
///<param name="useInternalUrl">If set to <c>true</c> uses ServiceNet URL.</param>
/// <param name="identity">The users Cloud Identity. <see cref="CloudIdentity"/> <remarks>If not specified, the default identity given in the constructor will be used.</remarks> </param>
/// <returns><see cref="ObjectStore"/></returns>
ObjectStore MoveObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary<string, string> headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null);

/// <summary>
/// Deletes the object.
/// </summary>
/// <param name="container">The container name.</param>
/// <param name="objectName">Name of the object.<remarks>Example image_name.jpeg</remarks></param>
/// <param name="headers">The headers. </param>
/// <param name="headers">A list of HTTP headers to send to the service. </param>
/// <param name="region">The region in which to execute this action.<remarks>If not specified, the user’s default region will be used.</remarks></param>
/// <param name="useInternalUrl">If set to <c>true</c> uses ServiceNet URL.</param>
/// <param name="identity">The users Cloud Identity. <see cref="CloudIdentity"/> <remarks>If not specified, the default identity given in the constructor will be used.</remarks> </param>
Expand Down
39 changes: 18 additions & 21 deletions src/corelib/Providers/Rackspace/CloudFilesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -659,27 +659,13 @@ public ObjectStore CopyObject(string sourceContainer, string sourceObjectName, s
_cloudFilesValidator.ValidateContainerName(destinationContainer);
_cloudFilesValidator.ValidateObjectName(destinationObjectName);

if (headers != null)
{
if (string.IsNullOrWhiteSpace(headers.FirstOrDefault(x => x.Key.Equals(ContentLength, StringComparison.OrdinalIgnoreCase)).Value))
{
var contentLength = GetObjectContentLength(identity, sourceContainer, sourceObjectName, region, useInternalUrl);
headers.Add(ContentLength, contentLength);
}
}
else
{
headers = new Dictionary<string, string>();
var contentLength = GetObjectContentLength(identity, sourceContainer, sourceObjectName, region, useInternalUrl);
headers.Add(ContentLength, contentLength);

}

headers.Add(CopyFrom, string.Format("{0}/{1}", sourceContainer, sourceObjectName));
var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(sourceContainer), _encodeDecodeProvider.UrlEncode(sourceObjectName)));

var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(destinationContainer), _encodeDecodeProvider.UrlEncode(destinationObjectName)));
if(headers == null)
headers = new Dictionary<string, string>();

var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.PUT, headers);
headers.Add(Destination, string.Format("{0}/{1}", destinationContainer, destinationObjectName));
var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.COPY, headers: headers);

if (response.StatusCode == 201)
return ObjectStore.ObjectCreated;
Expand All @@ -697,7 +683,7 @@ public ObjectStore DeleteObject(string container, string objectName, Dictionary<

var urlPath = new Uri(string.Format("{0}/{1}/{2}", GetServiceEndpointCloudFiles(identity, region, useInternalUrl), _encodeDecodeProvider.UrlEncode(container), _encodeDecodeProvider.UrlEncode(objectName)));

var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.DELETE, headers);
var response = ExecuteRESTRequest(identity, urlPath, HttpMethod.DELETE, headers: headers);

if (response.StatusCode == 204)
return ObjectStore.ObjectDeleted;
Expand All @@ -708,6 +694,17 @@ public ObjectStore DeleteObject(string container, string objectName, Dictionary<

}

/// <inheritdoc />
public ObjectStore MoveObject(string sourceContainer, string sourceObjectName, string destinationContainer, string destinationObjectName, Dictionary<string, string> headers = null, string region = null, bool useInternalUrl = false, CloudIdentity identity = null)
{
var result = CopyObject(sourceContainer, sourceObjectName, destinationContainer, destinationObjectName, headers, region, useInternalUrl, identity);

if (result != ObjectStore.ObjectCreated)
return result;

return DeleteObject(sourceContainer, sourceObjectName, headers, region, useInternalUrl, identity);
}

/// <inheritdoc />
public ObjectStore PurgeObjectFromCDN(string container, string objectName, string region = null, CloudIdentity identity = null)
{
Expand Down Expand Up @@ -959,7 +956,7 @@ protected override IObjectStorageProvider BuildProvider(CloudIdentity identity)
public const string Etag = "etag";
public const string ContentType = "content-type";
public const string ContentLength = "content-length";
public const string CopyFrom = "x-copy-from";
public const string Destination = "Destination";
public const string ObjectManifestMetadataKey = "X-Object-Manifest";
//Cdn Object Constants
public const string CdnPurgeEmail = "x-purge-email";
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/corelib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SimpleRESTServices, Version=1.0.6.3, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="SimpleRESTServices, Version=1.0.6.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SimpleRESTServices.1.0.6.3\lib\net40\SimpleRESTServices.dll</HintPath>
<HintPath>..\packages\SimpleRESTServices.1.0.6.6\lib\net40\SimpleRESTServices.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -215,7 +216,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Icons\openstack_net_logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="SimpleRESTServices" version="1.0.6.3" targetFramework="net40" />
<package id="SimpleRESTServices" version="1.0.6.6" targetFramework="net40" />
</packages>
25 changes: 25 additions & 0 deletions src/openstack.net_Integration_Tests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testing", "testing", "{62B45D81-B643-4E2B-B612-F479B9570F3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unit", "testing\unit\unit.csproj", "{FDFD92C2-75CF-4437-87B8-841EC3624CE4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console\console.csproj", "{1C279666-B88A-4765-8A51-B352C85EFC28}"
EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = openstack.net.vsmdi
Expand Down Expand Up @@ -46,11 +50,32 @@ Global
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|x86.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|x86.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.Build.0 = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|x86.ActiveCfg = Release|Any CPU
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Any CPU.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.Build.0 = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.Build.0 = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Any CPU.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.Build.0 = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4} = {62B45D81-B643-4E2B-B612-F479B9570F3A}
{FDFD92C2-75CF-4437-87B8-841EC3624CE4} = {62B45D81-B643-4E2B-B612-F479B9570F3A}
EndGlobalSection
EndGlobal
29 changes: 27 additions & 2 deletions src/openstack.net_Integration_Tests_2012.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "corelib", "corelib\corelib.csproj", "{7DBA11EB-DBA7-4D3A-8D42-B5312E74B9C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "integration", "testing\integration\integration.csproj", "{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}"
Expand All @@ -13,6 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testing", "testing", "{62B45D81-B643-4E2B-B612-F479B9570F3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unit", "testing\unit\unit.csproj", "{FDFD92C2-75CF-4437-87B8-841EC3624CE4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console\console.csproj", "{1C279666-B88A-4765-8A51-B352C85EFC28}"
EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = openstack.net.vsmdi
Expand Down Expand Up @@ -46,11 +50,32 @@ Global
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4}.Release|x86.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Debug|x86.ActiveCfg = Debug|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Any CPU.Build.0 = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FDFD92C2-75CF-4437-87B8-841EC3624CE4}.Release|x86.ActiveCfg = Release|Any CPU
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Any CPU.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|Mixed Platforms.Build.0 = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.ActiveCfg = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Debug|x86.Build.0 = Debug|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Any CPU.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|Mixed Platforms.Build.0 = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.ActiveCfg = Release|x86
{1C279666-B88A-4765-8A51-B352C85EFC28}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C1D0D0D8-9EF2-4557-B85F-34FDB0F466C4} = {62B45D81-B643-4E2B-B612-F479B9570F3A}
{FDFD92C2-75CF-4437-87B8-841EC3624CE4} = {62B45D81-B643-4E2B-B612-F479B9570F3A}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Newtonsoft.Json</id>
<version>4.5.11</version>
Expand All @@ -12,8 +12,5 @@
<description>Json.NET is a popular high-performance JSON framework for .NET</description>
<language>en-US</language>
<tags>json</tags>
<references>
<reference file="Newtonsoft.Json.dll" />
</references>
</metadata>
</package>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>SimpleRESTServices</id>
<version>1.0.6.3</version>
<version>1.0.6.6</version>
<title>SimpleRESTServices</title>
<authors>alanquillin</authors>
<owners>alanquillin</owners>
<licenseUrl>https://github.com/JSIStudios/SimpleRestServices/wiki/License</licenseUrl>
<projectUrl>https://github.com/JSIStudios/SimpleRestServices</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>A simple set of client side and server side REST helpers</description>
<releaseNotes>https://github.com/JSIStudios/SimpleRestServices/wiki/v1.0.6.3</releaseNotes>
<releaseNotes>https://github.com/JSIStudios/SimpleRestServices/wiki/v1.0.6.6</releaseNotes>
<copyright>Copyright 2013</copyright>
<language />
<tags>REST REST_client</tags>
<dependencies>
<dependency id="Newtonsoft.Json" version="4.5.11" />
Expand Down
Binary file not shown.
Loading