-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 44bf895
Showing
186 changed files
with
10,818 additions
and
0 deletions.
There are no files selected for viewing
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,40 @@ | ||
### Git Ignore ### | ||
.metadata | ||
.recommenders | ||
target/ | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.settings/ | ||
.loadpath | ||
.project | ||
.classpath | ||
*.launch | ||
.target | ||
*.orig | ||
|
||
### IntelliJ ### | ||
.idea/ | ||
.idea/misc.xml | ||
|
||
### Gradle ### | ||
.gradle | ||
build/ | ||
gradle-app.setting | ||
|
||
### TestNG ### | ||
test-output/ | ||
|
||
### Others ### | ||
ms-*.txt | ||
behavior*.txt | ||
*.log | ||
|
||
### IDEA IDE Files ### | ||
*.iml | ||
|
||
|
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,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.equinix.ecp.assets</groupId> | ||
<artifactId>ecp-sample</artifactId> | ||
<version>1.0-RELEASE</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>7</source> | ||
<target>7</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<name>ecp-sample</name> | ||
<description>sample code to demonstrate how to use the ecp APIs</description> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<version>1.5.8.RELEASE</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.16.18</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>2.9.8</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.5.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.8</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
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,17 @@ | ||
package com.equinix.ecp; | ||
|
||
public class APIException extends Exception{ | ||
|
||
private int code = 0; | ||
private String message = null; | ||
|
||
public APIException() { } | ||
|
||
public APIException(int code, String message) { | ||
this.code = code; | ||
this.message = message; | ||
} | ||
} | ||
|
||
|
||
|
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,40 @@ | ||
package com.equinix.ecp; | ||
|
||
import com.equinix.ecp.config.ApiConfig; | ||
import com.equinix.ecp.model.authentication.AuthenTokenResponse; | ||
import com.equinix.ecp.model.authentication.AuthenTokenRequest; | ||
import org.springframework.http.*; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
public class APIHandler { | ||
|
||
private ApiConfig apiConfigDoNotUpload = new ApiConfig(); | ||
|
||
private RestTemplate restTemplate = new RestTemplate(); | ||
|
||
public APIHandler() { | ||
} | ||
|
||
public AuthenTokenResponse getAuthenTokenResponse(HttpHeaders headers, AuthenTokenRequest request) throws APIException { | ||
|
||
String url = ApiConfig.URI + "/oauth2/v1/token"; | ||
final HttpEntity<AuthenTokenRequest> entity = new HttpEntity<>(request, headers); | ||
headers.setContentType(MediaType.APPLICATION_JSON); | ||
Object[] args = new String[]{}; | ||
try { | ||
ResponseEntity<AuthenTokenResponse> Response = restTemplate.exchange(url, HttpMethod.POST, entity, | ||
AuthenTokenResponse.class, args); | ||
return Response.getBody(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
throw new APIException(1000, e.getMessage()); | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
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 @@ | ||
package com.equinix.ecp; | ||
|
||
import com.equinix.ecp.config.ApiConfig; | ||
import com.equinix.ecp.model.authentication.AuthenTokenRequest; | ||
import com.equinix.ecp.model.authentication.AuthenTokenResponse; | ||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import org.springframework.http.HttpHeaders; | ||
|
||
public class Util { | ||
|
||
public static ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
public static ObjectMapper getObjectMapper() { | ||
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); | ||
objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); | ||
objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT); | ||
|
||
return objectMapper; | ||
} | ||
|
||
public static AuthenTokenResponse createToken() throws APIException { | ||
|
||
AuthenTokenResponse authenTokenResponse = null; | ||
|
||
AuthenTokenRequest authenTokenRequest = new AuthenTokenRequest(); | ||
|
||
authenTokenRequest.setClient_id(ApiConfig.CLIENT_ID); | ||
|
||
authenTokenRequest.setClient_secret(ApiConfig.CLIENT_SECRET); | ||
|
||
authenTokenRequest.setGrant_type(ApiConfig.GRANT_TYPE); | ||
|
||
authenTokenRequest.setUser_name(ApiConfig.USER_NAME); | ||
|
||
authenTokenRequest.setUser_password(ApiConfig.USER_PASSWORD); | ||
|
||
try { | ||
APIHandler handler = new APIHandler(); | ||
HttpHeaders headers = new HttpHeaders(); | ||
headers.add("Content-Type", "application/json"); | ||
authenTokenResponse = handler.getAuthenTokenResponse(headers, authenTokenRequest); | ||
} catch (Exception ex) { | ||
throw new APIException(2000, ex.getMessage()); | ||
} | ||
return authenTokenResponse; | ||
} | ||
} | ||
|
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,19 @@ | ||
package com.equinix.ecp.config; | ||
|
||
public class ApiConfig { | ||
|
||
public static final String USER_NAME="<<username>>"; | ||
|
||
public static final String USER_PASSWORD="<<user_password>>"; | ||
|
||
public static final String CLIENT_ID="<<client_id>>"; | ||
|
||
public static final String CLIENT_SECRET = "<<client_secret>>"; | ||
|
||
public static final String GRANT_TYPE = "password"; | ||
|
||
public static final String BEARER="Bearer "; | ||
|
||
public static final String URI="https://api.equinix.com"; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/equinix/ecp/config/AttachmentVariables.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,7 @@ | ||
package com.equinix.ecp.config; | ||
|
||
public class AttachmentVariables { | ||
|
||
public static final String ATTACHMENT_PATH=""; | ||
|
||
} |
136 changes: 136 additions & 0 deletions
136
src/main/java/com/equinix/ecp/config/crossConnect/CrossConnectCommon.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,136 @@ | ||
package com.equinix.ecp.config.crossConnect; | ||
|
||
interface CrossConnectCommon { | ||
|
||
int QUANTITY_REQUESTED = 1; | ||
|
||
boolean CUSTOMER_FOLLOW_UP_REQUIRED = false; | ||
|
||
String CUSTOMER_REFERENCE_NUMBER = "<<refNo>>"; | ||
|
||
String NUMBER = "<<number>>"; | ||
|
||
String PURCHASE_ORDER_TYPE = "<<purchaseordertype>>"; | ||
|
||
// ************************************************************************* | ||
|
||
String ORDERING_USERNAME = "<<username>>"; | ||
|
||
String ORDERING_NAME = "<<firstName_lastName>>"; | ||
|
||
String ORDERING_EMAIL = "<<email_address>>"; | ||
|
||
String ORDERING_WORK_PHONE = "<<workphone_number>>"; | ||
|
||
String ORDERING_WORK_PHONE_COUNTRY_CODE = "<<workphone_country_code>>"; | ||
|
||
String ORDERING_MOBILE_PHONE = "<<mobile_number>>"; | ||
|
||
String ORDERING_MOBILE_PHONE_COUNTRY_CODE = "<<mobilephone_country_code>>"; | ||
|
||
// ************************************************************************* | ||
|
||
String TECHNICAL_USERNAME = "<<username>>"; | ||
|
||
String TECHNICAL_NAME = "<<firstName_lastName>>"; | ||
|
||
String TECHNICAL_EMAIL = "<<email_address>>"; | ||
|
||
String TECHNICAL_WORK_PHONE = "<<workphone_number>>"; | ||
|
||
String TECHNICAL_WORK_PHONE_COUNTRY_CODE = "<<workphone_country_code>>"; | ||
|
||
String TECHNICAL_WORK_PHONE_PREF_TO_CALL = "<<work_pref_to_call>>"; | ||
|
||
String TECHNICAL_MOBILE_PHONE_COUNTRY_CODE = "<<mobile_phone_country_code>>"; | ||
|
||
String TECHNICAL_MOBILE_PHONE = "<<mobile_number>>"; | ||
|
||
String TECHNICAL_MOBILE_PHONE_PREF_TO_CALL = "<<work_pref_to_call>>"; | ||
|
||
// ************************************************************************** | ||
|
||
String NOTIFICATION_USERNAME = "<<username>>"; | ||
|
||
String NOTIFICATION_NAME = "<<firstName_lastName>>"; | ||
|
||
String NOTIFICATION_EMAIL = "<<email_address>>"; | ||
|
||
// ************************************************************************* | ||
|
||
String IBX_TIMEZONE = "<<ibxtimezone>>"; | ||
|
||
String SCHEDULE_TYPE = "<<scheduletype>>"; | ||
|
||
String REQUESTED_START_DATE = "<<requestedStartDate>>"; | ||
|
||
String REQUESTED_COMPLETION_DATE = "<<requestedCompletionDate>>"; | ||
|
||
// ************************************************************************* | ||
|
||
String ASIDE_IBX = "<<aside_ibx>>"; | ||
|
||
String ASIDE_CAGE = "<<aside_cage>>"; | ||
|
||
String ASIDE_ACCOUNTNUMBER = "<<aside_accountnumber>>"; | ||
|
||
String ASIDE_CABINETS = "<<aside_cabinets>>"; | ||
|
||
String ASIDE_CONNECTIONSERVICE = "<<aside_connectionservice>>"; | ||
|
||
String ASIDE_MEDIATYPE = "<<aside_mediatype>>"; | ||
|
||
boolean ASIDE_PROCEEDIFMEDIACOVERTERISREQUIRED = false; | ||
|
||
String ASIDE_PROTOCOLTYPE = "<<aside_protocoltype>>"; | ||
|
||
String ASIDE_CONNECTORTYPE = "<<aside_connectortype>>"; | ||
|
||
String ASIDE_PATCHPANEL_NAME = "<<aside_patchpanel_name>>"; | ||
|
||
String ASIDE_PORTA = "<<aside_porta>>"; | ||
|
||
String ASIDE_PORTB = "<<aside_portb>>"; | ||
|
||
String ZSIDE_CUSTOMER = "<<zside_customer>>"; | ||
|
||
String ZSIDE_CUSTOMERACCOUNT = "<<zside_customeraccount>>"; | ||
|
||
String ZSIDE_IBX = "<<zside_ibx>>"; | ||
|
||
String ZSIDE_CAGE = "<<zside_cage>>"; | ||
|
||
String ZSIDE_CABINET = "<<zside_cabinet>>"; | ||
|
||
String ZSIDE_ACCOUNT_NUMBER = "<<zside_account_number>>"; | ||
|
||
String ZSIDE_CONNECTIONSERVICE = "<<zside_connectionservice>>"; | ||
|
||
String ZSIDE_CONNECTORTYPE = "<<zside_connectortype>>"; | ||
|
||
String ZSIDE_PATCHPANEL_NAME = "<<zside_patchpanel_name>>"; | ||
|
||
String ZSIDE_PORTA = "<<zside_porta>>"; | ||
|
||
String ZSIDE_PORTB = "<<zside_portb>>"; | ||
|
||
String ZSIDE_CIRCUITID = "<<zside_circuitid>>"; | ||
|
||
String ZSIDE_CONTACT_EMAIL = null; | ||
|
||
boolean PATCH_EQUIPMENT = false; | ||
|
||
String CABINET = "<<cabinet>>"; | ||
|
||
String CONNECTOR_TYPE = "<<connectortype>>"; | ||
|
||
String DETAILS = "<<details>>"; | ||
|
||
String PORT = "<<port>>"; | ||
|
||
Boolean LIGHT_LINK_VERIFICATION_REQUIRED=false; | ||
|
||
Boolean NOTIFY_Z_SIDE_UPON_COMPLETION=false; | ||
|
||
} | ||
|
Oops, something went wrong.