/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Opc.Ua.Client.Roles { /// /// Strongly-typed client over the OPC UA Part 18 §4 role-management /// methods on the server's RoleSet and RoleType objects. /// /// /// All mutator operations require the calling session to hold the /// SecurityAdmin role and to use a SignAndEncrypt secure /// channel; otherwise the server returns /// Bad_UserAccessDenied / Bad_SecurityModeInsufficient /// which surfaces as a . /// public interface IRoleManagementClient { /// /// Browses the server's RoleSet and returns a snapshot of /// every role exposed by it. /// ValueTask> ListRolesAsync(CancellationToken cancellationToken = default); /// /// Reads a single role by NodeId. /// ValueTask ReadRoleAsync(NodeId roleId, CancellationToken cancellationToken = default); /// /// Invokes RoleSet.AddRole per Part 18 §4.2.2 and returns the /// new role's NodeId. /// ValueTask AddRoleAsync( string roleName, string? namespaceUri = null, CancellationToken cancellationToken = default); /// /// Invokes RoleSet.RemoveRole per Part 18 §4.2.3. /// ValueTask RemoveRoleAsync(NodeId roleId, CancellationToken cancellationToken = default); /// /// Invokes RoleType.AddIdentity per Part 18 §4.4.5. /// ValueTask AddIdentityAsync( NodeId roleId, IdentityMappingRuleType rule, CancellationToken cancellationToken = default); /// /// Invokes RoleType.RemoveIdentity per Part 18 §4.4.6. /// ValueTask RemoveIdentityAsync( NodeId roleId, IdentityMappingRuleType rule, CancellationToken cancellationToken = default); /// /// Invokes RoleType.AddApplication per Part 18 §4.4.7. /// ValueTask AddApplicationAsync( NodeId roleId, string applicationUri, CancellationToken cancellationToken = default); /// /// Invokes RoleType.RemoveApplication per Part 18 §4.4.8. /// ValueTask RemoveApplicationAsync( NodeId roleId, string applicationUri, CancellationToken cancellationToken = default); /// /// Invokes RoleType.AddEndpoint per Part 18 §4.4.9. /// ValueTask AddEndpointAsync( NodeId roleId, EndpointType endpoint, CancellationToken cancellationToken = default); /// /// Invokes RoleType.RemoveEndpoint per Part 18 §4.4.10. /// ValueTask RemoveEndpointAsync( NodeId roleId, EndpointType endpoint, CancellationToken cancellationToken = default); /// /// Writes the ApplicationsExclude property on a role. /// ValueTask SetApplicationsExcludeAsync( NodeId roleId, bool value, CancellationToken cancellationToken = default); /// /// Writes the EndpointsExclude property on a role. /// ValueTask SetEndpointsExcludeAsync( NodeId roleId, bool value, CancellationToken cancellationToken = default); /// /// Writes the CustomConfiguration property on a role. /// ValueTask SetCustomConfigurationAsync( NodeId roleId, bool value, CancellationToken cancellationToken = default); } }