001/* 002 * Copyright 2012-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.sendgrid; 018 019import org.springframework.boot.context.properties.ConfigurationProperties; 020 021/** 022 * {@link ConfigurationProperties} for SendGrid. 023 * 024 * @author Maciej Walkowiak 025 * @since 1.3.0 026 */ 027@ConfigurationProperties(prefix = "spring.sendgrid") 028public class SendGridProperties { 029 030 /** 031 * SendGrid username. Alternative to api key. 032 */ 033 private String username; 034 035 /** 036 * SendGrid password. 037 */ 038 private String password; 039 040 /** 041 * SendGrid api key. Alternative to username/password. 042 */ 043 private String apiKey; 044 045 /** 046 * Proxy configuration. 047 */ 048 private Proxy proxy; 049 050 public String getUsername() { 051 return this.username; 052 } 053 054 public void setUsername(String username) { 055 this.username = username; 056 } 057 058 public String getPassword() { 059 return this.password; 060 } 061 062 public void setPassword(String password) { 063 this.password = password; 064 } 065 066 public String getApiKey() { 067 return this.apiKey; 068 } 069 070 public void setApiKey(final String apiKey) { 071 this.apiKey = apiKey; 072 } 073 074 public Proxy getProxy() { 075 return this.proxy; 076 } 077 078 public void setProxy(Proxy proxy) { 079 this.proxy = proxy; 080 } 081 082 public boolean isProxyConfigured() { 083 return this.proxy != null && this.proxy.getHost() != null 084 && this.proxy.getPort() != null; 085 } 086 087 public static class Proxy { 088 089 /** 090 * SendGrid proxy host. 091 */ 092 private String host; 093 094 /** 095 * SendGrid proxy port. 096 */ 097 private Integer port; 098 099 public String getHost() { 100 return this.host; 101 } 102 103 public void setHost(String host) { 104 this.host = host; 105 } 106 107 public Integer getPort() { 108 return this.port; 109 } 110 111 public void setPort(Integer port) { 112 this.port = port; 113 } 114 115 } 116 117}