forked from rabbitmq/messaging-topology-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue_delete_options.go
More file actions
26 lines (20 loc) · 1.13 KB
/
queue_delete_options.go
File metadata and controls
26 lines (20 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
RabbitMQ Messaging Topology Kubernetes Operator
Copyright 2021 VMware, Inc.
This product is licensed to you under the Mozilla Public License 2.0 license (the "License"). You may not use this product except in compliance with the Mozilla 2.0 License.
This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.
*/
package internal
import (
rabbithole "github.com/michaelklishin/rabbit-hole/v2"
topology "github.com/rabbitmq/messaging-topology-operator/api/v1beta1"
)
// GenerateQueueDeleteOptions generates rabbithole.QueueDeleteOptions for a given Queue
// queue.Spec.Arguments (type k8s runtime.RawExtensions) is unmarshalled
func GenerateQueueDeleteOptions(q *topology.Queue) (*rabbithole.QueueDeleteOptions, error) {
return &rabbithole.QueueDeleteOptions{
// Set these values to false if q.Spec.Type = Quorum, not supported by the API
IfEmpty: q.Spec.Type != "quorum" && q.Spec.DeleteIfEmpty,
IfUnused: q.Spec.Type != "quorum" && q.Spec.DeleteIfUnused,
}, nil
}