public void run() { String AWSAccessKey="AKIAJM7YMMLXKUH5EWRQ"; String AWSSecretKey="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"; BasicAWSCredentials awsCredentials = new BasicAWSCredentials(AWSAccessKey, AWSSecretKey); AmazonApiGatewayClient apiClient = new AmazonApiGatewayClient(awsCredentials); apiClient.setRegion(Region.getRegion(Regions.US_WEST_2)); GetRestApisRequest graReq = new GetRestApisRequest(); GetRestApisResult graRes = apiClient.getRestApis(graReq); RestApi theApi = null; for ( RestApi api : graRes.getItems() ) { System.out.println("Found existing REST API: " + api.getName()); if ( "TestAPI".equals(api.getName())) { theApi = api; GetExportRequest geReq = new GetExportRequest() .withRestApiId(api.getId()) .withExportType("swagger") .withStageName("TEST"); GetExportResult geRes = apiClient.getExport(geReq); String f = new String(geRes.getBody().array()); int x = 1; String from = ""; PatchOperation po = new PatchOperation() .withFrom(from) .withOp(Op.Replace) .withPath(""); } } }
public static PatchOperation createReplaceOperation(String path, String value) { PatchOperation op = new PatchOperation(); op.setOp("replace"); op.setPath(path); op.setValue(value); return op; }
public static PatchOperation createAddOperation(String path, String value) { PatchOperation op = new PatchOperation(); op.setOp("add"); op.setPath(path); op.setValue(value); return op; }
public static PatchDocument createPatchDocument(PatchOperation... ops) { PatchDocument pd = new PatchDocument(); pd.setPatchOperations(new ArrayList<>()); for (PatchOperation op : ops) { pd.getPatchOperations().add(op); } return pd; }
public static PatchOperation createRemoveOperation(String path) { PatchOperation op = new PatchOperation(); op.setOp("remove"); op.setPath(path); return op; }