Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update cmd for Pulsar Functions #33

Merged
merged 11 commits into from
Sep 5, 2019
Merged

Conversation

wolfstudy
Copy link
Contributor

Add update cmd for Pulsar Functions, output as follows:

USED FOR:
    Update a Pulsar Function that has been deployed to a Pulsar cluster.

REQUIRED PERMISSION:
    This command requires super-user permissions.

EXAMPLES:
    #Update output topic of Pulsar Function
    pulsarctl functions update
	--tenant public
	--namespace default
	--name update-function
	--output test-output-topic

    #Update function config yaml file of Pulsar Function
    pulsarctl functions update
	--function-config-file <the path of function config yaml file>
	--jar <the path of user code jar>

    #Update log topic of Pulsar Function
    pulsarctl functions update
	--log-topic persistent://public/default/test-log-topic
	# Other function parameters

    #Update dead letter topic of Pulsar Function
    pulsarctl functions update
	--dead-letter-topic persistent://public/default/test-dead-letter-topic
	--max-message-retries 10
	# Other function parameters

    #Update user config of Pulsar Function
    pulsarctl functions update
	--user-config "{"publishTopic":"publishTopic", "key":"pulsar"}"
	# Other function parameters

    #Update custom schema of inputs topic for Pulsar Function
    pulsarctl functions update
	--custom-schema-inputs "{"topic-1":"schema.STRING", "topic-2":"schema.JSON"}"
	# Other function parameters

    #Update schema type of output topic for Pulsar Function
    pulsarctl functions update
	--schema-type schema.STRING
	# Other function parameters

    #Update parallelism of Pulsar Function
    pulsarctl functions update
	--parallelism 1
	# Other function parameters

    #Update resource of Pulsar Function
    pulsarctl functions update
	--ram 5656565656
	--disk 8080808080808080
	--cpu 5.0
	# Other function parameters

    #Update window functions config of Pulsar Function
    pulsarctl functions update
	--window-length-count 10
	--window-length-duration-ms 1000
	--sliding-interval-count 3
	--sliding-interval-duration-ms 1000
	# Other function parameters

OUTPUT:
    #normal output
    Updated successfully

    #Update contains no change
    [✖]  code: 400 reason: Update contains no change

    #The name of Pulsar Functions doesn't exist, please check the --name args
    [✖]  code: 404 reason: Function <your function name> doesn't exist

Usage: pulsarctl functions update [flags]

Aliases: update, update

Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
@wolfstudy wolfstudy self-assigned this Sep 4, 2019
@wolfstudy
Copy link
Contributor Author

@sijie @zymap PTAL

pkg/ctl/functions/update.go Outdated Show resolved Hide resolved
}
examples = append(examples, update)

updateWithConf := pulsar.Example{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update a Pulsar Function using a function config yaml file

pkg/ctl/functions/update.go Show resolved Hide resolved
examples = append(examples, updateWithLogTopic)

updateWithDeadLetterTopic := pulsar.Example{
Desc: "Update dead letter topic of Pulsar Function",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the dead letter topic of a Pulsar Function

}
examples = append(examples, updateWithDeadLetterTopic)

updateWithUserConfig := pulsar.Example{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the user configs of a Pulsar Function

Please change Pulsar Function to a Pulsar Function in other places.

examples = append(examples, updateWithCustomSchemasInputs)

updateWithSchema := pulsar.Example{
Desc: "Update schema type of output topic for Pulsar Function",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is for input topic, not for output topic, no?

If it is for input topic, change it to Change the schema type of the input topic for a Pulsar Function.

}
examples = append(examples, updateWithSchema)

updateWithParallelism := pulsar.Example{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the parallelism of a Pulsar Function

examples = append(examples, updateWithParallelism)

updateWithResource := pulsar.Example{
Desc: "Update resource of Pulsar Function",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the resource usage for a Pulsar Function

examples = append(examples, updateWithResource)

updateWithWindowFunctions := pulsar.Example{
Desc: "Update window functions config of Pulsar Function",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the window configurations for a Pulsar Function

var out []pulsar.Output
successOut := pulsar.Output{
Desc: "normal output",
Out: "Updated successfully",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we have the function name in the output?

Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
@wolfstudy
Copy link
Contributor Author

@sijie PTAL again

@sijie sijie added area/pulsar/functions type/task Indicates a chore or a small item of work labels Sep 5, 2019
@sijie sijie added this to the 0.0.1 milestone Sep 5, 2019
@sijie sijie merged commit 18e5897 into master Sep 5, 2019
@sijie sijie deleted the xiaolong/update-pulsar-functions branch September 5, 2019 06:11
tisonkun pushed a commit to tisonkun/pulsar-client-go that referenced this pull request Aug 15, 2023
Add update cmd for Pulsar Functions, output as follows:

```
USED FOR:
    Update a Pulsar Function that has been deployed to a Pulsar cluster.

REQUIRED PERMISSION:
    This command requires super-user permissions.

EXAMPLES:
    #Update output topic of Pulsar Function
    pulsarctl functions update
	--tenant public
	--namespace default
	--name update-function
	--output test-output-topic

    #Update function config yaml file of Pulsar Function
    pulsarctl functions update
	--function-config-file <the path of function config yaml file>
	--jar <the path of user code jar>

    #Update log topic of Pulsar Function
    pulsarctl functions update
	--log-topic persistent://public/default/test-log-topic
	# Other function parameters

    #Update dead letter topic of Pulsar Function
    pulsarctl functions update
	--dead-letter-topic persistent://public/default/test-dead-letter-topic
	--max-message-retries 10
	# Other function parameters

    #Update user config of Pulsar Function
    pulsarctl functions update
	--user-config "{"publishTopic":"publishTopic", "key":"pulsar"}"
	# Other function parameters

    #Update custom schema of inputs topic for Pulsar Function
    pulsarctl functions update
	--custom-schema-inputs "{"topic-1":"schema.STRING", "topic-2":"schema.JSON"}"
	# Other function parameters

    #Update schema type of output topic for Pulsar Function
    pulsarctl functions update
	--schema-type schema.STRING
	# Other function parameters

    #Update parallelism of Pulsar Function
    pulsarctl functions update
	--parallelism 1
	# Other function parameters

    #Update resource of Pulsar Function
    pulsarctl functions update
	--ram 5656565656
	--disk 8080808080808080
	--cpu 5.0
	# Other function parameters

    #Update window functions config of Pulsar Function
    pulsarctl functions update
	--window-length-count 10
	--window-length-duration-ms 1000
	--sliding-interval-count 3
	--sliding-interval-duration-ms 1000
	# Other function parameters

OUTPUT:
    #normal output
    Updated successfully

    #Update contains no change
    [✖]  code: 400 reason: Update contains no change

    #The name of Pulsar Functions doesn't exist, please check the --name args
    [✖]  code: 404 reason: Function <your function name> doesn't exist

Usage: pulsarctl functions update [flags]

Aliases: update, update
```
tisonkun pushed a commit to apache/pulsar-client-go that referenced this pull request Aug 16, 2023
Add update cmd for Pulsar Functions, output as follows:

```
USED FOR:
    Update a Pulsar Function that has been deployed to a Pulsar cluster.

REQUIRED PERMISSION:
    This command requires super-user permissions.

EXAMPLES:
    #Update output topic of Pulsar Function
    pulsarctl functions update
	--tenant public
	--namespace default
	--name update-function
	--output test-output-topic

    #Update function config yaml file of Pulsar Function
    pulsarctl functions update
	--function-config-file <the path of function config yaml file>
	--jar <the path of user code jar>

    #Update log topic of Pulsar Function
    pulsarctl functions update
	--log-topic persistent://public/default/test-log-topic
	# Other function parameters

    #Update dead letter topic of Pulsar Function
    pulsarctl functions update
	--dead-letter-topic persistent://public/default/test-dead-letter-topic
	--max-message-retries 10
	# Other function parameters

    #Update user config of Pulsar Function
    pulsarctl functions update
	--user-config "{"publishTopic":"publishTopic", "key":"pulsar"}"
	# Other function parameters

    #Update custom schema of inputs topic for Pulsar Function
    pulsarctl functions update
	--custom-schema-inputs "{"topic-1":"schema.STRING", "topic-2":"schema.JSON"}"
	# Other function parameters

    #Update schema type of output topic for Pulsar Function
    pulsarctl functions update
	--schema-type schema.STRING
	# Other function parameters

    #Update parallelism of Pulsar Function
    pulsarctl functions update
	--parallelism 1
	# Other function parameters

    #Update resource of Pulsar Function
    pulsarctl functions update
	--ram 5656565656
	--disk 8080808080808080
	--cpu 5.0
	# Other function parameters

    #Update window functions config of Pulsar Function
    pulsarctl functions update
	--window-length-count 10
	--window-length-duration-ms 1000
	--sliding-interval-count 3
	--sliding-interval-duration-ms 1000
	# Other function parameters

OUTPUT:
    #normal output
    Updated successfully

    #Update contains no change
    [✖]  code: 400 reason: Update contains no change

    #The name of Pulsar Functions doesn't exist, please check the --name args
    [✖]  code: 404 reason: Function <your function name> doesn't exist

Usage: pulsarctl functions update [flags]

Aliases: update, update
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pulsar/functions type/task Indicates a chore or a small item of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants