Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

83 Commits

Repository files navigation

Go API client for opal

The Opal API is a RESTful API that allows you to interact with the Opal Security platform programmatically.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Generator version: 7.19.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.opal.dev/

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import opal "github.com/opalsecurity/opal-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value opal.ContextServerIndex of type int.

ctx:=context.WithValue(context.Background(), opal.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value opal.ContextServerVariables of type map[string]string.

ctx:=context.WithValue(context.Background(), opal.ContextServerVariables, map[string]string{
"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using opal.ContextOperationServerIndices and opal.ContextOperationServerVariables context maps.

ctx:=context.WithValue(context.Background(), opal.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx=context.WithValue(context.Background(), opal.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})

Documentation for API Endpoints

All URIs are relative to https://api.opal.dev/v1

ClassMethodHTTP requestDescription
AccessRulesAPICreateAccessRulePost /access-rules
AccessRulesAPIGetAccessRuleGet /access-rules/{access_rule_id}
AccessRulesAPIGetAccessRulesGet /access-rules
AccessRulesAPIUpdateAccessRulePut /access-rules/{access_rule_id}
AppsAPIGetAppGet /apps/{app_id}Get app by ID
AppsAPIGetAppsGet /appsGet apps
AppsAPIGetSyncErrorsGet /sync_errors
BundlesAPIAddBundleGroupPost /bundles/{bundle_id}/groups
BundlesAPIAddBundleResourcePost /bundles/{bundle_id}/resources
BundlesAPICreateBundlePost /bundles
BundlesAPIDeleteBundleDelete /bundles/{bundle_id}
BundlesAPIGetBundleGet /bundles/{bundle_id}Get bundle by ID
BundlesAPIGetBundleGroupsGet /bundles/{bundle_id}/groups
BundlesAPIGetBundleResourcesGet /bundles/{bundle_id}/resources
BundlesAPIGetBundleVisibilityGet /bundles/{bundle_id}/visibility
BundlesAPIGetBundlesGet /bundlesGet bundles
BundlesAPIRemoveBundleGroupDelete /bundles/{bundle_id}/groups/{group_id}
BundlesAPIRemoveBundleResourceDelete /bundles/{bundle_id}/resources/{resource_id}
BundlesAPISetBundleVisibilityPut /bundles/{bundle_id}/visibility
BundlesAPIUpdateBundlePut /bundles/{bundle_id}
ConfigurationTemplatesAPICreateConfigurationTemplatePost /configuration-templates
ConfigurationTemplatesAPIDeleteConfigurationTemplateDelete /configuration-templates/{configuration_template_id}
ConfigurationTemplatesAPIGetConfigurationTemplatesGet /configuration-templates
ConfigurationTemplatesAPIUpdateConfigurationTemplatePut /configuration-templates
DelegationsAPICreateDelegationPost /delegations
DelegationsAPIDeleteDelegationDelete /delegations/{delegation_id}
DelegationsAPIGetDelegationGet /delegations/{delegation_id}Get delegation by ID
DelegationsAPIGetDelegationsGet /delegationsGet delegations
EventStreamsAPICreateEventStreamPost /event-streamsCreate event stream
EventStreamsAPIDeleteEventStreamDelete /event-streams/{event_stream_id}Delete event stream
EventStreamsAPIGetEventStreamsGet /event-streamsGet event streams
EventStreamsAPIUpdateEventStreamPut /event-streams/{event_stream_id}Update event stream
EventsAPIEventsGet /events
EventsAPIGetEventGet /events/{event_id}Get event by ID
GroupBindingsAPICreateGroupBindingPost /group-bindings
GroupBindingsAPIDeleteGroupBindingDelete /group-bindings/{group_binding_id}
GroupBindingsAPIGetGroupBindingGet /group-bindings/{group_binding_id}Get group binding by ID
GroupBindingsAPIGetGroupBindingsGet /group-bindingsGet group bindings
GroupBindingsAPIUpdateGroupBindingsPut /group-bindings
GroupsAPIAddGroupContainingGroupPost /groups/{group_id}/containing-groups
GroupsAPIAddGroupResourcePost /groups/{group_id}/resources/{resource_id}
GroupsAPIAddGroupUserPost /groups/{group_id}/users/{user_id}
GroupsAPICreateGroupPost /groups
GroupsAPIDeleteGroupDelete /groups/{group_id}
GroupsAPIDeleteGroupUserDelete /groups/{group_id}/users/{user_id}
GroupsAPIGetGroupGet /groups/{group_id}Get group by ID
GroupsAPIGetGroupContainingGroupGet /groups/{group_id}/containing-groups/{containing_group_id}Get nested group by ID
GroupsAPIGetGroupContainingGroupsGet /groups/{group_id}/containing-groupsGet nested groups
GroupsAPIGetGroupMessageChannelsGet /groups/{group_id}/message-channels
GroupsAPIGetGroupOnCallSchedulesGet /groups/{group_id}/on-call-schedules
GroupsAPIGetGroupResourcesGet /groups/{group_id}/resources
GroupsAPIGetGroupReviewerStagesGet /groups/{group_id}/reviewer-stages
GroupsAPIGetGroupReviewersGet /groups/{group_id}/reviewers
GroupsAPIGetGroupTagsGet /groups/{group_id}/tags
GroupsAPIGetGroupUsersGet /groups/{group_id}/users
GroupsAPIGetGroupVisibilityGet /groups/{group_id}/visibility
GroupsAPIGetGroupsGet /groupsGet groups
GroupsAPIGetUserGroupsGet /groups/users/{user_id}
GroupsAPIRemoveGroupContainingGroupDelete /groups/{group_id}/containing-groups/{containing_group_id}
GroupsAPISetGroupMessageChannelsPut /groups/{group_id}/message-channels
GroupsAPISetGroupOnCallSchedulesPut /groups/{group_id}/on-call-schedules
GroupsAPISetGroupResourcesPut /groups/{group_id}/resources
GroupsAPISetGroupReviewerStagesPut /groups/{group_id}/reviewer-stages
GroupsAPISetGroupReviewersPut /groups/{group_id}/reviewers
GroupsAPISetGroupVisibilityPut /groups/{group_id}/visibility
GroupsAPIUpdateGroupUserPut /groups/{group_id}/users/{user_id}
GroupsAPIUpdateGroupsPut /groups
IdpGroupMappingsAPICreateIdpGroupMappingPost /idp-group-mappings/{app_resource_id}/groups/{group_id}
IdpGroupMappingsAPIDeleteIdpGroupMappingsDelete /idp-group-mappings/{app_resource_id}/groups/{group_id}
IdpGroupMappingsAPIGetIdpGroupMappingGet /idp-group-mappings/{app_resource_id}/groups/{group_id}
IdpGroupMappingsAPIGetIdpGroupMappingsGet /idp-group-mappings/{app_resource_id}
IdpGroupMappingsAPIUpdateIdpGroupMappingsPut /idp-group-mappings/{app_resource_id}
MessageChannelsAPICreateMessageChannelPost /message-channels
MessageChannelsAPIGetMessageChannelGet /message-channels/{message_channel_id}Get message channel by ID
MessageChannelsAPIGetMessageChannelsGet /message-channelsGet message channels
NonHumanIdentitiesAPIGetNhisGet /non-human-identities
OnCallSchedulesAPICreateOnCallSchedulePost /on-call-schedules
OnCallSchedulesAPIGetOnCallScheduleGet /on-call-schedules/{on_call_schedule_id}Get on call schedule by ID
OnCallSchedulesAPIGetOnCallSchedulesGet /on-call-schedulesGet on call schedules
OpalQueriesAPIRunOpalQueryPost /queries/runRun an ad-hoc OpalQuery
OwnersAPICreateOwnerPost /owners
OwnersAPIDeleteOwnerDelete /owners/{owner_id}
OwnersAPIGetOwnerGet /owners/{owner_id}Get owner by ID
OwnersAPIGetOwnerFromNameGet /owners/name/{owner_name}
OwnersAPIGetOwnerUsersGet /owners/{owner_id}/users
OwnersAPIGetOwnersGet /ownersGet owners
OwnersAPISetOwnerUsersPut /owners/{owner_id}/users
OwnersAPIUpdateOwnersPut /owners
RequestsAPIApproveRequestPost /requests/{id}/approve
RequestsAPICreateRequestPost /requests
RequestsAPICreateRequestCommentPost /requests/{id}/comments
RequestsAPIDenyRequestPost /requests/{id}/deny
RequestsAPIGetRequestGet /requests/{id}Get request by ID
RequestsAPIGetRequestCommentsGet /requests/{id}/comments
RequestsAPIGetRequestsGet /requestsGet requests
RequestsAPIGetRequestsRelayGet /requests/relayGet requests via Relay
ResourcesAPIAddResourceNhiPost /resources/{resource_id}/non-human-identities/{non_human_identity_id}
ResourcesAPIAddResourceUserPost /resources/{resource_id}/users/{user_id}
ResourcesAPICreateResourcePost /resources
ResourcesAPIDeleteResourceDelete /resources/{resource_id}
ResourcesAPIDeleteResourceNhiDelete /resources/{resource_id}/non-human-identities/{non_human_identity_id}
ResourcesAPIDeleteResourceUserDelete /resources/{resource_id}/users/{user_id}
ResourcesAPIGetResourceGet /resources/{resource_id}Get resource by ID
ResourcesAPIGetResourceGroupsGet /resources/{resource_id}/groups
ResourcesAPIGetResourceMessageChannelsGet /resources/{resource_id}/message-channels
ResourcesAPIGetResourceNhisGet /resources/{resource_id}/non-human-identities
ResourcesAPIGetResourceReviewerStagesGet /resources/{resource_id}/reviewer-stages
ResourcesAPIGetResourceReviewersGet /resources/{resource_id}/reviewers
ResourcesAPIGetResourceScopedRolePermissionsGet /resources/{resource_id}/scoped-role-permissions
ResourcesAPIGetResourceTagsGet /resources/{resource_id}/tags
ResourcesAPIGetResourceUserGet /resources/{resource_id}/users/{user_id}Get resource user
ResourcesAPIGetResourceUsersGet /resources/{resource_id}/usersGet resource users
ResourcesAPIGetResourceVisibilityGet /resources/{resource_id}/visibility
ResourcesAPIGetResourcesGet /resourcesGet resources
ResourcesAPIGetUserResourcesGet /resources/users/{user_id}
ResourcesAPIResourceUserAccessStatusRetrieveGet /resource-user-access-status/{resource_id}/{user_id}
ResourcesAPISetResourceMessageChannelsPut /resources/{resource_id}/message-channels
ResourcesAPISetResourceReviewerStagesPut /resources/{resource_id}/reviewer-stages
ResourcesAPISetResourceReviewersPut /resources/{resource_id}/reviewers
ResourcesAPISetResourceScopedRolePermissionsPut /resources/{resource_id}/scoped-role-permissions
ResourcesAPISetResourceVisibilityPut /resources/{resource_id}/visibility
ResourcesAPIUpdateResourceUserPut /resources/{resource_id}/users/{user_id}
ResourcesAPIUpdateResourcesPut /resources
SessionsAPISessionsGet /sessions
TagsAPIAddGroupTagPost /tags/{tag_id}/groups/{group_id}
TagsAPIAddResourceTagPost /tags/{tag_id}/resources/{resource_id}
TagsAPIAddUserTagPost /tags/{tag_id}/users/{user_id}
TagsAPICreateTagPost /tag
TagsAPIDeleteTagByIDDelete /tag/{tag_id}
TagsAPIGetTagGet /tag
TagsAPIGetTagByIDGet /tag/{tag_id}Get tag by ID
TagsAPIGetTagsGet /tagsGet tags
TagsAPIRemoveGroupTagDelete /tags/{tag_id}/groups/{group_id}
TagsAPIRemoveResourceTagDelete /tags/{tag_id}/resources/{resource_id}
TagsAPIRemoveUserTagDelete /tags/{tag_id}/users/{user_id}
TokensAPIDeleteTokenDelete /tokens/{token_id}Delete token
TokensAPIGetTokensGet /tokensGet tokens
UarsAPICreateUarPost /uar
UarsAPIGetUARsGet /uars
UarsAPIGetUarGet /uar/{uar_id}
UsersAPIGetRemoteUsersGet /users/remote_users
UsersAPIGetUserTagsGet /users/{user_id}/tags
UsersAPIGetUsersGet /users
UsersAPIUserGet /user

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: HTTP Bearer token authentication

Example

auth:=context.WithValue(context.Background(), opal.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err:=client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

hello@opal.dev

About

Opal Golang SDK

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages