Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Address review comments
  • Loading branch information
GDLMadushanka committed Feb 23, 2022
1 parent e3a01a2 commit 29bbcfa
Show file tree
Hide file tree
Showing 19 changed files with 482 additions and 13 deletions.
6 changes: 3 additions & 3 deletions import-export-cli/cmd/mi/delete/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var deleteRoleCmd = &cobra.Command{

func init() {
DeleteCmd.AddCommand(deleteRoleCmd)
deleteRoleCmd.Flags().StringVarP(&deleteRoleCmdDomain, "domain", "d", "", "select the domain of the role")
deleteRoleCmd.Flags().StringVarP(&deleteRoleCmdEnvironment, "environment", "e", "", "Environment of the micro integrator from which a role should be deleted")
deleteRoleCmd.Flags().StringVarP(&deleteRoleCmdDomain, "domain", "d", "", "Select the domain of the role")
deleteRoleCmd.Flags().StringVarP(&deleteRoleCmdEnvironment, "environment", "e", "", "Environment of the Micro Integrator from which a role should be deleted")
deleteRoleCmd.MarkFlagRequired("environment")
}

Expand All @@ -69,7 +69,7 @@ func handledeleteRoleCmdArguments(args []string) {
func executeDeleteRole(roleName string) {
resp, err := impl.DeleteMIRole(deleteRoleCmdEnvironment, roleName, deleteRoleCmdDomain)
if err != nil {
fmt.Println(utils.LogPrefixError+"deleting role [ "+roleName+" ]", err)
fmt.Println(utils.LogPrefixError + "deleting role [ "+roleName+" ]", err)
} else {
fmt.Println("Deleting role [ "+roleName+" ] status:", resp)
}
Expand Down
6 changes: 3 additions & 3 deletions import-export-cli/cmd/mi/update/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const updateUserCmdShortDesc = "Update roles of a user in a Micro Integrator"
const updateUserCmdLongDesc = "Update the roles of a user named [user-name] specified by the command line arguments in a Micro Integrator in the environment specified by the flag --environment, -e"

var updateUserCmdExamples = "To update the roles\n" +
" " + utils.ProjectName + " " + utils.MiCmdLiteral + " " + updateCmdLiteral + " " + miUtils.GetTrimmedCmdLiteral(updateUserCmdLiteral) + " [user-name] DEBUG -e dev\n" +
" " + utils.ProjectName + " " + utils.MiCmdLiteral + " " + updateCmdLiteral + " " + miUtils.GetTrimmedCmdLiteral(updateUserCmdLiteral) + " [user-name] -e dev\n" +
"NOTE: The flag (--environment (-e)) is mandatory"

var updateUserCmd = &cobra.Command{
Expand All @@ -55,7 +55,7 @@ var updateUserCmd = &cobra.Command{

func init() {
UpdateCmd.AddCommand(updateUserCmd)
updateUserCmd.Flags().StringVarP(&updateUserCmdEnvironment, "environment", "e", "", "Environment of the micro integrator of which the user's roles should be updated")
updateUserCmd.Flags().StringVarP(&updateUserCmdEnvironment, "environment", "e", "", "Environment of the Micro Integrator of which the user's roles should be updated")
updateUserCmd.MarkFlagRequired("environment")
}

Expand All @@ -66,7 +66,7 @@ func handleupdateUserCmdArguments(args []string) {
}

func executeUpdateUser(userName, domain string, addedRoles, removedRoles []string) {
resp, err := impl.UpdateMIUser(updateUserCmdEnvironment,userName, domain, addedRoles, removedRoles)
resp, err := impl.UpdateMIUser(updateUserCmdEnvironment, userName, domain, addedRoles, removedRoles)
if err != nil {
fmt.Println(utils.LogPrefixError+"updating roles of user [ "+userName+" ] ", err)
} else {
Expand Down
40 changes: 40 additions & 0 deletions import-export-cli/docs/apictl_get_api-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## apictl get api-logging

Display a list of API loggers in an environment

### Synopsis

Display a list of API loggers available for the APIs in the environment specified

```
apictl get api-logging [flags]
```

### Examples

```
apictl get api-logging -e dev --tenant-domain carbon.super
apictl get api-logging --api-id bf36ca3a-0332-49ba-abce-e9992228ae06 -e dev --tenant-domain carbon.super
```

### Options

```
-i, --api-id string API ID
-e, --environment string Environment of the APIs which the API loggers should be displayed
--format string Pretty-print API loggers using Go Templates. Use "{{ jsonPretty . }}" to list all fields
-h, --help help for api-logging
--tenant-domain string Tenant Domain
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl get](apictl_get.md) - Get APIs/APIProducts/Applications or revisions of a specific API/APIProduct in an environment or Get the log level of each API in an environment or Get the environments

1 change: 1 addition & 0 deletions import-export-cli/docs/apictl_mi_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ apictl mi add log-level synapse-api org.apache.synapse.rest.API DEBUG -e dev

* [apictl mi](apictl_mi.md) - Micro Integrator related commands
* [apictl mi add log-level](apictl_mi_add_log-level.md) - Add new Logger to a Micro Integrator
* [apictl mi add role](apictl_mi_add_role.md) - Add new role to a Micro Integrator
* [apictl mi add user](apictl_mi_add_user.md) - Add new user to a Micro Integrator

38 changes: 38 additions & 0 deletions import-export-cli/docs/apictl_mi_add_role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## apictl mi add role

Add new role to a Micro Integrator

### Synopsis

Add a new role with the name specified by the command line argument [role-name] to a Micro Integrator in the environment specified by the flag --environment, -e

```
apictl mi add role [role-name] [flags]
```

### Examples

```
To add a new role
apictl mi add role [role-name] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-e, --environment string Environment of the micro integrator to which a new user should be added
-h, --help help for role
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl mi add](apictl_mi_add.md) - Add new users or loggers to a Micro Integrator instance

1 change: 1 addition & 0 deletions import-export-cli/docs/apictl_mi_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ apictl mi delete user capp-tester -e dev
### SEE ALSO

* [apictl mi](apictl_mi.md) - Micro Integrator related commands
* [apictl mi delete role](apictl_mi_delete_role.md) - Delete a role from the Micro Integrator
* [apictl mi delete user](apictl_mi_delete_user.md) - Delete a user from the Micro Integrator

41 changes: 41 additions & 0 deletions import-export-cli/docs/apictl_mi_delete_role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## apictl mi delete role

Delete a role from the Micro Integrator

### Synopsis

Delete a role with the name specified by the command line argument [role-name] from a Micro Integrator in the environment specified by the flag --environment, -e

```
apictl mi delete role [role-name] [flags]
```

### Examples

```
To delete a role
apictl mi delete role [role-name] -e dev
To delete a role in a secondary user store
apictl mi delete role [role-name] -d [domain] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-d, --domain string Select the domain of the role
-e, --environment string Environment of the Micro Integrator from which a role should be deleted
-h, --help help for role
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl mi delete](apictl_mi_delete.md) - Delete users from a Micro Integrator instance

5 changes: 4 additions & 1 deletion import-export-cli/docs/apictl_mi_delete_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ apictl mi delete user [user-name] [flags]

```
To delete a user
apictl mi delete user capp-tester -e dev
apictl mi delete user [user-id] -e dev
To delete a user in a secondary user store
apictl mi delete user [user-id] -d [domain] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-d, --domain string select user's domain
-e, --environment string Environment of the micro integrator from which a user should be deleted
-h, --help help for user
```
Expand Down
1 change: 1 addition & 0 deletions import-export-cli/docs/apictl_mi_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ apictl mi get endpoints -e dev
* [apictl mi get message-processors](apictl_mi_get_message-processors.md) - Get information about message processors deployed in a Micro Integrator
* [apictl mi get message-stores](apictl_mi_get_message-stores.md) - Get information about message stores deployed in a Micro Integrator
* [apictl mi get proxy-services](apictl_mi_get_proxy-services.md) - Get information about proxy services deployed in a Micro Integrator
* [apictl mi get roles](apictl_mi_get_roles.md) - Get information about roles
* [apictl mi get sequences](apictl_mi_get_sequences.md) - Get information about sequences deployed in a Micro Integrator
* [apictl mi get tasks](apictl_mi_get_tasks.md) - Get information about tasks deployed in a Micro Integrator
* [apictl mi get templates](apictl_mi_get_templates.md) - Get information about templates deployed in a Micro Integrator
Expand Down
45 changes: 45 additions & 0 deletions import-export-cli/docs/apictl_mi_get_roles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## apictl mi get roles

Get information about roles

### Synopsis

Get information about the roles in primary and secondary user stores.
List all roles of the Micro Integrator in the environment specified by the flag --environment, -e

```
apictl mi get roles [role-name] [flags]
```

### Examples

```
To list all the roles
apictl mi get roles -e dev
To get details about a role by providing the role name
apictl mi get roles [role-name] -e dev
To get details about a role in a secondary user store
apictl mi get roles [role-name] -d [domain] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-d, --domain string Filter roles by domain
-e, --environment string Environment to be searched
--format string Pretty-print using Go Templates. Use "{{ jsonPretty . }}" to list all fields
-h, --help help for roles
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl mi get](apictl_mi_get.md) - Get information about artifacts deployed in a Micro Integrator instance

3 changes: 3 additions & 0 deletions import-export-cli/docs/apictl_mi_get_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ To get the list of users with a username matching with the wild card Ex: "*mi*"
apictl mi get users -p [pattern] -e dev
To get details about a user by providing the user-id
apictl mi get users [user-id] -e dev
To get details about a user in a secondary user store
apictl mi get users [user-id] -d [domain] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-d, --domain string Filter users by domain
-e, --environment string Environment to be searched
--format string Pretty-print using Go Templates. Use "{{ jsonPretty . }}" to list all fields
-h, --help help for users
Expand Down
1 change: 1 addition & 0 deletions import-export-cli/docs/apictl_mi_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ apictl mi update log-level org-apache-coyote DEBUG -e dev
* [apictl mi](apictl_mi.md) - Micro Integrator related commands
* [apictl mi update hashicorp-secret](apictl_mi_update_hashicorp-secret.md) - Update the secret ID of HashiCorp configuration in a Micro Integrator
* [apictl mi update log-level](apictl_mi_update_log-level.md) - Update log level of a Logger in a Micro Integrator
* [apictl mi update user](apictl_mi_update_user.md) - Update roles of a user in a Micro Integrator

38 changes: 38 additions & 0 deletions import-export-cli/docs/apictl_mi_update_user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## apictl mi update user

Update roles of a user in a Micro Integrator

### Synopsis

Update the roles of a user named [user-name] specified by the command line arguments in a Micro Integrator in the environment specified by the flag --environment, -e

```
apictl mi update user [user-name] [flags]
```

### Examples

```
To update the roles
apictl mi update user [user-name] -e dev
NOTE: The flag (--environment (-e)) is mandatory
```

### Options

```
-e, --environment string Environment of the Micro Integrator of which the user's roles should be updated
-h, --help help for user
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl mi update](apictl_mi_update.md) - Update log level of Loggers in a Micro Integrator instance

40 changes: 40 additions & 0 deletions import-export-cli/docs/apictl_set_api-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## apictl set api-logging

Set the log level for an API in an environment

### Synopsis

Set the log level for an API in the environment specified

```
apictl set api-logging [flags]
```

### Examples

```
apictl set api-logging --api-id bf36ca3a-0332-49ba-abce-e9992228ae06 --log-level full -e dev --tenant-domain carbon.super
apictl set api-logging --api-id bf36ca3a-0332-49ba-abce-e9992228ae06 --log-level off -e dev --tenant-domain carbon.super
```

### Options

```
-i, --api-id string API ID
-e, --environment string Environment of the API which the log level should be set
-h, --help help for api-logging
--log-level string Log Level
--tenant-domain string Tenant Domain
```

### Options inherited from parent commands

```
-k, --insecure Allow connections to SSL endpoints without certs
--verbose Enable verbose mode
```

### SEE ALSO

* [apictl set](apictl_set.md) - Set configuration parameters or per API log levels

2 changes: 1 addition & 1 deletion import-export-cli/mi/impl/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func invokeDELETERequestWithRetry(url string, env string) (*resty.Response, erro
})
}

func invokeDELETERequestWithRetryAndParams(url string, env string, params map[string]string) (*resty.Response, error) {
func invokeDELETERequestWithRetryAndParams(url, env string, params map[string]string) (*resty.Response, error) {
return retryHTTPCall(miHTTPRetryCount, env, func(accessToken string) (*resty.Response, error) {
headers := make(map[string]string)
headers[utils.HeaderAuthorization] = utils.HeaderValueAuthBearerPrefix + " " + accessToken
Expand Down
2 changes: 1 addition & 1 deletion import-export-cli/mi/impl/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ const monthHeader = "MONTH"
const yearHeader = "YEAR"
const transactionCountHeader = "TRANSACTION COUNT"
const userIDHeader = "USER ID"
const RoleHeader = "ROLE"
const roleHeader = "ROLE"
2 changes: 1 addition & 1 deletion import-export-cli/mi/impl/getRoles.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func PrintRoleList(roleList *artifactutils.RoleList, format string) {
return nil
}
roleListTableHeaders := map[string]string{
"Role": RoleHeader,
"Role": roleHeader,
}
if err := roleListContext.Write(renderer, roleListTableHeaders); err != nil {
fmt.Println("Error executing template:", err.Error())
Expand Down
Loading

0 comments on commit 29bbcfa

Please sign in to comment.