Home

Awesome

Go API client for dfirtrackapi

OpenAPI 3 - Documentation of DFIRTrack API

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.

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 dfirtrackapi "github.com/dfirtrack/dfirtrackapi"

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(), dfirtrackapi.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(), dfirtrackapi.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 sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
ApiApiCreateArtifactPost /api/artifact/
ApiApiCreateArtifacttypePost /api/artifacttype/
ApiApiCreateAuthTokenPost /api/token-auth/
ApiApiCreateCasePost /api/case/
ApiApiCreateCasetypePost /api/casetype/
ApiApiCreateCompanyPost /api/company/
ApiApiCreateContactPost /api/contact/
ApiApiCreateDivisionPost /api/division/
ApiApiCreateDnsnamePost /api/dnsname/
ApiApiCreateDomainPost /api/domain/
ApiApiCreateDomainuserPost /api/domainuser/
ApiApiCreateHeadlinePost /api/headline/
ApiApiCreateIpPost /api/ip/
ApiApiCreateLocationPost /api/location/
ApiApiCreateNotePost /api/note/
ApiApiCreateOsPost /api/os/
ApiApiCreateOsarchPost /api/osarch/
ApiApiCreateReasonPost /api/reason/
ApiApiCreateRecommendationPost /api/recommendation/
ApiApiCreateReportitemPost /api/reportitem/
ApiApiCreateServiceproviderPost /api/serviceprovider/
ApiApiCreateSystemPost /api/system/
ApiApiCreateSystemtypePost /api/systemtype/
ApiApiCreateSystemuserPost /api/systemuser/
ApiApiCreateTagPost /api/tag/
ApiApiCreateTaskPost /api/task/
ApiApiCreateTasknamePost /api/taskname/
ApiApiListAnalysisstatusGet /api/analysisstatus/
ApiApiListArtifactprioritysGet /api/artifactpriority/
ApiApiListArtifactsGet /api/artifact/
ApiApiListArtifactstatusGet /api/artifactstatus/
ApiApiListArtifacttypesGet /api/artifacttype/
ApiApiListCaseprioritysGet /api/casepriority/
ApiApiListCasesGet /api/case/
ApiApiListCasestatusGet /api/casestatus/
ApiApiListCasetypesGet /api/casetype/
ApiApiListCompanysGet /api/company/
ApiApiListContactsGet /api/contact/
ApiApiListDivisionsGet /api/division/
ApiApiListDnsnamesGet /api/dnsname/
ApiApiListDomainsGet /api/domain/
ApiApiListDomainusersGet /api/domainuser/
ApiApiListHeadlinesGet /api/headline/
ApiApiListIpsGet /api/ip/
ApiApiListLocationsGet /api/location/
ApiApiListNotesGet /api/note/
ApiApiListNotestatusGet /api/notestatus/
ApiApiListOsGet /api/os/
ApiApiListOsarchsGet /api/osarch/
ApiApiListReasonsGet /api/reason/
ApiApiListRecommendationsGet /api/recommendation/
ApiApiListReportitemsGet /api/reportitem/
ApiApiListServiceprovidersGet /api/serviceprovider/
ApiApiListSystemsGet /api/system/
ApiApiListSystemstatusGet /api/systemstatus/
ApiApiListSystemtypesGet /api/systemtype/
ApiApiListSystemusersGet /api/systemuser/
ApiApiListTagcolorsGet /api/tagcolor/
ApiApiListTagsGet /api/tag/
ApiApiListTasknamesGet /api/taskname/
ApiApiListTaskprioritysGet /api/taskpriority/
ApiApiListTasksGet /api/task/
ApiApiListTaskstatusGet /api/taskstatus/
ApiApiPartialUpdateArtifactPatch /api/artifact/{artifact_id}/
ApiApiPartialUpdateArtifacttypePatch /api/artifacttype/{artifacttype_id}/
ApiApiPartialUpdateCasePatch /api/case/{case_id}/
ApiApiPartialUpdateCasetypePatch /api/casetype/{casetype_id}/
ApiApiPartialUpdateCompanyPatch /api/company/{company_id}/
ApiApiPartialUpdateContactPatch /api/contact/{contact_id}/
ApiApiPartialUpdateDivisionPatch /api/division/{division_id}/
ApiApiPartialUpdateDnsnamePatch /api/dnsname/{dnsname_id}/
ApiApiPartialUpdateDomainPatch /api/domain/{domain_id}/
ApiApiPartialUpdateDomainuserPatch /api/domainuser/{domainuser_id}/
ApiApiPartialUpdateHeadlinePatch /api/headline/{headline_id}/
ApiApiPartialUpdateIpPatch /api/ip/{ip_id}/
ApiApiPartialUpdateLocationPatch /api/location/{location_id}/
ApiApiPartialUpdateNotePatch /api/note/{note_id}/
ApiApiPartialUpdateOsPatch /api/os/{os_id}/
ApiApiPartialUpdateOsarchPatch /api/osarch/{osarch_id}/
ApiApiPartialUpdateReasonPatch /api/reason/{reason_id}/
ApiApiPartialUpdateRecommendationPatch /api/recommendation/{recommendation_id}/
ApiApiPartialUpdateReportitemPatch /api/reportitem/{reportitem_id}/
ApiApiPartialUpdateServiceproviderPatch /api/serviceprovider/{serviceprovider_id}/
ApiApiPartialUpdateSystemPatch /api/system/{system_id}/
ApiApiPartialUpdateSystemtypePatch /api/systemtype/{systemtype_id}/
ApiApiPartialUpdateSystemuserPatch /api/systemuser/{systemuser_id}/
ApiApiPartialUpdateTagPatch /api/tag/{tag_id}/
ApiApiPartialUpdateTaskPatch /api/task/{task_id}/
ApiApiPartialUpdateTasknamePatch /api/taskname/{taskname_id}/
ApiApiRetrieveAnalysisstatusGet /api/analysisstatus/{analysisstatus_id}/
ApiApiRetrieveArtifactGet /api/artifact/{artifact_id}/
ApiApiRetrieveArtifactpriorityGet /api/artifactpriority/{artifactpriority_id}/
ApiApiRetrieveArtifactstatusGet /api/artifactstatus/{artifactstatus_id}/
ApiApiRetrieveArtifacttypeGet /api/artifacttype/{artifacttype_id}/
ApiApiRetrieveCaseGet /api/case/{case_id}/
ApiApiRetrieveCasepriorityGet /api/casepriority/{casepriority_id}/
ApiApiRetrieveCasestatusGet /api/casestatus/{casestatus_id}/
ApiApiRetrieveCasetypeGet /api/casetype/{casetype_id}/
ApiApiRetrieveCompanyGet /api/company/{company_id}/
ApiApiRetrieveContactGet /api/contact/{contact_id}/
ApiApiRetrieveDivisionGet /api/division/{division_id}/
ApiApiRetrieveDnsnameGet /api/dnsname/{dnsname_id}/
ApiApiRetrieveDomainGet /api/domain/{domain_id}/
ApiApiRetrieveDomainuserGet /api/domainuser/{domainuser_id}/
ApiApiRetrieveHeadlineGet /api/headline/{headline_id}/
ApiApiRetrieveIpGet /api/ip/{ip_id}/
ApiApiRetrieveLocationGet /api/location/{location_id}/
ApiApiRetrieveNoteGet /api/note/{note_id}/
ApiApiRetrieveNotestatusGet /api/notestatus/{notestatus_id}/
ApiApiRetrieveOsGet /api/os/{os_id}/
ApiApiRetrieveOsarchGet /api/osarch/{osarch_id}/
ApiApiRetrieveReasonGet /api/reason/{reason_id}/
ApiApiRetrieveRecommendationGet /api/recommendation/{recommendation_id}/
ApiApiRetrieveReportitemGet /api/reportitem/{reportitem_id}/
ApiApiRetrieveServiceproviderGet /api/serviceprovider/{serviceprovider_id}/
ApiApiRetrieveSystemGet /api/system/{system_id}/
ApiApiRetrieveSystemstatusGet /api/systemstatus/{systemstatus_id}/
ApiApiRetrieveSystemtypeGet /api/systemtype/{systemtype_id}/
ApiApiRetrieveSystemuserGet /api/systemuser/{systemuser_id}/
ApiApiRetrieveTagGet /api/tag/{tag_id}/
ApiApiRetrieveTagcolorGet /api/tagcolor/{tagcolor_id}/
ApiApiRetrieveTaskGet /api/task/{task_id}/
ApiApiRetrieveTasknameGet /api/taskname/{taskname_id}/
ApiApiRetrieveTaskpriorityGet /api/taskpriority/{taskpriority_id}/
ApiApiRetrieveTaskstatusGet /api/taskstatus/{taskstatus_id}/
ApiApiUpdateArtifactPut /api/artifact/{artifact_id}/
ApiApiUpdateArtifacttypePut /api/artifacttype/{artifacttype_id}/
ApiApiUpdateCasePut /api/case/{case_id}/
ApiApiUpdateCasetypePut /api/casetype/{casetype_id}/
ApiApiUpdateCompanyPut /api/company/{company_id}/
ApiApiUpdateContactPut /api/contact/{contact_id}/
ApiApiUpdateDivisionPut /api/division/{division_id}/
ApiApiUpdateDnsnamePut /api/dnsname/{dnsname_id}/
ApiApiUpdateDomainPut /api/domain/{domain_id}/
ApiApiUpdateDomainuserPut /api/domainuser/{domainuser_id}/
ApiApiUpdateHeadlinePut /api/headline/{headline_id}/
ApiApiUpdateIpPut /api/ip/{ip_id}/
ApiApiUpdateLocationPut /api/location/{location_id}/
ApiApiUpdateNotePut /api/note/{note_id}/
ApiApiUpdateOsPut /api/os/{os_id}/
ApiApiUpdateOsarchPut /api/osarch/{osarch_id}/
ApiApiUpdateReasonPut /api/reason/{reason_id}/
ApiApiUpdateRecommendationPut /api/recommendation/{recommendation_id}/
ApiApiUpdateReportitemPut /api/reportitem/{reportitem_id}/
ApiApiUpdateServiceproviderPut /api/serviceprovider/{serviceprovider_id}/
ApiApiUpdateSystemPut /api/system/{system_id}/
ApiApiUpdateSystemtypePut /api/systemtype/{systemtype_id}/
ApiApiUpdateSystemuserPut /api/systemuser/{systemuser_id}/
ApiApiUpdateTagPut /api/tag/{tag_id}/
ApiApiUpdateTaskPut /api/task/{task_id}/
ApiApiUpdateTasknamePut /api/taskname/{taskname_id}/

Documentation For Models

Documentation For Authorization

basicAuth

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

bearerAuth

Example

auth := context.WithValue(context.Background(), sw.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:

Author