001
002package com.commercetools.api.models.extension;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 * HttpDestinationAuthentication
018 *
019 * <hr>
020 * Example to create a subtype instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     HttpDestinationAuthentication httpDestinationAuthentication = HttpDestinationAuthentication.authorizationHeaderBuilder()
024 *             headerValue("{headerValue}")
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@JsonSubTypes({
030        @JsonSubTypes.Type(value = com.commercetools.api.models.extension.AuthorizationHeaderAuthenticationImpl.class, name = AuthorizationHeaderAuthentication.AUTHORIZATION_HEADER),
031        @JsonSubTypes.Type(value = com.commercetools.api.models.extension.AzureFunctionsAuthenticationImpl.class, name = AzureFunctionsAuthentication.AZURE_FUNCTIONS) })
032@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", defaultImpl = HttpDestinationAuthenticationImpl.class, visible = true)
033@JsonDeserialize(as = HttpDestinationAuthenticationImpl.class)
034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
035public interface HttpDestinationAuthentication {
036
037    /**
038     *
039     * @return type
040     */
041    @NotNull
042    @JsonProperty("type")
043    public String getType();
044
045    /**
046     * factory method to create a deep copy of HttpDestinationAuthentication
047     * @param template instance to be copied
048     * @return copy instance
049     */
050    @Nullable
051    public static HttpDestinationAuthentication deepCopy(@Nullable final HttpDestinationAuthentication template) {
052        if (template == null) {
053            return null;
054        }
055        if (template instanceof com.commercetools.api.models.extension.AuthorizationHeaderAuthentication) {
056            return com.commercetools.api.models.extension.AuthorizationHeaderAuthentication
057                    .deepCopy((com.commercetools.api.models.extension.AuthorizationHeaderAuthentication) template);
058        }
059        if (template instanceof com.commercetools.api.models.extension.AzureFunctionsAuthentication) {
060            return com.commercetools.api.models.extension.AzureFunctionsAuthentication
061                    .deepCopy((com.commercetools.api.models.extension.AzureFunctionsAuthentication) template);
062        }
063        HttpDestinationAuthenticationImpl instance = new HttpDestinationAuthenticationImpl();
064        return instance;
065    }
066
067    /**
068     * builder for authorizationHeader subtype
069     * @return builder
070     */
071    public static com.commercetools.api.models.extension.AuthorizationHeaderAuthenticationBuilder authorizationHeaderBuilder() {
072        return com.commercetools.api.models.extension.AuthorizationHeaderAuthenticationBuilder.of();
073    }
074
075    /**
076     * builder for azureFunctions subtype
077     * @return builder
078     */
079    public static com.commercetools.api.models.extension.AzureFunctionsAuthenticationBuilder azureFunctionsBuilder() {
080        return com.commercetools.api.models.extension.AzureFunctionsAuthenticationBuilder.of();
081    }
082
083    /**
084     * accessor map function
085     * @param <T> mapped type
086     * @param helper function to map the object
087     * @return mapped value
088     */
089    default <T> T withHttpDestinationAuthentication(Function<HttpDestinationAuthentication, T> helper) {
090        return helper.apply(this);
091    }
092
093    /**
094     * gives a TypeReference for usage with Jackson DataBind
095     * @return TypeReference
096     */
097    public static com.fasterxml.jackson.core.type.TypeReference<HttpDestinationAuthentication> typeReference() {
098        return new com.fasterxml.jackson.core.type.TypeReference<HttpDestinationAuthentication>() {
099            @Override
100            public String toString() {
101                return "TypeReference<HttpDestinationAuthentication>";
102            }
103        };
104    }
105}