okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
171 stars 142 forks source link

not all channels configuraiton implmented in the sdk #469

Open AdamRussak opened 3 weeks ago

AdamRussak commented 3 weeks ago

Describe the bug?

there is no Conig implementation in InlineHookChannel struct the okta v4 sdk

What is expected to happen?

when createing an inline hook you should be able to create a InlineHookChannel with channel config: github.com/okta/okta-sdk-golang/v4@v4.1.2/okta/model_inline_hook_channel_config.go

but this struct is not used by any function

What is the actual behavior?

you cannot create an inline hook using any other than the basic configuration github.com/okta/okta-sdk-golang/v4@v4.1.2/okta/api_inline_hook.go

Reproduction Steps?

try to create an inline hook with this body:

{
    "name": "OIDC/OAuth token inline hook",
    "type": "com.okta.oauth2.tokens.transform",
    "version": "1.0.0",
    "channel": {
        "type": "HTTP",
        "version": "1.0.0",
        "config": {
            "uri": "https://example.com",
            "headers": [
                {
                    "key": "x-any-key",
                    "value": "my-header-value"
                }
            ],
            "method": "POST",
            "authScheme": {
                "type": "HEADER",
                "key": "Authorization",
                "value": "my-shared-secret"
            }
        }
    }
}

as provided in the example in the okta offical docs.

Additional Information?

example (not working)

    body := getInlinehookBody(cr.Spec.ForProvider)
OktaCli.InlineHookAPI.CreateInlineHook(ctx).InlineHook(*body).Execute()

body creation:

func getInlinehookBody(spec *inlinehookv1alpha1.InlinehookParameters) *okta.InlineHook {
    inlinbody := okta.NewInlineHook()
    inlinbody.SetName(*spec.Name)
    // inlinbody.SetStatus(*spec.Status)
    channelBody := getChannelBody(spec.Channel)
    inlinbody.SetChannel(*channelBody)
    inlinbody.SetType(*spec.Type)
    inlinbody.SetVersion(*spec.Version)

    return inlinbody
}
func getChannelBody(spec *inlinehookv1alpha1.InlineHookChannel) *okta.InlineHookChannel {
    newChannel := okta.NewInlineHookChannel()
    if !helpers.IsZero(spec.Config) {
        configParam := helpers.StructToMap(spec.Config)
        newChannel.AdditionalProperties["Config"] = configParam
    }
    newChannel.SetType(*spec.Type)
    newChannel.SetVersion(*spec.Version)
    return newChannel
}

Golang Version

go version go1.22.4 darwin/amd64

SDK Version

4.1.2

OS version

Darwin ilnesahprib48cb 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64

duytiennguyen-okta commented 3 weeks ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-742339

AdamRussak commented 3 weeks ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-742339

I don't have access to the jira

AdamRussak commented 2 weeks ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-742339

how can i see the ticket?

github-actions[bot] commented 9 hours ago

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

AdamRussak commented 4 hours ago

Not stale