projects

package module
v0.0.0-...-a16a07d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README ΒΆ

snyk-api

Production-Ready: Comprehensive Snyk API management tool with CLI interface.

CI Go Reference License Go Version

A comprehensive Go library and CLI tool for managing Snyk APIs. Built on go-application-framework with type-safe clients generated from OpenAPI specifications.

Note: Currently developed at github.com/sam1el/snyk-api. Upon maturity and official adoption, it will be migrated to github.com/snyk/snyk-api.

✨ Features

  • 🎯 Type-Safe API Clients - Generated from official OpenAPI specs
  • πŸ”„ Rate Limiting - Token bucket algorithm with worker pools
  • πŸ” Smart Retries - Exponential backoff with jitter
  • 🎨 Multiple Output Formats - JSON, YAML, and table views
  • πŸ”Œ Framework Integration - Built on go-application-framework
  • 🌍 Multi-Region Support - All Snyk regional endpoints
  • πŸ“¦ Library + CLI - Use as Go package or standalone tool

πŸ“¦ Installation

CLI Installation
go install github.com/sam1el/snyk-api/cmd/snyk-api@latest
Library Installation
go get github.com/sam1el/snyk-api

πŸš€ Quick Start

CLI Usage
# Set your Snyk API token
export SNYK_TOKEN=your-snyk-token-here

# List organizations
snyk-api orgs list

# List projects in an organization
snyk-api projects list --org-id=<org-id>

# Filter projects by type
snyk-api projects list --org-id=<org-id> --type npm --origin github

# Get organization details (YAML output)
snyk-api orgs get <org-id> --output yaml

# Get project details (table output)
snyk-api projects get <project-id> --org-id=<org-id> --output table

# Delete a project
snyk-api projects delete <project-id> --org-id=<org-id>
Library Usage
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/sam1el/snyk-api/pkg/apiclients/orgs"
    "github.com/sam1el/snyk-api/pkg/apiclients/projects"
    "github.com/sam1el/snyk-api/pkg/client"
)

func main() {
    ctx := context.Background()

    // Create base client (uses SNYK_TOKEN from environment)
    baseClient, err := client.New(ctx)
    if err != nil {
        log.Fatal(err)
    }
    defer baseClient.Close()

    // List organizations
    orgsClient := orgs.NewOrgsClient(baseClient)
    limit := 10
    orgsList, err := orgsClient.ListOrganizations(ctx, &orgs.ListOrganizationsParams{
        Limit: &limit,
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, org := range orgsList.Data {
        fmt.Printf("Org: %s (%s)\n", org.Attributes.Name, org.Id)
    }

    // List projects in first organization
    if len(orgsList.Data) > 0 {
        orgID := orgsList.Data[0].Id.String()
        projectsClient := projects.NewProjectsClient(baseClient)

        projectsList, err := projectsClient.ListProjects(ctx, orgID, &projects.ListProjectsParams{
            Limit: &limit,
        })
        if err != nil {
            log.Fatal(err)
        }

        for _, project := range projectsList.Data {
            fmt.Printf("  Project: %s (%s)\n", project.Attributes.Name, project.Attributes.Type)
        }
    }
}
Advanced Client Configuration
// Custom configuration
baseClient, err := client.New(ctx,
    client.WithVersion(client.APIVersion("2024-04-22")),           // Specific API version
    client.WithBaseURL("https://api.snyk.io", "https://api.snyk.io/rest"), // Custom endpoint
    client.WithRateLimitConfig(ratelimit.Config{
        BurstSize:      20,
        Period:         time.Second,
        MaxRetries:     10,
        RetryBaseDelay: 200 * time.Millisecond,
        RetryMaxDelay:  10 * time.Second,
    }),
)

🎯 Available Commands

snyk-api --help                 # Show all commands
snyk-api version               # Version information

# Organizations
snyk-api orgs list             # List organizations
snyk-api orgs get <id>         # Get organization by ID

# Projects
snyk-api projects list --org-id=<id>              # List projects
snyk-api projects list --org-id=<id> --origin github --type npm  # Filter projects
snyk-api projects get <id> --org-id=<id>         # Get project by ID
snyk-api projects delete <id> --org-id=<id>      # Delete project
Global Flags
--output, -o       Output format: json, yaml, table (default: json)
--api-url          Override Snyk API URL
--api-version      Snyk API version (default: 2025-11-05)
--debug            Enable debug logging

βš™οΈ Configuration

Environment Variables
Variable Description Default
SNYK_TOKEN API authentication token Required
SNYK_API Custom API endpoint https://api.snyk.io
API Versioning

Snyk's REST API uses date-based versioning. Specify versions per request:

# Use specific API version
snyk-api orgs list --api-version 2024-04-22

# Use beta version
snyk-api orgs list --api-version 2025-11-05~beta

# Use experimental version
snyk-api orgs list --api-version 2025-11-05~experimental

In Go code:

// Use default latest GA version
client.New(ctx)

// Use specific version
client.New(ctx, client.WithVersion(client.Version20240422))

// Use beta
client.New(ctx, client.WithVersion(client.DefaultAPIVersion.Beta()))

See API_VERSIONING.md for details.

πŸ“Š Project Status

Current: Production-ready with 2 API domains βœ…

Component Status Coverage
Organizations API βœ… Complete list, get
Projects API βœ… Complete list, get, delete
Targets API ⏭️ Future -
Issues API ⏭️ Future -
Ignores API ⏭️ Future -

Quality Metrics:

  • βœ… 21 Go source files (~3,500 lines)
  • βœ… 13 passing tests with race detection
  • βœ… 0 linter issues (golangci-lint)
  • βœ… 0 security vulnerabilities (Snyk Code + SCA)

πŸ—οΈ Architecture

Built on proven patterns from Snyk's go-application-framework:

OpenAPI Spec β†’ oapi-codegen β†’ Generated Client β†’ Wrapper β†’ CLI
                                      ↓
                                Base Client (rate limit, retry, auth)
                                      ↓
                                Snyk REST API
Project Structure
snyk-api/
β”œβ”€β”€ cmd/
β”‚   └── snyk-api/              # CLI entry point
β”œβ”€β”€ pkg/
β”‚   β”œβ”€β”€ client/                # Base HTTP client with rate limiting
β”‚   β”œβ”€β”€ apiclients/
β”‚   β”‚   β”œβ”€β”€ orgs/             # Organizations API client
β”‚   β”‚   └── projects/         # Projects API client
β”‚   └── config/               # Configuration management
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ commands/             # Cobra CLI commands
β”‚   β”œβ”€β”€ output/               # Output formatters
β”‚   └── ratelimit/            # Rate limiting implementation
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ api-ref/              # OpenAPI specifications
β”‚   └── workflows/            # CI/CD pipelines
└── docs/
    └── planning/             # Architecture docs

πŸ› οΈ Development

Prerequisites
  • Go 1.24 or later
  • Make
  • golangci-lint
  • oapi-codegen
Setup
# Clone repository
git clone https://github.com/sam1el/snyk-api.git
cd snyk-api

# Install development tools
make install-tools

# Run tests
make test

# Run linters
make lint

# Build CLI
make build

# Run all checks
make all
Make Targets
make help              # Show all available targets
make build             # Build the CLI binary
make test              # Run tests with coverage
make lint              # Run golangci-lint
make fmt               # Format code (gofmt + gofmt -s)
make vet               # Run go vet
make generate          # Generate API clients from OpenAPI specs
make pull-specs        # Pull latest OpenAPI specifications
make clean             # Clean build artifacts
make dev               # Run fmt + vet + lint + test
Adding New API Domains

See CONTRIBUTING.md for detailed instructions on adding new API domains.

Quick overview:

  1. Create minimal OpenAPI spec in .github/api-ref/rest/
  2. Add oapi-codegen.yaml config
  3. Generate client: make generate
  4. Create wrapper client in pkg/apiclients/<domain>/
  5. Add CLI commands in internal/commands/
  6. Add tests

πŸ“š Documentation

🀝 Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Development Workflow
  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linters (make dev)
  5. Commit your changes (git commit -m 'feat: add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

πŸ“„ License

Apache-2.0 - see LICENSE for details.

πŸ’¬ Support


Built with ❀️ for the Snyk community

Documentation ΒΆ

Overview ΒΆ

Package projects provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Index ΒΆ

Constants ΒΆ

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables ΒΆ

This section is empty.

Functions ΒΆ

func GetSwagger ΒΆ

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func NewDeleteProjectRequest ΒΆ

func NewDeleteProjectRequest(server string, orgId openapi_types.UUID, projectId openapi_types.UUID) (*http.Request, error)

NewDeleteProjectRequest generates requests for DeleteProject

func NewGetProjectRequest ΒΆ

func NewGetProjectRequest(server string, orgId openapi_types.UUID, projectId openapi_types.UUID) (*http.Request, error)

NewGetProjectRequest generates requests for GetProject

func NewListProjectsRequest ΒΆ

func NewListProjectsRequest(server string, orgId openapi_types.UUID, params *ListProjectsParams) (*http.Request, error)

NewListProjectsRequest generates requests for ListProjects

func NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody ΒΆ

func NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody(server string, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)

NewUpdateProjectRequestWithApplicationVndAPIPlusJSONBody calls the generic UpdateProject builder with application/vnd.api+json body

func NewUpdateProjectRequestWithBody ΒΆ

func NewUpdateProjectRequestWithBody(server string, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error)

NewUpdateProjectRequestWithBody generates requests for UpdateProject with any type of body

func PathToRawSpec ΒΆ

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types ΒΆ

type Client ΒΆ

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient ΒΆ

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) DeleteProject ΒΆ

func (c *Client) DeleteProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetProject ΒΆ

func (c *Client) GetProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListProjects ΒΆ

func (c *Client) ListProjects(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateProjectWithApplicationVndAPIPlusJSONBody ΒΆ

func (c *Client) UpdateProjectWithApplicationVndAPIPlusJSONBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateProjectWithBody ΒΆ

func (c *Client) UpdateProjectWithBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface ΒΆ

type ClientInterface interface {
	// ListProjects request
	ListProjects(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteProject request
	DeleteProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetProject request
	GetProject(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpdateProjectWithBody request with any body
	UpdateProjectWithBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdateProjectWithApplicationVndAPIPlusJSONBody(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption ΒΆ

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL ΒΆ

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient ΒΆ

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn ΒΆ

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses ΒΆ

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses ΒΆ

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) DeleteProjectWithResponse ΒΆ

func (c *ClientWithResponses) DeleteProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteProjectResponse, error)

DeleteProjectWithResponse request returning *DeleteProjectResponse

func (*ClientWithResponses) GetProjectWithResponse ΒΆ

func (c *ClientWithResponses) GetProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetProjectResponse, error)

GetProjectWithResponse request returning *GetProjectResponse

func (*ClientWithResponses) ListProjectsWithResponse ΒΆ

func (c *ClientWithResponses) ListProjectsWithResponse(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

ListProjectsWithResponse request returning *ListProjectsResponse

func (*ClientWithResponses) UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse ΒΆ

func (c *ClientWithResponses) UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

func (*ClientWithResponses) UpdateProjectWithBodyWithResponse ΒΆ

func (c *ClientWithResponses) UpdateProjectWithBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

UpdateProjectWithBodyWithResponse request with arbitrary body returning *UpdateProjectResponse

type ClientWithResponsesInterface ΒΆ

type ClientWithResponsesInterface interface {
	// ListProjectsWithResponse request
	ListProjectsWithResponse(ctx context.Context, orgId openapi_types.UUID, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

	// DeleteProjectWithResponse request
	DeleteProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteProjectResponse, error)

	// GetProjectWithResponse request
	GetProjectWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetProjectResponse, error)

	// UpdateProjectWithBodyWithResponse request with any body
	UpdateProjectWithBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)

	UpdateProjectWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, orgId openapi_types.UUID, projectId openapi_types.UUID, body UpdateProjectApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateProjectResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DeleteProjectResponse ΒΆ

type DeleteProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseDeleteProjectResponse ΒΆ

func ParseDeleteProjectResponse(rsp *http.Response) (*DeleteProjectResponse, error)

ParseDeleteProjectResponse parses an HTTP response from a DeleteProjectWithResponse call

func (DeleteProjectResponse) Status ΒΆ

func (r DeleteProjectResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteProjectResponse) StatusCode ΒΆ

func (r DeleteProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error ΒΆ

type Error struct {
	Errors []struct {
		Detail string  `json:"detail"`
		Status string  `json:"status"`
		Title  *string `json:"title,omitempty"`
	} `json:"errors"`
}

Error defines model for Error.

type GetProjectResponse ΒΆ

type GetProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectResponse
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseGetProjectResponse ΒΆ

func ParseGetProjectResponse(rsp *http.Response) (*GetProjectResponse, error)

ParseGetProjectResponse parses an HTTP response from a GetProjectWithResponse call

func (GetProjectResponse) Status ΒΆ

func (r GetProjectResponse) Status() string

Status returns HTTPResponse.Status

func (GetProjectResponse) StatusCode ΒΆ

func (r GetProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer ΒΆ

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListProjectsParams ΒΆ

type ListProjectsParams struct {
	// Limit Number of results to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// StartingAfter Cursor for pagination
	StartingAfter *string `form:"starting_after,omitempty" json:"starting_after,omitempty"`

	// TargetId Filter by target ID
	TargetId *openapi_types.UUID `form:"target_id,omitempty" json:"target_id,omitempty"`

	// Origin Filter by origin (e.g., github, cli)
	Origin *string `form:"origin,omitempty" json:"origin,omitempty"`

	// Type Filter by project type (e.g., npm, maven)
	Type *string `form:"type,omitempty" json:"type,omitempty"`
}

ListProjectsParams defines parameters for ListProjects.

type ListProjectsResponse ΒΆ

type ListProjectsResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectList
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseListProjectsResponse ΒΆ

func ParseListProjectsResponse(rsp *http.Response) (*ListProjectsResponse, error)

ParseListProjectsResponse parses an HTTP response from a ListProjectsWithResponse call

func (ListProjectsResponse) Status ΒΆ

func (r ListProjectsResponse) Status() string

Status returns HTTPResponse.Status

func (ListProjectsResponse) StatusCode ΒΆ

func (r ListProjectsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Project ΒΆ

type Project struct {
	Attributes struct {
		// Created Project creation date
		Created time.Time `json:"created"`

		// Name Project name
		Name string `json:"name"`

		// Origin Source of the project (e.g., github, cli)
		Origin string `json:"origin"`

		// Status Project status
		Status *ProjectAttributesStatus `json:"status,omitempty"`
		Tags   *[]struct {
			Key   *string `json:"key,omitempty"`
			Value *string `json:"value,omitempty"`
		} `json:"tags,omitempty"`

		// TargetReference Branch or reference being monitored
		TargetReference *string `json:"target_reference,omitempty"`

		// Type Project type (e.g., npm, maven, pip)
		Type string `json:"type"`
	} `json:"attributes"`

	// Id Project ID
	Id            openapi_types.UUID `json:"id"`
	Relationships *struct {
		Organization *struct {
			Data *struct {
				Id   *openapi_types.UUID                       `json:"id,omitempty"`
				Type *ProjectRelationshipsOrganizationDataType `json:"type,omitempty"`
			} `json:"data,omitempty"`
		} `json:"organization,omitempty"`
		Target *struct {
			Data *struct {
				Id   *openapi_types.UUID                 `json:"id,omitempty"`
				Type *ProjectRelationshipsTargetDataType `json:"type,omitempty"`
			} `json:"data,omitempty"`
		} `json:"target,omitempty"`
	} `json:"relationships,omitempty"`
	Type ProjectType `json:"type"`
}

Project defines model for Project.

type ProjectAttributesStatus ΒΆ

type ProjectAttributesStatus string

ProjectAttributesStatus Project status

const (
	Active   ProjectAttributesStatus = "active"
	Inactive ProjectAttributesStatus = "inactive"
)

Defines values for ProjectAttributesStatus.

type ProjectList ΒΆ

type ProjectList struct {
	Data  []Project `json:"data"`
	Links *struct {
		Next *string `json:"next,omitempty"`
		Prev *string `json:"prev,omitempty"`
		Self *string `json:"self,omitempty"`
	} `json:"links,omitempty"`
	Meta *struct {
		// Count Total number of projects
		Count *int `json:"count,omitempty"`
	} `json:"meta,omitempty"`
}

ProjectList defines model for ProjectList.

type ProjectRelationshipsOrganizationDataType ΒΆ

type ProjectRelationshipsOrganizationDataType string

ProjectRelationshipsOrganizationDataType defines model for Project.Relationships.Organization.Data.Type.

const (
	Organization ProjectRelationshipsOrganizationDataType = "organization"
)

Defines values for ProjectRelationshipsOrganizationDataType.

type ProjectRelationshipsTargetDataType ΒΆ

type ProjectRelationshipsTargetDataType string

ProjectRelationshipsTargetDataType defines model for Project.Relationships.Target.Data.Type.

const (
	Target ProjectRelationshipsTargetDataType = "target"
)

Defines values for ProjectRelationshipsTargetDataType.

type ProjectResponse ΒΆ

type ProjectResponse struct {
	Data Project `json:"data"`
}

ProjectResponse defines model for ProjectResponse.

type ProjectType ΒΆ

type ProjectType string

ProjectType defines model for Project.Type.

const (
	ProjectTypeProject ProjectType = "project"
)

Defines values for ProjectType.

type RequestEditorFn ΒΆ

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type UpdateProjectApplicationVndAPIPlusJSONBody ΒΆ

type UpdateProjectApplicationVndAPIPlusJSONBody struct {
	Data struct {
		Attributes struct {
			Tags *[]struct {
				Key   *string `json:"key,omitempty"`
				Value *string `json:"value,omitempty"`
			} `json:"tags,omitempty"`
		} `json:"attributes"`
		Id   openapi_types.UUID                                 `json:"id"`
		Type UpdateProjectApplicationVndAPIPlusJSONBodyDataType `json:"type"`
	} `json:"data"`
}

UpdateProjectApplicationVndAPIPlusJSONBody defines parameters for UpdateProject.

type UpdateProjectApplicationVndAPIPlusJSONBodyDataType ΒΆ

type UpdateProjectApplicationVndAPIPlusJSONBodyDataType string

UpdateProjectApplicationVndAPIPlusJSONBodyDataType defines parameters for UpdateProject.

const (
	UpdateProjectApplicationVndAPIPlusJSONBodyDataTypeProject UpdateProjectApplicationVndAPIPlusJSONBodyDataType = "project"
)

Defines values for UpdateProjectApplicationVndAPIPlusJSONBodyDataType.

type UpdateProjectApplicationVndAPIPlusJSONRequestBody ΒΆ

type UpdateProjectApplicationVndAPIPlusJSONRequestBody UpdateProjectApplicationVndAPIPlusJSONBody

UpdateProjectApplicationVndAPIPlusJSONRequestBody defines body for UpdateProject for application/vnd.api+json ContentType.

type UpdateProjectResponse ΒΆ

type UpdateProjectResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *ProjectResponse
	ApplicationvndApiJSON400 *Error
	ApplicationvndApiJSON401 *Error
	ApplicationvndApiJSON404 *Error
	ApplicationvndApiJSON500 *Error
}

func ParseUpdateProjectResponse ΒΆ

func ParseUpdateProjectResponse(rsp *http.Response) (*UpdateProjectResponse, error)

ParseUpdateProjectResponse parses an HTTP response from a UpdateProjectWithResponse call

func (UpdateProjectResponse) Status ΒΆ

func (r UpdateProjectResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateProjectResponse) StatusCode ΒΆ

func (r UpdateProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Directories ΒΆ

Path Synopsis
cmd
snyk-api command
examples
advanced command
Package main demonstrates advanced usage of the snyk-api library.
Package main demonstrates advanced usage of the snyk-api library.
basic command
Package main demonstrates basic usage of the snyk-api library.
Package main demonstrates basic usage of the snyk-api library.
filtering command
Package main demonstrates filtering and searching with the snyk-api library.
Package main demonstrates filtering and searching with the snyk-api library.
internal
commands
Package commands provides the CLI command structure for snyk-api.
Package commands provides the CLI command structure for snyk-api.
output
Package output provides output formatting for CLI commands.
Package output provides output formatting for CLI commands.
ratelimit
Package ratelimit provides token bucket rate limiting with worker pools for managing concurrent API requests with configurable burst and period settings.
Package ratelimit provides token bucket rate limiting with worker pools for managing concurrent API requests with configurable burst and period settings.
pkg
apiclients/issues
Package issues provides primitives to interact with the openapi HTTP API.
Package issues provides primitives to interact with the openapi HTTP API.
apiclients/orgs
Package orgs provides a high-level client for the Snyk Organizations API.
Package orgs provides a high-level client for the Snyk Organizations API.
apiclients/projects
Package projects provides primitives to interact with the openapi HTTP API.
Package projects provides primitives to interact with the openapi HTTP API.
apiclients/rest
Package rest provides manual clients for Snyk's REST API endpoints.
Package rest provides manual clients for Snyk's REST API endpoints.
apiclients/rest/groups
Package groups provides a manual client for Snyk REST Groups API.
Package groups provides a manual client for Snyk REST Groups API.
apiclients/rest/orgs
Package orgs provides a manual client for Snyk REST Organizations API.
Package orgs provides a manual client for Snyk REST Organizations API.
apiclients/rest/self
Package self provides a manual client for Snyk REST Self API.
Package self provides a manual client for Snyk REST Self API.
apiclients/rest/tenants
Package tenants provides a manual client for Snyk REST Tenants API.
Package tenants provides a manual client for Snyk REST Tenants API.
apiclients/targets
Package targets provides primitives to interact with the openapi HTTP API.
Package targets provides primitives to interact with the openapi HTTP API.
apiclients/v1
Package v1 provides clients for Snyk's v1 API endpoints.
Package v1 provides clients for Snyk's v1 API endpoints.
apiclients/v1/groups
Package groups provides a client for Snyk v1 Groups API.
Package groups provides a client for Snyk v1 Groups API.
apiclients/v1/integrations
Package integrations provides a client for Snyk v1 Integrations API.
Package integrations provides a client for Snyk v1 Integrations API.
apiclients/v1/monitor
Package monitor provides a client for Snyk v1 Monitor API.
Package monitor provides a client for Snyk v1 Monitor API.
apiclients/v1/orgs
Package orgs provides a client for Snyk v1 Organizations API.
Package orgs provides a client for Snyk v1 Organizations API.
apiclients/v1/projects
Package projects provides a client for Snyk v1 Projects API.
Package projects provides a client for Snyk v1 Projects API.
apiclients/v1/reporting
Package reporting provides a client for Snyk v1 Reporting API.
Package reporting provides a client for Snyk v1 Reporting API.
apiclients/v1/testing
Package testing provides a client for Snyk v1 Testing API.
Package testing provides a client for Snyk v1 Testing API.
apiclients/v1/users
Package users provides a client for Snyk v1 Users API.
Package users provides a client for Snyk v1 Users API.
apiclients/v1/webhooks
Package webhooks provides a client for Snyk v1 Webhooks API.
Package webhooks provides a client for Snyk v1 Webhooks API.
client
Package client provides a comprehensive API client for Snyk with rate limiting, retry logic, and integration with go-application-framework.
Package client provides a comprehensive API client for Snyk with rate limiting, retry logic, and integration with go-application-framework.
config
Package config provides configuration loading and management for the Snyk API client, integrating with go-application-framework's configuration system.
Package config provides configuration loading and management for the Snyk API client, integrating with go-application-framework's configuration system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL