डेवलपर उपकरण

एसडीके एकीकरण जाओ

अपनी गो सेवाओं, कुबेरनेट्स नियंत्रकों और परिनियोजन पाइपलाइनों को सीधे ब्लैकशील्ड की सुरक्षा स्थिति एपीआई से कनेक्ट करें।

शून्य बाहरी निर्भरता

The core SDK relies only on the Go standard library. It adds no third-party packages or licenses to your binaries and container images.

अंतर्निहित पुनः प्रयास और बैकऑफ़

Transient network hiccups, 5xx gateway errors, and 429 rate limits retry automatically with exponential backoff and jitter.

स्ट्रीमिंग और टाइप की गई पेजिंग

Process thousands of findings or telemetry events without memory spikes using streaming NDJSON readers and typed cursor paginators.

स्थापना

अपने गो प्रोजेक्ट में मॉड्यूल जोड़ें:

go get github.com/blackshield-security/blackshield-go

त्वरित शुरुआत: क्वेरी निष्कर्ष

अपनी किरायेदार एपीआई कुंजी के साथ क्लाइंट को प्रारंभ करें और सक्रिय सुरक्षा निष्कर्ष प्राप्त करें:

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/blackshield-security/blackshield-go"
)

func main() {
    client, err := blackshield.NewClient(
        blackshield.WithAPIKey("bsk_live_your_api_key"),
    )
    if err != nil {
        log.Fatalf("client error: %v", err)
    }

    ctx := context.Background()
    page, err := client.Findings.List(ctx, blackshield.FindingsFilter{
        Severity: []string{"critical", "high"},
        Limit:    10,
    })
    if err != nil {
        log.Fatalf("query failed: %v", err)
    }

    for _, f := range page.Items {
        fmt.Printf("[%s] %s: %s\n", f.Severity, f.ID, f.Title)
    }
}

परिनियोजन नीति मूल्यांकन

प्रचार या रिलीज़ से पहले जांचें कि कोई कलाकृति आपकी सुरक्षा नीतियों को पूरा करती है या नहीं:

decision, err := client.Policies.EvaluateDeploy(ctx, blackshield.DeployEvaluationRequest{
    ServiceID:    "payment-service",
    ArtifactURI:  "123456789.dkr.ecr.us-east-1.amazonaws.com/payments:v1.2.0",
    GitCommitSHA: "abcdef0123456789abcdef0123456789abcdef01",
    Environment:  "production",
})
if err != nil {
    log.Fatalf("policy evaluation failed: %v", err)
}

if !decision.Allowed {
    log.Fatalf("Release rejected: %s (Violations: %v)", decision.Reason, decision.Violations)
}

संबंधित मार्गदर्शिकाएँ

एसडीके एकीकरण जाओ