أدوات المطور

انتقل إلى تكامل SDK

قم بتوصيل خدمات Go ووحدات تحكم Kubernetes ومسارات النشر مباشرةً بواجهات برمجة تطبيقات الوضع الأمني الخاصة بـ BlackShield.

صفر التبعيات الخارجية

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 الخاص بك:

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

بداية سريعة: نتائج الاستعلام

قم بتهيئة العميل باستخدام مفتاح API للمستأجر الخاص بك واحصل على نتائج الأمان النشطة:

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)
}

أدلة ذات صلة

انتقل إلى تكامل SDK