azure-data-tables
Loading...
Searching...
No Matches
models.hpp
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License. See License.txt in the project root for license information.
3
4#pragma once
5
6#include "azure/data/tables/dll_import_export.hpp"
8
9#include <azure/core/datetime.hpp>
10#include <azure/core/internal/extendable_enumeration.hpp>
11#include <azure/core/nullable.hpp>
12#include <azure/core/paged_response.hpp>
13
14#include <cstdint>
15#include <map>
16#include <memory>
17#include <string>
18#include <utility>
19#include <vector>
20
21namespace Azure { namespace Data { namespace Tables {
22 class TableServiceClient;
23 class TableClient;
24
25 namespace Models {
29 struct Table final
30 {
34 std::string TableName;
38 std::string Metadata;
42 std::string EditLink;
46 std::string Type;
50 std::string Id;
51 };
52
57 enum class QueryTablesIncludeFlags
58 {
59 None = 0,
60 Metadata = 1,
61 };
62
67 struct QueryTablesOptions final
68 {
73 Azure::Nullable<std::string> Prefix;
74
82 Azure::Nullable<std::string> ContinuationToken;
83
87 Azure::Nullable<std::int32_t> PageSizeHint;
88
92 Models::QueryTablesIncludeFlags Include = Models::QueryTablesIncludeFlags::None;
93 };
94
99 : public Azure::Core::PagedResponse<QueryTablesPagedResponse> {
100
101 public:
105 std::string ServiceEndpoint;
106
110 Azure::Nullable<std::string> Prefix;
111
115 std::vector<Models::Table> Tables;
116
119
120 private:
121 QueryTablesPagedResponse(std::shared_ptr<TableServiceClient> tableServiceClient)
122 : m_tableServiceClient(tableServiceClient){};
123
125 friend class Azure::Core::PagedResponse<QueryTablesPagedResponse>;
126 std::shared_ptr<TableServiceClient> m_tableServiceClient;
127 void OnNextPage(const Azure::Core::Context& context);
128 };
129
133 struct RetentionPolicy final
134 {
138 bool IsEnabled = bool();
143 Nullable<std::int32_t> DataRetentionInDays;
144 };
145
150 struct Metrics final
151 {
155 std::string Version;
159 bool IsEnabled = bool();
163 Nullable<bool> IncludeApis;
168 };
169
173 struct AnalyticsLogging final
174 {
178 std::string Version;
182 bool Delete = bool();
186 bool Read = bool();
190 bool Write = bool();
195 };
196
203 struct CorsRule final
204 {
212 std::string AllowedOrigins;
217 std::string AllowedMethods;
221 std::string AllowedHeaders;
226 std::string ExposedHeaders;
230 std::int32_t MaxAgeInSeconds = int32_t();
231 };
232
237 {
253 std::vector<CorsRule> Cors;
254 };
255
261 {
266 };
267
272 {
273 };
274
279 {
280 };
281
287 {
291 std::string Origin;
295 std::string TableName;
296 };
297
302 public:
306 explicit GeoReplicationStatus(std::string value) : m_value(std::move(value)) {}
308 bool operator==(const GeoReplicationStatus& other) const { return m_value == other.m_value; }
310 bool operator!=(const GeoReplicationStatus& other) const { return !(*this == other); }
312 const std::string& ToString() const { return m_value; }
314 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Live;
316 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Bootstrap;
318 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Unavailable;
319
320 private:
321 std::string m_value;
322 };
323
328 : public Azure::Core::_internal::ExtendableEnumeration<TableEntityDataType> {
329 public:
339 explicit TableEntityDataType(std::string tableEntityDataType)
340 : ExtendableEnumeration(std::move(tableEntityDataType))
341 {
342 }
344 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmBinary;
346 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmBoolean;
348 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmDateTime;
350 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmDouble;
352 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmGuid;
354 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmInt32;
356 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmInt64;
358 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmString;
359 };
360
364 struct GeoReplication final
365 {
375 Nullable<DateTime> LastSyncedOn;
376 };
377
382 struct ServiceStatistics final
383 {
388 };
389
394 struct DeleteTableResult final
395 {
396 };
397
402 struct SignedIdentifier final
403 {
407 std::string Id;
411 Nullable<DateTime> StartsOn;
415 Nullable<DateTime> ExpiresOn;
419 std::string Permissions;
420 };
421
426 struct TableAccessPolicy final
427 {
431 std::vector<SignedIdentifier> SignedIdentifiers;
432 };
433
439 {
440 };
441
447 public:
450
456 TableEntityProperty(std::string const& value) : Value(std::move(value)) {}
462 TableEntityProperty(std::string const& value, TableEntityDataType type)
463 : Value(std::move(value)), Type(type)
464 {
465 }
469 std::string Value;
473 Azure::Nullable<TableEntityDataType> Type;
474 };
475
480 class TableEntity final {
481 constexpr static const char* PartitionKeyPropertyName = "PartitionKey";
482 constexpr static const char* RowKeyPropertyName = "RowKey";
483 constexpr static const char* ETagPropertyName = "odata.etag";
484 constexpr static const char* TimestampPropertyName = "Timestamp";
485
486 public:
490 std::map<std::string, TableEntityProperty> Properties;
491
497 TableEntityProperty GetPartitionKey() const { return GetProperty(PartitionKeyPropertyName); }
498
504 void SetPartitionKey(const std::string& partitionKey)
505 {
506 Properties[PartitionKeyPropertyName] = TableEntityProperty(partitionKey);
507 }
508
514 TableEntityProperty GetRowKey() const { return GetProperty(RowKeyPropertyName); }
520 void SetRowKey(const std::string& rowKey)
521 {
522 Properties[RowKeyPropertyName] = TableEntityProperty(rowKey);
523 }
524
530 TableEntityProperty GetETag() const { return GetProperty(ETagPropertyName); }
536 void SetETag(const std::string& eTag)
537 {
538 Properties[ETagPropertyName] = TableEntityProperty(eTag);
539 }
540
546 TableEntityProperty GetTimestamp() const { return GetProperty(TimestampPropertyName); }
552 void SetTimestamp(const std::string& timestamp)
553 {
554 Properties[TimestampPropertyName] = TableEntityProperty(timestamp);
555 }
556
557 private:
558 TableEntityProperty GetProperty(std::string const& name) const
559 {
560 return Properties.find(name) == Properties.end() ? TableEntityProperty()
561 : Properties.at(name);
562 }
563 };
564
569 enum class UpsertKind
570 {
571 Update,
572 Merge,
573 };
574
580 {
585 UpsertKind UpsertType = UpsertKind::Update;
586 };
592 {
593 AddEntityOptions() = default;
599 explicit AddEntityOptions(UpsertEntityOptions const& other) { (void)other; }
600 };
601
607 {
611 std::string ETag;
612 };
613
619 {
630 UpdateEntityOptions(UpsertEntityOptions const& other) { (void)other; }
631 };
632
638 {
642 std::string ETag;
643 };
644
650 {
661 MergeEntityOptions(UpsertEntityOptions const& other) { (void)other; }
662 };
663
669 {
673 std::string ETag;
674 };
675
681 {
682 };
683
689 {
693 std::string ETag;
705 : MergeEntityResult(other), ETag(std::move(other.ETag))
706 {
707 }
714 : UpdateEntityResult(other), ETag(std::move(other.ETag))
715 {
716 }
723 : AddEntityResult(other), ETag(std::move(other.ETag))
724 {
725 }
726 };
727
733 {
738 std::string PartitionKey;
743 std::string RowKey;
748 std::string NextPartitionKey;
753 std::string NextRowKey;
758 std::string SelectColumns;
763 Azure::Nullable<std::string> Filter;
764 };
765
771 : public Azure::Core::PagedResponse<QueryEntitiesPagedResponse> {
772 public:
776 std::string NextPartitionKey;
780 std::string NextRowKey;
784 std::vector<Models::TableEntity> TableEntities;
789
790 private:
791 QueryEntitiesPagedResponse(std::shared_ptr<TableClient> tableClient)
792 : m_tableClient(tableClient){};
793
794 std::shared_ptr<TableClient> m_tableClient;
796 friend class Azure::Core::PagedResponse<QueryEntitiesPagedResponse>;
797
798 void OnNextPage(const Azure::Core::Context& context);
799 };
800
805 enum class TransactionActionType
806 {
807 Add,
808 UpdateMerge,
809 UpdateReplace,
810 Delete,
811 InsertMerge,
812 InsertReplace
813 };
814
819 struct TransactionStep final
820 {
824 TransactionActionType Action;
829 };
830
835 struct TransactionError final
836 {
840 std::string Message;
844 std::string Code;
845 };
846
852 {
856 std::string StatusCode;
860 Azure::Nullable<TransactionError> Error;
861 };
862 } // namespace Models
863}}} // namespace Azure::Data::Tables
The status of the secondary location.
Definition models.hpp:301
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Live
Definition models.hpp:314
bool operator!=(const GeoReplicationStatus &other) const
Definition models.hpp:310
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Unavailable
Definition models.hpp:318
GeoReplicationStatus(std::string value)
Definition models.hpp:306
bool operator==(const GeoReplicationStatus &other) const
Definition models.hpp:308
const std::string & ToString() const
Definition models.hpp:312
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Bootstrap
Definition models.hpp:316
Query Entities result.
Definition models.hpp:771
std::string NextPartitionKey
Definition models.hpp:776
std::string NextRowKey
Definition models.hpp:780
std::vector< Models::TableEntity > TableEntities
Definition models.hpp:784
QueryEntitiesOptions m_operationOptions
Definition models.hpp:788
Query tables paged response.
Definition models.hpp:99
QueryTablesOptions m_operationOptions
Definition models.hpp:118
std::string ServiceEndpoint
Definition models.hpp:105
std::vector< Models::Table > Tables
Definition models.hpp:115
Azure::Nullable< std::string > Prefix
Definition models.hpp:110
Table Entity Data Type.
Definition models.hpp:328
TableEntityDataType()=default
Construct a new TableEntityDataType object.
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmDouble
Definition models.hpp:350
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmInt32
Definition models.hpp:354
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmInt64
Definition models.hpp:356
TableEntityDataType(std::string tableEntityDataType)
Construct a new TableEntityDataType object.
Definition models.hpp:339
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmString
Definition models.hpp:358
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmGuid
Definition models.hpp:352
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmDateTime
Definition models.hpp:348
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmBinary
Definition models.hpp:344
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmBoolean
Definition models.hpp:346
Table Entity.
Definition models.hpp:480
std::map< std::string, TableEntityProperty > Properties
Definition models.hpp:490
void SetETag(const std::string &eTag)
Set ETag.
Definition models.hpp:536
TableEntityProperty GetPartitionKey() const
Get partition key.
Definition models.hpp:497
void SetPartitionKey(const std::string &partitionKey)
Set Partition key.
Definition models.hpp:504
TableEntityProperty GetTimestamp() const
Get time stamp.
Definition models.hpp:546
TableEntityProperty GetETag() const
Get ETag.
Definition models.hpp:530
void SetRowKey(const std::string &rowKey)
Set Row key.
Definition models.hpp:520
void SetTimestamp(const std::string &timestamp)
Set time stamp.
Definition models.hpp:552
TableEntityProperty GetRowKey() const
Get row key.
Definition models.hpp:514
Table entity property.
Definition models.hpp:446
TableEntityProperty(std::string const &value)
Construct a new TableEntityProperty object.
Definition models.hpp:456
std::string Value
Definition models.hpp:469
TableEntityProperty(std::string const &value, TableEntityDataType type)
Construct a new TableEntityProperty object.
Definition models.hpp:462
Azure::Nullable< TableEntityDataType > Type
Definition models.hpp:473
Table Client.
Definition tables_clients.hpp:167
Table Service Client.
Definition tables_clients.hpp:390
Defines bitwise operators for enums.
Add Entity options.
Definition models.hpp:592
AddEntityOptions(UpsertEntityOptions const &other)
Create Entity options constructor.
Definition models.hpp:599
Add Entity result.
Definition models.hpp:607
std::string ETag
Definition models.hpp:611
Azure Analytics Logging settings.
Definition models.hpp:174
bool Write
Definition models.hpp:190
bool Delete
Definition models.hpp:182
bool Read
Definition models.hpp:186
RetentionPolicy RetentionPolicyDefinition
Definition models.hpp:194
std::string Version
Definition models.hpp:178
CORS is an HTTP feature that enables a web application running under one domain to access resources i...
Definition models.hpp:204
std::int32_t MaxAgeInSeconds
Definition models.hpp:230
std::string ExposedHeaders
Definition models.hpp:226
std::string AllowedOrigins
Definition models.hpp:212
std::string AllowedMethods
Definition models.hpp:217
std::string AllowedHeaders
Definition models.hpp:221
Delete Entity result.
Definition models.hpp:681
Delete result.
Definition models.hpp:395
Geo-Replication information for the Secondary Storage Service.
Definition models.hpp:365
GeoReplicationStatus Status
Definition models.hpp:369
Nullable< DateTime > LastSyncedOn
Definition models.hpp:375
Merge Entity options.
Definition models.hpp:650
MergeEntityOptions(UpsertEntityOptions const &other)
Merge Entity options constructor.
Definition models.hpp:661
MergeEntityOptions()=default
Merge Entity options default constructor.
Merge Entity result.
Definition models.hpp:669
std::string ETag
Definition models.hpp:673
A summary of request statistics grouped by API in hour or minute aggregates for tables.
Definition models.hpp:151
bool IsEnabled
Definition models.hpp:159
Nullable< bool > IncludeApis
Definition models.hpp:163
std::string Version
Definition models.hpp:155
RetentionPolicy RetentionPolicyDefinition
Definition models.hpp:167
Preflight check options.
Definition models.hpp:287
std::string TableName
Definition models.hpp:295
std::string Origin
Definition models.hpp:291
Preflight check response.
Definition models.hpp:279
Query Entities options.
Definition models.hpp:733
std::string NextPartitionKey
The next Partition key.
Definition models.hpp:748
std::string NextRowKey
The next row key.
Definition models.hpp:753
std::string SelectColumns
The select query.
Definition models.hpp:758
std::string PartitionKey
The Partition key.
Definition models.hpp:738
Azure::Nullable< std::string > Filter
The filter expression.
Definition models.hpp:763
std::string RowKey
The row key.
Definition models.hpp:743
Query Tables options.
Definition models.hpp:68
Azure::Nullable< std::string > ContinuationToken
A string value that identifies the portion of the list of tables to be returned with the next listing...
Definition models.hpp:82
Azure::Nullable< std::string > Prefix
Specifies a string that filters the results to return only tables whose name begins with the specifie...
Definition models.hpp:73
Models::QueryTablesIncludeFlags Include
Specifies that the table's metadata be returned.
Definition models.hpp:92
Azure::Nullable< std::int32_t > PageSizeHint
Specifies the maximum number of tables to return.
Definition models.hpp:87
The retention policy.
Definition models.hpp:134
Nullable< std::int32_t > DataRetentionInDays
Definition models.hpp:143
bool IsEnabled
Definition models.hpp:138
Stats for the storage service.
Definition models.hpp:383
Models::GeoReplication GeoReplication
Definition models.hpp:387
Set Service Properties options.
Definition models.hpp:261
TableServiceProperties ServiceProperties
Definition models.hpp:265
Set service properties response.
Definition models.hpp:272
Set Table Access Policy result.
Definition models.hpp:439
Signed identifier.
Definition models.hpp:403
std::string Id
Definition models.hpp:407
Nullable< DateTime > ExpiresOn
Definition models.hpp:415
std::string Permissions
Definition models.hpp:419
Nullable< DateTime > StartsOn
Definition models.hpp:411
Submit Transaction options.
Definition models.hpp:852
std::string StatusCode
Definition models.hpp:856
Azure::Nullable< TransactionError > Error
Definition models.hpp:860
Table Access Policy.
Definition models.hpp:427
std::vector< SignedIdentifier > SignedIdentifiers
Definition models.hpp:431
Table definition struct.
Definition models.hpp:30
std::string Id
Definition models.hpp:50
std::string Metadata
Definition models.hpp:38
std::string EditLink
Definition models.hpp:42
std::string Type
Definition models.hpp:46
std::string TableName
Definition models.hpp:34
Table Service Properties.
Definition models.hpp:237
Metrics MinuteMetrics
Definition models.hpp:249
AnalyticsLogging Logging
Definition models.hpp:241
std::vector< CorsRule > Cors
Definition models.hpp:253
Metrics HourMetrics
Definition models.hpp:245
Transaction Error.
Definition models.hpp:836
std::string Code
Definition models.hpp:844
std::string Message
Definition models.hpp:840
Transaction Step.
Definition models.hpp:820
Models::TableEntity Entity
Definition models.hpp:828
TransactionActionType Action
Definition models.hpp:824
Update Entity options.
Definition models.hpp:619
UpdateEntityOptions(UpsertEntityOptions const &other)
Update Entity options constructor.
Definition models.hpp:630
UpdateEntityOptions()=default
Update Entity options default constructor.
Update Entity result.
Definition models.hpp:638
std::string ETag
Definition models.hpp:642
Upsert Entity options.
Definition models.hpp:580
UpsertKind UpsertType
Upsert type.
Definition models.hpp:585
Upsert Entity result.
Definition models.hpp:689
std::string ETag
Definition models.hpp:693
UpsertEntityResult(MergeEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:704
UpsertEntityResult()=default
Upsert Entity result default constructor.
UpsertEntityResult(AddEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:722
UpsertEntityResult(UpdateEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:713