package
4.3.0+incompatible
Repository: https://github.com/nextlinux/enterprise-client-go.git
Documentation: pkg.go.dev

# README

Go API client for engine

This is the Nextlinux Engine API. Provides the primary external API for users of the service.

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: 0.6.0
  • Package version: 4.6.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

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

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

import sw "./engine"

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 sw.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), sw.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 identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
ArchivesApiArchiveImageAnalysisPost /archives/images
ArchivesApiCreateAnalysisArchiveRulePost /archives/rules
ArchivesApiDeleteAnalysisArchiveRuleDelete /archives/rules/{ruleId}
ArchivesApiDeleteArchivedAnalysisDelete /archives/images/{imageDigest}
ArchivesApiGetAnalysisArchiveRuleGet /archives/rules/{ruleId}
ArchivesApiGetArchivedAnalysisGet /archives/images/{imageDigest}
ArchivesApiListAnalysisArchiveGet /archives/images
ArchivesApiListAnalysisArchiveRulesGet /archives/rules
ArchivesApiListArchivesGet /archives
DefaultApiGetOauthTokenPost /oauth/token
DefaultApiHealthCheckGet /health
DefaultApiListFileContentSearchResultsGet /images/{imageDigest}/artifacts/file_content_searchReturn a list of analyzer artifacts of the specified type
DefaultApiListRetrievedFilesGet /images/{imageDigest}/artifacts/retrieved_filesReturn a list of analyzer artifacts of the specified type
DefaultApiListSecretSearchResultsGet /images/{imageDigest}/artifacts/secret_searchReturn a list of analyzer artifacts of the specified type
DefaultApiPingGet /
DefaultApiRevokeOauthTokenPost /oauth/revoke
DefaultApiVersionCheckGet /version
EventsApiDeleteEventDelete /events/{eventId}Delete Event
EventsApiDeleteEventsDelete /eventsDelete Events
EventsApiGetEventGet /events/{eventId}Get Event
EventsApiListEventTypesGet /event_typesList Event Types
EventsApiListEventsGet /eventsList Events
IdentityApiAddCredentialPost /user/credentialsadd/replace credential
IdentityApiGetCredentialsGet /user/credentialsGet current credential summary
IdentityApiGetUserGet /userList authenticated user info
IdentityApiGetUsersAccountGet /accountList the account for the authenticated user
ImagesApiAddImagePost /imagesSubmit a new image for analysis by the engine
ImagesApiDeleteImageDelete /images/{imageDigest}Delete an image analysis
ImagesApiDeleteImageByImageIdDelete /images/by_id/{imageId}Delete image by docker imageId
ImagesApiDeleteImagesAsyncDelete /imagesBulk mark images for deletion
ImagesApiGetImageGet /images/{imageDigest}Get image metadata
ImagesApiGetImageByImageIdGet /images/by_id/{imageId}Lookup image by docker imageId
ImagesApiGetImageContentByTypeGet /images/{imageDigest}/content/{ctype}Get the content of an image by type
ImagesApiGetImageContentByTypeFilesGet /images/{imageDigest}/content/filesGet the content of an image by type files
ImagesApiGetImageContentByTypeImageIdGet /images/by_id/{imageId}/content/{ctype}Get the content of an image by type
ImagesApiGetImageContentByTypeImageIdFilesGet /images/by_id/{imageId}/content/filesGet the content of an image by type files
ImagesApiGetImageContentByTypeImageIdJavapackageGet /images/by_id/{imageId}/content/javaGet the content of an image by type java
ImagesApiGetImageContentByTypeJavapackageGet /images/{imageDigest}/content/javaGet the content of an image by type java
ImagesApiGetImageContentByTypeMalwareGet /images/{imageDigest}/content/malwareGet the content of an image by type malware
ImagesApiGetImageMetadataByTypeGet /images/{imageDigest}/metadata/{mtype}Get the metadata of an image by type
ImagesApiGetImagePolicyCheckGet /images/{imageDigest}/checkCheck policy evaluation status for image
ImagesApiGetImagePolicyCheckByImageIdGet /images/by_id/{imageId}/checkCheck policy evaluation status for image
ImagesApiGetImageSbomCyclonedxJsonGet /images/{imageDigest}/sboms/cyclonedx-jsonGet image sbom in the CycloneDX format
ImagesApiGetImageSbomNativeGet /images/{imageDigest}/sboms/nativeGet image sbom in the native Nextlinux format
ImagesApiGetImageSbomNativeJsonGet /images/{imageDigest}/sboms/native-jsonGet image sbom in the native Nextlinux format
ImagesApiGetImageSbomSpdxJsonGet /images/{imageDigest}/sboms/spdx-jsonGet image sbom in the SPDX format
ImagesApiGetImageVulnerabilitiesByTypeGet /images/{imageDigest}/vuln/{vtype}Get vulnerabilities by type
ImagesApiGetImageVulnerabilitiesByTypeImageIdGet /images/by_id/{imageId}/vuln/{vtype}Get vulnerabilities by type
ImagesApiGetImageVulnerabilityTypesGet /images/{imageDigest}/vulnGet vulnerability types
ImagesApiGetImageVulnerabilityTypesByImageIdGet /images/by_id/{imageId}/vulnGet vulnerability types
ImagesApiListImageContentGet /images/{imageDigest}/contentList image content types
ImagesApiListImageContentByImageidGet /images/by_id/{imageId}/contentList image content types
ImagesApiListImageMetadataGet /images/{imageDigest}/metadataList image metadata types
ImagesApiListImagesGet /imagesList all visible images
ImportApiImportImageArchivePost /import/imagesImport an nextlinux image tar.gz archive file. This is a deprecated API replaced by the "/imports/images" route
ImportsApiCreateOperationPost /imports/imagesBegin the import of an image SBOM into the system
ImportsApiGetOperationGet /imports/images/{operation_id}Get detail on a single import
ImportsApiImportContentSearchesPost /imports/images/{operation_id}/content_searchesImport a content search analysis catalog
ImportsApiImportFileContentsPost /imports/images/{operation_id}/file_contentsImport a file contents analysis catalog
ImportsApiImportImageConfigPost /imports/images/{operation_id}/image_configImport a docker or OCI image config to associate with the image
ImportsApiImportImageDockerfilePost /imports/images/{operation_id}/dockerfileBegin the import of an image analyzed by Syft into the system
ImportsApiImportImageManifestPost /imports/images/{operation_id}/manifestImport a docker or OCI distribution manifest to associate with the image
ImportsApiImportImagePackagesPost /imports/images/{operation_id}/packagesBegin the import of an image analyzed by Syft into the system
ImportsApiImportImageParentManifestPost /imports/images/{operation_id}/parent_manifestImport a docker or OCI distribution manifest list to associate with the image
ImportsApiImportSecretSearchesPost /imports/images/{operation_id}/secret_searchesImport a secret search analysis catalog
ImportsApiInvalidateOperationDelete /imports/images/{operation_id}Invalidate operation ID so it can be garbage collected
ImportsApiListImportContentSearchesGet /imports/images/{operation_id}/content_searchesList uploaded content search results
ImportsApiListImportDockerfilesGet /imports/images/{operation_id}/dockerfileList uploaded dockerfiles
ImportsApiListImportFileContentsGet /imports/images/{operation_id}/file_contentsList uploaded file contents
ImportsApiListImportImageConfigsGet /imports/images/{operation_id}/image_configList uploaded image configs
ImportsApiListImportImageManifestsGet /imports/images/{operation_id}/manifestList uploaded image manifests
ImportsApiListImportPackagesGet /imports/images/{operation_id}/packagesList uploaded package manifests
ImportsApiListImportParentManifestsGet /imports/images/{operation_id}/parent_manifestList uploaded parent manifests (manifest lists for a tag)
ImportsApiListImportSecretSearchesGet /imports/images/{operation_id}/secret_searchesList uploaded secret search results
ImportsApiListOperationsGet /imports/imagesLists in-progress imports
PoliciesApiAddPolicyPost /policiesAdd a new policy
PoliciesApiDeletePolicyDelete /policies/{policyId}Delete policy
PoliciesApiGetPolicyGet /policies/{policyId}Get specific policy
PoliciesApiListPoliciesGet /policiesList policies
PoliciesApiUpdatePolicyPut /policies/{policyId}Update policy
QueryApiQueryImagesByPackageGet /query/images/by_packageList of images containing given package
QueryApiQueryImagesByVulnerabilityGet /query/images/by_vulnerabilityList images vulnerable to the specific vulnerability ID.
QueryApiQueryVulnerabilitiesGet /query/vulnerabilitiesListing information about given vulnerability
RegistriesApiCreateRegistryPost /registriesAdd a new registry
RegistriesApiDeleteRegistryDelete /registries/{registry}Delete a registry configuration
RegistriesApiGetRegistryGet /registries/{registry}Get a specific registry configuration
RegistriesApiListRegistriesGet /registriesList configured registries
RegistriesApiUpdateRegistryPut /registries/{registry}Update/replace a registry configuration
RepositoryCredentialsApiAddRepositoryPost /repositoriesAdd repository to watch
SubscriptionsApiAddSubscriptionPost /subscriptionsAdd a subscription of a specific type
SubscriptionsApiDeleteSubscriptionDelete /subscriptions/{subscriptionId}Delete subscriptions of a specific type
SubscriptionsApiGetSubscriptionGet /subscriptions/{subscriptionId}Get a specific subscription set
SubscriptionsApiListSubscriptionsGet /subscriptionsList all subscriptions
SubscriptionsApiUpdateSubscriptionPut /subscriptions/{subscriptionId}Update an existing and specific subscription
SummariesApiListImagetagsGet /summaries/imagetagsList all visible image digests and tags
SystemApiDeleteFeedDelete /system/feeds/{feed}
SystemApiDeleteFeedGroupDelete /system/feeds/{feed}/{group}
SystemApiDeleteServiceDelete /system/services/{servicename}/{hostid}Delete the service config
SystemApiDescribeErrorCodesGet /system/error_codesDescribe nextlinux engine error codes.
SystemApiDescribePolicyGet /system/policy_specDescribe the policy language spec implemented by this service.
SystemApiGetServiceDetailGet /systemSystem status
SystemApiGetServicesByNameGet /system/services/{servicename}Get a service configuration and state
SystemApiGetServicesByNameAndHostGet /system/services/{servicename}/{hostid}Get service config for a specific host
SystemApiGetStatusGet /statusService status
SystemApiGetSystemFeedsGet /system/feedslist feeds operations and information
SystemApiListServicesGet /system/servicesList system services
SystemApiPostSystemFeedsPost /system/feedstrigger feeds operations
SystemApiTestWebhookPost /system/webhooks/{webhook_type}/testAdds the capabilities to test a webhook delivery for the given notification type
SystemApiToggleFeedEnabledPut /system/feeds/{feed}
SystemApiToggleGroupEnabledPut /system/feeds/{feed}/{group}
UserManagementApiCreateAccountPost /accountsCreate a new account. Only available to admin user.
UserManagementApiCreateUserPost /accounts/{accountname}/usersCreate a new user within the specified account.
UserManagementApiCreateUserCredentialPost /accounts/{accountname}/users/{username}/credentialsadd/replace credential
UserManagementApiDeleteAccountDelete /accounts/{accountname}Delete the specified account, only allowed if the account is in the disabled state. All users will be deleted along with the account and all resources will be garbage collected
UserManagementApiDeleteUserDelete /accounts/{accountname}/users/{username}Delete a specific user credential by username of the credential. Cannot be the credential used to authenticate the request.
UserManagementApiDeleteUserCredentialDelete /accounts/{accountname}/users/{username}/credentialsDelete a credential by type
UserManagementApiGetAccountGet /accounts/{accountname}Get account info about this specific account.
UserManagementApiGetAccountUserGet /accounts/{accountname}/users/{username}Get a specific user in the specified account
UserManagementApiListAccountsGet /accountsList account summaries. Only available to the system admin user.
UserManagementApiListUserCredentialsGet /accounts/{accountname}/users/{username}/credentialsGet current credential summary
UserManagementApiListUsersGet /accounts/{accountname}/usersList of users found in this account.
UserManagementApiUpdateAccountPut /accounts/{accountname}Update the info for this specific account.
UserManagementApiUpdateAccountStatePut /accounts/{accountname}/stateUpdate the state of an account to either enabled or disabled. For deletion use the DELETE route

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

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

[email protected]