All Downloads are FREE. Search and download functionalities are using the official Maven repository.

services.TemplateService Maven / Gradle / Ivy

There is a newer version: 4.6.0
Show newest version
/*
Copyright (c) 2015, 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package services;

import mixins.Follow;

import org.ovirt.api.metamodel.annotations.In;
import org.ovirt.api.metamodel.annotations.InputDetail;
import org.ovirt.api.metamodel.annotations.Out;
import org.ovirt.api.metamodel.annotations.Service;

import annotations.Area;
import types.Host;
import types.StorageDomain;
import types.Template;

import static org.ovirt.api.metamodel.language.ApiLanguage.COLLECTION;
import static org.ovirt.api.metamodel.language.ApiLanguage.mandatory;
import static org.ovirt.api.metamodel.language.ApiLanguage.optional;
import static org.ovirt.api.metamodel.language.ApiLanguage.or;

/**
 * Manages the virtual machine template and template versions.
 *
 * @author Tomas Jelinek 
 * @author Tahlia Richardson 
 * @date 03 Mar 2018
 * @status updated_by_docs
 */
@Service
@Area("Virtualization")
public interface TemplateService {
    /**
     * Exports a template to the data center export domain.
     *
     * For example, send the following request:
     *
     * [source]
     * ----
     * POST /ovirt-engine/api/templates/123/export
     * ----
     *
     * With a request body like this:
     *
     * [source,xml]
     * ----
     * 
     *   
     *   true
     * 
     * ----
     *
     * @author Liron Aravot 
     * @author Tahlia Richardson 
     * @date 03 Mar 2018
     * @status updated_by_docs
     */
    interface Export {
        /**
         * Indicates if the existing templates with the same name should be overwritten.
         *
         * The export action reports a failed action if a template of the same name exists in the destination domain.
         * Set this parameter to `true` to change this behavior and overwrite any existing template.
         *
         * @author Liron Aravot 
         * @author Tahlia Richardson 
         * @date 03 Mar 2018
         * @status updated_by_docs
         */
        @In Boolean exclusive();

        /**
         * Specifies the destination export storage domain.
         *
         * @author Liron Aravot 
         * @author Tahlia Richardson 
         * @date 03 Mar 2018
         * @status updated_by_docs
         */
        @In StorageDomain storageDomain();

        /**
         * Exports a template to an export domain.
         *
         * @author Arik Hadas 
         * @author Tahlia Richardson 
         * @date 03 Mar 2018
         * @status updated_by_docs
         */
        interface ToExportDomain extends Export {
            @InputDetail
            default void inputDetail() {
                or(mandatory(storageDomain().id()), mandatory(storageDomain().name()));
                optional(exclusive());
            }
        }

        /**
         * Exports a template as an OVA file to a given path on a specified host.
         *
         * @author Arik Hadas 
         * @author Tahlia Richardson 
         * @date 03 Mar 2018
         * @status updated_by_docs
         * @since 4.2.3
         */
        interface ToPathOnHost extends Export {
            /**
             * The host to generate the OVA file on.
             *
             * @author Arik Hadas 
             * @author Tahlia Richardson 
             * @date 03 Mar 2018
             * @status updated_by_docs
             * @since 4.2.3
             */
            @In Host host();

            /**
             * An absolute path of a directory on the host to generate the OVA file in.
             *
             * @author Arik Hadas 
             * @author Tahlia Richardson 
             * @date 03 Mar 2018
             * @status updated_by_docs
             * @since 4.2.3
             */
            @In String directory();

            /**
             * The name of the OVA file.
             *
             * This is an optional parameter. If it is not specified, the name of the OVA file is determined according
             * to the name of the template. It will conform to the following pattern: "