1 /*
2  * Hunt - A redis client library for D programming language.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11  
12 module hunt.redis.params.ClientKillParams;
13 
14 import hunt.redis.params.Params;
15 
16 import std.conv;
17 import std.variant;
18 
19 class ClientKillParams : Params {
20 
21     private enum string ID = "ID";
22     private enum string TYPE = "TYPE";
23     private enum string ADDR = "ADDR";
24     private enum string SKIPME = "SKIPME";
25 
26     alias addParam = Params.addParam;
27 
28     static enum Type {
29         NORMAL,
30         MASTER,
31         SLAVE,
32         PUBSUB
33     }
34 
35     static enum SkipMe {
36         YES,
37         NO
38     }
39 
40     this() {
41     }
42 
43     static ClientKillParams clientKillParams() {
44         return new ClientKillParams();
45     }
46 
47     ClientKillParams id(string clientId) {
48         addParam(ID, clientId);
49         return this;
50     }
51 
52     ClientKillParams id(byte[] clientId) {
53         addParam(ID, clientId);
54         return this;
55     }
56 
57     ClientKillParams type(Type type) {
58         addParam(TYPE, Variant(type));
59         return this;
60     }
61 
62     ClientKillParams addr(string ipPort) {
63         addParam(ADDR, ipPort);
64         return this;
65     }
66 
67     ClientKillParams addr(byte[] ipPort) {
68         addParam(ADDR, ipPort);
69         return this;
70     }
71 
72     ClientKillParams addr(string ip, int port) {
73         addParam(ADDR, ip ~ ":" ~ port.to!string());
74         return this;
75     }
76 
77     ClientKillParams skipMe(SkipMe skipMe) {
78         addParam(SKIPME, Variant(skipMe));
79         return this;
80     }
81 
82 }