-
Notifications
You must be signed in to change notification settings - Fork 82
/
virtual_deployment_listener.go
108 lines (90 loc) · 5.06 KB
/
virtual_deployment_listener.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Service Mesh API
//
// Use the Service Mesh API to manage mesh, virtual service, access policy and other mesh related items.
//
package servicemesh
import (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// VirtualDeploymentListener Listener configuration for a virtual deployment.
type VirtualDeploymentListener struct {
// Type of protocol used in virtual deployment.
Protocol VirtualDeploymentListenerProtocolEnum `mandatory:"true" json:"protocol"`
// Port in which virtual deployment is running.
Port *int `mandatory:"true" json:"port"`
// The maximum duration in milliseconds for the deployed service to respond to an incoming request through the listener.
// If provided, the timeout value overrides the default timeout of 15 seconds for the HTTP/HTTP2 listeners, and disabled (no timeout) for the GRPC listeners. The value 0 (zero) indicates that the timeout is disabled.
// The timeout cannot be configured for the TCP and TLS_PASSTHROUGH listeners.
// For streaming responses from the deployed service, consider either keeping the timeout disabled or set a sufficiently high value.
RequestTimeoutInMs *int64 `mandatory:"false" json:"requestTimeoutInMs"`
// The maximum duration in milliseconds for which the request's stream may be idle. The value 0 (zero) indicates that the timeout is disabled.
IdleTimeoutInMs *int64 `mandatory:"false" json:"idleTimeoutInMs"`
}
func (m VirtualDeploymentListener) String() string {
return common.PointerString(m)
}
// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m VirtualDeploymentListener) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingVirtualDeploymentListenerProtocolEnum(string(m.Protocol)); !ok && m.Protocol != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Protocol: %s. Supported values are: %s.", m.Protocol, strings.Join(GetVirtualDeploymentListenerProtocolEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// VirtualDeploymentListenerProtocolEnum Enum with underlying type: string
type VirtualDeploymentListenerProtocolEnum string
// Set of constants representing the allowable values for VirtualDeploymentListenerProtocolEnum
const (
VirtualDeploymentListenerProtocolHttp VirtualDeploymentListenerProtocolEnum = "HTTP"
VirtualDeploymentListenerProtocolTlsPassthrough VirtualDeploymentListenerProtocolEnum = "TLS_PASSTHROUGH"
VirtualDeploymentListenerProtocolTcp VirtualDeploymentListenerProtocolEnum = "TCP"
VirtualDeploymentListenerProtocolHttp2 VirtualDeploymentListenerProtocolEnum = "HTTP2"
VirtualDeploymentListenerProtocolGrpc VirtualDeploymentListenerProtocolEnum = "GRPC"
)
var mappingVirtualDeploymentListenerProtocolEnum = map[string]VirtualDeploymentListenerProtocolEnum{
"HTTP": VirtualDeploymentListenerProtocolHttp,
"TLS_PASSTHROUGH": VirtualDeploymentListenerProtocolTlsPassthrough,
"TCP": VirtualDeploymentListenerProtocolTcp,
"HTTP2": VirtualDeploymentListenerProtocolHttp2,
"GRPC": VirtualDeploymentListenerProtocolGrpc,
}
var mappingVirtualDeploymentListenerProtocolEnumLowerCase = map[string]VirtualDeploymentListenerProtocolEnum{
"http": VirtualDeploymentListenerProtocolHttp,
"tls_passthrough": VirtualDeploymentListenerProtocolTlsPassthrough,
"tcp": VirtualDeploymentListenerProtocolTcp,
"http2": VirtualDeploymentListenerProtocolHttp2,
"grpc": VirtualDeploymentListenerProtocolGrpc,
}
// GetVirtualDeploymentListenerProtocolEnumValues Enumerates the set of values for VirtualDeploymentListenerProtocolEnum
func GetVirtualDeploymentListenerProtocolEnumValues() []VirtualDeploymentListenerProtocolEnum {
values := make([]VirtualDeploymentListenerProtocolEnum, 0)
for _, v := range mappingVirtualDeploymentListenerProtocolEnum {
values = append(values, v)
}
return values
}
// GetVirtualDeploymentListenerProtocolEnumStringValues Enumerates the set of values in String for VirtualDeploymentListenerProtocolEnum
func GetVirtualDeploymentListenerProtocolEnumStringValues() []string {
return []string{
"HTTP",
"TLS_PASSTHROUGH",
"TCP",
"HTTP2",
"GRPC",
}
}
// GetMappingVirtualDeploymentListenerProtocolEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingVirtualDeploymentListenerProtocolEnum(val string) (VirtualDeploymentListenerProtocolEnum, bool) {
enum, ok := mappingVirtualDeploymentListenerProtocolEnumLowerCase[strings.ToLower(val)]
return enum, ok
}