Skip to content

Added CRUD support for API-client object#4

Merged
vivshankar merged 4 commits into
ibm-verify:mainfrom
manjusha-sonawane2309:main
Apr 14, 2025
Merged

Added CRUD support for API-client object#4
vivshankar merged 4 commits into
ibm-verify:mainfrom
manjusha-sonawane2309:main

Conversation

@manjusha-sonawane2309

@manjusha-sonawane2309 manjusha-sonawane2309 commented Apr 4, 2025

Copy link
Copy Markdown

Usage:

Commands:

Create API client:

verifyctl create -f "api_client.yaml"

Update API client:

verifyctl replace -f "api_client.yaml"

Delete API client by clientName:

verifyctl delete apiclient --clientName "Test API client"

Delete API client by clientId:

verifyctl delete apiclient --clientId "12345"

Get API client:

verifyctl get apiclient --clientName "Automation Client"

Get all API clients:

verifyctl get apiclients

Input YAML:

apiVersion: '1.0'
kind: IBMVerifyAPIClient
data:
clientName: Testing_custom_apiclient
description: Testing_custom_apiclient Description
entitlements:
- analyticsDataSyncToCloud
- analyticsSatelliteOnboard
- readCerts
- readAPIClients
- manageIdentitySources
- readIdentitySources
- manageMFAMethods
- readMFAMethods
- manageEnrollMFAMethodAnyUser
- readEnrollMFAMethodAnyUser
- authnAnyUser
- manageAuthenticatorsConfig
enabled: true
overrideSettings:
restrictScopes: true
scopes:
- name: test scope
description: scope description
ipFilterOp: allow
ipFilters:
- 1.2.3.4
jwkUri: ''
additionalConfig:
clientAuthMethod: default
validateClientAssertionJti: true
allowedClientAssertionVerificationKeys:
- string
additionalProperties:
Namespace: Namespace1

@vivshankar vivshankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my comments. Thanks for your contribution.

Comment thread pkg/cmd/create/API_client.go

if o.boilerplate {
resourceObj := &resource.ResourceObject{
Kind: resource.ResourceTypePrefix + "ApiClient",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use APIClient and not ApiClient. Acronyms, such as API, should be in caps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread pkg/cmd/create/API_client.go Outdated
Comment thread pkg/cmd/delete/API_client.go Outdated
config *config.CLIConfig
}

func NewAPIclientCommand(config *config.CLIConfig, streams io.ReadWriter) *cobra.Command {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct the naming of this function. It should be NewAPIClientCommand.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread pkg/cmd/delete/API_client.go Outdated
Comment thread pkg/cmd/delete/API_client.go Outdated

calledAs := cmd.CalledAs()
if calledAs == "apiclient" && o.name == "" {
return module.MakeSimpleError(i18n.Translate("'clientName' flag is required"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not also accepting clientID? In fact that is more natural for customers than the name, in this case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread pkg/module/directory/API_client.go
Comment thread pkg/module/directory/API_client.go
@vivshankar vivshankar merged commit afc10e7 into ibm-verify:main Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants