Skip to content

Commit

Permalink
Storage STG97/NFS REST Part2(Impl+test) (#6285)
Browse files Browse the repository at this point in the history
* add test cases and some code change.

* update logic

* fix pipeline failure

* fix cspell

* update test record

* Fix pipeline failure

* Fix test case failure
  • Loading branch information
microzchang authored Dec 11, 2024
1 parent 631af66 commit 5f41928
Show file tree
Hide file tree
Showing 15 changed files with 1,193 additions and 343 deletions.
1 change: 1 addition & 0 deletions sdk/core/azure-core-test/src/test_proxy_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ void TestProxyManager::SetProxySanitizer()
"x-ms-file-change-time",
"x-ms-file-creation-time",
"x-ms-file-last-write-time",
"x-ms-link-text",
"x-ms-rename-source",
"x-ms-immutability-policy-until-date",
};
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/storage",
"Tag": "cpp/storage_f9f7bb54df"
"Tag": "cpp/storage_6a4354ee63"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Azure { namespace Storage { namespace Sas {
namespace {
constexpr static const char* SasVersion = "2025-01-05";
constexpr static const char* SasVersion = "2025-05-05";
}

void AccountSasBuilder::SetPermissions(AccountSasPermissions permissions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2025-01-05";
constexpr static const char* ApiVersion = "2025-05-05";
} // namespace _detail
namespace Models {
/**
Expand Down Expand Up @@ -1102,7 +1102,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/** Constant value of type NfsFileType: Directory */
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static NfsFileType Directory;
/** Constant value of type NfsFileType: Symlink */
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static NfsFileType Symlink;
AZ_STORAGE_FILES_SHARES_DLLEXPORT const static NfsFileType SymLink;
};
namespace _detail {
/**
Expand Down Expand Up @@ -2284,6 +2284,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
struct CreateFileSymbolicLinkResult final
{
bool Created = true;
/**
* The SMB related properties for the file.
*/
FileSmbProperties SmbProperties;
/**
* The ETag contains a value which represents the version of the file, in quotes.
*/
Expand All @@ -2294,26 +2299,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* affect the last modified time of the directory.
*/
DateTime LastModified;
/**
* Creation time for the file.
*/
DateTime FileCreationTime;
/**
* Last write time for the file.
*/
DateTime FileLastWriteTime;
/**
* Change time for the file.
*/
DateTime FileChangeTime;
/**
* The fileId of the file.
*/
std::string FileId;
/**
* The parent fileId of the directory.
*/
std::string FileParentId;
/**
* NFS only. The mode of the file or directory.
*/
Expand Down Expand Up @@ -2358,6 +2343,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
struct CreateFileHardLinkResult final
{
bool Created = true;
/**
* The SMB related properties for the file.
*/
FileSmbProperties SmbProperties;
/**
* The ETag contains a value which represents the version of the file, in quotes.
*/
Expand All @@ -2368,26 +2358,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* affect the last modified time of the directory.
*/
DateTime LastModified;
/**
* Creation time for the file.
*/
DateTime FileCreationTime;
/**
* Last write time for the file.
*/
DateTime FileLastWriteTime;
/**
* Change time for the file.
*/
DateTime FileChangeTime;
/**
* The fileId of the file.
*/
std::string FileId;
/**
* The parent fileId of the directory.
*/
std::string FileParentId;
/**
* NFS only. The link count of the file or directory.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief Set effective user ID (setuid) on the file or directory.
*/
bool EffectiveUserIdentity;
bool EffectiveUserIdentity = false;

/**
* @brief Set effective group ID (setgid) on the file or directory.
*/
bool EffectiveGroupIdentity;
bool EffectiveGroupIdentity = false;

/**
* @brief The sticky bit may be set on directories. The files in that directory may only be
* renamed or deleted by the file's owner, the directory's owner, or the root user.
*/
bool StickyBit;
bool StickyBit = false;

/**
* @brief Returns the octal representation of NfsFileMode as a string.
Expand Down Expand Up @@ -148,6 +148,78 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
};
} // namespace Models

/**
* Smb Properties to copy from the source file.
*/
enum class CopyableFileSmbPropertyFlags
{
/**
* None.
*/
None = 0,

/**
* File Attributes.
*/
FileAttributes = 1,

/**
* Created On.
*/
CreatedOn = 2,

/**
* Last Written On.
*/
LastWrittenOn = 4,

/**
* Changed On.
*/
ChangedOn = 8,

/**
* Permission
*/
Permission = 16,

/**
* All.
*/
All = ~None
};

inline CopyableFileSmbPropertyFlags operator|(
CopyableFileSmbPropertyFlags lhs,
CopyableFileSmbPropertyFlags rhs)
{
using type = std::underlying_type_t<CopyableFileSmbPropertyFlags>;
return static_cast<CopyableFileSmbPropertyFlags>(
static_cast<type>(lhs) | static_cast<type>(rhs));
}
inline CopyableFileSmbPropertyFlags& operator|=(
CopyableFileSmbPropertyFlags& lhs,
CopyableFileSmbPropertyFlags rhs)
{
lhs = lhs | rhs;
return lhs;
}
inline CopyableFileSmbPropertyFlags operator&(
CopyableFileSmbPropertyFlags lhs,
CopyableFileSmbPropertyFlags rhs)
{
using type = std::underlying_type_t<CopyableFileSmbPropertyFlags>;
return static_cast<CopyableFileSmbPropertyFlags>(
static_cast<type>(lhs) & static_cast<type>(rhs));
}
inline CopyableFileSmbPropertyFlags& operator&=(
CopyableFileSmbPropertyFlags& lhs,
CopyableFileSmbPropertyFlags rhs)
{
lhs = lhs & rhs;
return lhs;
}

/**
* @brief Audiences available for share service
*
Expand Down Expand Up @@ -911,6 +983,17 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
*/
Azure::Nullable<Models::PermissionCopyMode> PermissionCopyMode;

/**
* Smb Properties to copy from the source file.
* If this flag is nullable, it will use the value of source file(except ChangedOn, it will be
* default value) if the property is not set.
* If this flag is disabled, it will use the default
* value of destination file if the property is not set.
* If this flag is enabled, it will use the value of source file no
* matter the property is set or not.
*/
Azure::Nullable<CopyableFileSmbPropertyFlags> SmbPropertiesToCopy;

/**
* Specifies the option to overwrite the target file if it already exists and has
* read-only attribute set.
Expand All @@ -932,6 +1015,18 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* The NFS related properties for the file.
*/
Models::FilePosixProperties NfsProperties;

/**
* Optional, only applicable to NFS Files. If not populated, the destination file will have the
* default File Mode.
*/
Azure::Nullable<Models::ModeCopyMode> ModeCopyMode;

/**
* Optional, only applicable to NFS Files. If not populated, the destination file will have the
* default Owner and Group.
*/
Azure::Nullable<Models::OwnerCopyMode> OwnerCopyMode;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,32 +600,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* The ETag contains a value which represents the version of the file, in quotes.
*/
Azure::ETag ETag;

/**
* Returns the date and time the share was last modified. Any operation that modifies the
* directory or its properties updates the last modified time. Operations on files do not
* affect the last modified time of the directory.
*/
DateTime LastModified;

/**
* Creation time for the file.
*/
DateTime FileCreationTime;
/**
* Last write time for the file.
*/
DateTime FileLastWriteTime;
/**
* Change time for the file.
*/
DateTime FileChangeTime;
/**
* The fileId of the file.
*/
std::string FileId;
/**
* The parent fileId of the directory.
* The SMB related properties for the file.
*/
std::string FileParentId;
FileSmbProperties SmbProperties;

/**
* The NFS related properties for the file.
*/
Expand Down Expand Up @@ -662,32 +649,19 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* The ETag contains a value which represents the version of the file, in quotes.
*/
Azure::ETag ETag;

/**
* Returns the date and time the share was last modified. Any operation that modifies the
* directory or its properties updates the last modified time. Operations on files do not
* affect the last modified time of the directory.
*/
DateTime LastModified;

/**
* Creation time for the file.
*/
DateTime FileCreationTime;
/**
* Last write time for the file.
*/
DateTime FileLastWriteTime;
/**
* Change time for the file.
*/
DateTime FileChangeTime;
/**
* The fileId of the file.
*/
std::string FileId;
/**
* The parent fileId of the directory.
* The SMB related properties for the file.
*/
std::string FileParentId;
FileSmbProperties SmbProperties;

/**
* The NFS related properties for the file.
*/
Expand Down
Loading

0 comments on commit 5f41928

Please sign in to comment.