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 struct QueryTablesOptions final
58 {
63 Azure::Nullable<std::string> Prefix;
64
72 Azure::Nullable<std::string> ContinuationToken;
73
77 Azure::Nullable<std::int32_t> PageSizeHint;
78 };
79
84 : public Azure::Core::PagedResponse<QueryTablesPagedResponse> {
85
86 public:
90 std::string ServiceEndpoint;
91
95 Azure::Nullable<std::string> Prefix;
96
100 std::vector<Models::Table> Tables;
101
104
105 private:
106 QueryTablesPagedResponse(std::shared_ptr<TableServiceClient> tableServiceClient)
107 : m_tableServiceClient(std::move(tableServiceClient)){};
108
110 friend class Azure::Core::PagedResponse<QueryTablesPagedResponse>;
111 std::shared_ptr<TableServiceClient> m_tableServiceClient;
112 void OnNextPage(const Azure::Core::Context& context);
113 };
114
118 struct RetentionPolicy final
119 {
123 bool IsEnabled = bool();
128 Nullable<std::int32_t> DataRetentionInDays;
129 };
130
135 struct Metrics final
136 {
140 std::string Version;
144 bool IsEnabled = bool();
148 Nullable<bool> IncludeApis;
153 };
154
158 struct AnalyticsLogging final
159 {
163 std::string Version;
167 bool Delete = bool();
171 bool Read = bool();
175 bool Write = bool();
180 };
181
188 struct CorsRule final
189 {
197 std::string AllowedOrigins;
202 std::string AllowedMethods;
206 std::string AllowedHeaders;
211 std::string ExposedHeaders;
215 std::int32_t MaxAgeInSeconds = int32_t();
216 };
217
222 {
238 std::vector<CorsRule> Cors;
239 };
240
246 {
251 };
252
257 {
258 };
259
264 {
265 };
266
272 {
276 std::string Origin;
280 std::string TableName;
281 };
282
287 public:
291 explicit GeoReplicationStatus(std::string value) : m_value(std::move(value)) {}
293 bool operator==(const GeoReplicationStatus& other) const { return m_value == other.m_value; }
295 bool operator!=(const GeoReplicationStatus& other) const { return !(*this == other); }
297 const std::string& ToString() const { return m_value; }
299 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Live;
301 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Bootstrap;
303 AZ_DATA_TABLES_DLLEXPORT const static GeoReplicationStatus Unavailable;
304
305 private:
306 std::string m_value;
307 };
308
313 : public Azure::Core::_internal::ExtendableEnumeration<TableEntityDataType> {
314 public:
324 explicit TableEntityDataType(std::string tableEntityDataType)
325 : ExtendableEnumeration(std::move(tableEntityDataType))
326 {
327 }
329 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmBinary;
331 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmBoolean;
333 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmDateTime;
335 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmDouble;
337 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmGuid;
339 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmInt32;
341 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmInt64;
343 AZ_DATA_TABLES_DLLEXPORT const static TableEntityDataType EdmString;
344 };
345
349 struct GeoReplication final
350 {
360 Nullable<DateTime> LastSyncedOn;
361 };
362
367 struct ServiceStatistics final
368 {
373 };
374
379 struct DeleteTableResult final
380 {
381 };
382
387 struct SignedIdentifier final
388 {
392 std::string Id;
396 Nullable<DateTime> StartsOn;
400 Nullable<DateTime> ExpiresOn;
404 std::string Permissions;
405 };
406
411 struct TableAccessPolicy final
412 {
416 std::vector<SignedIdentifier> SignedIdentifiers;
417 };
418
424 {
425 };
426
432 public:
435
441 TableEntityProperty(std::string value) : Value(std::move(value)) {}
448 : Value(std::move(value)), Type(std::move(type))
449 {
450 }
454 std::string Value;
458 Azure::Nullable<TableEntityDataType> Type;
459 };
460
465 class TableEntity final {
466 constexpr static const char* PartitionKeyPropertyName = "PartitionKey";
467 constexpr static const char* RowKeyPropertyName = "RowKey";
468 constexpr static const char* ETagPropertyName = "odata.etag";
469 constexpr static const char* TimestampPropertyName = "Timestamp";
470
471 public:
475 std::map<std::string, TableEntityProperty> Properties;
476
482 TableEntityProperty GetPartitionKey() const { return GetProperty(PartitionKeyPropertyName); }
483
489 void SetPartitionKey(const std::string& partitionKey)
490 {
491 Properties[PartitionKeyPropertyName] = TableEntityProperty(partitionKey);
492 }
493
499 TableEntityProperty GetRowKey() const { return GetProperty(RowKeyPropertyName); }
505 void SetRowKey(const std::string& rowKey)
506 {
507 Properties[RowKeyPropertyName] = TableEntityProperty(rowKey);
508 }
509
515 TableEntityProperty GetETag() const { return GetProperty(ETagPropertyName); }
521 void SetETag(const std::string& eTag)
522 {
523 Properties[ETagPropertyName] = TableEntityProperty(eTag);
524 }
525
531 TableEntityProperty GetTimestamp() const { return GetProperty(TimestampPropertyName); }
537 void SetTimestamp(const std::string& timestamp)
538 {
539 Properties[TimestampPropertyName] = TableEntityProperty(timestamp);
540 }
541
542 private:
543 TableEntityProperty GetProperty(std::string const& name) const
544 {
545 return Properties.find(name) == Properties.end() ? TableEntityProperty()
546 : Properties.at(name);
547 }
548 };
549
554 enum class UpsertKind
555 {
556 Update,
557 Merge,
558 };
559
565 {
570 UpsertKind UpsertType = UpsertKind::Update;
571 };
577 {
578 AddEntityOptions() = default;
584 explicit AddEntityOptions(UpsertEntityOptions const& other) { (void)other; }
585 };
586
592 {
596 std::string ETag;
597 };
598
604 {
615 UpdateEntityOptions(UpsertEntityOptions const& other) { (void)other; }
616 };
617
623 {
627 std::string ETag;
628 };
629
635 {
646 MergeEntityOptions(UpsertEntityOptions const& other) { (void)other; }
647 };
648
654 {
658 std::string ETag;
659 };
660
666 {
667 };
668
674 {
678 std::string ETag;
690 : MergeEntityResult(other), ETag(other.ETag)
691 {
692 }
699 : UpdateEntityResult(other), ETag(other.ETag)
700 {
701 }
708 };
709
715 {
720 std::string PartitionKey;
725 std::string RowKey;
730 std::string NextPartitionKey;
735 std::string NextRowKey;
740 std::string SelectColumns;
745 Azure::Nullable<std::string> Filter;
746 };
747
753 : public Azure::Core::PagedResponse<QueryEntitiesPagedResponse> {
754 public:
758 std::string NextPartitionKey;
762 std::string NextRowKey;
766 std::vector<Models::TableEntity> TableEntities;
771
772 private:
773 QueryEntitiesPagedResponse(std::shared_ptr<TableClient> tableClient)
774 : m_tableClient(std::move(tableClient)){};
775
776 std::shared_ptr<TableClient> m_tableClient;
778 friend class Azure::Core::PagedResponse<QueryEntitiesPagedResponse>;
779
780 void OnNextPage(const Azure::Core::Context& context);
781 };
782
787 enum class TransactionActionType
788 {
789 Add,
790 UpdateMerge,
791 UpdateReplace,
792 Delete,
793 InsertMerge,
794 InsertReplace
795 };
796
801 struct TransactionStep final
802 {
806 TransactionActionType Action{};
811 };
812
817 struct TransactionError final
818 {
822 std::string Message;
826 std::string Code;
827 };
828
834 {
838 std::string StatusCode;
842 Azure::Nullable<TransactionError> Error;
843 };
844 } // namespace Models
845}}} // namespace Azure::Data::Tables
The status of the secondary location.
Definition models.hpp:286
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Live
Definition models.hpp:299
bool operator!=(const GeoReplicationStatus &other) const
Definition models.hpp:295
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Unavailable
Definition models.hpp:303
GeoReplicationStatus(std::string value)
Definition models.hpp:291
bool operator==(const GeoReplicationStatus &other) const
Definition models.hpp:293
const std::string & ToString() const
Definition models.hpp:297
AZ_DATA_TABLES_DLLEXPORT static const GeoReplicationStatus Bootstrap
Definition models.hpp:301
Query Entities result.
Definition models.hpp:753
std::string NextPartitionKey
Definition models.hpp:758
std::string NextRowKey
Definition models.hpp:762
std::vector< Models::TableEntity > TableEntities
Definition models.hpp:766
QueryEntitiesOptions m_operationOptions
Definition models.hpp:770
Query tables paged response.
Definition models.hpp:84
QueryTablesOptions m_operationOptions
Definition models.hpp:103
std::string ServiceEndpoint
Definition models.hpp:90
std::vector< Models::Table > Tables
Definition models.hpp:100
Azure::Nullable< std::string > Prefix
Definition models.hpp:95
Table Entity Data Type.
Definition models.hpp:313
TableEntityDataType()=default
Construct a new TableEntityDataType object.
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmDouble
Definition models.hpp:335
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmInt32
Definition models.hpp:339
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmInt64
Definition models.hpp:341
TableEntityDataType(std::string tableEntityDataType)
Construct a new TableEntityDataType object.
Definition models.hpp:324
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmString
Definition models.hpp:343
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmGuid
Definition models.hpp:337
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmDateTime
Definition models.hpp:333
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmBinary
Definition models.hpp:329
AZ_DATA_TABLES_DLLEXPORT static const TableEntityDataType EdmBoolean
Definition models.hpp:331
Table Entity.
Definition models.hpp:465
std::map< std::string, TableEntityProperty > Properties
Definition models.hpp:475
void SetETag(const std::string &eTag)
Set ETag.
Definition models.hpp:521
TableEntityProperty GetPartitionKey() const
Get partition key.
Definition models.hpp:482
void SetPartitionKey(const std::string &partitionKey)
Set Partition key.
Definition models.hpp:489
TableEntityProperty GetTimestamp() const
Get time stamp.
Definition models.hpp:531
TableEntityProperty GetETag() const
Get ETag.
Definition models.hpp:515
void SetRowKey(const std::string &rowKey)
Set Row key.
Definition models.hpp:505
void SetTimestamp(const std::string &timestamp)
Set time stamp.
Definition models.hpp:537
TableEntityProperty GetRowKey() const
Get row key.
Definition models.hpp:499
Table entity property.
Definition models.hpp:431
std::string Value
Definition models.hpp:454
Azure::Nullable< TableEntityDataType > Type
Definition models.hpp:458
TableEntityProperty(std::string value, TableEntityDataType type)
Construct a new TableEntityProperty object.
Definition models.hpp:447
TableEntityProperty(std::string value)
Construct a new TableEntityProperty object.
Definition models.hpp:441
Table Client.
Definition table_client.hpp:60
Table Service Client.
Definition table_service_client.hpp:25
Defines bitwise operators for enums.
Add Entity options.
Definition models.hpp:577
AddEntityOptions(UpsertEntityOptions const &other)
Create Entity options constructor.
Definition models.hpp:584
Add Entity result.
Definition models.hpp:592
std::string ETag
Definition models.hpp:596
Azure Analytics Logging settings.
Definition models.hpp:159
bool Write
Definition models.hpp:175
bool Delete
Definition models.hpp:167
bool Read
Definition models.hpp:171
RetentionPolicy RetentionPolicyDefinition
Definition models.hpp:179
std::string Version
Definition models.hpp:163
CORS is an HTTP feature that enables a web application running under one domain to access resources i...
Definition models.hpp:189
std::int32_t MaxAgeInSeconds
Definition models.hpp:215
std::string ExposedHeaders
Definition models.hpp:211
std::string AllowedOrigins
Definition models.hpp:197
std::string AllowedMethods
Definition models.hpp:202
std::string AllowedHeaders
Definition models.hpp:206
Delete Entity result.
Definition models.hpp:666
Delete result.
Definition models.hpp:380
Geo-Replication information for the Secondary Storage Service.
Definition models.hpp:350
GeoReplicationStatus Status
Definition models.hpp:354
Nullable< DateTime > LastSyncedOn
Definition models.hpp:360
Merge Entity options.
Definition models.hpp:635
MergeEntityOptions(UpsertEntityOptions const &other)
Merge Entity options constructor.
Definition models.hpp:646
MergeEntityOptions()=default
Merge Entity options default constructor.
Merge Entity result.
Definition models.hpp:654
std::string ETag
Definition models.hpp:658
A summary of request statistics grouped by API in hour or minute aggregates for tables.
Definition models.hpp:136
bool IsEnabled
Definition models.hpp:144
Nullable< bool > IncludeApis
Definition models.hpp:148
std::string Version
Definition models.hpp:140
RetentionPolicy RetentionPolicyDefinition
Definition models.hpp:152
Preflight check options.
Definition models.hpp:272
std::string TableName
Definition models.hpp:280
std::string Origin
Definition models.hpp:276
Preflight check response.
Definition models.hpp:264
Query Entities options.
Definition models.hpp:715
std::string NextPartitionKey
The next Partition key.
Definition models.hpp:730
std::string NextRowKey
The next row key.
Definition models.hpp:735
std::string SelectColumns
The select query.
Definition models.hpp:740
std::string PartitionKey
The Partition key.
Definition models.hpp:720
Azure::Nullable< std::string > Filter
The filter expression.
Definition models.hpp:745
std::string RowKey
The row key.
Definition models.hpp:725
Query Tables options.
Definition models.hpp:58
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:72
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:63
Azure::Nullable< std::int32_t > PageSizeHint
Specifies the maximum number of tables to return.
Definition models.hpp:77
The retention policy.
Definition models.hpp:119
Nullable< std::int32_t > DataRetentionInDays
Definition models.hpp:128
bool IsEnabled
Definition models.hpp:123
Stats for the storage service.
Definition models.hpp:368
Models::GeoReplication GeoReplication
Definition models.hpp:372
Set Service Properties options.
Definition models.hpp:246
TableServiceProperties ServiceProperties
Definition models.hpp:250
Set service properties response.
Definition models.hpp:257
Set Table Access Policy result.
Definition models.hpp:424
Signed identifier.
Definition models.hpp:388
std::string Id
Definition models.hpp:392
Nullable< DateTime > ExpiresOn
Definition models.hpp:400
std::string Permissions
Definition models.hpp:404
Nullable< DateTime > StartsOn
Definition models.hpp:396
Submit Transaction options.
Definition models.hpp:834
std::string StatusCode
Definition models.hpp:838
Azure::Nullable< TransactionError > Error
Definition models.hpp:842
Table Access Policy.
Definition models.hpp:412
std::vector< SignedIdentifier > SignedIdentifiers
Definition models.hpp:416
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:222
Metrics MinuteMetrics
Definition models.hpp:234
AnalyticsLogging Logging
Definition models.hpp:226
std::vector< CorsRule > Cors
Definition models.hpp:238
Metrics HourMetrics
Definition models.hpp:230
Transaction Error.
Definition models.hpp:818
std::string Code
Definition models.hpp:826
std::string Message
Definition models.hpp:822
Transaction Step.
Definition models.hpp:802
Models::TableEntity Entity
Definition models.hpp:810
TransactionActionType Action
Definition models.hpp:806
Update Entity options.
Definition models.hpp:604
UpdateEntityOptions(UpsertEntityOptions const &other)
Update Entity options constructor.
Definition models.hpp:615
UpdateEntityOptions()=default
Update Entity options default constructor.
Update Entity result.
Definition models.hpp:623
std::string ETag
Definition models.hpp:627
Upsert Entity options.
Definition models.hpp:565
UpsertKind UpsertType
Upsert type.
Definition models.hpp:570
Upsert Entity result.
Definition models.hpp:674
std::string ETag
Definition models.hpp:678
UpsertEntityResult(MergeEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:689
UpsertEntityResult()=default
Upsert Entity result default constructor.
UpsertEntityResult(AddEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:707
UpsertEntityResult(UpdateEntityResult const &other)
Upsert Entity result constructor.
Definition models.hpp:698