001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.model.cloud;
018
019import javax.xml.bind.annotation.XmlAccessType;
020import javax.xml.bind.annotation.XmlAccessorType;
021import javax.xml.bind.annotation.XmlAttribute;
022import javax.xml.bind.annotation.XmlRootElement;
023import javax.xml.bind.annotation.XmlTransient;
024
025import org.apache.camel.spi.Metadata;
026import org.apache.camel.util.jsse.SSLContextParameters;
027
028@Metadata(label = "routing,cloud,service-discovery")
029@XmlRootElement(name = "etcdServiceDiscovery")
030@XmlAccessorType(XmlAccessType.FIELD)
031public class EtcdServiceCallServiceDiscoveryConfiguration extends ServiceCallServiceDiscoveryConfiguration {
032    @XmlAttribute
033    private String uris;
034    @XmlAttribute @Metadata(label = "security")
035    private String userName;
036    @XmlAttribute @Metadata(label = "security")
037    private String password;
038    @XmlAttribute
039    private Long timeout;
040    @XmlAttribute @Metadata(defaultValue = "/services/")
041    private String servicePath = "/services/";
042    @XmlTransient
043    private SSLContextParameters sslContextParameters;
044    @XmlAttribute @Metadata(defaultValue = "on-demand", enums = "on-demand,watch")
045    private String type = "on-demand";
046
047    public EtcdServiceCallServiceDiscoveryConfiguration() {
048        this(null);
049    }
050
051    public EtcdServiceCallServiceDiscoveryConfiguration(ServiceCallDefinition parent) {
052        super(parent, "etcd-service-discovery");
053    }
054
055    // *************************************************************************
056    // Properties
057    // *************************************************************************
058
059    public String getUris() {
060        return uris;
061    }
062
063    /**
064     * The URIs the client can connect to.
065     */
066    public void setUris(String uris) {
067        this.uris = uris;
068    }
069
070    public String getUserName() {
071        return userName;
072    }
073
074    /**
075     * The user name to use for basic authentication.
076     */
077    public void setUserName(String userName) {
078        this.userName = userName;
079    }
080    public String getPassword() {
081        return password;
082    }
083
084    /**
085     * The password to use for basic authentication.
086     */
087    public void setPassword(String password) {
088        this.password = password;
089    }
090
091    public Long getTimeout() {
092        return timeout;
093    }
094
095    /**
096     * To set the maximum time an action could take to complete.
097     */
098    public void setTimeout(Long timeout) {
099        this.timeout = timeout;
100    }
101
102    public String getServicePath() {
103        return servicePath;
104    }
105
106    /**
107     * The path to look for for service discovery
108     */
109    public void setServicePath(String servicePath) {
110        this.servicePath = servicePath;
111    }
112
113    public SSLContextParameters getSslContextParameters() {
114        return sslContextParameters;
115    }
116
117    /**
118     * To configure security using SSLContextParameters.
119     */
120    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
121        this.sslContextParameters = sslContextParameters;
122    }
123
124    public String getType() {
125        return type;
126    }
127
128    /**
129     * To set the discovery type, valid values are on-demand and watch.
130     */
131    public void setType(String type) {
132        this.type = type;
133    }
134
135    // *************************************************************************
136    // Fluent API
137    // *************************************************************************
138
139    /**
140     * The URIs the client can connect to.
141     */
142    public EtcdServiceCallServiceDiscoveryConfiguration uris(String uris) {
143        setUris(uris);
144        return this;
145    }
146
147    /**
148     * The user name to use for basic authentication.
149     */
150    public EtcdServiceCallServiceDiscoveryConfiguration userName(String userName) {
151        setUserName(userName);
152        return this;
153    }
154
155    /**
156     * The password to use for basic authentication.
157     */
158    public EtcdServiceCallServiceDiscoveryConfiguration password(String password) {
159        setPassword(password);
160        return this;
161    }
162
163    /**
164     * To set the maximum time an action could take to complete.
165     */
166    public EtcdServiceCallServiceDiscoveryConfiguration timeout(Long timeout) {
167        setTimeout(timeout);
168        return this;
169    }
170
171    /**
172     * The path to look for for service discovery
173     */
174    public EtcdServiceCallServiceDiscoveryConfiguration servicePath(String servicePath) {
175        setServicePath(servicePath);
176        return this;
177    }
178
179    /**
180     * To configure security using SSLContextParameters.
181     */
182    public EtcdServiceCallServiceDiscoveryConfiguration sslContextParameters(SSLContextParameters sslContextParameters) {
183        setSslContextParameters(sslContextParameters);
184        return this;
185    }
186
187    /**
188     * To set the discovery type, valid values are on-demand and watch.
189     */
190    public EtcdServiceCallServiceDiscoveryConfiguration type(String type) {
191        setType(type);
192        return this;
193    }
194}