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.support.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 035 @Metadata(label = "security") 036 private String userName; 037 @XmlAttribute 038 @Metadata(label = "security") 039 private String password; 040 @XmlAttribute 041 private Long timeout; 042 @XmlAttribute 043 @Metadata(defaultValue = "/services/") 044 private String servicePath = "/services/"; 045 @XmlTransient 046 private SSLContextParameters sslContextParameters; 047 @XmlAttribute 048 @Metadata(defaultValue = "on-demand", enums = "on-demand,watch") 049 private String type = "on-demand"; 050 051 public EtcdServiceCallServiceDiscoveryConfiguration() { 052 this(null); 053 } 054 055 public EtcdServiceCallServiceDiscoveryConfiguration(ServiceCallDefinition parent) { 056 super(parent, "etcd-service-discovery"); 057 } 058 059 // ************************************************************************* 060 // Properties 061 // ************************************************************************* 062 063 public String getUris() { 064 return uris; 065 } 066 067 /** 068 * The URIs the client can connect to. 069 */ 070 public void setUris(String uris) { 071 this.uris = uris; 072 } 073 074 public String getUserName() { 075 return userName; 076 } 077 078 /** 079 * The user name to use for basic authentication. 080 */ 081 public void setUserName(String userName) { 082 this.userName = userName; 083 } 084 085 public String getPassword() { 086 return password; 087 } 088 089 /** 090 * The password to use for basic authentication. 091 */ 092 public void setPassword(String password) { 093 this.password = password; 094 } 095 096 public Long getTimeout() { 097 return timeout; 098 } 099 100 /** 101 * To set the maximum time an action could take to complete. 102 */ 103 public void setTimeout(Long timeout) { 104 this.timeout = timeout; 105 } 106 107 public String getServicePath() { 108 return servicePath; 109 } 110 111 /** 112 * The path to look for for service discovery 113 */ 114 public void setServicePath(String servicePath) { 115 this.servicePath = servicePath; 116 } 117 118 public SSLContextParameters getSslContextParameters() { 119 return sslContextParameters; 120 } 121 122 /** 123 * To configure security using SSLContextParameters. 124 */ 125 public void setSslContextParameters(SSLContextParameters sslContextParameters) { 126 this.sslContextParameters = sslContextParameters; 127 } 128 129 public String getType() { 130 return type; 131 } 132 133 /** 134 * To set the discovery type, valid values are on-demand and watch. 135 */ 136 public void setType(String type) { 137 this.type = type; 138 } 139 140 // ************************************************************************* 141 // Fluent API 142 // ************************************************************************* 143 144 /** 145 * The URIs the client can connect to. 146 */ 147 public EtcdServiceCallServiceDiscoveryConfiguration uris(String uris) { 148 setUris(uris); 149 return this; 150 } 151 152 /** 153 * The user name to use for basic authentication. 154 */ 155 public EtcdServiceCallServiceDiscoveryConfiguration userName(String userName) { 156 setUserName(userName); 157 return this; 158 } 159 160 /** 161 * The password to use for basic authentication. 162 */ 163 public EtcdServiceCallServiceDiscoveryConfiguration password(String password) { 164 setPassword(password); 165 return this; 166 } 167 168 /** 169 * To set the maximum time an action could take to complete. 170 */ 171 public EtcdServiceCallServiceDiscoveryConfiguration timeout(Long timeout) { 172 setTimeout(timeout); 173 return this; 174 } 175 176 /** 177 * The path to look for for service discovery 178 */ 179 public EtcdServiceCallServiceDiscoveryConfiguration servicePath(String servicePath) { 180 setServicePath(servicePath); 181 return this; 182 } 183 184 /** 185 * To configure security using SSLContextParameters. 186 */ 187 public EtcdServiceCallServiceDiscoveryConfiguration sslContextParameters(SSLContextParameters sslContextParameters) { 188 setSslContextParameters(sslContextParameters); 189 return this; 190 } 191 192 /** 193 * To set the discovery type, valid values are on-demand and watch. 194 */ 195 public EtcdServiceCallServiceDiscoveryConfiguration type(String type) { 196 setType(type); 197 return this; 198 } 199}