github.com/greenpau/go-authcrunch@v1.0.50/pkg/authn/enums/operator/operator.go (about) 1 // Copyright 2022 Paul Greenberg greenpau@outlook.com 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package operator 16 17 import ( 18 "fmt" 19 ) 20 21 // Type is the type of an operator. 22 type Type int 23 24 const ( 25 // Unknown operator signals invalid operator. 26 Unknown Type = iota 27 // Authenticate operator signals authentication request. 28 Authenticate 29 // ChangePassword operator signals the changing of password. 30 ChangePassword 31 // GetPublicKeys operator signals the retrieval of public keys. 32 GetPublicKeys 33 // GetAPIKeys operator signals the retrieval of API keys. 34 GetAPIKeys 35 // AddKeySSH operator signals the addition of an SSH public key. 36 AddKeySSH 37 // AddKeyGPG operator signals the addition of an GPG public key. 38 AddKeyGPG 39 // AddAPIKey operator signals the addition of an API key. 40 AddAPIKey 41 // DeletePublicKey operator signals the deletion of a public key. 42 DeletePublicKey 43 // DeleteAPIKey operator signals the deletion of an API key. 44 DeleteAPIKey 45 // GetMfaTokens operator signals the retrieval of MFA tokens. 46 GetMfaTokens 47 // AddMfaToken operator signals the addition of an MFA token. 48 AddMfaToken 49 // DeleteMfaToken operator signals the deletion of an MFA token. 50 DeleteMfaToken 51 // GetUsers operator signals the retrieval of users. 52 GetUsers 53 // GetUser operator signals the retrieval of a specific user. 54 GetUser 55 // AddUser operator signals the addition of a user. 56 AddUser 57 // DeleteUser operator signals the deletion of a user. 58 DeleteUser 59 // IdentifyUser operator signals the retrieval of user identity and 60 // associated challenges. 61 IdentifyUser 62 // LookupAPIKey operator signals the retrieval of user identity associated 63 // with an API key 64 LookupAPIKey 65 ) 66 67 // String returns string representation of an operator. 68 func (e Type) String() string { 69 switch e { 70 case Unknown: 71 return "Unknown" 72 case Authenticate: 73 return "Authenticate" 74 case ChangePassword: 75 return "ChangePassword" 76 case GetPublicKeys: 77 return "GetPublicKeys" 78 case AddKeySSH: 79 return "AddKeySSH" 80 case AddKeyGPG: 81 return "AddKeyGPG" 82 case DeletePublicKey: 83 return "DeletePublicKey" 84 case GetMfaTokens: 85 return "GetMfaTokens" 86 case AddMfaToken: 87 return "AddMfaToken" 88 case DeleteMfaToken: 89 return "DeleteMfaToken" 90 case GetUsers: 91 return "GetUsers" 92 case GetUser: 93 return "GetUser" 94 case AddUser: 95 return "AddUser" 96 case DeleteUser: 97 return "DeleteUser" 98 case GetAPIKeys: 99 return "GetAPIKeys" 100 case AddAPIKey: 101 return "AddAPIKey" 102 case DeleteAPIKey: 103 return "DeleteAPIKey" 104 case IdentifyUser: 105 return "IdentifyUser" 106 case LookupAPIKey: 107 return "LookupAPIKey" 108 } 109 return fmt.Sprintf("Type(%d)", int(e)) 110 }