Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<DateTime> FileChangeTime;
Nullable<std::string> FileChangeTime;
};
static Response<Models::CreateDirectoryResult> Create(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down Expand Up @@ -2065,7 +2065,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<DateTime> FileChangeTime;
Nullable<std::string> FileChangeTime;
};
static Response<Models::SetDirectoryPropertiesResult> SetProperties(
Core::Http::_internal::HttpPipeline& pipeline,
Expand Down Expand Up @@ -2158,7 +2158,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<DateTime> FileChangeTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> LeaseId;
};
static Response<Models::CreateFileResult> Create(
Expand Down Expand Up @@ -2210,7 +2210,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string FileAttributes;
Nullable<std::string> FileCreationTime;
Nullable<std::string> FileLastWriteTime;
Nullable<DateTime> FileChangeTime;
Nullable<std::string> FileChangeTime;
Nullable<std::string> LeaseId;
};
static Response<Models::SetFilePropertiesResult> SetHttpHeaders(
Expand Down
31 changes: 12 additions & 19 deletions sdk/storage/azure-storage-files-shares/src/rest_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) AutoRest C++ Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
#include <azure/storage/files/shares/rest_client.hpp>

#include <algorithm>
Expand Down Expand Up @@ -187,8 +188,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const CopyStatus CopyStatus::Success("success");
const CopyStatus CopyStatus::Aborted("aborted");
const CopyStatus CopyStatus::Failed("failed");
const FileLastWrittenMode FileLastWrittenMode::Now("Now");
const FileLastWrittenMode FileLastWrittenMode::Preserve("Preserve");
const FileLastWrittenMode FileLastWrittenMode::Now("now");
const FileLastWrittenMode FileLastWrittenMode::Preserve("preserve");
const PermissionCopyMode PermissionCopyMode::Source("source");
const PermissionCopyMode PermissionCopyMode::Override("override");
} // namespace Models
Expand Down Expand Up @@ -1691,11 +1692,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-last-write-time", options.FileLastWriteTime.Value());
}
if (options.FileChangeTime.HasValue())
if (options.FileChangeTime.HasValue() && !options.FileChangeTime.Value().empty())
{
request.SetHeader(
"x-ms-file-change-time",
options.FileChangeTime.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
request.SetHeader("x-ms-file-change-time", options.FileChangeTime.Value());
}
auto pRawResponse = pipeline.Send(request, context);
auto httpStatusCode = pRawResponse->GetStatusCode();
Expand Down Expand Up @@ -1848,11 +1847,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-last-write-time", options.FileLastWriteTime.Value());
}
if (options.FileChangeTime.HasValue())
if (options.FileChangeTime.HasValue() && !options.FileChangeTime.Value().empty())
{
request.SetHeader(
"x-ms-file-change-time",
options.FileChangeTime.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
request.SetHeader("x-ms-file-change-time", options.FileChangeTime.Value());
}
auto pRawResponse = pipeline.Send(request, context);
auto httpStatusCode = pRawResponse->GetStatusCode();
Expand Down Expand Up @@ -2645,11 +2642,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-last-write-time", options.FileLastWriteTime.Value());
}
if (options.FileChangeTime.HasValue())
if (options.FileChangeTime.HasValue() && !options.FileChangeTime.Value().empty())
{
request.SetHeader(
"x-ms-file-change-time",
options.FileChangeTime.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
request.SetHeader("x-ms-file-change-time", options.FileChangeTime.Value());
}
if (options.LeaseId.HasValue() && !options.LeaseId.Value().empty())
{
Expand Down Expand Up @@ -3080,11 +3075,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
request.SetHeader("x-ms-file-last-write-time", options.FileLastWriteTime.Value());
}
if (options.FileChangeTime.HasValue())
if (options.FileChangeTime.HasValue() && !options.FileChangeTime.Value().empty())
{
request.SetHeader(
"x-ms-file-change-time",
options.FileChangeTime.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
request.SetHeader("x-ms-file-change-time", options.FileChangeTime.Value());
}
if (options.LeaseId.HasValue() && !options.LeaseId.Value().empty())
{
Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/azure-storage-files-shares/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ directive:
$.ShareEnabledProtocols["enum"] = ["Smb", "Nfs"];
$.ShareEnabledProtocols["x-ms-enum"] = {"name": "ShareProtocols", "modelAsString": false};
$.ShareEnabledProtocols["x-ms-enum"]["values"] = [{"value": "SMB", "name": "Smb"},{"value": "NFS", "name": "Nfs"}];
delete $.FileChangeTime.format;
$.FileLastWriteTimeMode["x-ms-enum"]["values"] = [{"value": "now", "name": "Now"},{"value": "preserve", "name": "Preserve"}];
Comment on lines +222 to +223
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to modify the swagger in this case?
Is the swagger wrong, and do other languages behave the same way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other languages also do this.

- from: swagger-document
where: $.definitions
transform: >
Expand Down