aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/core/ymq/base/action.h
blob: 9ad47c392539ea9bb97d935a4cc17b74dcb22ccf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once

#include <ydb/core/protos/msgbus.pb.h>

#include <util/generic/string.h>

namespace NKikimr::NSQS {

enum EAction {
    Unknown = 0,
    ChangeMessageVisibility,
    ChangeMessageVisibilityBatch,
    CreateQueue,
    CreateUser,
    GetQueueAttributes,
    GetQueueAttributesBatch,
    GetQueueUrl,
    DeleteMessage,
    DeleteMessageBatch,
    DeleteQueue,
    DeleteQueueBatch,
    DeleteUser,
    ListQueues,
    ListUsers,
    PurgeQueue,
    PurgeQueueBatch,
    ReceiveMessage,
    SendMessage,
    SendMessageBatch,
    SetQueueAttributes,
    ModifyPermissions,
    ListPermissions,
    ListDeadLetterSourceQueues,
    CountQueues,

    ActionsArraySize,
};

EAction ActionFromString(const TString& name);
const TString& ActionToString(EAction action);
const TString& ActionToCloudConvMethod(EAction action);

bool IsBatchAction(EAction action);
bool IsActionForQueue(EAction action);
bool IsActionForQueueYMQ(EAction action);
bool IsActionForUser(EAction action);
bool IsActionForUserYMQ(EAction action);
bool IsProxyAction(EAction action);
bool IsActionForMessage(EAction action);
bool IsFastAction(EAction action);
bool IsPrivateAction(EAction action);

bool IsModifySchemaRequest(const NKikimrClient::TSqsRequest& req);

// get nonbatch action variant for given action
EAction GetNonBatchAction(EAction action);

#define SQS_REQUEST_CASE_WRAP(action)                    \
    case NKikimrClient::TSqsRequest::Y_CAT(k, action): { \
        SQS_REQUEST_CASE(action)                         \
        break;                                           \
    }

// DO NOT proxy account creation or queue listing

#define SQS_SWITCH_REQUEST_CUSTOM(request, enumerate, default_case) \
    switch ((request).GetRequestCase()) {                           \
        enumerate(SQS_REQUEST_CASE_WRAP)                            \
        default:                                                    \
            default_case;                                           \
    }

// Actions with proxy
#define ENUMERATE_PROXY_ACTIONS(macro)      \
        macro(ChangeMessageVisibility)      \
        macro(ChangeMessageVisibilityBatch) \
        macro(DeleteMessage)                \
        macro(DeleteMessageBatch)           \
        macro(DeleteQueue)                  \
        macro(GetQueueAttributes)           \
        macro(PurgeQueue)                   \
        macro(ReceiveMessage)               \
        macro(SendMessage)                  \
        macro(SendMessageBatch)             \
        macro(ListDeadLetterSourceQueues)   \
        macro(SetQueueAttributes)

} // namespace NKikimr::NSQS