/// <summary> /// Destroy invalidates a given session /// </summary> /// <param name="id">The session ID to destroy</param> /// <param name="q">Customized write options</param> /// <returns>A write result containing the result of the session destruction</returns> public Task <WriteResult <bool> > Destroy(string id, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put <object, bool>(string.Format("/v1/session/destroy/{0}", id), null, q).Execute(ct)); }
public async Task <WriteResult <string> > Create(PreparedQueryDefinition query, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.Post <PreparedQueryDefinition, PreparedQueryCreationResult>("/v1/query", query, q).Execute(ct).ConfigureAwait(false); return(new WriteResult <string>(res, res.Response.ID)); }
public Task <WriteResult> Update(PreparedQueryDefinition query, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put(string.Format("/v1/query/{0}", query.ID), query, q).Execute(ct)); }
internal PostRequest <TIn, TOut> Post <TIn, TOut>(string path, TIn body, WriteOptions opts = null) { return(new PostRequest <TIn, TOut>(this, path, body, opts ?? WriteOptions.Default)); }
/// <summary> /// Deletes an existing ACL Role from Consul /// </summary> /// <param name="id">The ID of the ACL Role to delete</param> /// <param name="writeOptions">Customised write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>Success (true) or failure (false)</returns> public async Task <WriteResult <bool> > Delete(string id, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.DeleteReturning <bool>($"/v1/acl/role/{id}", writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <bool>(res, res.Response)); }
/// <summary> /// Deregister an existing catalog item /// </summary> /// <param name="reg">A catalog deregistration</param> /// <param name="q">Customized write options</param> /// <returns>An empty write result</returns> public WriteResult Deregister(CatalogDeregistration reg, WriteOptions q) { return(_client.CreateInWrite <CatalogDeregistration>("/v1/catalog/deregister", reg, q) .Execute()); }
internal EmptyPutRequest <TOut> EmptyPut <TOut>(string path, WriteOptions opts = null) { return(new EmptyPutRequest <TOut>(this, path, opts ?? WriteOptions.Default)); }
public Task <WriteResult> Restore(Stream s, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put("/v1/snapshot", s, q).Execute(ct)); }
public async Task <WriteResult <string> > Create(ACLEntry acl, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <ACLEntry, ACLCreationResult>("/v1/acl/create", acl, q).Execute(ct).ConfigureAwait(false); return(new WriteResult <string>(res, res.Response.ID)); }
/// <summary> /// Clones an existing ACL Token in Consul /// </summary> /// <param name="id">The Accessor ID of the ACL Token to clone</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the created ACL token</returns> public Task <WriteResult <TokenEntry> > Clone(string id, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { return(Clone(id, string.Empty, writeOptions, ct)); }
/// <summary> /// Clones an existing ACL Token in Consul /// </summary> /// <param name="id">The Accessor ID of the ACL Token to clone</param> /// <param name="description">The description for the cloned ACL Token</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the created ACL token</returns> public async Task <WriteResult <TokenEntry> > Clone(string id, string description, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var body = new Dictionary <string, string> { { "Description", description } }; var res = await _client.Put <object, TokenActionResult>($"/v1/acl/token/{id}/clone", body, writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <TokenEntry>(res, res.Response)); }
/// <summary> /// Deletes an existing ACL Token from Consul /// </summary> /// <param name="id">The Accessor ID of the ACL Token to delete</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>Success (true) or failure (false)</returns> public Task <WriteResult <bool> > Delete(string id, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { return(_client.DeleteReturning <bool>($"/v1/acl/token/{id}", writeOptions).Execute(ct)); }
/// <summary> /// Updates an existing ACL Token in Consul /// </summary> /// <param name="token">The modified ACL Token</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the updated ACL Token</returns> public async Task <WriteResult <TokenEntry> > Update(TokenEntry token, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <TokenEntry, TokenActionResult>($"/v1/acl/token/{token.AccessorID}", token, writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <TokenEntry>(res, res.Response)); }
/// <summary> /// Deregister an existing catalog item /// </summary> /// <param name="reg">A catalog deregistration</param> /// <param name="q">Customized write options</param> /// <returns>An empty write result</returns> public Task <WriteResult> Deregister(CatalogDeregistration reg, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put("/v1/catalog/deregister", reg, q).Execute(ct)); }
/// <summary> /// Login to ACL Auth Method /// </summary> /// <param name="writeOptions"></param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>>A write result containing an ACL Token for the login</returns> public async Task <WriteResult <TokenEntry> > Login(WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.PutReturning <TokenEntry>("/v1/acl/login", writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <TokenEntry>(res, res.Response)); }
public Task <WriteResult> Update(ACLEntry acl, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put("/v1/acl/update", acl, q).Execute(ct)); }
/// <summary> /// Logout from ACL Auth Method /// </summary> /// <param name="writeOptions"></param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result</returns> public async Task <WriteResult> Logout(WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { return(await _client.Post($"/v1/acl/logout", writeOptions).Execute(ct)); }
public Task <WriteResult <bool> > Destroy(string id, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.PutReturning <bool>(string.Format("/v1/acl/destroy/{0}", id), q).Execute(ct)); }
internal DeleteRequest <T> Delete <T>(string path, WriteOptions opts = null) { return(new DeleteRequest <T>(this, path, opts ?? WriteOptions.Default)); }
public async Task <WriteResult <string> > Clone(string id, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.PutReturning <ACLCreationResult>(string.Format("/v1/acl/clone/{0}", id), q).Execute(ct).ConfigureAwait(false); return(new WriteResult <string>(res, res.Response.ID)); }
internal SilentPutRequest Put(string path, WriteOptions opts = null) { return(new SilentPutRequest(this, path, opts ?? WriteOptions.Default)); }
public async Task <WriteResult <string> > TranslateRules(string rules, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.Post($"/v1/acl/rules/translate", rules, q).Execute(ct).ConfigureAwait(false); return(new WriteResult <string>(res, res.Response)); }
/// <summary> /// Write is used to do a PUT request against an endpoint and serialize/deserialized using the standard Consul conventions. /// </summary> /// <param name="endpoint">The URL endpoint to access</param> /// <param name="obj">The object to serialize and send to the endpoint. Must be able to be JSON serialized, or be an object of type byte[], which is sent without serialzation.</param> /// <param name="q">Custom write options</param> /// <returns>The data returned by the custom endpoint in response to the write request</returns> public Task <WriteResult <dynamic> > Write(string endpoint, object obj, WriteOptions q, CancellationToken ct = default(CancellationToken)) { return(_client.Put <object, dynamic>(endpoint, obj, q).Execute(ct)); }
/// <summary> /// Updates an existing ACL Policy in Consul /// </summary> /// <param name="policy">The modified ACL Policy</param> /// <param name="writeOptions">Customised write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the updated ACL policy</returns> public async Task <WriteResult <PolicyEntry> > Update(PolicyEntry policy, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <PolicyEntry, PolicyActionResult>($"/v1/acl/policy/{policy.ID}", policy, writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <PolicyEntry>(res, res.Response)); }
/// <summary> /// Updates an existing ACL Role in Consul /// </summary> /// <param name="role">The modified ACL Role</param> /// <param name="writeOptions">Customised write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the updated ACL Role</returns> public async Task <WriteResult <RoleEntry> > Update(RoleEntry role, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <RoleEntry, RoleActionResult>($"/v1/acl/role/{role.ID}", role, writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <RoleEntry>(res, res.Response)); }
/// <summary> /// Updates an existing ACL AuthMethod in Consul /// </summary> /// <param name="authMethod">The modified ACL AuthMethod</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>A write result containing the updated ACL AuthMethod</returns> public async Task <WriteResult <AuthMethodEntry> > Update(AuthMethodEntry authMethod, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { var res = await _client.Put <AuthMethodEntry, AuthMethodActionResult>($"/v1/acl/auth-method/{authMethod.Name}", authMethod, writeOptions).Execute(ct).ConfigureAwait(false); return(new WriteResult <AuthMethodEntry>(res, res.Response)); }
public async Task <WriteResult> Delete(string queryID, WriteOptions q, CancellationToken ct = default(CancellationToken)) { var res = await _client.DeleteReturning <string>(string.Format("/v1/query/{0}", queryID), q).Execute(ct).ConfigureAwait(false); return(new WriteResult(res)); }
/// <summary> /// Deletes an existing ACL AuthMethod from Consul /// </summary> /// <param name="name">The name of the ACL AuthMethod to delete</param> /// <param name="writeOptions">Customized write options</param> /// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param> /// <returns>Success (true) or failure (false)</returns> public Task <WriteResult <bool> > Delete(string name, WriteOptions writeOptions, CancellationToken ct = default(CancellationToken)) { return(_client.DeleteReturning <bool>($"/v1/acl/auth-method/{name}", writeOptions).Execute(ct)); }
/// <summary> /// Delete is used to delete a single key. /// </summary> /// <param name="key">The key name to delete</param> /// <param name="q">Customized write options</param> /// <returns>A write result indicating if the delete attempt succeeded</returns> public Task <WriteResult <bool> > Delete(string key, WriteOptions q, CancellationToken ct = default(CancellationToken)) { KVPair.ValidatePath(key); return(_client.DeleteReturning <bool>(string.Format("/v1/kv/{0}", key.TrimStart('/')), q).Execute(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)); }