Skip to content

Commit 00babba

Browse files
skeeeyclaude
andcommitted
Update CloudEvents documentation to reflect current API
Signed-off-by: Wei Liu <liuweixa@redhat.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8db061d commit 00babba

3 files changed

Lines changed: 368 additions & 320 deletions

File tree

README.md

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ The OCM SDK for Go provides essential building blocks for:
1717

1818
### CloudEvents Clients
1919

20-
The SDK includes comprehensive CloudEvents-based clients for implementing event-driven communication between hub clusters and managed clusters. This supports the Event Based ManifestWork architecture.
20+
The SDK includes comprehensive CloudEvents-based clients for implementing event-driven communication between hub clusters and managed clusters.
2121

2222
**Supported Protocols:**
2323
- MQTT Protocol/Driver
24-
- gRPC Protocol/Driver
24+
- gRPC Protocol/Driver
25+
- Google Cloud Pub/Sub Protocol/Driver
2526

2627
**Key Features:**
2728
- Generic CloudEvents clients for custom resources
28-
- Specialized ManifestWork clients
29-
- Source and agent client implementations
29+
- Specialized kube style clients, e.g. ManifestWork, etc
30+
- Protocol-agnostic design with pluggable transports
3031
- Automatic reconnection handling
3132
- Resource synchronization capabilities
3233

@@ -61,55 +62,12 @@ Common utilities for OCM development:
6162
- **Testing Utilities**: Helper functions and mocks for testing OCM components
6263
- **Serving Certificates**: Certificate management for webhooks and APIs
6364

64-
## Getting Started
65-
66-
### Installation
65+
## Installation
6766

6867
```bash
6968
go get open-cluster-management.io/sdk-go
7069
```
7170

72-
### Basic Usage
73-
74-
#### CloudEvents Client Example
75-
76-
```go
77-
import (
78-
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic"
79-
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/options/mqtt"
80-
)
81-
82-
// Create a CloudEvents source client
83-
client, err := generic.NewCloudEventSourceClient[*YourResource](
84-
ctx,
85-
mqtt.NewSourceOptions(mqttConfig, "client-id", "source-id"),
86-
resourceLister,
87-
statusHashGetter,
88-
resourceCodec,
89-
)
90-
91-
// Subscribe to receive events
92-
client.Subscribe(ctx, resourceHandler)
93-
```
94-
95-
#### ManifestWork Client Example
96-
97-
```go
98-
import (
99-
"open-cluster-management.io/sdk-go/pkg/cloudevents/work"
100-
"open-cluster-management.io/sdk-go/pkg/cloudevents/work/codec"
101-
)
102-
103-
// Build a ManifestWork client
104-
clientHolder, err := work.NewClientHolderBuilder(config).
105-
WithClientID("controller-client").
106-
WithSourceID("controller").
107-
WithCodec(codec.NewManifestBundleCodec()).
108-
NewSourceClientHolder(ctx)
109-
110-
manifestWorkClient := clientHolder.ManifestWorks(namespace)
111-
```
112-
11371
## Documentation
11472

11573
- **CloudEvents**: See [pkg/cloudevents/README.md](pkg/cloudevents/README.md) for detailed CloudEvents client documentation

0 commit comments

Comments
 (0)