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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# making sure ot not commit the SDK libs
libs/*

# Compiled class file
*.class

Expand Down
8 changes: 6 additions & 2 deletions application/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ Ensure that you have:
| APICP_RUNTIME_CAPACITY_VALUE | *Optional*. The approximate estimate of the throughput that a runtime can handle for the specified duration.| Default value: *500000* <br><br>If you do not specify a value for this property, the default value is considered. |
| APICP_RUNTIME_CAPACITY_UNIT | *Optional*. Choose the unit of duration in which the capacity must be defined. | Possible values are as follows:<ul><li>*PER_SECOND*</li><li>PER_MINUTE </li><li>*PER_HOUR*</li><li>*PER_DAY* </li><li>*PER_WEEK*</li><li>*PER_MONTH* </li><li>*PER_YEAR* (Default value)</li></ul><br><br>If you do not specify a value for this property, the default value is considered.|
| APICP_RUNTIME_TYPE | *Mandatory*. The runtime type. | Ensure to verify if the runtime type exists in API Control Plane. If it does not exist, use the Runtime Type Management Service REST API to add the runtime type. For details, see [How to create the runtime type?](../docs/runtime_service_mgmt_api.md) |
| APICP_LOG_LEVEL | *Optional*. The level of logs to be captured.| <ul><li>*ALL*</li><li>*ERROR*</li><li>*INFO* (Default value)</li><li>*TRACE*</li></ul><br><br>If you do not specify a value for this property, the default value is considered.|

| APICP_RUNTIME_NAME | *Optional*. api runtime name | if not specified, will be set to the actual name of the Azure api gateway |
| APICP_RUNTIME_DESCRIPTION | *Optional*. Description about the Azure API Gateway name | if not specified, no description added |
| APICP_RUNTIME_REGION | *Optional*. The region for the Azure API Gateway name | if not specified, the value will be set from the actual Azure region for the Azure API Gateway |
| APICP_RUNTIME_LOCATION | *Optional*. The location for the Azure API Gateway name | if not specified, the value will be set from the actual Azure location for the Azure API Gateway |
| APICP_RUNTIME_TAGS | *Optional*. Tags for the Azure API Gateway name | if not specified, the value will be set to the tags set in Azure API Gateway |
| APICP_LOG_LEVEL | *Optional*. The level of logs to be captured.| <ul><li>*ALL*</li><li>*ERROR*</li><li>*INFO* (Default value)</li><li>*TRACE*</li></ul><br><br>If you do not specify a value for this property, the default value is considered.|


2. Run the following command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import java.util.Set;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

Expand All @@ -19,6 +20,30 @@
@Setter
@Validated
public class RuntimeProperties {
/**
* Name for the Azure API Gateway - if not specified, the value will be set from the actual name of the Azure API Gateway
*/
private String name;

/**
* Description about the Azure API Gateway name
*/
private String description;

/**
* The region for the Azure API Gateway name - if not specified, the value will be set from the actual Azure region for the Azure API Gateway
*/
private String region;

/**
* The location for the Azure API Gateway name - if not specified, the value will be set from the actual Azure location for the Azure API Gateway
*/
private String location;

/**
* Tags for the Azure API Gateway name
*/
private Set<String> tags;

/**
* The API Management Service transaction capacity is represented as number in here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.softwareag.controlplane.agentsdk.api.config.TlsConfig;
import com.softwareag.controlplane.agentsdk.model.Capacity;
import com.softwareag.controlplane.agentsdk.model.Runtime;
import java.util.Set;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -58,26 +59,46 @@ public static ControlPlaneConfig controlPlaneConfig(AgentProperties agentPropert

public static RuntimeConfig runtimeConfig(AzureProperties azureProperties,RuntimeProperties runtimeProperties, AzureManagersHolder managerHolder){

Location location = managerHolder.getAzureResourceManager().subscriptions()
//name block
String runtimeName = ObjectUtils.isEmpty(runtimeProperties.getName()) ? azureProperties.getApiManagementServiceName() : runtimeProperties.getName();

//region block
Region azureRegion = Region.fromName(managerHolder.getApiService().regionName());
String runtimeRegion = ObjectUtils.isEmpty(runtimeProperties.getRegion()) && ObjectUtils.isNotEmpty(azureRegion) ?
azureRegion.toString() : runtimeProperties.getRegion();

//location block
Location azureLocation = managerHolder.getAzureResourceManager().subscriptions()
.getById(azureProperties.getSubscriptionId())
.getLocationByRegion(Region.fromName(managerHolder.getApiService().regionName()));
.getLocationByRegion(azureRegion);
String runtimeLocation = ObjectUtils.isEmpty(runtimeProperties.getLocation()) && ObjectUtils.isNotEmpty(azureLocation) ?
azureLocation.physicalLocation() : runtimeProperties.getLocation();

//tags block
Set<String> runtimeTags = ObjectUtils.isEmpty(runtimeProperties.getTags()) ? AzureAgentUtil.convertTags(managerHolder.getApiService().tags()) : runtimeProperties.getTags();

//capacity block
Capacity capacity = null;
if(ObjectUtils.isNotEmpty(runtimeProperties.getCapacityValue())) {
capacity = new Capacity();
capacity.setUnit(Capacity.TimeUnit.valueOf(runtimeProperties.getCapacityUnit()));
capacity.setValue(Long.parseLong(runtimeProperties.getCapacityValue()));
}

// runtime ID = subscriptionId_serviceName
String runtimeId =
azureProperties.getSubscriptionId() + Constants.UNDERSCORE + azureProperties.getApiManagementServiceName();
return new RuntimeConfig.Builder(runtimeId,
azureProperties.getApiManagementServiceName(), runtimeProperties.getType(),

String runtimeHost = String.format("https://%s.developer.azure-api.net", azureProperties.getApiManagementServiceName());

return new RuntimeConfig.Builder(runtimeId, runtimeName, runtimeProperties.getType(),
Runtime.DeploymentType.PUBLIC_CLOUD)
.region(managerHolder.getApiService().regionName())
.location(location.physicalLocation())
.tags(AzureAgentUtil.convertTags(managerHolder.getApiService().tags()))
.description(runtimeProperties.getDescription())
.region(runtimeRegion)
.location(runtimeLocation)
.tags(runtimeTags)
.capacity(capacity)
.host(runtimeHost)
.build();
}

Expand Down
10 changes: 10 additions & 0 deletions application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ apicp.runtime.capacity-value=500000
apicp.runtime.capacity-unit=PER_DAY
# Pre-requisite for creating your API Management as Runtime into Control Plane is to create Runtime type in Control Plane.
apicp.runtime.type=azure
# api runtime name (if not specified, will be set to the actual name of the Azure api gateway)
apicp.runtime.name=
# Description about the Azure API Gateway name
apicp.runtime.description=
# The region for the Azure API Gateway name - if not specified, the value will be set from the actual Azure region for the Azure API Gateway
apicp.runtime.region=
# The location for the Azure API Gateway name - if not specified, the value will be set from the actual Azure location for the Azure API Gateway
apicp.runtime.location=
# Tags for the Azure API Gateway name - if not specified, the value will be set to the tags set in Azure API Gateway
apicp.runtime.tags=
# SDK Log level as Configured such as ALL , ERROR , INFO , TRACE
apicp.log-level=ALL
##################################### API Control Plane SDK properties - End #####################################
Empty file modified gradlew
100644 → 100755
Empty file.