Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ public interface MorpheusAdminService {
* @return an instance of the implementation of the {@link MorpheusApplianceService}
*/
MorpheusApplianceService getAppliance();

/**
* Returns the Package Service for downloading and installing Morpheus package files asynchronously (reactive).
* @return an instance of the implementation of the {@link MorpheusPackageService}
*/
MorpheusPackageService getPackage();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2025 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* 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 com.morpheusdata.core.admin;

import com.morpheusdata.core.util.HttpApiClient;
import com.morpheusdata.response.ServiceResponse;
import io.reactivex.rxjava3.core.Single;

import java.io.InputStream;

/**
* Provides plugin-accessible methods to download and install Morpheus package files (.morpkg).
*
* <p>Accessible via {@code morpheusContext.async.admin.getPackage()}.</p>
*
* <p>Typical usage:</p>
* <pre>
* morpheusContext.async.admin.getPackage().downloadAndInstall(url)
* .subscribe(response -> ...)
* </pre>
*/
public interface MorpheusPackageService {

/**
* Downloads a Morpheus package file from the given URL and installs it.
*
* @param url the URL of the package file to download and install
* @param opts optional {@link HttpApiClient.RequestOptions} for configuring the download request (e.g. auth token, headers); may be {@code null}
* @param force if {@code true}, reinstalls the package even if it is already installed
* @return a Single wrapping a {@link ServiceResponse} indicating success or failure
*/
Single<ServiceResponse> downloadAndInstall(String url, HttpApiClient.RequestOptions opts, Boolean force);

/**
* Installs a Morpheus package from an InputStream.
*
* @param stream the input stream of the package file contents
* @param filename the filename of the package (e.g. {@code "mypackage.morpkg"})
* @param force if {@code true}, reinstalls the package even if it is already installed
* @return a Single wrapping a {@link ServiceResponse} indicating success or failure
*/
Single<ServiceResponse> install(InputStream stream, String filename, Boolean force);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public interface MorpheusSynchronousAdminService {
MorpheusSynchronousUserService getUser();

MorpheusSynchronousApplianceService getAppliance();

MorpheusSynchronousPackageService getPackage();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2025 Morpheus Data, LLC.
*
* Licensed under the PLUGIN CORE SOURCE LICENSE (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://raw.githubusercontent.com/gomorpheus/morpheus-plugin-core/v1.0.x/LICENSE
*
* 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 com.morpheusdata.core.synchronous.admin;

import com.morpheusdata.core.util.HttpApiClient;
import com.morpheusdata.response.ServiceResponse;

import java.io.InputStream;

/**
* Synchronous counterpart to {@link com.morpheusdata.core.admin.MorpheusPackageService}.
* Provides plugin-accessible methods to download and install Morpheus package files (.morpkg).
*
* <p>Accessible via {@code morpheusContext.services.admin.getPackage()}.</p>
*/
public interface MorpheusSynchronousPackageService {

/**
* Downloads a Morpheus package file from the given URL and installs it.
*
* @param url the URL of the package file to download and install
* @param opts optional {@link HttpApiClient.RequestOptions} for configuring the download request (e.g. auth token, headers); may be {@code null}
* @param force if {@code true}, reinstalls the package even if it is already installed
* @return a {@link ServiceResponse} indicating success or failure
*/
ServiceResponse downloadAndInstall(String url, HttpApiClient.RequestOptions opts, Boolean force);

/**
* Installs a Morpheus package from an InputStream.
*
* @param stream the input stream of the package file contents
* @param filename the filename of the package (e.g. {@code "mypackage.morpkg"})
* @param force if {@code true}, reinstalls the package even if it is already installed
* @return a {@link ServiceResponse} indicating success or failure
*/
ServiceResponse install(InputStream stream, String filename, Boolean force);
}
Loading