mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-13 09:48:47 +00:00
Client API connection infrastructure
Create the infrastructure for the client to connect to API gateway in a generic manner. Tested with the ListPOST lambda.
This commit is contained in:
parent
a97caebd04
commit
2c9334ee9e
1
.gitignore
vendored
1
.gitignore
vendored
@ -87,3 +87,4 @@ lint/tmp/
|
|||||||
Lambdas/Lists/src/main/resources/dbProperties.json
|
Lambdas/Lists/src/main/resources/dbProperties.json
|
||||||
Lambdas/Lists/target/classes/dbProperties.json
|
Lambdas/Lists/target/classes/dbProperties.json
|
||||||
Lambdas/Lists/target/classes/META-INF/Lists.kotlin_module
|
Lambdas/Lists/target/classes/META-INF/Lists.kotlin_module
|
||||||
|
Listify/app/src/main/res/raw/auths.json
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class ListAdder {
|
|||||||
public void add(Map<String, Object> bodyMap) throws SQLException {
|
public void add(Map<String, Object> bodyMap) throws SQLException {
|
||||||
Connection connection = connector.getConnection();
|
Connection connection = connector.getConnection();
|
||||||
PreparedStatement statement = connection.prepareStatement(LIST_CREATE);
|
PreparedStatement statement = connection.prepareStatement(LIST_CREATE);
|
||||||
statement.setString(1, bodyMap.get("Name").toString());
|
statement.setString(1, bodyMap.get("name").toString());//Needs safe checking
|
||||||
statement.setString(2, cognitoID);
|
statement.setString(2, cognitoID);
|
||||||
System.out.println(statement);
|
System.out.println(statement);
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
import com.amazonaws.services.lambda.runtime.Context;
|
import com.amazonaws.services.lambda.runtime.Context;
|
||||||
import com.amazonaws.services.lambda.runtime.RequestHandler;
|
import com.amazonaws.services.lambda.runtime.RequestHandler;
|
||||||
|
|
||||||
public class ListsPOST implements RequestHandler<Map<String,Object>, String>{
|
public class ListPOST implements RequestHandler<Map<String,Object>, String>{
|
||||||
|
|
||||||
|
|
||||||
public String handleRequest(Map<String, Object> inputMap, Context unfilled) {
|
public String handleRequest(Map<String, Object> inputMap, Context unfilled) {
|
||||||
@ -4,6 +4,7 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
<option name="delegatedBuild" value="false" />
|
||||||
<option name="testRunner" value="PLATFORM" />
|
<option name="testRunner" value="PLATFORM" />
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@ -7,7 +7,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.listify"
|
applicationId "com.example.listify"
|
||||||
minSdkVersion 28
|
minSdkVersion 28
|
||||||
targetSdkVersion 30
|
targetSdkVersion 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ android {
|
|||||||
compileOptions {
|
compileOptions {
|
||||||
// Support for Java 8 features
|
// Support for Java 8 features
|
||||||
coreLibraryDesugaringEnabled true
|
coreLibraryDesugaringEnabled true
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility 1.8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility 1.8
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -30,7 +30,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.0.0'
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
@ -38,12 +38,17 @@ dependencies {
|
|||||||
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
||||||
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
||||||
implementation files('lib\\glide\\glide-3.6.0.jar')
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
implementation 'com.amplifyframework:core:1.3.2'
|
implementation 'com.amplifyframework:core:1.3.2'
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
||||||
implementation 'com.amplifyframework:aws-auth-cognito:1.3.2'
|
implementation 'com.amplifyframework:aws-auth-cognito:1.3.2'
|
||||||
|
implementation 'com.android.volley:volley:1.1.1'
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
|
||||||
|
implementation 'org.json:json:20200518'
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||||
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.example.listify;
|
package com.example.listify;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import com.amplifyframework.auth.AuthException;
|
import com.amplifyframework.auth.AuthException;
|
||||||
import com.amplifyframework.auth.AuthSession;
|
import com.amplifyframework.auth.AuthSession;
|
||||||
import com.amplifyframework.auth.cognito.AWSCognitoAuthSession;
|
import com.amplifyframework.auth.cognito.AWSCognitoAuthSession;
|
||||||
@ -7,6 +8,13 @@ import com.amplifyframework.auth.options.AuthSignUpOptions;
|
|||||||
import com.amplifyframework.auth.result.AuthSignInResult;
|
import com.amplifyframework.auth.result.AuthSignInResult;
|
||||||
import com.amplifyframework.auth.result.AuthSignUpResult;
|
import com.amplifyframework.auth.result.AuthSignUpResult;
|
||||||
import com.amplifyframework.core.Amplify;
|
import com.amplifyframework.core.Amplify;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class AuthManager {
|
public class AuthManager {
|
||||||
AWSCognitoAuthSession authSession = null;
|
AWSCognitoAuthSession authSession = null;
|
||||||
@ -110,5 +118,22 @@ public class AuthManager {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Properties loadProperties(Context context, String path) throws IOException, JSONException {
|
||||||
|
Properties toReturn = new Properties();
|
||||||
|
String propertiesJSONString = "";
|
||||||
|
for (Object line : new BufferedReader(new InputStreamReader(context.getResources().openRawResource(R.raw.auths))).lines().toArray()) {
|
||||||
|
propertiesJSONString += line.toString();
|
||||||
|
}
|
||||||
|
System.out.println(propertiesJSONString);
|
||||||
|
JSONObject propertiesJSON = new JSONObject(propertiesJSONString);
|
||||||
|
propertiesJSON.keys().forEachRemaining(key -> {
|
||||||
|
try {
|
||||||
|
toReturn.setProperty(key, propertiesJSON.get(key).toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
System.out.println(toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
Listify/app/src/main/java/com/example/listify/List.java
Normal file
8
Listify/app/src/main/java/com/example/listify/List.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
|
||||||
|
public class List {
|
||||||
|
String name;
|
||||||
|
List(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,29 +1,23 @@
|
|||||||
package com.example.listify;
|
package com.example.listify;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.widget.ImageButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.amazonaws.mobileconnectors.cognitoauth.Auth;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import com.amplifyframework.auth.AuthException;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import com.amplifyframework.auth.AuthUserAttributeKey;
|
|
||||||
import com.amplifyframework.auth.options.AuthSignUpOptions;
|
|
||||||
import com.amplifyframework.core.Amplify;
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import com.google.android.material.navigation.NavigationView;
|
|
||||||
|
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import com.amplifyframework.auth.AuthException;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import org.json.JSONException;
|
||||||
import android.widget.ImageButton;
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
@ -51,6 +45,26 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
//----------------------------------API Testing---------------------------------------------//
|
||||||
|
Properties configs = new Properties();
|
||||||
|
try {
|
||||||
|
configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json");
|
||||||
|
} catch (IOException|JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Requestor requestor = new Requestor(this, authManager,configs.getProperty("apiKey"));
|
||||||
|
List testList = new List("IAmATestList");
|
||||||
|
try {
|
||||||
|
requestor.postObject(testList);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|||||||
66
Listify/app/src/main/java/com/example/listify/Requestor.java
Normal file
66
Listify/app/src/main/java/com/example/listify/Requestor.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
|
import com.android.volley.Response;
|
||||||
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
|
import com.android.volley.toolbox.Volley;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Requestor {
|
||||||
|
|
||||||
|
private final String DEV_BASEURL = "https://datoh7woc9.execute-api.us-east-2.amazonaws.com/Development";
|
||||||
|
|
||||||
|
AuthManager authManager;
|
||||||
|
RequestQueue queue;
|
||||||
|
String apiKey;
|
||||||
|
|
||||||
|
Requestor(Context context, AuthManager authManager, String apiKey) {
|
||||||
|
queue = Volley.newRequestQueue(context);
|
||||||
|
this.authManager = authManager;
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void getObject(String id, Class<T> classType, Receiver<T> receiver) {
|
||||||
|
String getURL = DEV_BASEURL + "/" + classType.getSimpleName() + "?id=" + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postObject(Object toPost, Response.ErrorListener failureHandler) throws JSONException {
|
||||||
|
String postURL = DEV_BASEURL + "/" + toPost.getClass().getSimpleName();
|
||||||
|
queue.add(buildRequest(postURL, toPost, null, failureHandler));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postObject(Object toPost) throws JSONException {
|
||||||
|
postObject(toPost, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonObjectRequest buildRequest(String url, Object toJSONify, Response.Listener<JSONObject> successHandler, Response.ErrorListener failureHandler) throws JSONException {
|
||||||
|
return buildRequest(url, new JSONObject(new Gson().toJson(toJSONify)), successHandler, failureHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonObjectRequest buildRequest(String url, JSONObject jsonBody, Response.Listener<JSONObject> successHandler, Response.ErrorListener failureHandler) {
|
||||||
|
return new JsonObjectRequest(url, jsonBody, successHandler, failureHandler) {
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getHeaders() {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
System.out.println(authManager.getUserToken());
|
||||||
|
headers.put("Authorization", authManager.getUserToken());
|
||||||
|
headers.put("Content-Type", "application/json");
|
||||||
|
headers.put("X-API-Key", apiKey);
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Receiver<T> {
|
||||||
|
public void acceptDelivery(T delivered) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ public class HomeFragment extends Fragment {
|
|||||||
toLoginPage.setOnClickListener(new View.OnClickListener() {
|
toLoginPage.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.SignupPage.class);
|
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.SignupPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ allprojects {
|
|||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
|||||||
@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m
|
|||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|||||||
BIN
Listify/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Listify/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
#Fri Sep 18 14:57:14 EDT 2020
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
|
||||||
|
|||||||
53
Listify/gradlew
vendored
Normal file → Executable file
53
Listify/gradlew
vendored
Normal file → Executable file
@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@ -66,6 +82,7 @@ esac
|
|||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
@ -109,10 +126,11 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
@ -138,19 +156,19 @@ if $cygwin ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -159,14 +177,9 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
173
Listify/gradlew.bat
vendored
173
Listify/gradlew.bat
vendored
@ -1,84 +1,89 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@rem
|
||||||
@rem ##########################################################################
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@rem
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem ##########################################################################
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
set DIRNAME=%~dp0
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
set APP_BASE_NAME=%~n0
|
@rem See the License for the specific language governing permissions and
|
||||||
set APP_HOME=%DIRNAME%
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
@rem Find java.exe
|
@rem
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
set JAVA_EXE=java.exe
|
@rem ##########################################################################
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
set DIRNAME=%~dp0
|
||||||
echo.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
set APP_BASE_NAME=%~n0
|
||||||
echo location of your Java installation.
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
goto fail
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
set JAVA_EXE=java.exe
|
||||||
echo.
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
echo location of your Java installation.
|
|
||||||
|
echo.
|
||||||
goto fail
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
:init
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
@rem Get command-line arguments, handling Windows variants
|
echo location of your Java installation.
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
goto fail
|
||||||
|
|
||||||
:win9xME_args
|
:findJavaFromJavaHome
|
||||||
@rem Slurp the command line arguments.
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set CMD_LINE_ARGS=
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
set _SKIP=2
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
set CMD_LINE_ARGS=%*
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
:execute
|
echo location of your Java installation.
|
||||||
@rem Setup the command line
|
|
||||||
|
goto fail
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
:execute
|
||||||
@rem Execute Gradle
|
@rem Setup the command line
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
:end
|
||||||
rem the _cmd.exe /c_ return code!
|
@rem End local scope for the variables with windows NT shell
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
exit /b 1
|
|
||||||
|
:fail
|
||||||
:mainEnd
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
:omega
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
|
|||||||
@ -11,7 +11,7 @@ REL_SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
|
|||||||
source ${REL_SCRIPT_DIR}/VarSetup.sh
|
source ${REL_SCRIPT_DIR}/VarSetup.sh
|
||||||
|
|
||||||
|
|
||||||
RAWLAMBDA=$(aws lambda create-function --function-name ${functionName}${method} --zip-file fileb://${zipPath} --runtime ${LANGUAGE} --role ${LAMBDAROLE} --handler ${functionName}${method} 2>${DEBUGFILE})
|
RAWLAMBDA=$(aws lambda create-function --function-name ${functionName}${method} --zip-file fileb://${jarPath} --runtime ${LANGUAGE} --role ${LAMBDAROLE} --handler ${functionName}${method} 2>${DEBUGFILE})
|
||||||
|
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
@ -42,7 +42,7 @@ aws apigateway put-method --rest-api-id ${APIID} --resource-id ${RESOURCEID} --h
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
aws apigateway put-integration --rest-api-id ${APIID} --resource-id ${RESOURCEID} --http-method ${method} --type AWS --integration-http-method POST --uri arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/${LAMBDAARN}/invocations --request-templates 'file://body_and_auth_mapping.json' > ${DEBUGFILE}
|
aws apigateway put-integration --rest-api-id ${APIID} --resource-id ${RESOURCEID} --http-method ${method} --type AWS --integration-http-method POST --uri arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/${LAMBDAARN}/invocations --request-templates "file://${REL_SCRIPT_DIR}/body_and_auth_mapping.json" --passthrough-behavior NEVER > ${DEBUGFILE}
|
||||||
|
|
||||||
aws lambda add-permission --function-name ${functionName}${method} --statement-id ${functionName}API --action lambda:InvokeFunction --principal apigateway.amazonaws.com > ${DEBUGFILE}
|
aws lambda add-permission --function-name ${functionName}${method} --statement-id ${functionName}API --action lambda:InvokeFunction --principal apigateway.amazonaws.com > ${DEBUGFILE}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"application/json": "{\"body\": \"$input.json('$')\",\"context\" : {\"sub\" : \"$context.authorizer.claims.sub\",\"email\" : \"$context.authorizer.claims.email\"}}"
|
"application/json": "#set($allParams = $input.params())\n{\"body\": $input.json('$'),\"params\" : {\n #foreach($type in $allParams.keySet())\n #set($params = $allParams.get($type))\n \"$type\" : {\n #foreach($paramName in $params.keySet())\n \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\n #if($foreach.hasNext),#end\n #end\n }\n #if($foreach.hasNext),#end\n #end\n },\"context\" : {\"sub\" : \"$context.authorizer.claims.sub\",\"email\" : \"$context.authorizer.claims.email\"}}"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user