001/*
002 * Copyright 2012-2017 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 * @author Andy Wilkinson
026 * @since 1.3.0
027 */
028@ConfigurationProperties(prefix = "spring.sendgrid")
029public class SendGridProperties {
030
031        /**
032         * SendGrid API key.
033         */
034        private String apiKey;
035
036        /**
037         * Proxy configuration.
038         */
039        private Proxy proxy;
040
041        public String getApiKey() {
042                return this.apiKey;
043        }
044
045        public void setApiKey(String apiKey) {
046                this.apiKey = apiKey;
047        }
048
049        public Proxy getProxy() {
050                return this.proxy;
051        }
052
053        public void setProxy(Proxy proxy) {
054                this.proxy = proxy;
055        }
056
057        public boolean isProxyConfigured() {
058                return this.proxy != null && this.proxy.getHost() != null
059                                && this.proxy.getPort() != null;
060        }
061
062        public static class Proxy {
063
064                /**
065                 * SendGrid proxy host.
066                 */
067                private String host;
068
069                /**
070                 * SendGrid proxy port.
071                 */
072                private Integer port;
073
074                public String getHost() {
075                        return this.host;
076                }
077
078                public void setHost(String host) {
079                        this.host = host;
080                }
081
082                public Integer getPort() {
083                        return this.port;
084                }
085
086                public void setPort(Integer port) {
087                        this.port = port;
088                }
089
090        }
091
092}