-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
215 additions
and
45 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
modules/api/src/main/java/org/eclipse/xpanse/api/config/ServiceHostingTypeEnumConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* SPDX-FileCopyrightText: Huawei Inc. | ||
*/ | ||
|
||
package org.eclipse.xpanse.api.config; | ||
|
||
import org.eclipse.xpanse.modules.models.servicetemplate.enums.ServiceHostingType; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Bean for serializing string in request parameters to ServiceHostingType enum. | ||
*/ | ||
@Component | ||
public class ServiceHostingTypeEnumConverter implements Converter<String, ServiceHostingType> { | ||
|
||
@Override | ||
public ServiceHostingType convert(String serviceHostingType) { | ||
return ServiceHostingType.getByValue(serviceHostingType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...main/java/org/eclipse/xpanse/modules/models/servicetemplate/enums/ServiceHostingType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* SPDX-FileCopyrightText: Huawei Inc. | ||
*/ | ||
|
||
package org.eclipse.xpanse.modules.models.servicetemplate.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.eclipse.xpanse.modules.models.common.exceptions.UnsupportedEnumValueException; | ||
|
||
/** | ||
* Defines which cloud service account is used for deploying cloud resources. | ||
*/ | ||
@Schema(description = "Defines which cloud service account is used for deploying cloud resources.") | ||
public enum ServiceHostingType { | ||
|
||
SELF("self"), | ||
SERVICE_VENDOR("service-vendor"); | ||
|
||
private final String serviceHostingType; | ||
|
||
ServiceHostingType(String serviceHostingType) { | ||
this.serviceHostingType = serviceHostingType; | ||
} | ||
|
||
/** | ||
* For ServiceHostingType serialize. | ||
*/ | ||
@JsonCreator | ||
public static ServiceHostingType getByValue(String type) { | ||
for (ServiceHostingType serviceHostingType : values()) { | ||
if (serviceHostingType.toValue().equals(StringUtils.lowerCase(type))) { | ||
return serviceHostingType; | ||
} | ||
} | ||
throw new UnsupportedEnumValueException( | ||
String.format("ServiceHostingType value %s is not supported.", type)); | ||
} | ||
|
||
/** | ||
* For ServiceHostingType deserialize. | ||
*/ | ||
@JsonValue | ||
public String toValue() { | ||
return this.serviceHostingType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.