Skip to content

Commit 60e2233

Browse files
committed
Allow deprecation flags for component docs
1 parent f62093f commit 60e2233

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+393
-260
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 Ashley Jeffs
1+
Copyright (c) 2020 Ashley Jeffs
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

docs/inputs/README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,6 @@ input:
5353
30. [`udp_server`](#udp_server)
5454
31. [`websocket`](#websocket)
5555

56-
## `amqp`
57-
58-
``` yaml
59-
type: amqp
60-
amqp:
61-
bindings_declare: []
62-
consumer_tag: benthos-consumer
63-
max_batch_count: 1
64-
prefetch_count: 10
65-
prefetch_size: 0
66-
queue: benthos-queue
67-
queue_declare:
68-
durable: true
69-
enabled: false
70-
tls:
71-
client_certs: []
72-
enabled: false
73-
root_cas_file: ""
74-
skip_cert_verify: false
75-
url: amqp://guest:guest@localhost:5672/
76-
```
77-
78-
DEPRECATED: This input is deprecated and scheduled for removal in Benthos V4.
79-
Please use [`amqp_0_9`](#amqp_0_9) instead.
80-
8156
## `amqp_0_9`
8257

8358
``` yaml

docs/outputs/README.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,6 @@ a [`try`](#try) output.
9797
38. [`udp`](#udp)
9898
39. [`websocket`](#websocket)
9999

100-
## `amqp`
101-
102-
``` yaml
103-
type: amqp
104-
amqp:
105-
exchange: benthos-exchange
106-
exchange_declare:
107-
durable: true
108-
enabled: false
109-
type: direct
110-
immediate: false
111-
key: benthos-key
112-
mandatory: false
113-
max_in_flight: 1
114-
persistent: false
115-
tls:
116-
client_certs: []
117-
enabled: false
118-
root_cas_file: ""
119-
skip_cert_verify: false
120-
url: amqp://guest:guest@localhost:5672/
121-
```
122-
123-
DEPRECATED: This output is deprecated and scheduled for removal in Benthos V4.
124-
Please use [`amqp_0_9`](#amqp_0_9) instead.
125-
126100
## `amqp_0_9`
127101

128102
``` yaml

docs/processors/README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,6 @@ foo_created_at = "2018-12-18T11:57:32"
235235

236236
Custom functions can also still be used with this codec.
237237

238-
## `batch`
239-
240-
``` yaml
241-
type: batch
242-
batch:
243-
byte_size: 0
244-
condition:
245-
type: static
246-
static: false
247-
count: 0
248-
period: ""
249-
```
250-
251-
DEPRECATED: This processor is no longer supported and has been replaced with
252-
improved batching mechanisms. For more information about batching in Benthos
253-
please check out [this document](../batching.md).
254-
255-
This processor is scheduled to be removed in Benthos V4
256-
257238
## `bounds_check`
258239

259240
``` yaml

lib/input/amqp.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ import (
3232
func init() {
3333
Constructors[TypeAMQP] = TypeSpec{
3434
constructor: NewAMQP,
35-
description: `
35+
Description: `
3636
DEPRECATED: This input is deprecated and scheduled for removal in Benthos V4.
3737
Please use [` + "`amqp_0_9`" + `](#amqp_0_9) instead.`,
38+
Deprecated: true,
3839
}
3940
}
4041

lib/input/amqp_0_9.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
func init() {
3333
Constructors[TypeAMQP09] = TypeSpec{
3434
constructor: NewAMQP09,
35-
description: `
35+
Description: `
3636
Connects to an AMQP (0.91) queue. AMQP is a messaging protocol used by various
3737
message brokers, including RabbitMQ.
3838

lib/input/async_reader.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,15 @@ import (
2828

2929
"github.com/Jeffail/benthos/v3/lib/input/reader"
3030
"github.com/Jeffail/benthos/v3/lib/log"
31-
"github.com/Jeffail/benthos/v3/lib/message/batch"
3231
"github.com/Jeffail/benthos/v3/lib/message/tracing"
3332
"github.com/Jeffail/benthos/v3/lib/metrics"
3433
"github.com/Jeffail/benthos/v3/lib/response"
3534
"github.com/Jeffail/benthos/v3/lib/types"
3635
"github.com/Jeffail/benthos/v3/lib/util/throttle"
37-
"gopkg.in/yaml.v3"
3836
)
3937

4038
//------------------------------------------------------------------------------
4139

42-
func sanitiseWithBatch(
43-
componentConfig interface{},
44-
batchConfig batch.PolicyConfig,
45-
) (map[string]interface{}, error) {
46-
batchSanit, err := batch.SanitisePolicyConfig(batchConfig)
47-
if err != nil {
48-
return nil, err
49-
}
50-
51-
cBytes, err := yaml.Marshal(componentConfig)
52-
if err != nil {
53-
return nil, err
54-
}
55-
56-
hashMap := map[string]interface{}{}
57-
if err = yaml.Unmarshal(cBytes, &hashMap); err != nil {
58-
return nil, err
59-
}
60-
61-
hashMap["batching"] = batchSanit
62-
return hashMap, nil
63-
}
64-
65-
//------------------------------------------------------------------------------
66-
6740
// AsyncReader is an input implementation that reads messages from a
6841
// reader.Async component.
6942
type AsyncReader struct {

lib/input/broker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func init() {
4848
Constructors[TypeBroker] = TypeSpec{
4949
brokerConstructor: NewBroker,
5050
brokerConstructorHasBatchProcessor: newBrokerHasBatchProcessor,
51-
description: `
51+
Description: `
5252
The broker type allows you to combine multiple inputs, where each input will be
5353
read in parallel. A broker type is configured with its own list of input
5454
configurations and a field to specify how many copies of the list of inputs

lib/input/constructor.go

Lines changed: 5 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
package input
2222

2323
import (
24-
"bytes"
2524
"encoding/json"
2625
"fmt"
27-
"sort"
28-
"strings"
2926

3027
"github.com/Jeffail/benthos/v3/lib/input/reader"
3128
"github.com/Jeffail/benthos/v3/lib/log"
@@ -50,7 +47,6 @@ type TypeSpec struct {
5047
pipelineConstructors ...types.PipelineConstructorFunc,
5148
) (Type, error)
5249
constructor func(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
53-
description string
5450
sanitiseConfigFunc func(conf Config) (interface{}, error)
5551

5652
// DEPRECATED: This is a hack for until the batch processor is removed.
@@ -70,6 +66,11 @@ type TypeSpec struct {
7066
log log.Modular,
7167
stats metrics.Type,
7268
) (Type, error)
69+
70+
Description string
71+
72+
// Deprecated indicates whether this component is deprecated.
73+
Deprecated bool
7374
}
7475

7576
// Constructors is a map of all input types with their specs.
@@ -304,73 +305,6 @@ func (c *Config) UnmarshalYAML(value *yaml.Node) error {
304305

305306
//------------------------------------------------------------------------------
306307

307-
var header = "This document was generated with `benthos --list-inputs`" + `
308-
309-
An input is a source of data piped through an array of optional
310-
[processors](../processors). Only one input is configured at the root of a
311-
Benthos config. However, the root input can be a [broker](#broker) which
312-
combines multiple inputs.
313-
314-
An input config section looks like this:
315-
316-
` + "``` yaml" + `
317-
input:
318-
type: foo
319-
foo:
320-
bar: baz
321-
processors:
322-
- type: qux
323-
` + "```" + ``
324-
325-
// Descriptions returns a formatted string of descriptions for each type.
326-
func Descriptions() string {
327-
// Order our input types alphabetically
328-
names := []string{}
329-
for name := range Constructors {
330-
names = append(names, name)
331-
}
332-
sort.Strings(names)
333-
334-
buf := bytes.Buffer{}
335-
buf.WriteString("Inputs\n")
336-
buf.WriteString(strings.Repeat("=", 6))
337-
buf.WriteString("\n\n")
338-
buf.WriteString(header)
339-
buf.WriteString("\n\n")
340-
341-
buf.WriteString("### Contents\n\n")
342-
for i, name := range names {
343-
buf.WriteString(fmt.Sprintf("%v. [`%v`](#%v)\n", i+1, name, name))
344-
}
345-
buf.WriteString("\n")
346-
347-
// Append each description
348-
for i, name := range names {
349-
var confBytes []byte
350-
351-
conf := NewConfig()
352-
conf.Type = name
353-
conf.Processors = nil
354-
if confSanit, err := SanitiseConfig(conf); err == nil {
355-
confBytes, _ = config.MarshalYAML(confSanit)
356-
}
357-
358-
buf.WriteString("## ")
359-
buf.WriteString("`" + name + "`")
360-
buf.WriteString("\n")
361-
if confBytes != nil {
362-
buf.WriteString("\n``` yaml\n")
363-
buf.Write(confBytes)
364-
buf.WriteString("```\n")
365-
}
366-
buf.WriteString(Constructors[name].description)
367-
if i != (len(names) - 1) {
368-
buf.WriteString("\n\n")
369-
}
370-
}
371-
return buf.String()
372-
}
373-
374308
// New creates an input type based on an input configuration.
375309
func New(
376310
conf Config,

0 commit comments

Comments
 (0)