I do not see any problems in implementing this. Refer following:

https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java#L2597

DomainMapping domainMapping =
ObjectConverter.convertDomainMappingBeanToStubDomainMapping(
                            domainMappingBean);
                    domainMapping.setApplicationId(applicationId);
                    domainMapping.setTenantId(tenantId);

domainMapping.setServiceName(clusterDataHolder.getServiceType());

domainMapping.setClusterId(clusterDataHolder.getClusterId());
                    serviceClient.addDomainMapping(domainMapping);

On Sun, Aug 9, 2015 at 8:53 PM, Swapnil Patil <swapnil.r...@gmail.com>
wrote:

> Hi All,
>
> I need to add a REST method to add domain mappings using cluster id.
> Currently the request needs a JSON object with cartridge alias, domain name
> and context path.
>
> But I need to add a REST method which support adding domain mapping using
> cluster id instead of alias.
>
> Currently alias is used to find out cluster data and in turn service type
> and cluster id out of that cluster data.
>
> But the cluster data cannot be found using cluster id. Hence we cannot
> find the service type.
>
> So I need to follow either of the following ways.
>
> 1. Get cluster data from cluster id. I do not have any idea how to do
> this. Could someone please let me know if this is possible.
> 2. Add both service type and cluster id in the request JSON for adding
> domain mappings.
>
> I hope it is OK if we add a field or more in DomainMappingBean class but
> those be optional in JSON request. So we can add domain mapping using
> either alias or a combination of cluster id and service type. Could someone
> please let me know if this is possible.
>
> Code references
>
> 1. StratosApiV41Utils.java - In addApplicationDomainMappings, service type
> needs to be set to
> org.apache.stratos.manager.service.stub.domain.application.signup.DomainMapping
> object. Which we can get by ClusterDataHolder object.
> 2. ParentComponent.java - ClusterDataHolder is extracted from
> org.apache.stratos.messaging.domain.application.Application object. Which
> extends ParentComponent which has getClusterData(alias) method. This uses
> aliasToClusterDataMap. There is no clusterIdToClusterDataMap.
>
> Thanks and Regards,
> Swapnil
>
> On Mon, Jul 27, 2015 at 3:37 AM, Swapnil Patil <swapnil.r...@gmail.com>
> wrote:
>
>> Oh Okay. Sorry I missed this suggestion during the meeting. I will look
>> into this.
>>
>> Thanks and Regards,
>> Swapnil
>>
>> On Mon, Jul 27, 2015 at 2:59 AM, Imesh Gunaratne <im...@apache.org>
>> wrote:
>>
>>> As we discussed in the last meeting, may be you could add a new API
>>> method to use the cluster id instead of the alias.
>>>
>>> On Sun, Jul 26, 2015 at 10:51 PM, Swapnil Patil <swapnil.r...@gmail.com>
>>> wrote:
>>>
>>>> Thanks Ashan!
>>>>
>>>> But unfortunately I don't have access to application id. So this method
>>>> will not be useful for me.
>>>>
>>>> Thanks and Regards,
>>>> Swapnil
>>>>
>>>> On Sun, Jul 26, 2015 at 10:40 AM, Ashan Dhananjaya <
>>>> dhananjay...@gmail.com> wrote:
>>>>
>>>>> Hi Swapnil,
>>>>>
>>>>> You can get the cluster details using this api call.
>>>>>
>>>>> curl -k -u admin:admin https://localhost:9443/api/v4.1/applications/{
>>>>> applicationId}/runtime/
>>>>> curl -k -u admin:admin
>>>>> https://localhost:9443/api/v4.1/applications/tomcat-single-signon/runtime/
>>>>>
>>>>> I hope this may help.
>>>>>
>>>>> Thank You!
>>>>> Best Regards,
>>>>> Ashan
>>>>>
>>>>> On Sun, Jul 26, 2015 at 3:45 PM, Swapnil Patil <swapnil.r...@gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I want to add domain mappings to a cluster as a part of AWS load
>>>>>> balancer extension functionality.
>>>>>>
>>>>>> For that I went through [1]. But I have a couple of doubts.
>>>>>>
>>>>>> 1. In the request, I need to specify cartridge alias. But I am not
>>>>>> able to find a way to get the alias of a cluster using Service or Cluster
>>>>>> objects of org.apache.stratos.load.balancer.common.domain. Is there any 
>>>>>> way
>>>>>> to find out alias of a cluster?
>>>>>> 2. What does a context path mean?
>>>>>>
>>>>>> [1]
>>>>>> https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+Adding+Domain+Mappings+via+REST+API
>>>>>>
>>>>>>
>>>>>> Thanks and Regards,
>>>>>> Swapnil
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Senior Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Reply via email to