A client library gives application code programmatic access to an external service or system. Cloud-provider SDKs package calls to service APIs as dependencies in a programming language, avoiding manually crafted requests. That convenience can couple application code to a provider: upgrading the SDK may require an application release, and an SDK may conflict with a framework or lack support for a language. section 1.1.3
Choose the dependency according to what it couples the application to:
- A Dapr SDK helps code call Dapr APIs without constructing HTTP or gRPC requests. It is optional, and its dependency is not tied to the infrastructure component behind those APIs. section 7.3.3
- A Dagger SDK lets developers define pipelines in code for the Dagger engine to run locally or remotely; the pipelines do not require Kubernetes CRDs or YAML. section 3.5.4
- A direct database client can meet an edge case that platform capability APIs cannot. The service then depends on that database and a particular client version. section 7.2.1
State access with or without an SDK
An application can add a Dapr SDK dependency to call a statestore, or send HTTP requests to the Dapr state endpoint itself. The SDK saves request-writing work; the API remains available when the helper is unsuitable. section 7.3.3
Listing 3.11 Go application defining tasks using Dagger
func main() {
var err error
ctx := context.Background()
if len(os.Args) < 2 {
...)
}
client := getDaggerClient(ctx)
defer client.Close()
switch os.Args[1] {
case "build":
if len(os.Args) < 3 {
panic(...)
}
_, err = buildService(ctx, client, os.Args[2])
case "test":
err = testService(ctx, client, os.Args[2])
case "publish":
pv, err := buildService(ctx, client, os.Args[2])
err = publishService(ctx, client, os.Args[2], pv, os.Args[3])
case "all":
pv, err := buildService(ctx, client, os.Args[2])
err = testService(ctx, client, os.Args[2])
err = publishService(ctx, client, os.Args[2], pv, os.Args[3])
default:
log.Fatalln("invalid command specified")
}
A Go pipeline entry point obtains a Dagger client, passes it to build, test, and publish tasks, then closes it. section 3.5.4




