Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Error fix for creation of application [refer: Error creating application #63] #64

Merged
merged 3 commits into from
Mar 20, 2019
Merged
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: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
/data/target/
/samples/mqtt/target/
/.license
/management/src/main/proto/
/samples/account/target/
/samples/samples-account/target/
/data/data-common/target/
/samples/ttnmgmt/target/
/samples/samples-management/target/
/samples/samples-amqp/target/
/samples/samples-amqp/target/
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static Observable<AsyncApplication> create(AsyncOAuth2Token _creds, Abstr
* POST /applications
*/
return HttpRequest
.from(_creds.getAccountServer() + "/applications/" + _app.getId())
.from(_creds.getAccountServer() + "/applications")
.flatMap((HttpRequest t) -> t.inject(_creds))
.flatMap((HttpRequest t) -> HttpRequest
.buildRequestBody(_app)
Expand Down
22 changes: 2 additions & 20 deletions management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,12 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.0.Final</version>
<version>1.1.33.Fork26</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>generateSources</id>
<phase>generate-sources</phase>
<configuration>
<target>
<exec executable="./run.sh"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
Expand All @@ -82,4 +63,5 @@
</plugin>
</plugins>
</build>

</project>
46 changes: 0 additions & 46 deletions management/run.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ private AsyncDiscovery(DiscoveryGrpc.DiscoveryFutureStub _stub) {
* @param _port The server port
* @return An Observable stream containing the newly built AsyncDiscovery wrapper
*/
public static Observable<AsyncDiscovery> from(String _host, int _port) {
public static Observable<AsyncDiscovery> from(String _host, int _port, Boolean useSecureConnection) {
return Observable
.create((Subscriber<? super AsyncDiscovery> t) -> {
try {
ManagedChannel ch = ManagedChannelBuilder
.forAddress(_host, _port)
.usePlaintext(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid we need this for private networks still

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the current SDK fails because of trying to connect with the secured server. Is there any workaround?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it an option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally added the secure connection.

.usePlaintext(!useSecureConnection)
.build();
DiscoveryGrpc.DiscoveryFutureStub stub1 = DiscoveryGrpc.newFutureStub(ch);
t.onNext(new AsyncDiscovery(stub1));
Expand All @@ -86,7 +86,11 @@ public static Observable<AsyncDiscovery> from(String _host, int _port) {
* @return An Observable stream containing the newly built AsyncDiscovery wrapper
*/
public static Observable<AsyncDiscovery> getDefault() {
return from(HOST, PORT);
return from(HOST, PORT, false);
}

public static Observable<AsyncDiscovery> getDefault(Boolean useSecureConnection) {
return from(HOST, PORT, useSecureConnection);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected Discovery(AsyncDiscovery _wrap) {
* @param _port The server port
* @return The newly built Discovery wrapper
*/
public static Discovery from(String _host, int _port) {
return AsyncDiscovery.from(_host, _port)
public static Discovery from(String _host, int _port, Boolean useSecureConnection) {
return AsyncDiscovery.from(_host, _port, useSecureConnection)
.map((AsyncDiscovery t) -> new Discovery(t))
.toBlocking()
.single();
Expand All @@ -57,10 +57,19 @@ public static Discovery from(String _host, int _port) {
/**
* Build a Discovery wrapper using default servers
*
* @return The newly built Discovery wrapper
* @return The newly built Discovery wrapper without tls
*/
public static Discovery getDefault() {
return from(AsyncDiscovery.HOST, AsyncDiscovery.PORT);
return from(AsyncDiscovery.HOST, AsyncDiscovery.PORT, false);
}

/**
* Build a Discovery wrapper using default servers
*
* @return The newly built Discovery wrapper with option to enable tls
*/
public static Discovery getDefault(Boolean useSecureConnection) {
return from(AsyncDiscovery.HOST, AsyncDiscovery.PORT, useSecureConnection);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax = "proto2";
package gogoproto;

import "google/protobuf/descriptor.proto";

option java_package = "com.google.protobuf";
option java_outer_classname = "GoGoProtos";
option go_package = "github.com/gogo/protobuf/gogoproto";

extend google.protobuf.EnumOptions {
optional bool goproto_enum_prefix = 62001;
optional bool goproto_enum_stringer = 62021;
optional bool enum_stringer = 62022;
optional string enum_customname = 62023;
optional bool enumdecl = 62024;
}

extend google.protobuf.EnumValueOptions {
optional string enumvalue_customname = 66001;
}

extend google.protobuf.FileOptions {
optional bool goproto_getters_all = 63001;
optional bool goproto_enum_prefix_all = 63002;
optional bool goproto_stringer_all = 63003;
optional bool verbose_equal_all = 63004;
optional bool face_all = 63005;
optional bool gostring_all = 63006;
optional bool populate_all = 63007;
optional bool stringer_all = 63008;
optional bool onlyone_all = 63009;

optional bool equal_all = 63013;
optional bool description_all = 63014;
optional bool testgen_all = 63015;
optional bool benchgen_all = 63016;
optional bool marshaler_all = 63017;
optional bool unmarshaler_all = 63018;
optional bool stable_marshaler_all = 63019;

optional bool sizer_all = 63020;

optional bool goproto_enum_stringer_all = 63021;
optional bool enum_stringer_all = 63022;

optional bool unsafe_marshaler_all = 63023;
optional bool unsafe_unmarshaler_all = 63024;

optional bool goproto_extensions_map_all = 63025;
optional bool goproto_unrecognized_all = 63026;
optional bool gogoproto_import = 63027;
optional bool protosizer_all = 63028;
optional bool compare_all = 63029;
optional bool typedecl_all = 63030;
optional bool enumdecl_all = 63031;

optional bool goproto_registration = 63032;
optional bool messagename_all = 63033;

optional bool goproto_sizecache_all = 63034;
optional bool goproto_unkeyed_all = 63035;
}

extend google.protobuf.MessageOptions {
optional bool goproto_getters = 64001;
optional bool goproto_stringer = 64003;
optional bool verbose_equal = 64004;
optional bool face = 64005;
optional bool gostring = 64006;
optional bool populate = 64007;
optional bool stringer = 67008;
optional bool onlyone = 64009;

optional bool equal = 64013;
optional bool description = 64014;
optional bool testgen = 64015;
optional bool benchgen = 64016;
optional bool marshaler = 64017;
optional bool unmarshaler = 64018;
optional bool stable_marshaler = 64019;

optional bool sizer = 64020;

optional bool unsafe_marshaler = 64023;
optional bool unsafe_unmarshaler = 64024;

optional bool goproto_extensions_map = 64025;
optional bool goproto_unrecognized = 64026;

optional bool protosizer = 64028;
optional bool compare = 64029;

optional bool typedecl = 64030;

optional bool messagename = 64033;

optional bool goproto_sizecache = 64034;
optional bool goproto_unkeyed = 64035;
}

extend google.protobuf.FieldOptions {
optional bool nullable = 65001;
optional bool embed = 65002;
optional string customtype = 65003;
optional string customname = 65004;
optional string jsontag = 65005;
optional string moretags = 65006;
optional string casttype = 65007;
optional string castkey = 65008;
optional string castvalue = 65009;

optional bool stdtime = 65010;
optional bool stdduration = 65011;
optional bool wktpointer = 65012;

}
29 changes: 29 additions & 0 deletions management/src/main/proto/google/api/annotations.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2015, Google Inc.
//
// 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
//
// http://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.

syntax = "proto3";

package google.api;

import "google/api/http.proto";
import "google/protobuf/descriptor.proto";

option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";

extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}
Loading