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 *  <p>For GoogleCloudFunction destinations, you need to grant permissions to the <code>[email protected]</code> service account to invoke your function. If your function's version is 1st gen, grant the service account the IAM role <code>Cloud Functions Invoker</code>. For version 2nd gen, assign the IAM role <code>Cloud Run Invoker</code> using the Cloud Run console.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     GoogleCloudFunctionDestination googleCloudFunctionDestination = GoogleCloudFunctionDestination.builder()
024 *             .url("{url}")
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = GoogleCloudFunctionDestinationImpl.class)
031public interface GoogleCloudFunctionDestination extends ExtensionDestination {
032
033    /**
034     * discriminator value for GoogleCloudFunctionDestination
035     */
036    String GOOGLE_CLOUD_FUNCTION = "GoogleCloudFunction";
037
038    /**
039     *  <p>URL to the target function.</p>
040     * @return url
041     */
042    @NotNull
043    @JsonProperty("url")
044    public String getUrl();
045
046    /**
047     *  <p>URL to the target function.</p>
048     * @param url value to be set
049     */
050
051    public void setUrl(final String url);
052
053    /**
054     * factory method
055     * @return instance of GoogleCloudFunctionDestination
056     */
057    public static GoogleCloudFunctionDestination of() {
058        return new GoogleCloudFunctionDestinationImpl();
059    }
060
061    /**
062     * factory method to create a shallow copy GoogleCloudFunctionDestination
063     * @param template instance to be copied
064     * @return copy instance
065     */
066    public static GoogleCloudFunctionDestination of(final GoogleCloudFunctionDestination template) {
067        GoogleCloudFunctionDestinationImpl instance = new GoogleCloudFunctionDestinationImpl();
068        instance.setUrl(template.getUrl());
069        return instance;
070    }
071
072    /**
073     * factory method to create a deep copy of GoogleCloudFunctionDestination
074     * @param template instance to be copied
075     * @return copy instance
076     */
077    @Nullable
078    public static GoogleCloudFunctionDestination deepCopy(@Nullable final GoogleCloudFunctionDestination template) {
079        if (template == null) {
080            return null;
081        }
082        GoogleCloudFunctionDestinationImpl instance = new GoogleCloudFunctionDestinationImpl();
083        instance.setUrl(template.getUrl());
084        return instance;
085    }
086
087    /**
088     * builder factory method for GoogleCloudFunctionDestination
089     * @return builder
090     */
091    public static GoogleCloudFunctionDestinationBuilder builder() {
092        return GoogleCloudFunctionDestinationBuilder.of();
093    }
094
095    /**
096     * create builder for GoogleCloudFunctionDestination instance
097     * @param template instance with prefilled values for the builder
098     * @return builder
099     */
100    public static GoogleCloudFunctionDestinationBuilder builder(final GoogleCloudFunctionDestination template) {
101        return GoogleCloudFunctionDestinationBuilder.of(template);
102    }
103
104    /**
105     * accessor map function
106     * @param <T> mapped type
107     * @param helper function to map the object
108     * @return mapped value
109     */
110    default <T> T withGoogleCloudFunctionDestination(Function<GoogleCloudFunctionDestination, T> helper) {
111        return helper.apply(this);
112    }
113
114    /**
115     * gives a TypeReference for usage with Jackson DataBind
116     * @return TypeReference
117     */
118    public static com.fasterxml.jackson.core.type.TypeReference<GoogleCloudFunctionDestination> typeReference() {
119        return new com.fasterxml.jackson.core.type.TypeReference<GoogleCloudFunctionDestination>() {
120            @Override
121            public String toString() {
122                return "TypeReference<GoogleCloudFunctionDestination>";
123            }
124        };
125    }
126}