/// <summary> /// Create makes a new session. Providing a session entry can customize the session. It can also be null to use defaults. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <param name="q">Customized write options</param> /// <returns>A write result containing the new session ID</returns> public WriteResult <string> Create(SessionEntry se, WriteOptions q) { var res = _client.CreateWrite <SessionEntry, SessionCreationResult>("/v1/session/create", se, q).Execute(); return(new WriteResult <string>() { RequestTime = res.RequestTime, Response = res.Response.ID }); }
/// <summary> /// CreateSession is used to create a new managed session /// </summary> /// <returns>The session ID</returns> private async Task <string> CreateSession() { var se = new SessionEntry { Name = Opts.SessionName, TTL = Opts.SessionTTL }; return((await _client.Session.Create(se).ConfigureAwait(false)).Response); }
/// <summary> /// CreateSession is used to create a new managed session /// </summary> /// <returns>The session ID</returns> private string CreateSession() { var se = new SessionEntry { Name = Opts.SessionName, TTL = Opts.SessionTTL }; return(_client.Session.Create(se).Response); }
/// <summary> /// CreateNoChecks is like Create but is used specifically to create a session with no associated health checks. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <param name="q">Customized write options</param> /// <returns>A write result containing the new session ID</returns> public Task <WriteResult <string> > CreateNoChecks(SessionEntry se, WriteOptions q, CancellationToken ct = default(CancellationToken)) { if (se == null) { return(Create(null, q)); } var noChecksEntry = new SessionEntry() { Behavior = se.Behavior, Checks = new List <string>(0), LockDelay = se.LockDelay, Name = se.Name, Node = se.Node, TTL = se.TTL }; return(Create(noChecksEntry, q, ct)); }
/// <summary> /// CreateNoChecks is like Create but is used specifically to create a session with no associated health checks. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <param name="q">Customized write options</param> /// <returns>A write result containing the new session ID</returns> public WriteResult <string> CreateNoChecks(SessionEntry se, WriteOptions q) { if (se == null) { return(Create(null, q)); } var noChecksEntry = new SessionEntry() { Behavior = se.Behavior, Checks = new List <string>(0), LockDelay = se.LockDelay, Name = se.Name, Node = se.Node, TTL = se.TTL }; return(Create(noChecksEntry, q)); }
/// <summary> /// CreateNoChecks is like Create but is used specifically to create a session with no associated health checks. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <returns>A write result containing the new session ID</returns> public Task <WriteResult <string> > CreateNoChecks(SessionEntry se, CancellationToken ct = default(CancellationToken)) { return(CreateNoChecks(se, WriteOptions.Default, ct)); }
/// <summary> /// Create makes a new session. Providing a session entry can customize the session. It can also be null to use defaults. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <param name="q">Customized write options</param> /// <returns>A write result containing the new session ID</returns> public async Task <WriteResult <string> > Create(SessionEntry se, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <SessionEntry, SessionCreationResult>("/v1/session/create", se, q).Execute(ct).ConfigureAwait(false); return(new WriteResult <string>(res, res.Response.ID)); }
/// <summary> /// CreateNoChecks is like Create but is used specifically to create a session with no associated health checks. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <returns>A write result containing the new session ID</returns> public Task <WriteResult <string> > CreateNoChecks(SessionEntry se) { return(CreateNoChecks(se, WriteOptions.Default)); }
/// <summary> /// Create makes a new session. Providing a session entry can customize the session. It can also be null to use defaults. /// </summary> /// <param name="se">The SessionEntry options to use</param> /// <returns>A write result containing the new session ID</returns> public WriteResult <string> Create(SessionEntry se) { return(Create(se, WriteOptions.Empty)); }