Compare commits

...

22 Commits

Author SHA1 Message Date
c9df4fd6f4 实现 GeneralDeviceService 2025-09-16 17:12:27 +08:00
2ac3dcda84 去掉ping功能, 异步状态下设备ping平台, 平台ping设备没用 2025-09-15 23:46:14 +08:00
8ede415443 todo 2025-09-15 23:45:36 +08:00
1b255090b0 生成proto代码 2025-09-15 23:45:15 +08:00
80a35c2f14 TODO 2025-09-15 23:05:00 +08:00
b7c67ea3c2 定义GeneralDeviceService 2025-09-15 22:25:05 +08:00
264bcf9cb7 todo 2025-09-15 22:24:10 +08:00
621c45f9c0 定义上行事件监听器 2025-09-15 22:01:00 +08:00
6131f38232 todo 2025-09-15 22:00:22 +08:00
4980495f90 定义 device service 2025-09-15 21:28:22 +08:00
b183ad660f 实现 chirp stack transport 的Send方法 2025-09-15 21:27:54 +08:00
78e885e4ce 移动文件位置 2025-09-15 21:26:31 +08:00
28cf997f1d 定义平台和区域主控间的消息格式 2025-09-15 21:26:18 +08:00
417e63fbcb 调整文件目录 2025-09-15 21:25:48 +08:00
4105d91741 调整gorm注解 2025-09-15 20:01:09 +08:00
3ecebc0d61 增加待处理事项 2025-09-15 20:00:57 +08:00
9869897349 调整包名 2025-09-15 20:00:41 +08:00
ff5b40bb56 变量改名 2025-09-15 18:57:47 +08:00
dedb429186 定义 ChirpStackTransport 2025-09-15 18:56:11 +08:00
3876162f1d 移动代码位置 2025-09-15 18:02:10 +08:00
d42ca300d3 用chirp_stack swagger文档生成代码 2025-09-15 17:52:51 +08:00
bed87ba9ce 导入chirp_stack配置和swagger文档 2025-09-15 17:33:25 +08:00
393 changed files with 79993 additions and 61 deletions

View File

@@ -10,8 +10,9 @@ help:
@echo " build Build the application"
@echo " clean Clean generated files"
@echo " test Run all tests"
@echo " swag Generate swagger docs"
@echo " swag Generate swagger docs"
@echo " help Show this help message"
@echo " proto Generate protobuf files"
# 运行应用
.PHONY: run
@@ -36,4 +37,9 @@ test:
# 生成swagger文档
.PHONY: swag
swag:
swag init
swag init
# 生成protobuf文件
.PHONY: proto
proto:
protoc --go_out=internal/app/service/device/proto --go_opt=paths=source_relative --go-grpc_out=internal/app/service/device/proto --go-grpc_opt=paths=source_relative -Iinternal/app/service/device/proto internal/app/service/device/proto/device.proto

View File

@@ -1 +1,8 @@
// TODO 列表
可以用TimescaleDB代替PGSQL, 优化传感器数据存储性能
目前设备都只对应一个地址, 但实际上如电磁两位五通阀等设备是需要用两个开关控制的
Task调度器目前只能一个任务一个任务执行, 但实际上有些任务需要并发执行, 如开启下料口时需要不断从料筒称重传感器读取数据
ListenHandler 的实现遇到问题只能panic, 没有处理错误
暂时不考虑和区域主控间的同步消息, 假设所有消息都是异步的, 这可能导致无法知道指令是否执行成功

View File

@@ -42,3 +42,9 @@ websocket:
heartbeat:
interval: 600 # 任务调度或心跳检查的默认间隔(秒)
concurrency: 2 # 执行任务的并发协程数
# chirp_stack 配置文件
chirp_stack:
api_host: "http://192.168.5.16:8090" # ChirpStack API服务器地址
api_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjaGlycHN0YWNrIiwiaXNzIjoiY2hpcnBzdGFjayIsInN1YiI6IjU2ZWRhNWQ3LTM4NzgtNDAwMC05MWMzLWYwZDk3M2YwODhjNiIsInR5cCI6ImtleSJ9.NxBxTrhPAnezKMqAYZR_Uq2mGQjJRlmVzg1ZDFCyaHQ" # ChirpStack API密钥, 请求头中需要设置 Grpc-Metadata-Authorization: Bearer <YOUR_API_TOKEN>
api_timeout: 10 # ChirpStack API请求超时时间(秒)

26
go.mod
View File

@@ -4,13 +4,22 @@ go 1.25
require (
github.com/gin-gonic/gin v1.10.1
github.com/go-openapi/errors v0.22.2
github.com/go-openapi/loads v0.22.0
github.com/go-openapi/runtime v0.28.0
github.com/go-openapi/spec v0.21.0
github.com/go-openapi/strfmt v0.23.0
github.com/go-openapi/swag v0.23.0
github.com/go-openapi/validate v0.24.0
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/jessevdk/go-flags v1.6.1
github.com/stretchr/testify v1.11.1
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.1
github.com/swaggo/swag v1.16.6
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.36.0
golang.org/x/net v0.38.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v2 v2.4.0
gorm.io/datatypes v1.2.6
@@ -22,19 +31,18 @@ require (
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
@@ -51,21 +59,23 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect

69
go.sum
View File

@@ -2,10 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
@@ -14,10 +12,11 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
@@ -26,16 +25,26 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU=
github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo=
github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg=
github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco=
github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs=
github.com/go-openapi/runtime v0.28.0 h1:gpPPmWSNGo214l6n8hzdXYhPuJcGtziTOgUpvsFWGIQ=
github.com/go-openapi/runtime v0.28.0/go.mod h1:QN7OzcS+XuYmkQLw05akXk0jRH/eZ3kb18+1KwW9gyc=
github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c=
github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58=
github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
@@ -68,6 +77,8 @@ github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jessevdk/go-flags v1.6.1 h1:Cvu5U8UGrLay1rZfv/zP7iLpSHGUZ/Ou68T0iX1bBK4=
github.com/jessevdk/go-flags v1.6.1/go.mod h1:Mk8T1hIAWpOiJiHa9rJASDK2UGWji0EuPGBnNLMooyc=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
@@ -80,31 +91,29 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA=
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -117,7 +126,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -137,6 +145,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
@@ -155,7 +165,6 @@ golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
@@ -166,7 +175,6 @@ golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -179,7 +187,6 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
@@ -193,17 +200,13 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/datatypes v1.2.6 h1:KafLdXvFUhzNeL2ncm03Gl3eTLONQfNKZ+wJ+9Y4Nck=

View File

@@ -20,6 +20,7 @@ import (
"git.huangwc.com/pig/pig-farm-controller/internal/app/controller/plan"
"git.huangwc.com/pig/pig-farm-controller/internal/app/controller/user"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/token"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/transport"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/config"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/repository"
@@ -41,11 +42,12 @@ type API struct {
userController *user.Controller // 用户控制器实例
deviceController *device.Controller // 设备控制器实例
planController *plan.Controller // 计划控制器实例
listenHandler transport.ListenHandler // 设备上行事件监听器
}
// NewAPI 创建并返回一个新的 API 实例
// 负责初始化 Gin 引擎、设置全局中间件,并注入所有必要的依赖。
func NewAPI(cfg config.ServerConfig, logger *logs.Logger, userRepo repository.UserRepository, deviceRepository repository.DeviceRepository, planRepository repository.PlanRepository, tokenService token.TokenService) *API {
func NewAPI(cfg config.ServerConfig, logger *logs.Logger, userRepo repository.UserRepository, deviceRepository repository.DeviceRepository, planRepository repository.PlanRepository, tokenService token.TokenService, listenHandler transport.ListenHandler) *API {
// 设置 Gin 模式,例如 gin.ReleaseMode (生产模式) 或 gin.DebugMode (开发模式)
// 从配置中获取 Gin 模式
gin.SetMode(cfg.Mode)
@@ -60,11 +62,12 @@ func NewAPI(cfg config.ServerConfig, logger *logs.Logger, userRepo repository.Us
// 初始化 API 结构体
api := &API{
engine: engine,
logger: logger,
userRepo: userRepo,
tokenService: tokenService,
config: cfg,
engine: engine,
logger: logger,
userRepo: userRepo,
tokenService: tokenService,
config: cfg,
listenHandler: listenHandler,
// 在 NewAPI 中初始化用户控制器,并将其作为 API 结构体的成员
userController: user.NewController(userRepo, logger, tokenService),
// 在 NewAPI 中初始化设备控制器,并将其作为 API 结构体的成员
@@ -113,6 +116,12 @@ func (a *API) setupRoutes() {
}
}
// 上行事件监听路由
a.engine.POST("/upstream", func(c *gin.Context) {
h := a.listenHandler.Handler()
h.ServeHTTP(c.Writer, c.Request)
})
// 添加 Swagger UI 路由
a.engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
a.logger.Info("Swagger UI is available at /swagger/index.html")

View File

@@ -0,0 +1,39 @@
package device
import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
// 设备行为
type DeviceAction string
var (
DeviceActionStart DeviceAction = "start" // 启动
DeviceActionStop DeviceAction = "stop" // 停止
)
// 指令类型
type Method string
var (
MethodSwitch Method = "switch" // 启停指令
)
// Service 抽象了一组方法用于控制设备行为
type Service interface {
// Switch 用于切换指定设备的状态, 比如启动和停止
Switch(device models.Device, action DeviceAction) error
}
// 设备操作指令通用结构(最外层)
type DeviceRequest struct {
MessageID int // 消息ID, 用于后续匹配响应
Method string // 这是什么指令
Data interface{} // 指令参数
}
// 设备操作指令通用响应结构(最外层)
type DeviceResponse struct {
MessageID int // 消息ID, 用于匹配这是哪一个请求的响应
Message string
Data interface{} // 响应内容
}

View File

@@ -0,0 +1,103 @@
package device
import (
"fmt"
"strconv"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/device/proto"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/repository"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport"
gproto "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
type GeneralDeviceService struct {
deviceRepo repository.DeviceRepository
logger *logs.Logger
deviceID uint // 区域主控的设备ID
// regionalController 是执行命令的区域主控, 所有的指令都会发往区域主控
regionalController *models.Device
comm transport.Communicator
}
// NewGeneralDeviceService 创建一个通用设备服务
func NewGeneralDeviceService(deviceID uint, deviceRepo repository.DeviceRepository, logger *logs.Logger, comm transport.Communicator) *GeneralDeviceService {
return &GeneralDeviceService{
deviceID: deviceID,
deviceRepo: deviceRepo,
logger: logger,
comm: comm,
}
}
func (g *GeneralDeviceService) Switch(device models.Device, action DeviceAction) error {
// 校验设备参数及生成指令
if *device.ParentID != g.deviceID {
return fmt.Errorf("设备 %v(id=%v) 的上级区域主控是(id=%v), 不是当前区域主控(id=%v)下属设备, 无法执行指令", device.Name, device.ID, device.ParentID, g.deviceID)
}
if !device.SelfCheck() {
return fmt.Errorf("设备 %v(id=%v) 缺少必要信息, 无法发送指令", device.Name, device.ID)
}
deviceInfo := make(map[string]interface{})
if err := device.ParseProperties(&deviceInfo); err != nil {
return fmt.Errorf("解析设备 %v(id=%v) 配置失败: %v", device.Name, device.ID, err)
}
busNumber, err := strconv.Atoi(fmt.Sprintf("%v", deviceInfo[models.BusNumber]))
if err != nil {
return fmt.Errorf("无效的总线号: %v", err)
}
busAddress, err := strconv.Atoi(fmt.Sprintf("%v", deviceInfo[models.BusAddress]))
if err != nil {
return fmt.Errorf("无效的总线地址: %v", err)
}
relayChannel, err := strconv.Atoi(fmt.Sprintf("%v", deviceInfo[models.RelayChannel]))
if err != nil {
return fmt.Errorf("无效的继电器通道: %v", err)
}
data, err := anypb.New(&proto.Switch{
DeviceAction: string(action),
BusNumber: int32(busNumber),
BusAddress: int32(busAddress),
RelayChannel: int32(relayChannel),
})
if err != nil {
return fmt.Errorf("创建指令失败: %v", err)
}
instruction := &proto.Instruction{
Method: proto.MethodType_SWITCH,
Data: data,
}
// 获取自身LoRa设备ID, 因为可能变更, 所以每次都现获取
thisDevice, err := g.deviceRepo.FindByID(g.deviceID)
if err != nil {
return fmt.Errorf("获取区域主控(id=%v)信息失败: %v", g.deviceID, err)
}
if !thisDevice.SelfCheck() {
return fmt.Errorf("区域主控 %v(id=%v) 缺少必要信息, 无法发送指令", thisDevice.Name, thisDevice.ID)
}
thisDeviceinfo := make(map[string]interface{})
if err := thisDevice.ParseProperties(&thisDeviceinfo); err != nil {
return fmt.Errorf("解析区域主控 %v(id=%v) 配置失败: %v", device.Name, device.ID, err)
}
loraAddress := fmt.Sprintf("%v", thisDeviceinfo[models.LoRaAddress])
// 生成消息并发送
message, err := gproto.Marshal(instruction)
if err != nil {
return fmt.Errorf("序列化指令失败: %v", err)
}
return g.comm.Send(loraAddress, message)
}

View File

@@ -0,0 +1,263 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.9
// protoc v6.32.1
// source: device.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 指令类型
type MethodType int32
const (
MethodType_SWITCH MethodType = 0
)
// Enum value maps for MethodType.
var (
MethodType_name = map[int32]string{
0: "SWITCH",
}
MethodType_value = map[string]int32{
"SWITCH": 0,
}
)
func (x MethodType) Enum() *MethodType {
p := new(MethodType)
*p = x
return p
}
func (x MethodType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MethodType) Descriptor() protoreflect.EnumDescriptor {
return file_device_proto_enumTypes[0].Descriptor()
}
func (MethodType) Type() protoreflect.EnumType {
return &file_device_proto_enumTypes[0]
}
func (x MethodType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use MethodType.Descriptor instead.
func (MethodType) EnumDescriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{0}
}
// 指令
type Instruction struct {
state protoimpl.MessageState `protogen:"open.v1"`
Method MethodType `protobuf:"varint,1,opt,name=method,proto3,enum=device.MethodType" json:"method,omitempty"`
Data *anypb.Any `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Instruction) Reset() {
*x = Instruction{}
mi := &file_device_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Instruction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Instruction) ProtoMessage() {}
func (x *Instruction) ProtoReflect() protoreflect.Message {
mi := &file_device_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Instruction.ProtoReflect.Descriptor instead.
func (*Instruction) Descriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{0}
}
func (x *Instruction) GetMethod() MethodType {
if x != nil {
return x.Method
}
return MethodType_SWITCH
}
func (x *Instruction) GetData() *anypb.Any {
if x != nil {
return x.Data
}
return nil
}
type Switch struct {
state protoimpl.MessageState `protogen:"open.v1"`
DeviceAction string `protobuf:"bytes,1,opt,name=device_action,json=deviceAction,proto3" json:"device_action,omitempty"` // 指令
BusNumber int32 `protobuf:"varint,2,opt,name=bus_number,json=busNumber,proto3" json:"bus_number,omitempty"` // 总线号
BusAddress int32 `protobuf:"varint,3,opt,name=bus_address,json=busAddress,proto3" json:"bus_address,omitempty"` // 总线地址
RelayChannel int32 `protobuf:"varint,4,opt,name=relay_channel,json=relayChannel,proto3" json:"relay_channel,omitempty"` // 继电器通道号
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Switch) Reset() {
*x = Switch{}
mi := &file_device_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Switch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Switch) ProtoMessage() {}
func (x *Switch) ProtoReflect() protoreflect.Message {
mi := &file_device_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Switch.ProtoReflect.Descriptor instead.
func (*Switch) Descriptor() ([]byte, []int) {
return file_device_proto_rawDescGZIP(), []int{1}
}
func (x *Switch) GetDeviceAction() string {
if x != nil {
return x.DeviceAction
}
return ""
}
func (x *Switch) GetBusNumber() int32 {
if x != nil {
return x.BusNumber
}
return 0
}
func (x *Switch) GetBusAddress() int32 {
if x != nil {
return x.BusAddress
}
return 0
}
func (x *Switch) GetRelayChannel() int32 {
if x != nil {
return x.RelayChannel
}
return 0
}
var File_device_proto protoreflect.FileDescriptor
const file_device_proto_rawDesc = "" +
"\n" +
"\fdevice.proto\x12\x06device\x1a\x19google/protobuf/any.proto\"c\n" +
"\vInstruction\x12*\n" +
"\x06method\x18\x01 \x01(\x0e2\x12.device.MethodTypeR\x06method\x12(\n" +
"\x04data\x18\x02 \x01(\v2\x14.google.protobuf.AnyR\x04data\"\x92\x01\n" +
"\x06Switch\x12#\n" +
"\rdevice_action\x18\x01 \x01(\tR\fdeviceAction\x12\x1d\n" +
"\n" +
"bus_number\x18\x02 \x01(\x05R\tbusNumber\x12\x1f\n" +
"\vbus_address\x18\x03 \x01(\x05R\n" +
"busAddress\x12#\n" +
"\rrelay_channel\x18\x04 \x01(\x05R\frelayChannel*\x18\n" +
"\n" +
"MethodType\x12\n" +
"\n" +
"\x06SWITCH\x10\x00B#Z!internal/app/service/device/protob\x06proto3"
var (
file_device_proto_rawDescOnce sync.Once
file_device_proto_rawDescData []byte
)
func file_device_proto_rawDescGZIP() []byte {
file_device_proto_rawDescOnce.Do(func() {
file_device_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_device_proto_rawDesc), len(file_device_proto_rawDesc)))
})
return file_device_proto_rawDescData
}
var file_device_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_device_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_device_proto_goTypes = []any{
(MethodType)(0), // 0: device.MethodType
(*Instruction)(nil), // 1: device.Instruction
(*Switch)(nil), // 2: device.Switch
(*anypb.Any)(nil), // 3: google.protobuf.Any
}
var file_device_proto_depIdxs = []int32{
0, // 0: device.Instruction.method:type_name -> device.MethodType
3, // 1: device.Instruction.data:type_name -> google.protobuf.Any
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_device_proto_init() }
func file_device_proto_init() {
if File_device_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_device_proto_rawDesc), len(file_device_proto_rawDesc)),
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_device_proto_goTypes,
DependencyIndexes: file_device_proto_depIdxs,
EnumInfos: file_device_proto_enumTypes,
MessageInfos: file_device_proto_msgTypes,
}.Build()
File_device_proto = out.File
file_device_proto_goTypes = nil
file_device_proto_depIdxs = nil
}

View File

@@ -0,0 +1,25 @@
syntax = "proto3";
package device;
import "google/protobuf/any.proto";
option go_package = "internal/app/service/device/proto";
// 指令类型
enum MethodType{
SWITCH = 0;
}
// 指令
message Instruction{
MethodType method = 1;
google.protobuf.Any data = 2;
}
message Switch{
string device_action = 1; // 指令
int32 bus_number = 2; // 总线号
int32 bus_address = 3; // 总线地址
int32 relay_channel = 4; // 继电器通道号
}

View File

@@ -0,0 +1,52 @@
package transport
import (
"io"
"net/http"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
)
// ChirpStackListener 是一个监听器, 用于监听ChirpStack反馈的设备上行事件
type ChirpStackListener struct {
logger *logs.Logger
}
func NewChirpStackListener(logger *logs.Logger) *ChirpStackListener {
return &ChirpStackListener{
logger: logger,
}
}
func (c *ChirpStackListener) Handler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body)
if err != nil {
c.logger.Errorf("读取请求体失败: %v", err)
// TODO 直接崩溃不太合适
panic(err)
}
event := r.URL.Query().Get("event")
switch event {
case "up": // 链路上行事件
err = c.up(b)
if err != nil {
c.logger.Errorf("处理链路上行事件失败: %v", err)
// TODO 直接崩溃不太合适
panic(err)
}
default:
c.logger.Errorf("未知的ChirpStack事件: %s", event)
}
}
}
// up 处理链路上行事件
func (c *ChirpStackListener) up(data []byte) error {
// TODO implement me
panic("implement me")
}

View File

@@ -0,0 +1,8 @@
package transport
import "net/http"
// ListenHandler 是一个监听器, 用于监听设备上行事件
type ListenHandler interface {
Handler() http.HandlerFunc
}

View File

@@ -8,6 +8,7 @@ import (
"git.huangwc.com/pig/pig-farm-controller/internal/app/api"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/token"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/transport"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/config"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/database"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
@@ -28,40 +29,43 @@ type Application struct {
// NewApplication 创建并初始化一个新的 Application 实例。
// 这是应用的“组合根”,所有依赖都在这里被创建和注入。
func NewApplication(configPath string) (*Application, error) {
// 1. 加载配置
// 加载配置
cfg := config.NewConfig()
if err := cfg.Load(configPath); err != nil {
return nil, fmt.Errorf("无法加载配置: %w", err)
}
// 2. 初始化日志记录器
// 初始化日志记录器
logger := logs.NewLogger(cfg.Log)
// 3. 初始化数据库存储
// 初始化数据库存储
storage, err := initStorage(cfg.Database, logger)
if err != nil {
return nil, err // 错误已在 initStorage 中被包装
}
// 4. 初始化任务执行器
// 初始化任务执行器
executor := task.NewExecutor(cfg.Heartbeat.Concurrency, logger)
// 5. 初始化 Token 服务
// 初始化 Token 服务
tokenService := token.NewTokenService([]byte(cfg.App.JWTSecret))
// 6. 初始化用户仓库
// 初始化用户仓库
userRepo := repository.NewGormUserRepository(storage.GetDB())
// 7. 初始化设备仓库
// 初始化设备仓库
deviceRepo := repository.NewGormDeviceRepository(storage.GetDB())
// 8. 初始化计划仓库
// 初始化计划仓库
planRepo := repository.NewGormPlanRepository(storage.GetDB())
// 9. 初始化 API 服务
apiServer := api.NewAPI(cfg.Server, logger, userRepo, deviceRepo, planRepo, tokenService)
// 初始化设备上行监听
listenHandler := transport.NewChirpStackListener(logger)
// 10. 组装 Application 对象
// 初始化 API 服务器
apiServer := api.NewAPI(cfg.Server, logger, userRepo, deviceRepo, planRepo, tokenService, listenHandler)
// 组装 Application 对象
app := &Application{
Config: cfg,
Logger: logger,

View File

@@ -39,6 +39,18 @@ const (
SubTypeWaterCurtain DeviceSubType = "water_curtain"
)
// 设备属性名大全
var (
// 普通开关式设备
BusNumber = "bus_number" // 总线号
BusAddress = "bus_address" // 总线地址
RelayChannel = "relay_channel" // 继电器通道号
// 区域主控
LoRaAddress = "lora_address" // 区域主控 LoRa 地址, 如果使用LoRa网关也可能是LoRa网关记录的设备ID
)
// --- Properties 结构体定义 ---
// LoraProperties 定义了区域主控的特有属性
@@ -95,3 +107,31 @@ func (d *Device) ParseProperties(v interface{}) error {
}
return json.Unmarshal(d.Properties, v)
}
// SelfCheck 进行参数自检, 返回检测结果
// 方法会根据自身类型进行参数检查, 参数不全时返回false
// TODO 没写单测
func (d *Device) SelfCheck() bool {
properties := make(map[string]interface{})
if err := d.ParseProperties(&properties); err != nil {
return false
}
has := func(key string) bool {
_, ok := properties[key]
return ok
}
switch d.SubType {
case SubTypeFan:
if !has(BusNumber) || !has(BusAddress) || !has(RelayChannel) {
return false
}
default:
// 不应该有类型未知的设备
return false
}
return true
}

View File

@@ -49,7 +49,7 @@ type Plan struct {
// SubPlans 直接与此计划关联的子计划。仅当 ContentType 为 PlanContentTypeSubPlans 时有效。
SubPlans []SubPlan `gorm:"foreignKey:ParentPlanID" json:"sub_plans"`
// Tasks 直接与此计划关联的任务。仅当 ContentType 为 PlanContentTypeTasks 时有效。
Tasks []Task `gorm:"foreignKey:PlanID" json:"tasks"`
Tasks []Task `gorm:"foreignKey:PlanID;constraint:OnDelete:CASCADE;" json:"tasks"`
}
// TableName 自定义 GORM 使用的数据库表名

View File

@@ -0,0 +1,91 @@
package lora
import (
"time"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/client/device_service"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/client"
)
// ChirpStackConfig 保存连接到 ChirpStack API 所需的配置。
type ChirpStackConfig struct {
// ServerAddress 是 ChirpStack API 服务器的地址,例如 "localhost:8080"。
ServerAddress string
// APIKey 是用于认证的 API 密钥。
APIKey string
// LoRaWAN 端口, 需要和设备一致
Fport int64
}
// GenerateAPIKey 用于补齐API Key作为请求头时缺失的部分
func (c ChirpStackConfig) GenerateAPIKey() string {
return "Bearer " + c.APIKey
}
// ChirpStackTransport 是一个客户端,用于封装与 ChirpStack REST API 的交互。
type ChirpStackTransport struct {
client *client.ChirpStackRESTAPI
authInfo runtime.ClientAuthInfoWriter
config ChirpStackConfig
logger *logs.Logger
}
// NewChirpStackTransport 创建一个新的通信实例,用于与 ChirpStack 通信。
func NewChirpStackTransport(config ChirpStackConfig, logger *logs.Logger) *ChirpStackTransport {
// 使用配置中的服务器地址创建一个 HTTP transport。
// 它会使用生成的客户端中定义的默认 base path 和 schemes。
transport := httptransport.New(config.ServerAddress, client.DefaultBasePath, client.DefaultSchemes)
// 使用 transport 和默认的字符串格式化器,创建一个 API 主客户端。
apiClient := client.New(transport, strfmt.Default)
// 使用 API Key 创建认证信息写入器。
authInfo := httptransport.APIKeyAuth("grpc-metadata-authorization", "header", config.GenerateAPIKey())
return &ChirpStackTransport{
client: apiClient,
authInfo: authInfo,
config: config,
logger: logger,
}
}
func (c *ChirpStackTransport) Send(address string, payload []byte) error {
// 1. 构建 API 请求体。
// - Confirmed: true 表示确认消息, 设为false将不保证消息送达(但可以节约下行容量)。
// - Data: 经过 Base64 编码的数据。
// - FPort: LoRaWAN 端口。
body := device_service.DeviceServiceEnqueueBody{
QueueItem: &device_service.DeviceServiceEnqueueParamsBodyQueueItem{
Confirmed: true,
Data: payload,
FPort: c.config.Fport,
},
}
// 2. 构建 API 请求参数。
// - WithTimeout 设置一个合理的请求超时。
// - WithQueueItemDevEui 指定目标设备的 EUI。
// - WithBody 设置请求体。
params := device_service.NewDeviceServiceEnqueueParams().
WithTimeout(10 * time.Second).
WithQueueItemDevEui(address).
WithBody(body)
// 3. 调用生成的客户端方法来发送请求。
// c.authInfo 是您在 NewChirpStackTransport 中创建的认证信息。
_, err := c.client.DeviceService.DeviceServiceEnqueue(params, c.authInfo)
if err != nil {
c.logger.Errorf("设备 %s 调用ChirpStack Enqueue失败: %v", address, err)
return err
}
c.logger.Infof("设备 %s 调用ChirpStack Enqueue成功", address)
return nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateAwsSnsIntegrationParams creates a new ApplicationServiceCreateAwsSnsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateAwsSnsIntegrationParams() *ApplicationServiceCreateAwsSnsIntegrationParams {
return &ApplicationServiceCreateAwsSnsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceCreateAwsSnsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateAwsSnsIntegrationParams {
return &ApplicationServiceCreateAwsSnsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceCreateAwsSnsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateAwsSnsIntegrationParams {
return &ApplicationServiceCreateAwsSnsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateAwsSnsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateAwsSnsIntegrationParams {
return &ApplicationServiceCreateAwsSnsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateAwsSnsIntegrationParams contains all the parameters to send to the API endpoint
for the application service create aws sns integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateAwsSnsIntegrationParams struct {
// Body.
Body ApplicationServiceCreateAwsSnsIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithBody(body ApplicationServiceCreateAwsSnsIntegrationBody) *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetBody(body ApplicationServiceCreateAwsSnsIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateAwsSnsIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create aws sns integration params
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,392 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateAwsSnsIntegrationReader is a Reader for the ApplicationServiceCreateAwsSnsIntegration structure.
type ApplicationServiceCreateAwsSnsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateAwsSnsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateAwsSnsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateAwsSnsIntegrationOK creates a ApplicationServiceCreateAwsSnsIntegrationOK with default headers values
func NewApplicationServiceCreateAwsSnsIntegrationOK() *ApplicationServiceCreateAwsSnsIntegrationOK {
return &ApplicationServiceCreateAwsSnsIntegrationOK{}
}
/*
ApplicationServiceCreateAwsSnsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateAwsSnsIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create aws sns integration o k response has a 2xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create aws sns integration o k response has a 3xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create aws sns integration o k response has a 4xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create aws sns integration o k response has a 5xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create aws sns integration o k response a status code equal to that given
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create aws sns integration o k response
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceCreateAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceCreateAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateAwsSnsIntegrationDefault creates a ApplicationServiceCreateAwsSnsIntegrationDefault with default headers values
func NewApplicationServiceCreateAwsSnsIntegrationDefault(code int) *ApplicationServiceCreateAwsSnsIntegrationDefault {
return &ApplicationServiceCreateAwsSnsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateAwsSnsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateAwsSnsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create aws sns integration default response has a 2xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create aws sns integration default response has a 3xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create aws sns integration default response has a 4xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create aws sns integration default response has a 5xx status code
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create aws sns integration default response a status code equal to that given
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create aws sns integration default response
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_CreateAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_CreateAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateAwsSnsIntegrationBody application service create aws sns integration body
swagger:model ApplicationServiceCreateAwsSnsIntegrationBody
*/
type ApplicationServiceCreateAwsSnsIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create aws sns integration body
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create aws sns integration body based on the context it is used
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateAwsSnsIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateAwsSnsIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration struct {
// AWS Access Key ID.
AccessKeyID string `json:"accessKeyId,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// AWS region.
Region string `json:"region,omitempty"`
// AWS Secret Access Key.
SecretAccessKey string `json:"secretAccessKey,omitempty"`
// Topic ARN.
TopicArn string `json:"topicArn,omitempty"`
}
// Validate validates this application service create aws sns integration params body integration
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create aws sns integration params body integration based on the context it is used
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateAzureServiceBusIntegrationParams creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateAzureServiceBusIntegrationParams() *ApplicationServiceCreateAzureServiceBusIntegrationParams {
return &ApplicationServiceCreateAzureServiceBusIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
return &ApplicationServiceCreateAzureServiceBusIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
return &ApplicationServiceCreateAzureServiceBusIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
return &ApplicationServiceCreateAzureServiceBusIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint
for the application service create azure service bus integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateAzureServiceBusIntegrationParams struct {
// Body.
Body ApplicationServiceCreateAzureServiceBusIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithBody(body ApplicationServiceCreateAzureServiceBusIntegrationBody) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetBody(body ApplicationServiceCreateAzureServiceBusIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateAzureServiceBusIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create azure service bus integration params
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,387 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceCreateAzureServiceBusIntegration structure.
type ApplicationServiceCreateAzureServiceBusIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateAzureServiceBusIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateAzureServiceBusIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateAzureServiceBusIntegrationOK creates a ApplicationServiceCreateAzureServiceBusIntegrationOK with default headers values
func NewApplicationServiceCreateAzureServiceBusIntegrationOK() *ApplicationServiceCreateAzureServiceBusIntegrationOK {
return &ApplicationServiceCreateAzureServiceBusIntegrationOK{}
}
/*
ApplicationServiceCreateAzureServiceBusIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateAzureServiceBusIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create azure service bus integration o k response has a 2xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create azure service bus integration o k response has a 3xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create azure service bus integration o k response has a 4xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create azure service bus integration o k response has a 5xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create azure service bus integration o k response a status code equal to that given
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create azure service bus integration o k response
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceCreateAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceCreateAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateAzureServiceBusIntegrationDefault creates a ApplicationServiceCreateAzureServiceBusIntegrationDefault with default headers values
func NewApplicationServiceCreateAzureServiceBusIntegrationDefault(code int) *ApplicationServiceCreateAzureServiceBusIntegrationDefault {
return &ApplicationServiceCreateAzureServiceBusIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateAzureServiceBusIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create azure service bus integration default response has a 2xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create azure service bus integration default response has a 3xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create azure service bus integration default response has a 4xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create azure service bus integration default response has a 5xx status code
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create azure service bus integration default response a status code equal to that given
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create azure service bus integration default response
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_CreateAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_CreateAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateAzureServiceBusIntegrationBody application service create azure service bus integration body
swagger:model ApplicationServiceCreateAzureServiceBusIntegrationBody
*/
type ApplicationServiceCreateAzureServiceBusIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create azure service bus integration body
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create azure service bus integration body based on the context it is used
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateAzureServiceBusIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration struct {
// Connection string.
ConnectionString string `json:"connectionString,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Publish name.
// This is the name of the topic or queue.
PublishName string `json:"publishName,omitempty"`
}
// Validate validates this application service create azure service bus integration params body integration
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create azure service bus integration params body integration based on the context it is used
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateGcpPubSubIntegrationParams creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateGcpPubSubIntegrationParams() *ApplicationServiceCreateGcpPubSubIntegrationParams {
return &ApplicationServiceCreateGcpPubSubIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateGcpPubSubIntegrationParams {
return &ApplicationServiceCreateGcpPubSubIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateGcpPubSubIntegrationParams {
return &ApplicationServiceCreateGcpPubSubIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateGcpPubSubIntegrationParams {
return &ApplicationServiceCreateGcpPubSubIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint
for the application service create gcp pub sub integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateGcpPubSubIntegrationParams struct {
// Body.
Body ApplicationServiceCreateGcpPubSubIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithBody(body ApplicationServiceCreateGcpPubSubIntegrationBody) *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetBody(body ApplicationServiceCreateGcpPubSubIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateGcpPubSubIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create gcp pub sub integration params
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,393 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateGcpPubSubIntegrationReader is a Reader for the ApplicationServiceCreateGcpPubSubIntegration structure.
type ApplicationServiceCreateGcpPubSubIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateGcpPubSubIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateGcpPubSubIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateGcpPubSubIntegrationOK creates a ApplicationServiceCreateGcpPubSubIntegrationOK with default headers values
func NewApplicationServiceCreateGcpPubSubIntegrationOK() *ApplicationServiceCreateGcpPubSubIntegrationOK {
return &ApplicationServiceCreateGcpPubSubIntegrationOK{}
}
/*
ApplicationServiceCreateGcpPubSubIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateGcpPubSubIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create gcp pub sub integration o k response has a 2xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create gcp pub sub integration o k response has a 3xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create gcp pub sub integration o k response has a 4xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create gcp pub sub integration o k response has a 5xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create gcp pub sub integration o k response a status code equal to that given
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create gcp pub sub integration o k response
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceCreateGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceCreateGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateGcpPubSubIntegrationDefault creates a ApplicationServiceCreateGcpPubSubIntegrationDefault with default headers values
func NewApplicationServiceCreateGcpPubSubIntegrationDefault(code int) *ApplicationServiceCreateGcpPubSubIntegrationDefault {
return &ApplicationServiceCreateGcpPubSubIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateGcpPubSubIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateGcpPubSubIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create gcp pub sub integration default response has a 2xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create gcp pub sub integration default response has a 3xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create gcp pub sub integration default response has a 4xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create gcp pub sub integration default response has a 5xx status code
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create gcp pub sub integration default response a status code equal to that given
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create gcp pub sub integration default response
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_CreateGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_CreateGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateGcpPubSubIntegrationBody application service create gcp pub sub integration body
swagger:model ApplicationServiceCreateGcpPubSubIntegrationBody
*/
type ApplicationServiceCreateGcpPubSubIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create gcp pub sub integration body
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create gcp pub sub integration body based on the context it is used
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateGcpPubSubIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration struct {
// Credentials file.
// This IAM service-account credentials file (JSON) must have the following
// Pub/Sub roles:
// * Pub/Sub Publisher
CredentialsFile string `json:"credentialsFile,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Project ID.
ProjectID string `json:"projectId,omitempty"`
// Topic name.
// This is the name of the Pub/Sub topic.
TopicName string `json:"topicName,omitempty"`
}
// Validate validates this application service create gcp pub sub integration params body integration
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create gcp pub sub integration params body integration based on the context it is used
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateHTTPIntegrationParams creates a new ApplicationServiceCreateHTTPIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateHTTPIntegrationParams() *ApplicationServiceCreateHTTPIntegrationParams {
return &ApplicationServiceCreateHTTPIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceCreateHTTPIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateHTTPIntegrationParams {
return &ApplicationServiceCreateHTTPIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateHTTPIntegrationParamsWithContext creates a new ApplicationServiceCreateHTTPIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateHTTPIntegrationParams {
return &ApplicationServiceCreateHTTPIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateHTTPIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateHTTPIntegrationParams {
return &ApplicationServiceCreateHTTPIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateHTTPIntegrationParams contains all the parameters to send to the API endpoint
for the application service create Http integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateHTTPIntegrationParams struct {
// Body.
Body ApplicationServiceCreateHTTPIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithDefaults() *ApplicationServiceCreateHTTPIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateHTTPIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateHTTPIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateHTTPIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithBody(body ApplicationServiceCreateHTTPIntegrationBody) *ApplicationServiceCreateHTTPIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetBody(body ApplicationServiceCreateHTTPIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateHTTPIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create Http integration params
func (o *ApplicationServiceCreateHTTPIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,389 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateHTTPIntegrationReader is a Reader for the ApplicationServiceCreateHTTPIntegration structure.
type ApplicationServiceCreateHTTPIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateHTTPIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateHTTPIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateHTTPIntegrationOK creates a ApplicationServiceCreateHTTPIntegrationOK with default headers values
func NewApplicationServiceCreateHTTPIntegrationOK() *ApplicationServiceCreateHTTPIntegrationOK {
return &ApplicationServiceCreateHTTPIntegrationOK{}
}
/*
ApplicationServiceCreateHTTPIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateHTTPIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create Http integration o k response has a 2xx status code
func (o *ApplicationServiceCreateHTTPIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create Http integration o k response has a 3xx status code
func (o *ApplicationServiceCreateHTTPIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create Http integration o k response has a 4xx status code
func (o *ApplicationServiceCreateHTTPIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create Http integration o k response has a 5xx status code
func (o *ApplicationServiceCreateHTTPIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create Http integration o k response a status code equal to that given
func (o *ApplicationServiceCreateHTTPIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create Http integration o k response
func (o *ApplicationServiceCreateHTTPIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateHTTPIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceCreateHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateHTTPIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceCreateHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateHTTPIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateHTTPIntegrationDefault creates a ApplicationServiceCreateHTTPIntegrationDefault with default headers values
func NewApplicationServiceCreateHTTPIntegrationDefault(code int) *ApplicationServiceCreateHTTPIntegrationDefault {
return &ApplicationServiceCreateHTTPIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateHTTPIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateHTTPIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create Http integration default response has a 2xx status code
func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create Http integration default response has a 3xx status code
func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create Http integration default response has a 4xx status code
func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create Http integration default response has a 5xx status code
func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create Http integration default response a status code equal to that given
func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create Http integration default response
func (o *ApplicationServiceCreateHTTPIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateHTTPIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_CreateHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateHTTPIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_CreateHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateHTTPIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateHTTPIntegrationBody application service create HTTP integration body
swagger:model ApplicationServiceCreateHTTPIntegrationBody
*/
type ApplicationServiceCreateHTTPIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create HTTP integration body
func (o *ApplicationServiceCreateHTTPIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateHTTPIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create HTTP integration body based on the context it is used
func (o *ApplicationServiceCreateHTTPIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateHTTPIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateHTTPIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateHTTPIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateHTTPIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration struct {
// Payload encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Event endpoint URL.
// The HTTP integration will POST all events to this enpoint. The request
// will contain a query parameters "event" containing the type of the
// event.
EventEndpointURL string `json:"eventEndpointUrl,omitempty"`
// HTTP headers to set when making requests.
Headers map[string]string `json:"headers,omitempty"`
}
// Validate validates this application service create HTTP integration params body integration
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create HTTP integration params body integration based on the context it is used
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateIftttIntegrationParams creates a new ApplicationServiceCreateIftttIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateIftttIntegrationParams() *ApplicationServiceCreateIftttIntegrationParams {
return &ApplicationServiceCreateIftttIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateIftttIntegrationParamsWithTimeout creates a new ApplicationServiceCreateIftttIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateIftttIntegrationParams {
return &ApplicationServiceCreateIftttIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateIftttIntegrationParamsWithContext creates a new ApplicationServiceCreateIftttIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateIftttIntegrationParams {
return &ApplicationServiceCreateIftttIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateIftttIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateIftttIntegrationParams {
return &ApplicationServiceCreateIftttIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateIftttIntegrationParams contains all the parameters to send to the API endpoint
for the application service create ifttt integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateIftttIntegrationParams struct {
// Body.
Body ApplicationServiceCreateIftttIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateIftttIntegrationParams) WithDefaults() *ApplicationServiceCreateIftttIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateIftttIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateIftttIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateIftttIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateIftttIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) WithBody(body ApplicationServiceCreateIftttIntegrationBody) *ApplicationServiceCreateIftttIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) SetBody(body ApplicationServiceCreateIftttIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateIftttIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create ifttt integration params
func (o *ApplicationServiceCreateIftttIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,346 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateIftttIntegrationReader is a Reader for the ApplicationServiceCreateIftttIntegration structure.
type ApplicationServiceCreateIftttIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateIftttIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateIftttIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateIftttIntegrationOK creates a ApplicationServiceCreateIftttIntegrationOK with default headers values
func NewApplicationServiceCreateIftttIntegrationOK() *ApplicationServiceCreateIftttIntegrationOK {
return &ApplicationServiceCreateIftttIntegrationOK{}
}
/*
ApplicationServiceCreateIftttIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateIftttIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create ifttt integration o k response has a 2xx status code
func (o *ApplicationServiceCreateIftttIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create ifttt integration o k response has a 3xx status code
func (o *ApplicationServiceCreateIftttIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create ifttt integration o k response has a 4xx status code
func (o *ApplicationServiceCreateIftttIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create ifttt integration o k response has a 5xx status code
func (o *ApplicationServiceCreateIftttIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create ifttt integration o k response a status code equal to that given
func (o *ApplicationServiceCreateIftttIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create ifttt integration o k response
func (o *ApplicationServiceCreateIftttIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateIftttIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceCreateIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateIftttIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceCreateIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateIftttIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateIftttIntegrationDefault creates a ApplicationServiceCreateIftttIntegrationDefault with default headers values
func NewApplicationServiceCreateIftttIntegrationDefault(code int) *ApplicationServiceCreateIftttIntegrationDefault {
return &ApplicationServiceCreateIftttIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateIftttIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateIftttIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create ifttt integration default response has a 2xx status code
func (o *ApplicationServiceCreateIftttIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create ifttt integration default response has a 3xx status code
func (o *ApplicationServiceCreateIftttIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create ifttt integration default response has a 4xx status code
func (o *ApplicationServiceCreateIftttIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create ifttt integration default response has a 5xx status code
func (o *ApplicationServiceCreateIftttIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create ifttt integration default response a status code equal to that given
func (o *ApplicationServiceCreateIftttIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create ifttt integration default response
func (o *ApplicationServiceCreateIftttIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateIftttIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_CreateIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateIftttIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_CreateIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateIftttIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateIftttIntegrationBody application service create ifttt integration body
swagger:model ApplicationServiceCreateIftttIntegrationBody
*/
type ApplicationServiceCreateIftttIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create ifttt integration body
func (o *ApplicationServiceCreateIftttIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateIftttIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create ifttt integration body based on the context it is used
func (o *ApplicationServiceCreateIftttIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateIftttIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateIftttIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateIftttIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateIftttIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateIftttIntegrationParamsBodyIntegration Integration object.
swagger:model ApplicationServiceCreateIftttIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateIftttIntegrationParamsBodyIntegration struct {
// Arbitrary JSON.
// If set to true, ChirpStack events will be sent as-is as arbitrary JSON
// payload. If set to false (default), the 3 JSON values format will be used.
ArbitraryJSON bool `json:"arbitraryJson,omitempty"`
// Event prefix.
// If set, the event name will be PREFIX_EVENT. For example if event_prefix
// is set to weatherstation, and uplink event will be sent as
// weatherstation_up to the IFTTT webhook.
// Note: Only characters in the A-Z, a-z and 0-9 range are allowed.
EventPrefix string `json:"eventPrefix,omitempty"`
// Key.
// This key can be obtained from the IFTTT Webhooks documentation page.
Key string `json:"key,omitempty"`
// Values.
// Up to 2 values can be forwarded to IFTTT. These values must map to the
// decoded payload keys. For example:
// {
// "batteryLevel": 75.3,
// "buttons": [{"pressed": false}, {"pressed": true}]
// }
// You would specify the following fields:
// uplink_values = ["batteryLevel", "buttons_0_pressed"]
UplinkValues []string `json:"uplinkValues"`
}
// Validate validates this application service create ifttt integration params body integration
func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this application service create ifttt integration params body integration based on context it is used
func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateIftttIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateInfluxDbIntegrationParams creates a new ApplicationServiceCreateInfluxDbIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateInfluxDbIntegrationParams() *ApplicationServiceCreateInfluxDbIntegrationParams {
return &ApplicationServiceCreateInfluxDbIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceCreateInfluxDbIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateInfluxDbIntegrationParams {
return &ApplicationServiceCreateInfluxDbIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceCreateInfluxDbIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateInfluxDbIntegrationParams {
return &ApplicationServiceCreateInfluxDbIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateInfluxDbIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateInfluxDbIntegrationParams {
return &ApplicationServiceCreateInfluxDbIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateInfluxDbIntegrationParams contains all the parameters to send to the API endpoint
for the application service create influx db integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateInfluxDbIntegrationParams struct {
// Body.
Body ApplicationServiceCreateInfluxDbIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithBody(body ApplicationServiceCreateInfluxDbIntegrationBody) *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetBody(body ApplicationServiceCreateInfluxDbIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateInfluxDbIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create influx db integration params
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,455 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateInfluxDbIntegrationReader is a Reader for the ApplicationServiceCreateInfluxDbIntegration structure.
type ApplicationServiceCreateInfluxDbIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateInfluxDbIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateInfluxDbIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateInfluxDbIntegrationOK creates a ApplicationServiceCreateInfluxDbIntegrationOK with default headers values
func NewApplicationServiceCreateInfluxDbIntegrationOK() *ApplicationServiceCreateInfluxDbIntegrationOK {
return &ApplicationServiceCreateInfluxDbIntegrationOK{}
}
/*
ApplicationServiceCreateInfluxDbIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateInfluxDbIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create influx db integration o k response has a 2xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create influx db integration o k response has a 3xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create influx db integration o k response has a 4xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create influx db integration o k response has a 5xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create influx db integration o k response a status code equal to that given
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create influx db integration o k response
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceCreateInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceCreateInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateInfluxDbIntegrationDefault creates a ApplicationServiceCreateInfluxDbIntegrationDefault with default headers values
func NewApplicationServiceCreateInfluxDbIntegrationDefault(code int) *ApplicationServiceCreateInfluxDbIntegrationDefault {
return &ApplicationServiceCreateInfluxDbIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateInfluxDbIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateInfluxDbIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create influx db integration default response has a 2xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create influx db integration default response has a 3xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create influx db integration default response has a 4xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create influx db integration default response has a 5xx status code
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create influx db integration default response a status code equal to that given
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create influx db integration default response
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_CreateInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_CreateInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateInfluxDbIntegrationBody application service create influx db integration body
swagger:model ApplicationServiceCreateInfluxDbIntegrationBody
*/
type ApplicationServiceCreateInfluxDbIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create influx db integration body
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create influx db integration body based on the context it is used
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateInfluxDbIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateInfluxDbIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration struct {
// Bucket. (InfluxDb v2)
Bucket string `json:"bucket,omitempty"`
// InfluxDb database name. (InfluxDb v1)
Db string `json:"db,omitempty"`
// InfluxDb API write endpoint (e.g. http://localhost:8086/write).
Endpoint string `json:"endpoint,omitempty"`
// Organization. (InfluxDb v2)
Organization string `json:"organization,omitempty"`
// InfluxDb password. (InfluxDb v1)
Password string `json:"password,omitempty"`
// InfluxDb timestamp precision (InfluxDb v1).
Precision *models.APIInfluxDbPrecision `json:"precision,omitempty"`
// InfluxDb retention policy name. (InfluxDb v1)
RetentionPolicyName string `json:"retentionPolicyName,omitempty"`
// Token. (InfluxDb v2)
Token string `json:"token,omitempty"`
// InfluxDb username. (InfluxDb v1)
Username string `json:"username,omitempty"`
// InfluxDb version.
Version *models.APIInfluxDbVersion `json:"version,omitempty"`
}
// Validate validates this application service create influx db integration params body integration
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validatePrecision(formats); err != nil {
res = append(res, err)
}
if err := o.validateVersion(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) validatePrecision(formats strfmt.Registry) error {
if swag.IsZero(o.Precision) { // not required
return nil
}
if o.Precision != nil {
if err := o.Precision.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "precision")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "precision")
}
return err
}
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) validateVersion(formats strfmt.Registry) error {
if swag.IsZero(o.Version) { // not required
return nil
}
if o.Version != nil {
if err := o.Version.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "version")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "version")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create influx db integration params body integration based on the context it is used
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidatePrecision(ctx, formats); err != nil {
res = append(res, err)
}
if err := o.contextValidateVersion(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) contextValidatePrecision(ctx context.Context, formats strfmt.Registry) error {
if o.Precision != nil {
if swag.IsZero(o.Precision) { // not required
return nil
}
if err := o.Precision.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "precision")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "precision")
}
return err
}
}
return nil
}
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) contextValidateVersion(ctx context.Context, formats strfmt.Registry) error {
if o.Version != nil {
if swag.IsZero(o.Version) { // not required
return nil
}
if err := o.Version.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "version")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "version")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateMyDevicesIntegrationParams creates a new ApplicationServiceCreateMyDevicesIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateMyDevicesIntegrationParams() *ApplicationServiceCreateMyDevicesIntegrationParams {
return &ApplicationServiceCreateMyDevicesIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceCreateMyDevicesIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateMyDevicesIntegrationParams {
return &ApplicationServiceCreateMyDevicesIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceCreateMyDevicesIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateMyDevicesIntegrationParams {
return &ApplicationServiceCreateMyDevicesIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateMyDevicesIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateMyDevicesIntegrationParams {
return &ApplicationServiceCreateMyDevicesIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateMyDevicesIntegrationParams contains all the parameters to send to the API endpoint
for the application service create my devices integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateMyDevicesIntegrationParams struct {
// Body.
Body ApplicationServiceCreateMyDevicesIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithBody(body ApplicationServiceCreateMyDevicesIntegrationBody) *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetBody(body ApplicationServiceCreateMyDevicesIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateMyDevicesIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create my devices integration params
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,322 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateMyDevicesIntegrationReader is a Reader for the ApplicationServiceCreateMyDevicesIntegration structure.
type ApplicationServiceCreateMyDevicesIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateMyDevicesIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateMyDevicesIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateMyDevicesIntegrationOK creates a ApplicationServiceCreateMyDevicesIntegrationOK with default headers values
func NewApplicationServiceCreateMyDevicesIntegrationOK() *ApplicationServiceCreateMyDevicesIntegrationOK {
return &ApplicationServiceCreateMyDevicesIntegrationOK{}
}
/*
ApplicationServiceCreateMyDevicesIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateMyDevicesIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create my devices integration o k response has a 2xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create my devices integration o k response has a 3xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create my devices integration o k response has a 4xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create my devices integration o k response has a 5xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create my devices integration o k response a status code equal to that given
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create my devices integration o k response
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceCreateMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceCreateMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateMyDevicesIntegrationDefault creates a ApplicationServiceCreateMyDevicesIntegrationDefault with default headers values
func NewApplicationServiceCreateMyDevicesIntegrationDefault(code int) *ApplicationServiceCreateMyDevicesIntegrationDefault {
return &ApplicationServiceCreateMyDevicesIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateMyDevicesIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateMyDevicesIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create my devices integration default response has a 2xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create my devices integration default response has a 3xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create my devices integration default response has a 4xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create my devices integration default response has a 5xx status code
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create my devices integration default response a status code equal to that given
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create my devices integration default response
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_CreateMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_CreateMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateMyDevicesIntegrationBody application service create my devices integration body
swagger:model ApplicationServiceCreateMyDevicesIntegrationBody
*/
type ApplicationServiceCreateMyDevicesIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create my devices integration body
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create my devices integration body based on the context it is used
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateMyDevicesIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateMyDevicesIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration struct {
// myDevices API endpoint.
Endpoint string `json:"endpoint,omitempty"`
}
// Validate validates this application service create my devices integration params body integration
func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this application service create my devices integration params body integration based on context it is used
func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// NewApplicationServiceCreateParams creates a new ApplicationServiceCreateParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateParams() *ApplicationServiceCreateParams {
return &ApplicationServiceCreateParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateParamsWithTimeout creates a new ApplicationServiceCreateParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateParams {
return &ApplicationServiceCreateParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateParamsWithContext creates a new ApplicationServiceCreateParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateParamsWithContext(ctx context.Context) *ApplicationServiceCreateParams {
return &ApplicationServiceCreateParams{
Context: ctx,
}
}
// NewApplicationServiceCreateParamsWithHTTPClient creates a new ApplicationServiceCreateParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateParams {
return &ApplicationServiceCreateParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateParams contains all the parameters to send to the API endpoint
for the application service create operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateParams struct {
// Body.
Body *models.APICreateApplicationRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateParams) WithDefaults() *ApplicationServiceCreateParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create params
func (o *ApplicationServiceCreateParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create params
func (o *ApplicationServiceCreateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create params
func (o *ApplicationServiceCreateParams) WithContext(ctx context.Context) *ApplicationServiceCreateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create params
func (o *ApplicationServiceCreateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create params
func (o *ApplicationServiceCreateParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create params
func (o *ApplicationServiceCreateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create params
func (o *ApplicationServiceCreateParams) WithBody(body *models.APICreateApplicationRequest) *ApplicationServiceCreateParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create params
func (o *ApplicationServiceCreateParams) SetBody(body *models.APICreateApplicationRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreatePilotThingsIntegrationParams creates a new ApplicationServiceCreatePilotThingsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreatePilotThingsIntegrationParams() *ApplicationServiceCreatePilotThingsIntegrationParams {
return &ApplicationServiceCreatePilotThingsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreatePilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceCreatePilotThingsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreatePilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreatePilotThingsIntegrationParams {
return &ApplicationServiceCreatePilotThingsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreatePilotThingsIntegrationParamsWithContext creates a new ApplicationServiceCreatePilotThingsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreatePilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreatePilotThingsIntegrationParams {
return &ApplicationServiceCreatePilotThingsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreatePilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreatePilotThingsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreatePilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreatePilotThingsIntegrationParams {
return &ApplicationServiceCreatePilotThingsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreatePilotThingsIntegrationParams contains all the parameters to send to the API endpoint
for the application service create pilot things integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreatePilotThingsIntegrationParams struct {
// Body.
Body ApplicationServiceCreatePilotThingsIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithDefaults() *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithBody(body ApplicationServiceCreatePilotThingsIntegrationBody) *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetBody(body ApplicationServiceCreatePilotThingsIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreatePilotThingsIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create pilot things integration params
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,325 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreatePilotThingsIntegrationReader is a Reader for the ApplicationServiceCreatePilotThingsIntegration structure.
type ApplicationServiceCreatePilotThingsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreatePilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreatePilotThingsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreatePilotThingsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreatePilotThingsIntegrationOK creates a ApplicationServiceCreatePilotThingsIntegrationOK with default headers values
func NewApplicationServiceCreatePilotThingsIntegrationOK() *ApplicationServiceCreatePilotThingsIntegrationOK {
return &ApplicationServiceCreatePilotThingsIntegrationOK{}
}
/*
ApplicationServiceCreatePilotThingsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreatePilotThingsIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create pilot things integration o k response has a 2xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create pilot things integration o k response has a 3xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create pilot things integration o k response has a 4xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create pilot things integration o k response has a 5xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create pilot things integration o k response a status code equal to that given
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create pilot things integration o k response
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceCreatePilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceCreatePilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreatePilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreatePilotThingsIntegrationDefault creates a ApplicationServiceCreatePilotThingsIntegrationDefault with default headers values
func NewApplicationServiceCreatePilotThingsIntegrationDefault(code int) *ApplicationServiceCreatePilotThingsIntegrationDefault {
return &ApplicationServiceCreatePilotThingsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreatePilotThingsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreatePilotThingsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create pilot things integration default response has a 2xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create pilot things integration default response has a 3xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create pilot things integration default response has a 4xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create pilot things integration default response has a 5xx status code
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create pilot things integration default response a status code equal to that given
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create pilot things integration default response
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_CreatePilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_CreatePilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreatePilotThingsIntegrationBody application service create pilot things integration body
swagger:model ApplicationServiceCreatePilotThingsIntegrationBody
*/
type ApplicationServiceCreatePilotThingsIntegrationBody struct {
// integration
Integration *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create pilot things integration body
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create pilot things integration body based on the context it is used
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreatePilotThingsIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreatePilotThingsIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration struct {
// Server URL.
Server string `json:"server,omitempty"`
// Authentication token.
Token string `json:"token,omitempty"`
}
// Validate validates this application service create pilot things integration params body integration
func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this application service create pilot things integration params body integration based on context it is used
func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateReader is a Reader for the ApplicationServiceCreate structure.
type ApplicationServiceCreateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateOK creates a ApplicationServiceCreateOK with default headers values
func NewApplicationServiceCreateOK() *ApplicationServiceCreateOK {
return &ApplicationServiceCreateOK{}
}
/*
ApplicationServiceCreateOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateOK struct {
Payload *models.APICreateApplicationResponse
}
// IsSuccess returns true when this application service create o k response has a 2xx status code
func (o *ApplicationServiceCreateOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create o k response has a 3xx status code
func (o *ApplicationServiceCreateOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create o k response has a 4xx status code
func (o *ApplicationServiceCreateOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create o k response has a 5xx status code
func (o *ApplicationServiceCreateOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create o k response a status code equal to that given
func (o *ApplicationServiceCreateOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create o k response
func (o *ApplicationServiceCreateOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications][%d] applicationServiceCreateOK %s", 200, payload)
}
func (o *ApplicationServiceCreateOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications][%d] applicationServiceCreateOK %s", 200, payload)
}
func (o *ApplicationServiceCreateOK) GetPayload() *models.APICreateApplicationResponse {
return o.Payload
}
func (o *ApplicationServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APICreateApplicationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateDefault creates a ApplicationServiceCreateDefault with default headers values
func NewApplicationServiceCreateDefault(code int) *ApplicationServiceCreateDefault {
return &ApplicationServiceCreateDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create default response has a 2xx status code
func (o *ApplicationServiceCreateDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create default response has a 3xx status code
func (o *ApplicationServiceCreateDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create default response has a 4xx status code
func (o *ApplicationServiceCreateDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create default response has a 5xx status code
func (o *ApplicationServiceCreateDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create default response a status code equal to that given
func (o *ApplicationServiceCreateDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create default response
func (o *ApplicationServiceCreateDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications][%d] ApplicationService_Create default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications][%d] ApplicationService_Create default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceCreateThingsBoardIntegrationParams creates a new ApplicationServiceCreateThingsBoardIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceCreateThingsBoardIntegrationParams() *ApplicationServiceCreateThingsBoardIntegrationParams {
return &ApplicationServiceCreateThingsBoardIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceCreateThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceCreateThingsBoardIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceCreateThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateThingsBoardIntegrationParams {
return &ApplicationServiceCreateThingsBoardIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceCreateThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceCreateThingsBoardIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceCreateThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateThingsBoardIntegrationParams {
return &ApplicationServiceCreateThingsBoardIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceCreateThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateThingsBoardIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceCreateThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateThingsBoardIntegrationParams {
return &ApplicationServiceCreateThingsBoardIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceCreateThingsBoardIntegrationParams contains all the parameters to send to the API endpoint
for the application service create things board integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceCreateThingsBoardIntegrationParams struct {
// Body.
Body ApplicationServiceCreateThingsBoardIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service create things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service create things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithBody(body ApplicationServiceCreateThingsBoardIntegrationBody) *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetBody(body ApplicationServiceCreateThingsBoardIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateThingsBoardIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service create things board integration params
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,322 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceCreateThingsBoardIntegrationReader is a Reader for the ApplicationServiceCreateThingsBoardIntegration structure.
type ApplicationServiceCreateThingsBoardIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceCreateThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceCreateThingsBoardIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceCreateThingsBoardIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceCreateThingsBoardIntegrationOK creates a ApplicationServiceCreateThingsBoardIntegrationOK with default headers values
func NewApplicationServiceCreateThingsBoardIntegrationOK() *ApplicationServiceCreateThingsBoardIntegrationOK {
return &ApplicationServiceCreateThingsBoardIntegrationOK{}
}
/*
ApplicationServiceCreateThingsBoardIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceCreateThingsBoardIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service create things board integration o k response has a 2xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service create things board integration o k response has a 3xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service create things board integration o k response has a 4xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service create things board integration o k response has a 5xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service create things board integration o k response a status code equal to that given
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service create things board integration o k response
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceCreateThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceCreateThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceCreateThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceCreateThingsBoardIntegrationDefault creates a ApplicationServiceCreateThingsBoardIntegrationDefault with default headers values
func NewApplicationServiceCreateThingsBoardIntegrationDefault(code int) *ApplicationServiceCreateThingsBoardIntegrationDefault {
return &ApplicationServiceCreateThingsBoardIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceCreateThingsBoardIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceCreateThingsBoardIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service create things board integration default response has a 2xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service create things board integration default response has a 3xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service create things board integration default response has a 4xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service create things board integration default response has a 5xx status code
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service create things board integration default response a status code equal to that given
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service create things board integration default response
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_CreateThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_CreateThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceCreateThingsBoardIntegrationBody application service create things board integration body
swagger:model ApplicationServiceCreateThingsBoardIntegrationBody
*/
type ApplicationServiceCreateThingsBoardIntegrationBody struct {
// integration
Integration *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service create things board integration body
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service create things board integration body based on the context it is used
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateThingsBoardIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateThingsBoardIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration
*/
type ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration struct {
// ThingsBoard server endpoint, e.g. https://example.com
Server string `json:"server,omitempty"`
}
// Validate validates this application service create things board integration params body integration
func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this application service create things board integration params body integration based on context it is used
func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteAwsSnsIntegrationParams creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteAwsSnsIntegrationParams() *ApplicationServiceDeleteAwsSnsIntegrationParams {
return &ApplicationServiceDeleteAwsSnsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteAwsSnsIntegrationParams {
return &ApplicationServiceDeleteAwsSnsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteAwsSnsIntegrationParams {
return &ApplicationServiceDeleteAwsSnsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteAwsSnsIntegrationParams {
return &ApplicationServiceDeleteAwsSnsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteAwsSnsIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete aws sns integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteAwsSnsIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceDeleteAwsSnsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteAwsSnsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteAwsSnsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteAwsSnsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteAwsSnsIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete aws sns integration params
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteAwsSnsIntegrationReader is a Reader for the ApplicationServiceDeleteAwsSnsIntegration structure.
type ApplicationServiceDeleteAwsSnsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteAwsSnsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteAwsSnsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteAwsSnsIntegrationOK creates a ApplicationServiceDeleteAwsSnsIntegrationOK with default headers values
func NewApplicationServiceDeleteAwsSnsIntegrationOK() *ApplicationServiceDeleteAwsSnsIntegrationOK {
return &ApplicationServiceDeleteAwsSnsIntegrationOK{}
}
/*
ApplicationServiceDeleteAwsSnsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteAwsSnsIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete aws sns integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete aws sns integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete aws sns integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete aws sns integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete aws sns integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete aws sns integration o k response
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceDeleteAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceDeleteAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteAwsSnsIntegrationDefault creates a ApplicationServiceDeleteAwsSnsIntegrationDefault with default headers values
func NewApplicationServiceDeleteAwsSnsIntegrationDefault(code int) *ApplicationServiceDeleteAwsSnsIntegrationDefault {
return &ApplicationServiceDeleteAwsSnsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteAwsSnsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteAwsSnsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete aws sns integration default response has a 2xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete aws sns integration default response has a 3xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete aws sns integration default response has a 4xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete aws sns integration default response has a 5xx status code
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete aws sns integration default response a status code equal to that given
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete aws sns integration default response
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_DeleteAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_DeleteAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteAzureServiceBusIntegrationParams creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteAzureServiceBusIntegrationParams() *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete azure service bus integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteAzureServiceBusIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteAzureServiceBusIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete azure service bus integration params
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceDeleteAzureServiceBusIntegration structure.
type ApplicationServiceDeleteAzureServiceBusIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteAzureServiceBusIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteAzureServiceBusIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteAzureServiceBusIntegrationOK creates a ApplicationServiceDeleteAzureServiceBusIntegrationOK with default headers values
func NewApplicationServiceDeleteAzureServiceBusIntegrationOK() *ApplicationServiceDeleteAzureServiceBusIntegrationOK {
return &ApplicationServiceDeleteAzureServiceBusIntegrationOK{}
}
/*
ApplicationServiceDeleteAzureServiceBusIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteAzureServiceBusIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete azure service bus integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete azure service bus integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete azure service bus integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete azure service bus integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete azure service bus integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete azure service bus integration o k response
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceDeleteAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceDeleteAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteAzureServiceBusIntegrationDefault creates a ApplicationServiceDeleteAzureServiceBusIntegrationDefault with default headers values
func NewApplicationServiceDeleteAzureServiceBusIntegrationDefault(code int) *ApplicationServiceDeleteAzureServiceBusIntegrationDefault {
return &ApplicationServiceDeleteAzureServiceBusIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteAzureServiceBusIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete azure service bus integration default response has a 2xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete azure service bus integration default response has a 3xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete azure service bus integration default response has a 4xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete azure service bus integration default response has a 5xx status code
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete azure service bus integration default response a status code equal to that given
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete azure service bus integration default response
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_DeleteAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_DeleteAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteGcpPubSubIntegrationParams creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteGcpPubSubIntegrationParams() *ApplicationServiceDeleteGcpPubSubIntegrationParams {
return &ApplicationServiceDeleteGcpPubSubIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
return &ApplicationServiceDeleteGcpPubSubIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
return &ApplicationServiceDeleteGcpPubSubIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
return &ApplicationServiceDeleteGcpPubSubIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete gcp pub sub integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteGcpPubSubIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceDeleteGcpPubSubIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteGcpPubSubIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete gcp pub sub integration params
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteGcpPubSubIntegrationReader is a Reader for the ApplicationServiceDeleteGcpPubSubIntegration structure.
type ApplicationServiceDeleteGcpPubSubIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteGcpPubSubIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteGcpPubSubIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteGcpPubSubIntegrationOK creates a ApplicationServiceDeleteGcpPubSubIntegrationOK with default headers values
func NewApplicationServiceDeleteGcpPubSubIntegrationOK() *ApplicationServiceDeleteGcpPubSubIntegrationOK {
return &ApplicationServiceDeleteGcpPubSubIntegrationOK{}
}
/*
ApplicationServiceDeleteGcpPubSubIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteGcpPubSubIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete gcp pub sub integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete gcp pub sub integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete gcp pub sub integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete gcp pub sub integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete gcp pub sub integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete gcp pub sub integration o k response
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceDeleteGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceDeleteGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteGcpPubSubIntegrationDefault creates a ApplicationServiceDeleteGcpPubSubIntegrationDefault with default headers values
func NewApplicationServiceDeleteGcpPubSubIntegrationDefault(code int) *ApplicationServiceDeleteGcpPubSubIntegrationDefault {
return &ApplicationServiceDeleteGcpPubSubIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteGcpPubSubIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteGcpPubSubIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete gcp pub sub integration default response has a 2xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete gcp pub sub integration default response has a 3xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete gcp pub sub integration default response has a 4xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete gcp pub sub integration default response has a 5xx status code
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete gcp pub sub integration default response a status code equal to that given
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete gcp pub sub integration default response
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_DeleteGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_DeleteGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteHTTPIntegrationParams creates a new ApplicationServiceDeleteHTTPIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteHTTPIntegrationParams() *ApplicationServiceDeleteHTTPIntegrationParams {
return &ApplicationServiceDeleteHTTPIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteHTTPIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteHTTPIntegrationParams {
return &ApplicationServiceDeleteHTTPIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteHTTPIntegrationParamsWithContext creates a new ApplicationServiceDeleteHTTPIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteHTTPIntegrationParams {
return &ApplicationServiceDeleteHTTPIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteHTTPIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteHTTPIntegrationParams {
return &ApplicationServiceDeleteHTTPIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteHTTPIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete Http integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteHTTPIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithDefaults() *ApplicationServiceDeleteHTTPIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteHTTPIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteHTTPIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteHTTPIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteHTTPIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete Http integration params
func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteHTTPIntegrationReader is a Reader for the ApplicationServiceDeleteHTTPIntegration structure.
type ApplicationServiceDeleteHTTPIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteHTTPIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteHTTPIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteHTTPIntegrationOK creates a ApplicationServiceDeleteHTTPIntegrationOK with default headers values
func NewApplicationServiceDeleteHTTPIntegrationOK() *ApplicationServiceDeleteHTTPIntegrationOK {
return &ApplicationServiceDeleteHTTPIntegrationOK{}
}
/*
ApplicationServiceDeleteHTTPIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteHTTPIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete Http integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete Http integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete Http integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete Http integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete Http integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete Http integration o k response
func (o *ApplicationServiceDeleteHTTPIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteHTTPIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] applicationServiceDeleteHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteHTTPIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] applicationServiceDeleteHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteHTTPIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteHTTPIntegrationDefault creates a ApplicationServiceDeleteHTTPIntegrationDefault with default headers values
func NewApplicationServiceDeleteHTTPIntegrationDefault(code int) *ApplicationServiceDeleteHTTPIntegrationDefault {
return &ApplicationServiceDeleteHTTPIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteHTTPIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteHTTPIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete Http integration default response has a 2xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete Http integration default response has a 3xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete Http integration default response has a 4xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete Http integration default response has a 5xx status code
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete Http integration default response a status code equal to that given
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete Http integration default response
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] ApplicationService_DeleteHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] ApplicationService_DeleteHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteIftttIntegrationParams creates a new ApplicationServiceDeleteIftttIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteIftttIntegrationParams() *ApplicationServiceDeleteIftttIntegrationParams {
return &ApplicationServiceDeleteIftttIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteIftttIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteIftttIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteIftttIntegrationParams {
return &ApplicationServiceDeleteIftttIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteIftttIntegrationParamsWithContext creates a new ApplicationServiceDeleteIftttIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteIftttIntegrationParams {
return &ApplicationServiceDeleteIftttIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteIftttIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteIftttIntegrationParams {
return &ApplicationServiceDeleteIftttIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteIftttIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete ifttt integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteIftttIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteIftttIntegrationParams) WithDefaults() *ApplicationServiceDeleteIftttIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteIftttIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteIftttIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteIftttIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteIftttIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteIftttIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete ifttt integration params
func (o *ApplicationServiceDeleteIftttIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteIftttIntegrationReader is a Reader for the ApplicationServiceDeleteIftttIntegration structure.
type ApplicationServiceDeleteIftttIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteIftttIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteIftttIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteIftttIntegrationOK creates a ApplicationServiceDeleteIftttIntegrationOK with default headers values
func NewApplicationServiceDeleteIftttIntegrationOK() *ApplicationServiceDeleteIftttIntegrationOK {
return &ApplicationServiceDeleteIftttIntegrationOK{}
}
/*
ApplicationServiceDeleteIftttIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteIftttIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete ifttt integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteIftttIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete ifttt integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteIftttIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete ifttt integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteIftttIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete ifttt integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteIftttIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete ifttt integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteIftttIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete ifttt integration o k response
func (o *ApplicationServiceDeleteIftttIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteIftttIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceDeleteIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteIftttIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceDeleteIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteIftttIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteIftttIntegrationDefault creates a ApplicationServiceDeleteIftttIntegrationDefault with default headers values
func NewApplicationServiceDeleteIftttIntegrationDefault(code int) *ApplicationServiceDeleteIftttIntegrationDefault {
return &ApplicationServiceDeleteIftttIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteIftttIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteIftttIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete ifttt integration default response has a 2xx status code
func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete ifttt integration default response has a 3xx status code
func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete ifttt integration default response has a 4xx status code
func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete ifttt integration default response has a 5xx status code
func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete ifttt integration default response a status code equal to that given
func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete ifttt integration default response
func (o *ApplicationServiceDeleteIftttIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteIftttIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_DeleteIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteIftttIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_DeleteIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteIftttIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteInfluxDbIntegrationParams creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteInfluxDbIntegrationParams() *ApplicationServiceDeleteInfluxDbIntegrationParams {
return &ApplicationServiceDeleteInfluxDbIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteInfluxDbIntegrationParams {
return &ApplicationServiceDeleteInfluxDbIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteInfluxDbIntegrationParams {
return &ApplicationServiceDeleteInfluxDbIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteInfluxDbIntegrationParams {
return &ApplicationServiceDeleteInfluxDbIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteInfluxDbIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete influx db integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteInfluxDbIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceDeleteInfluxDbIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteInfluxDbIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteInfluxDbIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteInfluxDbIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteInfluxDbIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete influx db integration params
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteInfluxDbIntegrationReader is a Reader for the ApplicationServiceDeleteInfluxDbIntegration structure.
type ApplicationServiceDeleteInfluxDbIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteInfluxDbIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteInfluxDbIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteInfluxDbIntegrationOK creates a ApplicationServiceDeleteInfluxDbIntegrationOK with default headers values
func NewApplicationServiceDeleteInfluxDbIntegrationOK() *ApplicationServiceDeleteInfluxDbIntegrationOK {
return &ApplicationServiceDeleteInfluxDbIntegrationOK{}
}
/*
ApplicationServiceDeleteInfluxDbIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteInfluxDbIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete influx db integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete influx db integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete influx db integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete influx db integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete influx db integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete influx db integration o k response
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceDeleteInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceDeleteInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteInfluxDbIntegrationDefault creates a ApplicationServiceDeleteInfluxDbIntegrationDefault with default headers values
func NewApplicationServiceDeleteInfluxDbIntegrationDefault(code int) *ApplicationServiceDeleteInfluxDbIntegrationDefault {
return &ApplicationServiceDeleteInfluxDbIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteInfluxDbIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteInfluxDbIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete influx db integration default response has a 2xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete influx db integration default response has a 3xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete influx db integration default response has a 4xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete influx db integration default response has a 5xx status code
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete influx db integration default response a status code equal to that given
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete influx db integration default response
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_DeleteInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_DeleteInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteMyDevicesIntegrationParams creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteMyDevicesIntegrationParams() *ApplicationServiceDeleteMyDevicesIntegrationParams {
return &ApplicationServiceDeleteMyDevicesIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteMyDevicesIntegrationParams {
return &ApplicationServiceDeleteMyDevicesIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteMyDevicesIntegrationParams {
return &ApplicationServiceDeleteMyDevicesIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteMyDevicesIntegrationParams {
return &ApplicationServiceDeleteMyDevicesIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteMyDevicesIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete my devices integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteMyDevicesIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceDeleteMyDevicesIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteMyDevicesIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteMyDevicesIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteMyDevicesIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteMyDevicesIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete my devices integration params
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteMyDevicesIntegrationReader is a Reader for the ApplicationServiceDeleteMyDevicesIntegration structure.
type ApplicationServiceDeleteMyDevicesIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteMyDevicesIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteMyDevicesIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteMyDevicesIntegrationOK creates a ApplicationServiceDeleteMyDevicesIntegrationOK with default headers values
func NewApplicationServiceDeleteMyDevicesIntegrationOK() *ApplicationServiceDeleteMyDevicesIntegrationOK {
return &ApplicationServiceDeleteMyDevicesIntegrationOK{}
}
/*
ApplicationServiceDeleteMyDevicesIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteMyDevicesIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete my devices integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete my devices integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete my devices integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete my devices integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete my devices integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete my devices integration o k response
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceDeleteMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceDeleteMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteMyDevicesIntegrationDefault creates a ApplicationServiceDeleteMyDevicesIntegrationDefault with default headers values
func NewApplicationServiceDeleteMyDevicesIntegrationDefault(code int) *ApplicationServiceDeleteMyDevicesIntegrationDefault {
return &ApplicationServiceDeleteMyDevicesIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteMyDevicesIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteMyDevicesIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete my devices integration default response has a 2xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete my devices integration default response has a 3xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete my devices integration default response has a 4xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete my devices integration default response has a 5xx status code
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete my devices integration default response a status code equal to that given
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete my devices integration default response
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_DeleteMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_DeleteMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteParams creates a new ApplicationServiceDeleteParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteParams() *ApplicationServiceDeleteParams {
return &ApplicationServiceDeleteParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteParamsWithTimeout creates a new ApplicationServiceDeleteParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteParams {
return &ApplicationServiceDeleteParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteParamsWithContext creates a new ApplicationServiceDeleteParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteParamsWithContext(ctx context.Context) *ApplicationServiceDeleteParams {
return &ApplicationServiceDeleteParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteParamsWithHTTPClient creates a new ApplicationServiceDeleteParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteParams {
return &ApplicationServiceDeleteParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteParams contains all the parameters to send to the API endpoint
for the application service delete operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteParams struct {
/* ID.
Application ID (UUID).
*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteParams) WithDefaults() *ApplicationServiceDeleteParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete params
func (o *ApplicationServiceDeleteParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete params
func (o *ApplicationServiceDeleteParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete params
func (o *ApplicationServiceDeleteParams) WithContext(ctx context.Context) *ApplicationServiceDeleteParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete params
func (o *ApplicationServiceDeleteParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete params
func (o *ApplicationServiceDeleteParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete params
func (o *ApplicationServiceDeleteParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the application service delete params
func (o *ApplicationServiceDeleteParams) WithID(id string) *ApplicationServiceDeleteParams {
o.SetID(id)
return o
}
// SetID adds the id to the application service delete params
func (o *ApplicationServiceDeleteParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeletePilotThingsIntegrationParams creates a new ApplicationServiceDeletePilotThingsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeletePilotThingsIntegrationParams() *ApplicationServiceDeletePilotThingsIntegrationParams {
return &ApplicationServiceDeletePilotThingsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeletePilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceDeletePilotThingsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeletePilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeletePilotThingsIntegrationParams {
return &ApplicationServiceDeletePilotThingsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeletePilotThingsIntegrationParamsWithContext creates a new ApplicationServiceDeletePilotThingsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeletePilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeletePilotThingsIntegrationParams {
return &ApplicationServiceDeletePilotThingsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeletePilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeletePilotThingsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeletePilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeletePilotThingsIntegrationParams {
return &ApplicationServiceDeletePilotThingsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeletePilotThingsIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete pilot things integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeletePilotThingsIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithDefaults() *ApplicationServiceDeletePilotThingsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeletePilotThingsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeletePilotThingsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeletePilotThingsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeletePilotThingsIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete pilot things integration params
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeletePilotThingsIntegrationReader is a Reader for the ApplicationServiceDeletePilotThingsIntegration structure.
type ApplicationServiceDeletePilotThingsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeletePilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeletePilotThingsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeletePilotThingsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeletePilotThingsIntegrationOK creates a ApplicationServiceDeletePilotThingsIntegrationOK with default headers values
func NewApplicationServiceDeletePilotThingsIntegrationOK() *ApplicationServiceDeletePilotThingsIntegrationOK {
return &ApplicationServiceDeletePilotThingsIntegrationOK{}
}
/*
ApplicationServiceDeletePilotThingsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeletePilotThingsIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete pilot things integration o k response has a 2xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete pilot things integration o k response has a 3xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete pilot things integration o k response has a 4xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete pilot things integration o k response has a 5xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete pilot things integration o k response a status code equal to that given
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete pilot things integration o k response
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceDeletePilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceDeletePilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeletePilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeletePilotThingsIntegrationDefault creates a ApplicationServiceDeletePilotThingsIntegrationDefault with default headers values
func NewApplicationServiceDeletePilotThingsIntegrationDefault(code int) *ApplicationServiceDeletePilotThingsIntegrationDefault {
return &ApplicationServiceDeletePilotThingsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeletePilotThingsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeletePilotThingsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete pilot things integration default response has a 2xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete pilot things integration default response has a 3xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete pilot things integration default response has a 4xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete pilot things integration default response has a 5xx status code
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete pilot things integration default response a status code equal to that given
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete pilot things integration default response
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_DeletePilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_DeletePilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteReader is a Reader for the ApplicationServiceDelete structure.
type ApplicationServiceDeleteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteOK creates a ApplicationServiceDeleteOK with default headers values
func NewApplicationServiceDeleteOK() *ApplicationServiceDeleteOK {
return &ApplicationServiceDeleteOK{}
}
/*
ApplicationServiceDeleteOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete o k response has a 2xx status code
func (o *ApplicationServiceDeleteOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete o k response has a 3xx status code
func (o *ApplicationServiceDeleteOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete o k response has a 4xx status code
func (o *ApplicationServiceDeleteOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete o k response has a 5xx status code
func (o *ApplicationServiceDeleteOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete o k response a status code equal to that given
func (o *ApplicationServiceDeleteOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete o k response
func (o *ApplicationServiceDeleteOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{id}][%d] applicationServiceDeleteOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{id}][%d] applicationServiceDeleteOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteDefault creates a ApplicationServiceDeleteDefault with default headers values
func NewApplicationServiceDeleteDefault(code int) *ApplicationServiceDeleteDefault {
return &ApplicationServiceDeleteDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete default response has a 2xx status code
func (o *ApplicationServiceDeleteDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete default response has a 3xx status code
func (o *ApplicationServiceDeleteDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete default response has a 4xx status code
func (o *ApplicationServiceDeleteDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete default response has a 5xx status code
func (o *ApplicationServiceDeleteDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete default response a status code equal to that given
func (o *ApplicationServiceDeleteDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete default response
func (o *ApplicationServiceDeleteDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{id}][%d] ApplicationService_Delete default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{id}][%d] ApplicationService_Delete default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceDeleteThingsBoardIntegrationParams creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceDeleteThingsBoardIntegrationParams() *ApplicationServiceDeleteThingsBoardIntegrationParams {
return &ApplicationServiceDeleteThingsBoardIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteThingsBoardIntegrationParams {
return &ApplicationServiceDeleteThingsBoardIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteThingsBoardIntegrationParams {
return &ApplicationServiceDeleteThingsBoardIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteThingsBoardIntegrationParams {
return &ApplicationServiceDeleteThingsBoardIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceDeleteThingsBoardIntegrationParams contains all the parameters to send to the API endpoint
for the application service delete things board integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceDeleteThingsBoardIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service delete things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceDeleteThingsBoardIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service delete things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteThingsBoardIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteThingsBoardIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteThingsBoardIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteThingsBoardIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service delete things board integration params
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceDeleteThingsBoardIntegrationReader is a Reader for the ApplicationServiceDeleteThingsBoardIntegration structure.
type ApplicationServiceDeleteThingsBoardIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceDeleteThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceDeleteThingsBoardIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceDeleteThingsBoardIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceDeleteThingsBoardIntegrationOK creates a ApplicationServiceDeleteThingsBoardIntegrationOK with default headers values
func NewApplicationServiceDeleteThingsBoardIntegrationOK() *ApplicationServiceDeleteThingsBoardIntegrationOK {
return &ApplicationServiceDeleteThingsBoardIntegrationOK{}
}
/*
ApplicationServiceDeleteThingsBoardIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceDeleteThingsBoardIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service delete things board integration o k response has a 2xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service delete things board integration o k response has a 3xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service delete things board integration o k response has a 4xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service delete things board integration o k response has a 5xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service delete things board integration o k response a status code equal to that given
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service delete things board integration o k response
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceDeleteThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceDeleteThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceDeleteThingsBoardIntegrationDefault creates a ApplicationServiceDeleteThingsBoardIntegrationDefault with default headers values
func NewApplicationServiceDeleteThingsBoardIntegrationDefault(code int) *ApplicationServiceDeleteThingsBoardIntegrationDefault {
return &ApplicationServiceDeleteThingsBoardIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceDeleteThingsBoardIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceDeleteThingsBoardIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service delete things board integration default response has a 2xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service delete things board integration default response has a 3xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service delete things board integration default response has a 4xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service delete things board integration default response has a 5xx status code
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service delete things board integration default response a status code equal to that given
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service delete things board integration default response
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_DeleteThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_DeleteThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGenerateMqttIntegrationClientCertificateParams creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGenerateMqttIntegrationClientCertificateParams() *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithTimeout creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithTimeout(timeout time.Duration) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{
timeout: timeout,
}
}
// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithContext creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object
// with the ability to set a context for a request.
func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithContext(ctx context.Context) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{
Context: ctx,
}
}
// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithHTTPClient creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithHTTPClient(client *http.Client) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGenerateMqttIntegrationClientCertificateParams contains all the parameters to send to the API endpoint
for the application service generate mqtt integration client certificate operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGenerateMqttIntegrationClientCertificateParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service generate mqtt integration client certificate params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithDefaults() *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service generate mqtt integration client certificate params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithTimeout(timeout time.Duration) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithContext(ctx context.Context) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithHTTPClient(client *http.Client) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithApplicationID(applicationID string) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service generate mqtt integration client certificate params
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGenerateMqttIntegrationClientCertificateReader is a Reader for the ApplicationServiceGenerateMqttIntegrationClientCertificate structure.
type ApplicationServiceGenerateMqttIntegrationClientCertificateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGenerateMqttIntegrationClientCertificateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGenerateMqttIntegrationClientCertificateOK creates a ApplicationServiceGenerateMqttIntegrationClientCertificateOK with default headers values
func NewApplicationServiceGenerateMqttIntegrationClientCertificateOK() *ApplicationServiceGenerateMqttIntegrationClientCertificateOK {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateOK{}
}
/*
ApplicationServiceGenerateMqttIntegrationClientCertificateOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGenerateMqttIntegrationClientCertificateOK struct {
Payload *models.APIGenerateMqttIntegrationClientCertificateResponse
}
// IsSuccess returns true when this application service generate mqtt integration client certificate o k response has a 2xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service generate mqtt integration client certificate o k response has a 3xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service generate mqtt integration client certificate o k response has a 4xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service generate mqtt integration client certificate o k response has a 5xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service generate mqtt integration client certificate o k response a status code equal to that given
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service generate mqtt integration client certificate o k response
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) Code() int {
return 200
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] applicationServiceGenerateMqttIntegrationClientCertificateOK %s", 200, payload)
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] applicationServiceGenerateMqttIntegrationClientCertificateOK %s", 200, payload)
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) GetPayload() *models.APIGenerateMqttIntegrationClientCertificateResponse {
return o.Payload
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGenerateMqttIntegrationClientCertificateResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault creates a ApplicationServiceGenerateMqttIntegrationClientCertificateDefault with default headers values
func NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault(code int) *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault {
return &ApplicationServiceGenerateMqttIntegrationClientCertificateDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGenerateMqttIntegrationClientCertificateDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGenerateMqttIntegrationClientCertificateDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service generate mqtt integration client certificate default response has a 2xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service generate mqtt integration client certificate default response has a 3xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service generate mqtt integration client certificate default response has a 4xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service generate mqtt integration client certificate default response has a 5xx status code
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service generate mqtt integration client certificate default response a status code equal to that given
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service generate mqtt integration client certificate default response
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] ApplicationService_GenerateMqttIntegrationClientCertificate default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] ApplicationService_GenerateMqttIntegrationClientCertificate default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetAwsSnsIntegrationParams creates a new ApplicationServiceGetAwsSnsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetAwsSnsIntegrationParams() *ApplicationServiceGetAwsSnsIntegrationParams {
return &ApplicationServiceGetAwsSnsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceGetAwsSnsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetAwsSnsIntegrationParams {
return &ApplicationServiceGetAwsSnsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceGetAwsSnsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetAwsSnsIntegrationParams {
return &ApplicationServiceGetAwsSnsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetAwsSnsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetAwsSnsIntegrationParams {
return &ApplicationServiceGetAwsSnsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetAwsSnsIntegrationParams contains all the parameters to send to the API endpoint
for the application service get aws sns integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetAwsSnsIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceGetAwsSnsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetAwsSnsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetAwsSnsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetAwsSnsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetAwsSnsIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get aws sns integration params
func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetAwsSnsIntegrationReader is a Reader for the ApplicationServiceGetAwsSnsIntegration structure.
type ApplicationServiceGetAwsSnsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetAwsSnsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetAwsSnsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetAwsSnsIntegrationOK creates a ApplicationServiceGetAwsSnsIntegrationOK with default headers values
func NewApplicationServiceGetAwsSnsIntegrationOK() *ApplicationServiceGetAwsSnsIntegrationOK {
return &ApplicationServiceGetAwsSnsIntegrationOK{}
}
/*
ApplicationServiceGetAwsSnsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetAwsSnsIntegrationOK struct {
Payload *models.APIGetAwsSnsIntegrationResponse
}
// IsSuccess returns true when this application service get aws sns integration o k response has a 2xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get aws sns integration o k response has a 3xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get aws sns integration o k response has a 4xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get aws sns integration o k response has a 5xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get aws sns integration o k response a status code equal to that given
func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get aws sns integration o k response
func (o *ApplicationServiceGetAwsSnsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetAwsSnsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceGetAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetAwsSnsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceGetAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetAwsSnsIntegrationOK) GetPayload() *models.APIGetAwsSnsIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetAwsSnsIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetAwsSnsIntegrationDefault creates a ApplicationServiceGetAwsSnsIntegrationDefault with default headers values
func NewApplicationServiceGetAwsSnsIntegrationDefault(code int) *ApplicationServiceGetAwsSnsIntegrationDefault {
return &ApplicationServiceGetAwsSnsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetAwsSnsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetAwsSnsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get aws sns integration default response has a 2xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get aws sns integration default response has a 3xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get aws sns integration default response has a 4xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get aws sns integration default response has a 5xx status code
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get aws sns integration default response a status code equal to that given
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get aws sns integration default response
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_GetAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_GetAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetAzureServiceBusIntegrationParams creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetAzureServiceBusIntegrationParams() *ApplicationServiceGetAzureServiceBusIntegrationParams {
return &ApplicationServiceGetAzureServiceBusIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetAzureServiceBusIntegrationParams {
return &ApplicationServiceGetAzureServiceBusIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetAzureServiceBusIntegrationParams {
return &ApplicationServiceGetAzureServiceBusIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetAzureServiceBusIntegrationParams {
return &ApplicationServiceGetAzureServiceBusIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint
for the application service get azure service bus integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetAzureServiceBusIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceGetAzureServiceBusIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetAzureServiceBusIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetAzureServiceBusIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetAzureServiceBusIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetAzureServiceBusIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get azure service bus integration params
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceGetAzureServiceBusIntegration structure.
type ApplicationServiceGetAzureServiceBusIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetAzureServiceBusIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetAzureServiceBusIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetAzureServiceBusIntegrationOK creates a ApplicationServiceGetAzureServiceBusIntegrationOK with default headers values
func NewApplicationServiceGetAzureServiceBusIntegrationOK() *ApplicationServiceGetAzureServiceBusIntegrationOK {
return &ApplicationServiceGetAzureServiceBusIntegrationOK{}
}
/*
ApplicationServiceGetAzureServiceBusIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetAzureServiceBusIntegrationOK struct {
Payload *models.APIGetAzureServiceBusIntegrationResponse
}
// IsSuccess returns true when this application service get azure service bus integration o k response has a 2xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get azure service bus integration o k response has a 3xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get azure service bus integration o k response has a 4xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get azure service bus integration o k response has a 5xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get azure service bus integration o k response a status code equal to that given
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get azure service bus integration o k response
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceGetAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceGetAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) GetPayload() *models.APIGetAzureServiceBusIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetAzureServiceBusIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetAzureServiceBusIntegrationDefault creates a ApplicationServiceGetAzureServiceBusIntegrationDefault with default headers values
func NewApplicationServiceGetAzureServiceBusIntegrationDefault(code int) *ApplicationServiceGetAzureServiceBusIntegrationDefault {
return &ApplicationServiceGetAzureServiceBusIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetAzureServiceBusIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get azure service bus integration default response has a 2xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get azure service bus integration default response has a 3xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get azure service bus integration default response has a 4xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get azure service bus integration default response has a 5xx status code
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get azure service bus integration default response a status code equal to that given
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get azure service bus integration default response
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_GetAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_GetAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetGcpPubSubIntegrationParams creates a new ApplicationServiceGetGcpPubSubIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetGcpPubSubIntegrationParams() *ApplicationServiceGetGcpPubSubIntegrationParams {
return &ApplicationServiceGetGcpPubSubIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceGetGcpPubSubIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetGcpPubSubIntegrationParams {
return &ApplicationServiceGetGcpPubSubIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceGetGcpPubSubIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetGcpPubSubIntegrationParams {
return &ApplicationServiceGetGcpPubSubIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetGcpPubSubIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetGcpPubSubIntegrationParams {
return &ApplicationServiceGetGcpPubSubIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint
for the application service get gcp pub sub integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetGcpPubSubIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceGetGcpPubSubIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetGcpPubSubIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetGcpPubSubIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetGcpPubSubIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetGcpPubSubIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get gcp pub sub integration params
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetGcpPubSubIntegrationReader is a Reader for the ApplicationServiceGetGcpPubSubIntegration structure.
type ApplicationServiceGetGcpPubSubIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetGcpPubSubIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetGcpPubSubIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetGcpPubSubIntegrationOK creates a ApplicationServiceGetGcpPubSubIntegrationOK with default headers values
func NewApplicationServiceGetGcpPubSubIntegrationOK() *ApplicationServiceGetGcpPubSubIntegrationOK {
return &ApplicationServiceGetGcpPubSubIntegrationOK{}
}
/*
ApplicationServiceGetGcpPubSubIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetGcpPubSubIntegrationOK struct {
Payload *models.APIGetGcpPubSubIntegrationResponse
}
// IsSuccess returns true when this application service get gcp pub sub integration o k response has a 2xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get gcp pub sub integration o k response has a 3xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get gcp pub sub integration o k response has a 4xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get gcp pub sub integration o k response has a 5xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get gcp pub sub integration o k response a status code equal to that given
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get gcp pub sub integration o k response
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceGetGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceGetGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) GetPayload() *models.APIGetGcpPubSubIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetGcpPubSubIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetGcpPubSubIntegrationDefault creates a ApplicationServiceGetGcpPubSubIntegrationDefault with default headers values
func NewApplicationServiceGetGcpPubSubIntegrationDefault(code int) *ApplicationServiceGetGcpPubSubIntegrationDefault {
return &ApplicationServiceGetGcpPubSubIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetGcpPubSubIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetGcpPubSubIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get gcp pub sub integration default response has a 2xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get gcp pub sub integration default response has a 3xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get gcp pub sub integration default response has a 4xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get gcp pub sub integration default response has a 5xx status code
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get gcp pub sub integration default response a status code equal to that given
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get gcp pub sub integration default response
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_GetGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_GetGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetHTTPIntegrationParams creates a new ApplicationServiceGetHTTPIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetHTTPIntegrationParams() *ApplicationServiceGetHTTPIntegrationParams {
return &ApplicationServiceGetHTTPIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceGetHTTPIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetHTTPIntegrationParams {
return &ApplicationServiceGetHTTPIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetHTTPIntegrationParamsWithContext creates a new ApplicationServiceGetHTTPIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetHTTPIntegrationParams {
return &ApplicationServiceGetHTTPIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetHTTPIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetHTTPIntegrationParams {
return &ApplicationServiceGetHTTPIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetHTTPIntegrationParams contains all the parameters to send to the API endpoint
for the application service get Http integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetHTTPIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetHTTPIntegrationParams) WithDefaults() *ApplicationServiceGetHTTPIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetHTTPIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetHTTPIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetHTTPIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetHTTPIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetHTTPIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get Http integration params
func (o *ApplicationServiceGetHTTPIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetHTTPIntegrationReader is a Reader for the ApplicationServiceGetHTTPIntegration structure.
type ApplicationServiceGetHTTPIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetHTTPIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetHTTPIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetHTTPIntegrationOK creates a ApplicationServiceGetHTTPIntegrationOK with default headers values
func NewApplicationServiceGetHTTPIntegrationOK() *ApplicationServiceGetHTTPIntegrationOK {
return &ApplicationServiceGetHTTPIntegrationOK{}
}
/*
ApplicationServiceGetHTTPIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetHTTPIntegrationOK struct {
Payload *models.APIGetHTTPIntegrationResponse
}
// IsSuccess returns true when this application service get Http integration o k response has a 2xx status code
func (o *ApplicationServiceGetHTTPIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get Http integration o k response has a 3xx status code
func (o *ApplicationServiceGetHTTPIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get Http integration o k response has a 4xx status code
func (o *ApplicationServiceGetHTTPIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get Http integration o k response has a 5xx status code
func (o *ApplicationServiceGetHTTPIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get Http integration o k response a status code equal to that given
func (o *ApplicationServiceGetHTTPIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get Http integration o k response
func (o *ApplicationServiceGetHTTPIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetHTTPIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] applicationServiceGetHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetHTTPIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] applicationServiceGetHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetHTTPIntegrationOK) GetPayload() *models.APIGetHTTPIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetHTTPIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetHTTPIntegrationDefault creates a ApplicationServiceGetHTTPIntegrationDefault with default headers values
func NewApplicationServiceGetHTTPIntegrationDefault(code int) *ApplicationServiceGetHTTPIntegrationDefault {
return &ApplicationServiceGetHTTPIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetHTTPIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetHTTPIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get Http integration default response has a 2xx status code
func (o *ApplicationServiceGetHTTPIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get Http integration default response has a 3xx status code
func (o *ApplicationServiceGetHTTPIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get Http integration default response has a 4xx status code
func (o *ApplicationServiceGetHTTPIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get Http integration default response has a 5xx status code
func (o *ApplicationServiceGetHTTPIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get Http integration default response a status code equal to that given
func (o *ApplicationServiceGetHTTPIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get Http integration default response
func (o *ApplicationServiceGetHTTPIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetHTTPIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] ApplicationService_GetHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetHTTPIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] ApplicationService_GetHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetHTTPIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetIftttIntegrationParams creates a new ApplicationServiceGetIftttIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetIftttIntegrationParams() *ApplicationServiceGetIftttIntegrationParams {
return &ApplicationServiceGetIftttIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetIftttIntegrationParamsWithTimeout creates a new ApplicationServiceGetIftttIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetIftttIntegrationParams {
return &ApplicationServiceGetIftttIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetIftttIntegrationParamsWithContext creates a new ApplicationServiceGetIftttIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetIftttIntegrationParams {
return &ApplicationServiceGetIftttIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetIftttIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetIftttIntegrationParams {
return &ApplicationServiceGetIftttIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetIftttIntegrationParams contains all the parameters to send to the API endpoint
for the application service get ifttt integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetIftttIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetIftttIntegrationParams) WithDefaults() *ApplicationServiceGetIftttIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetIftttIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetIftttIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetIftttIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetIftttIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetIftttIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get ifttt integration params
func (o *ApplicationServiceGetIftttIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetIftttIntegrationReader is a Reader for the ApplicationServiceGetIftttIntegration structure.
type ApplicationServiceGetIftttIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetIftttIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetIftttIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetIftttIntegrationOK creates a ApplicationServiceGetIftttIntegrationOK with default headers values
func NewApplicationServiceGetIftttIntegrationOK() *ApplicationServiceGetIftttIntegrationOK {
return &ApplicationServiceGetIftttIntegrationOK{}
}
/*
ApplicationServiceGetIftttIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetIftttIntegrationOK struct {
Payload *models.APIGetIftttIntegrationResponse
}
// IsSuccess returns true when this application service get ifttt integration o k response has a 2xx status code
func (o *ApplicationServiceGetIftttIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get ifttt integration o k response has a 3xx status code
func (o *ApplicationServiceGetIftttIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get ifttt integration o k response has a 4xx status code
func (o *ApplicationServiceGetIftttIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get ifttt integration o k response has a 5xx status code
func (o *ApplicationServiceGetIftttIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get ifttt integration o k response a status code equal to that given
func (o *ApplicationServiceGetIftttIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get ifttt integration o k response
func (o *ApplicationServiceGetIftttIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetIftttIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceGetIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetIftttIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceGetIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetIftttIntegrationOK) GetPayload() *models.APIGetIftttIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetIftttIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetIftttIntegrationDefault creates a ApplicationServiceGetIftttIntegrationDefault with default headers values
func NewApplicationServiceGetIftttIntegrationDefault(code int) *ApplicationServiceGetIftttIntegrationDefault {
return &ApplicationServiceGetIftttIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetIftttIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetIftttIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get ifttt integration default response has a 2xx status code
func (o *ApplicationServiceGetIftttIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get ifttt integration default response has a 3xx status code
func (o *ApplicationServiceGetIftttIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get ifttt integration default response has a 4xx status code
func (o *ApplicationServiceGetIftttIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get ifttt integration default response has a 5xx status code
func (o *ApplicationServiceGetIftttIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get ifttt integration default response a status code equal to that given
func (o *ApplicationServiceGetIftttIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get ifttt integration default response
func (o *ApplicationServiceGetIftttIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetIftttIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_GetIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetIftttIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_GetIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetIftttIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetInfluxDbIntegrationParams creates a new ApplicationServiceGetInfluxDbIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetInfluxDbIntegrationParams() *ApplicationServiceGetInfluxDbIntegrationParams {
return &ApplicationServiceGetInfluxDbIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceGetInfluxDbIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetInfluxDbIntegrationParams {
return &ApplicationServiceGetInfluxDbIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceGetInfluxDbIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetInfluxDbIntegrationParams {
return &ApplicationServiceGetInfluxDbIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetInfluxDbIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetInfluxDbIntegrationParams {
return &ApplicationServiceGetInfluxDbIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetInfluxDbIntegrationParams contains all the parameters to send to the API endpoint
for the application service get influx db integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetInfluxDbIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceGetInfluxDbIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetInfluxDbIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetInfluxDbIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetInfluxDbIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetInfluxDbIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get influx db integration params
func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetInfluxDbIntegrationReader is a Reader for the ApplicationServiceGetInfluxDbIntegration structure.
type ApplicationServiceGetInfluxDbIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetInfluxDbIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetInfluxDbIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetInfluxDbIntegrationOK creates a ApplicationServiceGetInfluxDbIntegrationOK with default headers values
func NewApplicationServiceGetInfluxDbIntegrationOK() *ApplicationServiceGetInfluxDbIntegrationOK {
return &ApplicationServiceGetInfluxDbIntegrationOK{}
}
/*
ApplicationServiceGetInfluxDbIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetInfluxDbIntegrationOK struct {
Payload *models.APIGetInfluxDbIntegrationResponse
}
// IsSuccess returns true when this application service get influx db integration o k response has a 2xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get influx db integration o k response has a 3xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get influx db integration o k response has a 4xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get influx db integration o k response has a 5xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get influx db integration o k response a status code equal to that given
func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get influx db integration o k response
func (o *ApplicationServiceGetInfluxDbIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetInfluxDbIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceGetInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetInfluxDbIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceGetInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetInfluxDbIntegrationOK) GetPayload() *models.APIGetInfluxDbIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetInfluxDbIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetInfluxDbIntegrationDefault creates a ApplicationServiceGetInfluxDbIntegrationDefault with default headers values
func NewApplicationServiceGetInfluxDbIntegrationDefault(code int) *ApplicationServiceGetInfluxDbIntegrationDefault {
return &ApplicationServiceGetInfluxDbIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetInfluxDbIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetInfluxDbIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get influx db integration default response has a 2xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get influx db integration default response has a 3xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get influx db integration default response has a 4xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get influx db integration default response has a 5xx status code
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get influx db integration default response a status code equal to that given
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get influx db integration default response
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_GetInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_GetInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetMyDevicesIntegrationParams creates a new ApplicationServiceGetMyDevicesIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetMyDevicesIntegrationParams() *ApplicationServiceGetMyDevicesIntegrationParams {
return &ApplicationServiceGetMyDevicesIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceGetMyDevicesIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetMyDevicesIntegrationParams {
return &ApplicationServiceGetMyDevicesIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceGetMyDevicesIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetMyDevicesIntegrationParams {
return &ApplicationServiceGetMyDevicesIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetMyDevicesIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetMyDevicesIntegrationParams {
return &ApplicationServiceGetMyDevicesIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetMyDevicesIntegrationParams contains all the parameters to send to the API endpoint
for the application service get my devices integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetMyDevicesIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceGetMyDevicesIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get my devices integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetMyDevicesIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetMyDevicesIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetMyDevicesIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetMyDevicesIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get my devices integration params
func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetMyDevicesIntegrationReader is a Reader for the ApplicationServiceGetMyDevicesIntegration structure.
type ApplicationServiceGetMyDevicesIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetMyDevicesIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetMyDevicesIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetMyDevicesIntegrationOK creates a ApplicationServiceGetMyDevicesIntegrationOK with default headers values
func NewApplicationServiceGetMyDevicesIntegrationOK() *ApplicationServiceGetMyDevicesIntegrationOK {
return &ApplicationServiceGetMyDevicesIntegrationOK{}
}
/*
ApplicationServiceGetMyDevicesIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetMyDevicesIntegrationOK struct {
Payload *models.APIGetMyDevicesIntegrationResponse
}
// IsSuccess returns true when this application service get my devices integration o k response has a 2xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get my devices integration o k response has a 3xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get my devices integration o k response has a 4xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get my devices integration o k response has a 5xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get my devices integration o k response a status code equal to that given
func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get my devices integration o k response
func (o *ApplicationServiceGetMyDevicesIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetMyDevicesIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceGetMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetMyDevicesIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceGetMyDevicesIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetMyDevicesIntegrationOK) GetPayload() *models.APIGetMyDevicesIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetMyDevicesIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetMyDevicesIntegrationDefault creates a ApplicationServiceGetMyDevicesIntegrationDefault with default headers values
func NewApplicationServiceGetMyDevicesIntegrationDefault(code int) *ApplicationServiceGetMyDevicesIntegrationDefault {
return &ApplicationServiceGetMyDevicesIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetMyDevicesIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetMyDevicesIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get my devices integration default response has a 2xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get my devices integration default response has a 3xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get my devices integration default response has a 4xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get my devices integration default response has a 5xx status code
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get my devices integration default response a status code equal to that given
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get my devices integration default response
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_GetMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_GetMyDevicesIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetParams creates a new ApplicationServiceGetParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetParams() *ApplicationServiceGetParams {
return &ApplicationServiceGetParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetParamsWithTimeout creates a new ApplicationServiceGetParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetParams {
return &ApplicationServiceGetParams{
timeout: timeout,
}
}
// NewApplicationServiceGetParamsWithContext creates a new ApplicationServiceGetParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetParamsWithContext(ctx context.Context) *ApplicationServiceGetParams {
return &ApplicationServiceGetParams{
Context: ctx,
}
}
// NewApplicationServiceGetParamsWithHTTPClient creates a new ApplicationServiceGetParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetParams {
return &ApplicationServiceGetParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetParams contains all the parameters to send to the API endpoint
for the application service get operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetParams struct {
/* ID.
Application ID (UUID).
*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetParams) WithDefaults() *ApplicationServiceGetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get params
func (o *ApplicationServiceGetParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get params
func (o *ApplicationServiceGetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get params
func (o *ApplicationServiceGetParams) WithContext(ctx context.Context) *ApplicationServiceGetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get params
func (o *ApplicationServiceGetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get params
func (o *ApplicationServiceGetParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get params
func (o *ApplicationServiceGetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the application service get params
func (o *ApplicationServiceGetParams) WithID(id string) *ApplicationServiceGetParams {
o.SetID(id)
return o
}
// SetID adds the id to the application service get params
func (o *ApplicationServiceGetParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetPilotThingsIntegrationParams creates a new ApplicationServiceGetPilotThingsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetPilotThingsIntegrationParams() *ApplicationServiceGetPilotThingsIntegrationParams {
return &ApplicationServiceGetPilotThingsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetPilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceGetPilotThingsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetPilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetPilotThingsIntegrationParams {
return &ApplicationServiceGetPilotThingsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetPilotThingsIntegrationParamsWithContext creates a new ApplicationServiceGetPilotThingsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetPilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetPilotThingsIntegrationParams {
return &ApplicationServiceGetPilotThingsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetPilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetPilotThingsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetPilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetPilotThingsIntegrationParams {
return &ApplicationServiceGetPilotThingsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetPilotThingsIntegrationParams contains all the parameters to send to the API endpoint
for the application service get pilot things integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetPilotThingsIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithDefaults() *ApplicationServiceGetPilotThingsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get pilot things integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetPilotThingsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetPilotThingsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetPilotThingsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetPilotThingsIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get pilot things integration params
func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetPilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetPilotThingsIntegrationReader is a Reader for the ApplicationServiceGetPilotThingsIntegration structure.
type ApplicationServiceGetPilotThingsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetPilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetPilotThingsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetPilotThingsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetPilotThingsIntegrationOK creates a ApplicationServiceGetPilotThingsIntegrationOK with default headers values
func NewApplicationServiceGetPilotThingsIntegrationOK() *ApplicationServiceGetPilotThingsIntegrationOK {
return &ApplicationServiceGetPilotThingsIntegrationOK{}
}
/*
ApplicationServiceGetPilotThingsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetPilotThingsIntegrationOK struct {
Payload *models.APIGetPilotThingsIntegrationResponse
}
// IsSuccess returns true when this application service get pilot things integration o k response has a 2xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get pilot things integration o k response has a 3xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get pilot things integration o k response has a 4xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get pilot things integration o k response has a 5xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get pilot things integration o k response a status code equal to that given
func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get pilot things integration o k response
func (o *ApplicationServiceGetPilotThingsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetPilotThingsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceGetPilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetPilotThingsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceGetPilotThingsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetPilotThingsIntegrationOK) GetPayload() *models.APIGetPilotThingsIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetPilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetPilotThingsIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetPilotThingsIntegrationDefault creates a ApplicationServiceGetPilotThingsIntegrationDefault with default headers values
func NewApplicationServiceGetPilotThingsIntegrationDefault(code int) *ApplicationServiceGetPilotThingsIntegrationDefault {
return &ApplicationServiceGetPilotThingsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetPilotThingsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetPilotThingsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get pilot things integration default response has a 2xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get pilot things integration default response has a 3xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get pilot things integration default response has a 4xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get pilot things integration default response has a 5xx status code
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get pilot things integration default response a status code equal to that given
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get pilot things integration default response
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_GetPilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_GetPilotThingsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetPilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetReader is a Reader for the ApplicationServiceGet structure.
type ApplicationServiceGetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetOK creates a ApplicationServiceGetOK with default headers values
func NewApplicationServiceGetOK() *ApplicationServiceGetOK {
return &ApplicationServiceGetOK{}
}
/*
ApplicationServiceGetOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetOK struct {
Payload *models.APIGetApplicationResponse
}
// IsSuccess returns true when this application service get o k response has a 2xx status code
func (o *ApplicationServiceGetOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get o k response has a 3xx status code
func (o *ApplicationServiceGetOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get o k response has a 4xx status code
func (o *ApplicationServiceGetOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get o k response has a 5xx status code
func (o *ApplicationServiceGetOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get o k response a status code equal to that given
func (o *ApplicationServiceGetOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get o k response
func (o *ApplicationServiceGetOK) Code() int {
return 200
}
func (o *ApplicationServiceGetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{id}][%d] applicationServiceGetOK %s", 200, payload)
}
func (o *ApplicationServiceGetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{id}][%d] applicationServiceGetOK %s", 200, payload)
}
func (o *ApplicationServiceGetOK) GetPayload() *models.APIGetApplicationResponse {
return o.Payload
}
func (o *ApplicationServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetApplicationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetDefault creates a ApplicationServiceGetDefault with default headers values
func NewApplicationServiceGetDefault(code int) *ApplicationServiceGetDefault {
return &ApplicationServiceGetDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get default response has a 2xx status code
func (o *ApplicationServiceGetDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get default response has a 3xx status code
func (o *ApplicationServiceGetDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get default response has a 4xx status code
func (o *ApplicationServiceGetDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get default response has a 5xx status code
func (o *ApplicationServiceGetDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get default response a status code equal to that given
func (o *ApplicationServiceGetDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get default response
func (o *ApplicationServiceGetDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{id}][%d] ApplicationService_Get default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{id}][%d] ApplicationService_Get default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceGetThingsBoardIntegrationParams creates a new ApplicationServiceGetThingsBoardIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceGetThingsBoardIntegrationParams() *ApplicationServiceGetThingsBoardIntegrationParams {
return &ApplicationServiceGetThingsBoardIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceGetThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceGetThingsBoardIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceGetThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetThingsBoardIntegrationParams {
return &ApplicationServiceGetThingsBoardIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceGetThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceGetThingsBoardIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceGetThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetThingsBoardIntegrationParams {
return &ApplicationServiceGetThingsBoardIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceGetThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetThingsBoardIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceGetThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetThingsBoardIntegrationParams {
return &ApplicationServiceGetThingsBoardIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceGetThingsBoardIntegrationParams contains all the parameters to send to the API endpoint
for the application service get things board integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceGetThingsBoardIntegrationParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service get things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceGetThingsBoardIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service get things board integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetThingsBoardIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetThingsBoardIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetThingsBoardIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetThingsBoardIntegrationParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service get things board integration params
func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceGetThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceGetThingsBoardIntegrationReader is a Reader for the ApplicationServiceGetThingsBoardIntegration structure.
type ApplicationServiceGetThingsBoardIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceGetThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceGetThingsBoardIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceGetThingsBoardIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceGetThingsBoardIntegrationOK creates a ApplicationServiceGetThingsBoardIntegrationOK with default headers values
func NewApplicationServiceGetThingsBoardIntegrationOK() *ApplicationServiceGetThingsBoardIntegrationOK {
return &ApplicationServiceGetThingsBoardIntegrationOK{}
}
/*
ApplicationServiceGetThingsBoardIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceGetThingsBoardIntegrationOK struct {
Payload *models.APIGetThingsBoardIntegrationResponse
}
// IsSuccess returns true when this application service get things board integration o k response has a 2xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service get things board integration o k response has a 3xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service get things board integration o k response has a 4xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service get things board integration o k response has a 5xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service get things board integration o k response a status code equal to that given
func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service get things board integration o k response
func (o *ApplicationServiceGetThingsBoardIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceGetThingsBoardIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceGetThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetThingsBoardIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceGetThingsBoardIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceGetThingsBoardIntegrationOK) GetPayload() *models.APIGetThingsBoardIntegrationResponse {
return o.Payload
}
func (o *ApplicationServiceGetThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIGetThingsBoardIntegrationResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceGetThingsBoardIntegrationDefault creates a ApplicationServiceGetThingsBoardIntegrationDefault with default headers values
func NewApplicationServiceGetThingsBoardIntegrationDefault(code int) *ApplicationServiceGetThingsBoardIntegrationDefault {
return &ApplicationServiceGetThingsBoardIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceGetThingsBoardIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceGetThingsBoardIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service get things board integration default response has a 2xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service get things board integration default response has a 3xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service get things board integration default response has a 4xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service get things board integration default response has a 5xx status code
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service get things board integration default response a status code equal to that given
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service get things board integration default response
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_GetThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_GetThingsBoardIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceGetThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceListDeviceProfilesParams creates a new ApplicationServiceListDeviceProfilesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceListDeviceProfilesParams() *ApplicationServiceListDeviceProfilesParams {
return &ApplicationServiceListDeviceProfilesParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceListDeviceProfilesParamsWithTimeout creates a new ApplicationServiceListDeviceProfilesParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceListDeviceProfilesParamsWithTimeout(timeout time.Duration) *ApplicationServiceListDeviceProfilesParams {
return &ApplicationServiceListDeviceProfilesParams{
timeout: timeout,
}
}
// NewApplicationServiceListDeviceProfilesParamsWithContext creates a new ApplicationServiceListDeviceProfilesParams object
// with the ability to set a context for a request.
func NewApplicationServiceListDeviceProfilesParamsWithContext(ctx context.Context) *ApplicationServiceListDeviceProfilesParams {
return &ApplicationServiceListDeviceProfilesParams{
Context: ctx,
}
}
// NewApplicationServiceListDeviceProfilesParamsWithHTTPClient creates a new ApplicationServiceListDeviceProfilesParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceListDeviceProfilesParamsWithHTTPClient(client *http.Client) *ApplicationServiceListDeviceProfilesParams {
return &ApplicationServiceListDeviceProfilesParams{
HTTPClient: client,
}
}
/*
ApplicationServiceListDeviceProfilesParams contains all the parameters to send to the API endpoint
for the application service list device profiles operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceListDeviceProfilesParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service list device profiles params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListDeviceProfilesParams) WithDefaults() *ApplicationServiceListDeviceProfilesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service list device profiles params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListDeviceProfilesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) WithTimeout(timeout time.Duration) *ApplicationServiceListDeviceProfilesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) WithContext(ctx context.Context) *ApplicationServiceListDeviceProfilesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) WithHTTPClient(client *http.Client) *ApplicationServiceListDeviceProfilesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) WithApplicationID(applicationID string) *ApplicationServiceListDeviceProfilesParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service list device profiles params
func (o *ApplicationServiceListDeviceProfilesParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceListDeviceProfilesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceListDeviceProfilesReader is a Reader for the ApplicationServiceListDeviceProfiles structure.
type ApplicationServiceListDeviceProfilesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceListDeviceProfilesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceListDeviceProfilesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceListDeviceProfilesDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceListDeviceProfilesOK creates a ApplicationServiceListDeviceProfilesOK with default headers values
func NewApplicationServiceListDeviceProfilesOK() *ApplicationServiceListDeviceProfilesOK {
return &ApplicationServiceListDeviceProfilesOK{}
}
/*
ApplicationServiceListDeviceProfilesOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceListDeviceProfilesOK struct {
Payload *models.APIListApplicationDeviceProfilesResponse
}
// IsSuccess returns true when this application service list device profiles o k response has a 2xx status code
func (o *ApplicationServiceListDeviceProfilesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service list device profiles o k response has a 3xx status code
func (o *ApplicationServiceListDeviceProfilesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service list device profiles o k response has a 4xx status code
func (o *ApplicationServiceListDeviceProfilesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service list device profiles o k response has a 5xx status code
func (o *ApplicationServiceListDeviceProfilesOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service list device profiles o k response a status code equal to that given
func (o *ApplicationServiceListDeviceProfilesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service list device profiles o k response
func (o *ApplicationServiceListDeviceProfilesOK) Code() int {
return 200
}
func (o *ApplicationServiceListDeviceProfilesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] applicationServiceListDeviceProfilesOK %s", 200, payload)
}
func (o *ApplicationServiceListDeviceProfilesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] applicationServiceListDeviceProfilesOK %s", 200, payload)
}
func (o *ApplicationServiceListDeviceProfilesOK) GetPayload() *models.APIListApplicationDeviceProfilesResponse {
return o.Payload
}
func (o *ApplicationServiceListDeviceProfilesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIListApplicationDeviceProfilesResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceListDeviceProfilesDefault creates a ApplicationServiceListDeviceProfilesDefault with default headers values
func NewApplicationServiceListDeviceProfilesDefault(code int) *ApplicationServiceListDeviceProfilesDefault {
return &ApplicationServiceListDeviceProfilesDefault{
_statusCode: code,
}
}
/*
ApplicationServiceListDeviceProfilesDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceListDeviceProfilesDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service list device profiles default response has a 2xx status code
func (o *ApplicationServiceListDeviceProfilesDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service list device profiles default response has a 3xx status code
func (o *ApplicationServiceListDeviceProfilesDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service list device profiles default response has a 4xx status code
func (o *ApplicationServiceListDeviceProfilesDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service list device profiles default response has a 5xx status code
func (o *ApplicationServiceListDeviceProfilesDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service list device profiles default response a status code equal to that given
func (o *ApplicationServiceListDeviceProfilesDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service list device profiles default response
func (o *ApplicationServiceListDeviceProfilesDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceListDeviceProfilesDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] ApplicationService_ListDeviceProfiles default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDeviceProfilesDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] ApplicationService_ListDeviceProfiles default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDeviceProfilesDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceListDeviceProfilesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceListDeviceTagsParams creates a new ApplicationServiceListDeviceTagsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceListDeviceTagsParams() *ApplicationServiceListDeviceTagsParams {
return &ApplicationServiceListDeviceTagsParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceListDeviceTagsParamsWithTimeout creates a new ApplicationServiceListDeviceTagsParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceListDeviceTagsParamsWithTimeout(timeout time.Duration) *ApplicationServiceListDeviceTagsParams {
return &ApplicationServiceListDeviceTagsParams{
timeout: timeout,
}
}
// NewApplicationServiceListDeviceTagsParamsWithContext creates a new ApplicationServiceListDeviceTagsParams object
// with the ability to set a context for a request.
func NewApplicationServiceListDeviceTagsParamsWithContext(ctx context.Context) *ApplicationServiceListDeviceTagsParams {
return &ApplicationServiceListDeviceTagsParams{
Context: ctx,
}
}
// NewApplicationServiceListDeviceTagsParamsWithHTTPClient creates a new ApplicationServiceListDeviceTagsParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceListDeviceTagsParamsWithHTTPClient(client *http.Client) *ApplicationServiceListDeviceTagsParams {
return &ApplicationServiceListDeviceTagsParams{
HTTPClient: client,
}
}
/*
ApplicationServiceListDeviceTagsParams contains all the parameters to send to the API endpoint
for the application service list device tags operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceListDeviceTagsParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service list device tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListDeviceTagsParams) WithDefaults() *ApplicationServiceListDeviceTagsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service list device tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListDeviceTagsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) WithTimeout(timeout time.Duration) *ApplicationServiceListDeviceTagsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) WithContext(ctx context.Context) *ApplicationServiceListDeviceTagsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) WithHTTPClient(client *http.Client) *ApplicationServiceListDeviceTagsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) WithApplicationID(applicationID string) *ApplicationServiceListDeviceTagsParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service list device tags params
func (o *ApplicationServiceListDeviceTagsParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceListDeviceTagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceListDeviceTagsReader is a Reader for the ApplicationServiceListDeviceTags structure.
type ApplicationServiceListDeviceTagsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceListDeviceTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceListDeviceTagsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceListDeviceTagsDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceListDeviceTagsOK creates a ApplicationServiceListDeviceTagsOK with default headers values
func NewApplicationServiceListDeviceTagsOK() *ApplicationServiceListDeviceTagsOK {
return &ApplicationServiceListDeviceTagsOK{}
}
/*
ApplicationServiceListDeviceTagsOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceListDeviceTagsOK struct {
Payload *models.APIListApplicationDeviceTagsResponse
}
// IsSuccess returns true when this application service list device tags o k response has a 2xx status code
func (o *ApplicationServiceListDeviceTagsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service list device tags o k response has a 3xx status code
func (o *ApplicationServiceListDeviceTagsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service list device tags o k response has a 4xx status code
func (o *ApplicationServiceListDeviceTagsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service list device tags o k response has a 5xx status code
func (o *ApplicationServiceListDeviceTagsOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service list device tags o k response a status code equal to that given
func (o *ApplicationServiceListDeviceTagsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service list device tags o k response
func (o *ApplicationServiceListDeviceTagsOK) Code() int {
return 200
}
func (o *ApplicationServiceListDeviceTagsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] applicationServiceListDeviceTagsOK %s", 200, payload)
}
func (o *ApplicationServiceListDeviceTagsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] applicationServiceListDeviceTagsOK %s", 200, payload)
}
func (o *ApplicationServiceListDeviceTagsOK) GetPayload() *models.APIListApplicationDeviceTagsResponse {
return o.Payload
}
func (o *ApplicationServiceListDeviceTagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIListApplicationDeviceTagsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceListDeviceTagsDefault creates a ApplicationServiceListDeviceTagsDefault with default headers values
func NewApplicationServiceListDeviceTagsDefault(code int) *ApplicationServiceListDeviceTagsDefault {
return &ApplicationServiceListDeviceTagsDefault{
_statusCode: code,
}
}
/*
ApplicationServiceListDeviceTagsDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceListDeviceTagsDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service list device tags default response has a 2xx status code
func (o *ApplicationServiceListDeviceTagsDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service list device tags default response has a 3xx status code
func (o *ApplicationServiceListDeviceTagsDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service list device tags default response has a 4xx status code
func (o *ApplicationServiceListDeviceTagsDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service list device tags default response has a 5xx status code
func (o *ApplicationServiceListDeviceTagsDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service list device tags default response a status code equal to that given
func (o *ApplicationServiceListDeviceTagsDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service list device tags default response
func (o *ApplicationServiceListDeviceTagsDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceListDeviceTagsDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] ApplicationService_ListDeviceTags default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDeviceTagsDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] ApplicationService_ListDeviceTags default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDeviceTagsDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceListDeviceTagsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceListIntegrationsParams creates a new ApplicationServiceListIntegrationsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceListIntegrationsParams() *ApplicationServiceListIntegrationsParams {
return &ApplicationServiceListIntegrationsParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceListIntegrationsParamsWithTimeout creates a new ApplicationServiceListIntegrationsParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceListIntegrationsParamsWithTimeout(timeout time.Duration) *ApplicationServiceListIntegrationsParams {
return &ApplicationServiceListIntegrationsParams{
timeout: timeout,
}
}
// NewApplicationServiceListIntegrationsParamsWithContext creates a new ApplicationServiceListIntegrationsParams object
// with the ability to set a context for a request.
func NewApplicationServiceListIntegrationsParamsWithContext(ctx context.Context) *ApplicationServiceListIntegrationsParams {
return &ApplicationServiceListIntegrationsParams{
Context: ctx,
}
}
// NewApplicationServiceListIntegrationsParamsWithHTTPClient creates a new ApplicationServiceListIntegrationsParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceListIntegrationsParamsWithHTTPClient(client *http.Client) *ApplicationServiceListIntegrationsParams {
return &ApplicationServiceListIntegrationsParams{
HTTPClient: client,
}
}
/*
ApplicationServiceListIntegrationsParams contains all the parameters to send to the API endpoint
for the application service list integrations operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceListIntegrationsParams struct {
/* ApplicationID.
Application ID (UUID).
*/
ApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service list integrations params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListIntegrationsParams) WithDefaults() *ApplicationServiceListIntegrationsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service list integrations params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListIntegrationsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) WithTimeout(timeout time.Duration) *ApplicationServiceListIntegrationsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) WithContext(ctx context.Context) *ApplicationServiceListIntegrationsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) WithHTTPClient(client *http.Client) *ApplicationServiceListIntegrationsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApplicationID adds the applicationID to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) WithApplicationID(applicationID string) *ApplicationServiceListIntegrationsParams {
o.SetApplicationID(applicationID)
return o
}
// SetApplicationID adds the applicationId to the application service list integrations params
func (o *ApplicationServiceListIntegrationsParams) SetApplicationID(applicationID string) {
o.ApplicationID = applicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceListIntegrationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param applicationId
if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceListIntegrationsReader is a Reader for the ApplicationServiceListIntegrations structure.
type ApplicationServiceListIntegrationsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceListIntegrationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceListIntegrationsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceListIntegrationsDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceListIntegrationsOK creates a ApplicationServiceListIntegrationsOK with default headers values
func NewApplicationServiceListIntegrationsOK() *ApplicationServiceListIntegrationsOK {
return &ApplicationServiceListIntegrationsOK{}
}
/*
ApplicationServiceListIntegrationsOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceListIntegrationsOK struct {
Payload *models.APIListIntegrationsResponse
}
// IsSuccess returns true when this application service list integrations o k response has a 2xx status code
func (o *ApplicationServiceListIntegrationsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service list integrations o k response has a 3xx status code
func (o *ApplicationServiceListIntegrationsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service list integrations o k response has a 4xx status code
func (o *ApplicationServiceListIntegrationsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service list integrations o k response has a 5xx status code
func (o *ApplicationServiceListIntegrationsOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service list integrations o k response a status code equal to that given
func (o *ApplicationServiceListIntegrationsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service list integrations o k response
func (o *ApplicationServiceListIntegrationsOK) Code() int {
return 200
}
func (o *ApplicationServiceListIntegrationsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] applicationServiceListIntegrationsOK %s", 200, payload)
}
func (o *ApplicationServiceListIntegrationsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] applicationServiceListIntegrationsOK %s", 200, payload)
}
func (o *ApplicationServiceListIntegrationsOK) GetPayload() *models.APIListIntegrationsResponse {
return o.Payload
}
func (o *ApplicationServiceListIntegrationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIListIntegrationsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceListIntegrationsDefault creates a ApplicationServiceListIntegrationsDefault with default headers values
func NewApplicationServiceListIntegrationsDefault(code int) *ApplicationServiceListIntegrationsDefault {
return &ApplicationServiceListIntegrationsDefault{
_statusCode: code,
}
}
/*
ApplicationServiceListIntegrationsDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceListIntegrationsDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service list integrations default response has a 2xx status code
func (o *ApplicationServiceListIntegrationsDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service list integrations default response has a 3xx status code
func (o *ApplicationServiceListIntegrationsDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service list integrations default response has a 4xx status code
func (o *ApplicationServiceListIntegrationsDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service list integrations default response has a 5xx status code
func (o *ApplicationServiceListIntegrationsDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service list integrations default response a status code equal to that given
func (o *ApplicationServiceListIntegrationsDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service list integrations default response
func (o *ApplicationServiceListIntegrationsDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceListIntegrationsDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] ApplicationService_ListIntegrations default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListIntegrationsDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] ApplicationService_ListIntegrations default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListIntegrationsDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceListIntegrationsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,271 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewApplicationServiceListParams creates a new ApplicationServiceListParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceListParams() *ApplicationServiceListParams {
return &ApplicationServiceListParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceListParamsWithTimeout creates a new ApplicationServiceListParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceListParamsWithTimeout(timeout time.Duration) *ApplicationServiceListParams {
return &ApplicationServiceListParams{
timeout: timeout,
}
}
// NewApplicationServiceListParamsWithContext creates a new ApplicationServiceListParams object
// with the ability to set a context for a request.
func NewApplicationServiceListParamsWithContext(ctx context.Context) *ApplicationServiceListParams {
return &ApplicationServiceListParams{
Context: ctx,
}
}
// NewApplicationServiceListParamsWithHTTPClient creates a new ApplicationServiceListParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceListParamsWithHTTPClient(client *http.Client) *ApplicationServiceListParams {
return &ApplicationServiceListParams{
HTTPClient: client,
}
}
/*
ApplicationServiceListParams contains all the parameters to send to the API endpoint
for the application service list operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceListParams struct {
/* Limit.
Max number of applications to return in the result-set.
If not set, it will be treated as 0, and the response will only return the total_count.
Format: int64
*/
Limit *int64
/* Offset.
Offset in the result-set (for pagination).
Format: int64
*/
Offset *int64
/* Search.
If set, the given string will be used to search on name (optional).
*/
Search *string
/* TenantID.
Tenant ID to list the applications for.
*/
TenantID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service list params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListParams) WithDefaults() *ApplicationServiceListParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service list params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceListParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service list params
func (o *ApplicationServiceListParams) WithTimeout(timeout time.Duration) *ApplicationServiceListParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service list params
func (o *ApplicationServiceListParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service list params
func (o *ApplicationServiceListParams) WithContext(ctx context.Context) *ApplicationServiceListParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service list params
func (o *ApplicationServiceListParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service list params
func (o *ApplicationServiceListParams) WithHTTPClient(client *http.Client) *ApplicationServiceListParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service list params
func (o *ApplicationServiceListParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the application service list params
func (o *ApplicationServiceListParams) WithLimit(limit *int64) *ApplicationServiceListParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the application service list params
func (o *ApplicationServiceListParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the application service list params
func (o *ApplicationServiceListParams) WithOffset(offset *int64) *ApplicationServiceListParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the application service list params
func (o *ApplicationServiceListParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WithSearch adds the search to the application service list params
func (o *ApplicationServiceListParams) WithSearch(search *string) *ApplicationServiceListParams {
o.SetSearch(search)
return o
}
// SetSearch adds the search to the application service list params
func (o *ApplicationServiceListParams) SetSearch(search *string) {
o.Search = search
}
// WithTenantID adds the tenantID to the application service list params
func (o *ApplicationServiceListParams) WithTenantID(tenantID *string) *ApplicationServiceListParams {
o.SetTenantID(tenantID)
return o
}
// SetTenantID adds the tenantId to the application service list params
func (o *ApplicationServiceListParams) SetTenantID(tenantID *string) {
o.TenantID = tenantID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Limit != nil {
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int64
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if o.Search != nil {
// query param search
var qrSearch string
if o.Search != nil {
qrSearch = *o.Search
}
qSearch := qrSearch
if qSearch != "" {
if err := r.SetQueryParam("search", qSearch); err != nil {
return err
}
}
}
if o.TenantID != nil {
// query param tenantId
var qrTenantID string
if o.TenantID != nil {
qrTenantID = *o.TenantID
}
qTenantID := qrTenantID
if qTenantID != "" {
if err := r.SetQueryParam("tenantId", qTenantID); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceListReader is a Reader for the ApplicationServiceList structure.
type ApplicationServiceListReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceListOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceListDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceListOK creates a ApplicationServiceListOK with default headers values
func NewApplicationServiceListOK() *ApplicationServiceListOK {
return &ApplicationServiceListOK{}
}
/*
ApplicationServiceListOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceListOK struct {
Payload *models.APIListApplicationsResponse
}
// IsSuccess returns true when this application service list o k response has a 2xx status code
func (o *ApplicationServiceListOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service list o k response has a 3xx status code
func (o *ApplicationServiceListOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service list o k response has a 4xx status code
func (o *ApplicationServiceListOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service list o k response has a 5xx status code
func (o *ApplicationServiceListOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service list o k response a status code equal to that given
func (o *ApplicationServiceListOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service list o k response
func (o *ApplicationServiceListOK) Code() int {
return 200
}
func (o *ApplicationServiceListOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications][%d] applicationServiceListOK %s", 200, payload)
}
func (o *ApplicationServiceListOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications][%d] applicationServiceListOK %s", 200, payload)
}
func (o *ApplicationServiceListOK) GetPayload() *models.APIListApplicationsResponse {
return o.Payload
}
func (o *ApplicationServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.APIListApplicationsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceListDefault creates a ApplicationServiceListDefault with default headers values
func NewApplicationServiceListDefault(code int) *ApplicationServiceListDefault {
return &ApplicationServiceListDefault{
_statusCode: code,
}
}
/*
ApplicationServiceListDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceListDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service list default response has a 2xx status code
func (o *ApplicationServiceListDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service list default response has a 3xx status code
func (o *ApplicationServiceListDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service list default response has a 4xx status code
func (o *ApplicationServiceListDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service list default response has a 5xx status code
func (o *ApplicationServiceListDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service list default response a status code equal to that given
func (o *ApplicationServiceListDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service list default response
func (o *ApplicationServiceListDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceListDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications][%d] ApplicationService_List default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /api/applications][%d] ApplicationService_List default %s", o._statusCode, payload)
}
func (o *ApplicationServiceListDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateAwsSnsIntegrationParams creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateAwsSnsIntegrationParams() *ApplicationServiceUpdateAwsSnsIntegrationParams {
return &ApplicationServiceUpdateAwsSnsIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateAwsSnsIntegrationParams {
return &ApplicationServiceUpdateAwsSnsIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateAwsSnsIntegrationParams {
return &ApplicationServiceUpdateAwsSnsIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateAwsSnsIntegrationParams {
return &ApplicationServiceUpdateAwsSnsIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateAwsSnsIntegrationParams contains all the parameters to send to the API endpoint
for the application service update aws sns integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateAwsSnsIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateAwsSnsIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update aws sns integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithBody(body ApplicationServiceUpdateAwsSnsIntegrationBody) *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetBody(body ApplicationServiceUpdateAwsSnsIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateAwsSnsIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update aws sns integration params
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,392 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateAwsSnsIntegrationReader is a Reader for the ApplicationServiceUpdateAwsSnsIntegration structure.
type ApplicationServiceUpdateAwsSnsIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateAwsSnsIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateAwsSnsIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateAwsSnsIntegrationOK creates a ApplicationServiceUpdateAwsSnsIntegrationOK with default headers values
func NewApplicationServiceUpdateAwsSnsIntegrationOK() *ApplicationServiceUpdateAwsSnsIntegrationOK {
return &ApplicationServiceUpdateAwsSnsIntegrationOK{}
}
/*
ApplicationServiceUpdateAwsSnsIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateAwsSnsIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update aws sns integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update aws sns integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update aws sns integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update aws sns integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update aws sns integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update aws sns integration o k response
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceUpdateAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceUpdateAwsSnsIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateAwsSnsIntegrationDefault creates a ApplicationServiceUpdateAwsSnsIntegrationDefault with default headers values
func NewApplicationServiceUpdateAwsSnsIntegrationDefault(code int) *ApplicationServiceUpdateAwsSnsIntegrationDefault {
return &ApplicationServiceUpdateAwsSnsIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateAwsSnsIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateAwsSnsIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update aws sns integration default response has a 2xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update aws sns integration default response has a 3xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update aws sns integration default response has a 4xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update aws sns integration default response has a 5xx status code
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update aws sns integration default response a status code equal to that given
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update aws sns integration default response
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_UpdateAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_UpdateAwsSnsIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateAwsSnsIntegrationBody application service update aws sns integration body
swagger:model ApplicationServiceUpdateAwsSnsIntegrationBody
*/
type ApplicationServiceUpdateAwsSnsIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update aws sns integration body
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update aws sns integration body based on the context it is used
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateAwsSnsIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration Integration object to update.
swagger:model ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration struct {
// AWS Access Key ID.
AccessKeyID string `json:"accessKeyId,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// AWS region.
Region string `json:"region,omitempty"`
// AWS Secret Access Key.
SecretAccessKey string `json:"secretAccessKey,omitempty"`
// Topic ARN.
TopicArn string `json:"topicArn,omitempty"`
}
// Validate validates this application service update aws sns integration params body integration
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update aws sns integration params body integration based on the context it is used
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateAzureServiceBusIntegrationParams creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateAzureServiceBusIntegrationParams() *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint
for the application service update azure service bus integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateAzureServiceBusIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateAzureServiceBusIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update azure service bus integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithBody(body ApplicationServiceUpdateAzureServiceBusIntegrationBody) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetBody(body ApplicationServiceUpdateAzureServiceBusIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateAzureServiceBusIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update azure service bus integration params
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,387 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceUpdateAzureServiceBusIntegration structure.
type ApplicationServiceUpdateAzureServiceBusIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateAzureServiceBusIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateAzureServiceBusIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateAzureServiceBusIntegrationOK creates a ApplicationServiceUpdateAzureServiceBusIntegrationOK with default headers values
func NewApplicationServiceUpdateAzureServiceBusIntegrationOK() *ApplicationServiceUpdateAzureServiceBusIntegrationOK {
return &ApplicationServiceUpdateAzureServiceBusIntegrationOK{}
}
/*
ApplicationServiceUpdateAzureServiceBusIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateAzureServiceBusIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update azure service bus integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update azure service bus integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update azure service bus integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update azure service bus integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update azure service bus integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update azure service bus integration o k response
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceUpdateAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceUpdateAzureServiceBusIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateAzureServiceBusIntegrationDefault creates a ApplicationServiceUpdateAzureServiceBusIntegrationDefault with default headers values
func NewApplicationServiceUpdateAzureServiceBusIntegrationDefault(code int) *ApplicationServiceUpdateAzureServiceBusIntegrationDefault {
return &ApplicationServiceUpdateAzureServiceBusIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateAzureServiceBusIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update azure service bus integration default response has a 2xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update azure service bus integration default response has a 3xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update azure service bus integration default response has a 4xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update azure service bus integration default response has a 5xx status code
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update azure service bus integration default response a status code equal to that given
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update azure service bus integration default response
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_UpdateAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_UpdateAzureServiceBusIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateAzureServiceBusIntegrationBody application service update azure service bus integration body
swagger:model ApplicationServiceUpdateAzureServiceBusIntegrationBody
*/
type ApplicationServiceUpdateAzureServiceBusIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update azure service bus integration body
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update azure service bus integration body based on the context it is used
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateAzureServiceBusIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration Integration object to create.
swagger:model ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration struct {
// Connection string.
ConnectionString string `json:"connectionString,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Publish name.
// This is the name of the topic or queue.
PublishName string `json:"publishName,omitempty"`
}
// Validate validates this application service update azure service bus integration params body integration
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update azure service bus integration params body integration based on the context it is used
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateGcpPubSubIntegrationParams creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateGcpPubSubIntegrationParams() *ApplicationServiceUpdateGcpPubSubIntegrationParams {
return &ApplicationServiceUpdateGcpPubSubIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
return &ApplicationServiceUpdateGcpPubSubIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
return &ApplicationServiceUpdateGcpPubSubIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
return &ApplicationServiceUpdateGcpPubSubIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint
for the application service update gcp pub sub integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateGcpPubSubIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateGcpPubSubIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update gcp pub sub integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithBody(body ApplicationServiceUpdateGcpPubSubIntegrationBody) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetBody(body ApplicationServiceUpdateGcpPubSubIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateGcpPubSubIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update gcp pub sub integration params
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,393 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateGcpPubSubIntegrationReader is a Reader for the ApplicationServiceUpdateGcpPubSubIntegration structure.
type ApplicationServiceUpdateGcpPubSubIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateGcpPubSubIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateGcpPubSubIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateGcpPubSubIntegrationOK creates a ApplicationServiceUpdateGcpPubSubIntegrationOK with default headers values
func NewApplicationServiceUpdateGcpPubSubIntegrationOK() *ApplicationServiceUpdateGcpPubSubIntegrationOK {
return &ApplicationServiceUpdateGcpPubSubIntegrationOK{}
}
/*
ApplicationServiceUpdateGcpPubSubIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateGcpPubSubIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update gcp pub sub integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update gcp pub sub integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update gcp pub sub integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update gcp pub sub integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update gcp pub sub integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update gcp pub sub integration o k response
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceUpdateGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceUpdateGcpPubSubIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateGcpPubSubIntegrationDefault creates a ApplicationServiceUpdateGcpPubSubIntegrationDefault with default headers values
func NewApplicationServiceUpdateGcpPubSubIntegrationDefault(code int) *ApplicationServiceUpdateGcpPubSubIntegrationDefault {
return &ApplicationServiceUpdateGcpPubSubIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateGcpPubSubIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateGcpPubSubIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update gcp pub sub integration default response has a 2xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update gcp pub sub integration default response has a 3xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update gcp pub sub integration default response has a 4xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update gcp pub sub integration default response has a 5xx status code
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update gcp pub sub integration default response a status code equal to that given
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update gcp pub sub integration default response
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_UpdateGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_UpdateGcpPubSubIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateGcpPubSubIntegrationBody application service update gcp pub sub integration body
swagger:model ApplicationServiceUpdateGcpPubSubIntegrationBody
*/
type ApplicationServiceUpdateGcpPubSubIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update gcp pub sub integration body
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update gcp pub sub integration body based on the context it is used
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateGcpPubSubIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration Integration object to update.
swagger:model ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration struct {
// Credentials file.
// This IAM service-account credentials file (JSON) must have the following
// Pub/Sub roles:
// * Pub/Sub Publisher
CredentialsFile string `json:"credentialsFile,omitempty"`
// Encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Project ID.
ProjectID string `json:"projectId,omitempty"`
// Topic name.
// This is the name of the Pub/Sub topic.
TopicName string `json:"topicName,omitempty"`
}
// Validate validates this application service update gcp pub sub integration params body integration
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update gcp pub sub integration params body integration based on the context it is used
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateHTTPIntegrationParams creates a new ApplicationServiceUpdateHTTPIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateHTTPIntegrationParams() *ApplicationServiceUpdateHTTPIntegrationParams {
return &ApplicationServiceUpdateHTTPIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateHTTPIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateHTTPIntegrationParams {
return &ApplicationServiceUpdateHTTPIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateHTTPIntegrationParamsWithContext creates a new ApplicationServiceUpdateHTTPIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateHTTPIntegrationParams {
return &ApplicationServiceUpdateHTTPIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateHTTPIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateHTTPIntegrationParams {
return &ApplicationServiceUpdateHTTPIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateHTTPIntegrationParams contains all the parameters to send to the API endpoint
for the application service update Http integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateHTTPIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateHTTPIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithDefaults() *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update Http integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithBody(body ApplicationServiceUpdateHTTPIntegrationBody) *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetBody(body ApplicationServiceUpdateHTTPIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateHTTPIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update Http integration params
func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,389 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateHTTPIntegrationReader is a Reader for the ApplicationServiceUpdateHTTPIntegration structure.
type ApplicationServiceUpdateHTTPIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateHTTPIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateHTTPIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateHTTPIntegrationOK creates a ApplicationServiceUpdateHTTPIntegrationOK with default headers values
func NewApplicationServiceUpdateHTTPIntegrationOK() *ApplicationServiceUpdateHTTPIntegrationOK {
return &ApplicationServiceUpdateHTTPIntegrationOK{}
}
/*
ApplicationServiceUpdateHTTPIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateHTTPIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update Http integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update Http integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update Http integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update Http integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update Http integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update Http integration o k response
func (o *ApplicationServiceUpdateHTTPIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateHTTPIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceUpdateHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateHTTPIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceUpdateHttpIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateHTTPIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateHTTPIntegrationDefault creates a ApplicationServiceUpdateHTTPIntegrationDefault with default headers values
func NewApplicationServiceUpdateHTTPIntegrationDefault(code int) *ApplicationServiceUpdateHTTPIntegrationDefault {
return &ApplicationServiceUpdateHTTPIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateHTTPIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateHTTPIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update Http integration default response has a 2xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update Http integration default response has a 3xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update Http integration default response has a 4xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update Http integration default response has a 5xx status code
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update Http integration default response a status code equal to that given
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update Http integration default response
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_UpdateHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_UpdateHttpIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateHTTPIntegrationBody application service update HTTP integration body
swagger:model ApplicationServiceUpdateHTTPIntegrationBody
*/
type ApplicationServiceUpdateHTTPIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update HTTP integration body
func (o *ApplicationServiceUpdateHTTPIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateHTTPIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update HTTP integration body based on the context it is used
func (o *ApplicationServiceUpdateHTTPIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateHTTPIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateHTTPIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateHTTPIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateHTTPIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration Integration object to update.
swagger:model ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration struct {
// Payload encoding.
Encoding *models.APIEncoding `json:"encoding,omitempty"`
// Event endpoint URL.
// The HTTP integration will POST all events to this enpoint. The request
// will contain a query parameters "event" containing the type of the
// event.
EventEndpointURL string `json:"eventEndpointUrl,omitempty"`
// HTTP headers to set when making requests.
Headers map[string]string `json:"headers,omitempty"`
}
// Validate validates this application service update HTTP integration params body integration
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateEncoding(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if o.Encoding != nil {
if err := o.Encoding.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update HTTP integration params body integration based on the context it is used
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateEncoding(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error {
if o.Encoding != nil {
if swag.IsZero(o.Encoding) { // not required
return nil
}
if err := o.Encoding.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "encoding")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "encoding")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateIftttIntegrationParams creates a new ApplicationServiceUpdateIftttIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateIftttIntegrationParams() *ApplicationServiceUpdateIftttIntegrationParams {
return &ApplicationServiceUpdateIftttIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateIftttIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateIftttIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateIftttIntegrationParams {
return &ApplicationServiceUpdateIftttIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateIftttIntegrationParamsWithContext creates a new ApplicationServiceUpdateIftttIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateIftttIntegrationParams {
return &ApplicationServiceUpdateIftttIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateIftttIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateIftttIntegrationParams {
return &ApplicationServiceUpdateIftttIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateIftttIntegrationParams contains all the parameters to send to the API endpoint
for the application service update ifttt integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateIftttIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateIftttIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithDefaults() *ApplicationServiceUpdateIftttIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update ifttt integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateIftttIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateIftttIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateIftttIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithBody(body ApplicationServiceUpdateIftttIntegrationBody) *ApplicationServiceUpdateIftttIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetBody(body ApplicationServiceUpdateIftttIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateIftttIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update ifttt integration params
func (o *ApplicationServiceUpdateIftttIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,346 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateIftttIntegrationReader is a Reader for the ApplicationServiceUpdateIftttIntegration structure.
type ApplicationServiceUpdateIftttIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateIftttIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateIftttIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateIftttIntegrationOK creates a ApplicationServiceUpdateIftttIntegrationOK with default headers values
func NewApplicationServiceUpdateIftttIntegrationOK() *ApplicationServiceUpdateIftttIntegrationOK {
return &ApplicationServiceUpdateIftttIntegrationOK{}
}
/*
ApplicationServiceUpdateIftttIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateIftttIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update ifttt integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateIftttIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update ifttt integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateIftttIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update ifttt integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateIftttIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update ifttt integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateIftttIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update ifttt integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateIftttIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update ifttt integration o k response
func (o *ApplicationServiceUpdateIftttIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateIftttIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceUpdateIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateIftttIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceUpdateIftttIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateIftttIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateIftttIntegrationDefault creates a ApplicationServiceUpdateIftttIntegrationDefault with default headers values
func NewApplicationServiceUpdateIftttIntegrationDefault(code int) *ApplicationServiceUpdateIftttIntegrationDefault {
return &ApplicationServiceUpdateIftttIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateIftttIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateIftttIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update ifttt integration default response has a 2xx status code
func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update ifttt integration default response has a 3xx status code
func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update ifttt integration default response has a 4xx status code
func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update ifttt integration default response has a 5xx status code
func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update ifttt integration default response a status code equal to that given
func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update ifttt integration default response
func (o *ApplicationServiceUpdateIftttIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateIftttIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_UpdateIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateIftttIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_UpdateIftttIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateIftttIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateIftttIntegrationBody application service update ifttt integration body
swagger:model ApplicationServiceUpdateIftttIntegrationBody
*/
type ApplicationServiceUpdateIftttIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update ifttt integration body
func (o *ApplicationServiceUpdateIftttIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateIftttIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update ifttt integration body based on the context it is used
func (o *ApplicationServiceUpdateIftttIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateIftttIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateIftttIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateIftttIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateIftttIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration Integration object to update.
swagger:model ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration struct {
// Arbitrary JSON.
// If set to true, ChirpStack events will be sent as-is as arbitrary JSON
// payload. If set to false (default), the 3 JSON values format will be used.
ArbitraryJSON bool `json:"arbitraryJson,omitempty"`
// Event prefix.
// If set, the event name will be PREFIX_EVENT. For example if event_prefix
// is set to weatherstation, and uplink event will be sent as
// weatherstation_up to the IFTTT webhook.
// Note: Only characters in the A-Z, a-z and 0-9 range are allowed.
EventPrefix string `json:"eventPrefix,omitempty"`
// Key.
// This key can be obtained from the IFTTT Webhooks documentation page.
Key string `json:"key,omitempty"`
// Values.
// Up to 2 values can be forwarded to IFTTT. These values must map to the
// decoded payload keys. For example:
// {
// "batteryLevel": 75.3,
// "buttons": [{"pressed": false}, {"pressed": true}]
// }
// You would specify the following fields:
// uplink_values = ["batteryLevel", "buttons_0_pressed"]
UplinkValues []string `json:"uplinkValues"`
}
// Validate validates this application service update ifttt integration params body integration
func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this application service update ifttt integration params body integration based on context it is used
func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewApplicationServiceUpdateInfluxDbIntegrationParams creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewApplicationServiceUpdateInfluxDbIntegrationParams() *ApplicationServiceUpdateInfluxDbIntegrationParams {
return &ApplicationServiceUpdateInfluxDbIntegrationParams{
timeout: cr.DefaultTimeout,
}
}
// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object
// with the ability to set a timeout on a request.
func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateInfluxDbIntegrationParams {
return &ApplicationServiceUpdateInfluxDbIntegrationParams{
timeout: timeout,
}
}
// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object
// with the ability to set a context for a request.
func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateInfluxDbIntegrationParams {
return &ApplicationServiceUpdateInfluxDbIntegrationParams{
Context: ctx,
}
}
// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object
// with the ability to set a custom HTTPClient for a request.
func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateInfluxDbIntegrationParams {
return &ApplicationServiceUpdateInfluxDbIntegrationParams{
HTTPClient: client,
}
}
/*
ApplicationServiceUpdateInfluxDbIntegrationParams contains all the parameters to send to the API endpoint
for the application service update influx db integration operation.
Typically these are written to a http.Request.
*/
type ApplicationServiceUpdateInfluxDbIntegrationParams struct {
// Body.
Body ApplicationServiceUpdateInfluxDbIntegrationBody
/* IntegrationApplicationID.
Application ID (UUID).
*/
IntegrationApplicationID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the application service update influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the application service update influx db integration params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithBody(body ApplicationServiceUpdateInfluxDbIntegrationBody) *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetBody(body ApplicationServiceUpdateInfluxDbIntegrationBody) {
o.Body = body
}
// WithIntegrationApplicationID adds the integrationApplicationID to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateInfluxDbIntegrationParams {
o.SetIntegrationApplicationID(integrationApplicationID)
return o
}
// SetIntegrationApplicationID adds the integrationApplicationId to the application service update influx db integration params
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) {
o.IntegrationApplicationID = integrationApplicationID
}
// WriteToRequest writes these params to a swagger request
func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param integration.applicationId
if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,455 @@
// Code generated by go-swagger; DO NOT EDIT.
package application_service
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/transport/lora/chirp_stack_proto/models"
)
// ApplicationServiceUpdateInfluxDbIntegrationReader is a Reader for the ApplicationServiceUpdateInfluxDbIntegration structure.
type ApplicationServiceUpdateInfluxDbIntegrationReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ApplicationServiceUpdateInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplicationServiceUpdateInfluxDbIntegrationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewApplicationServiceUpdateInfluxDbIntegrationDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewApplicationServiceUpdateInfluxDbIntegrationOK creates a ApplicationServiceUpdateInfluxDbIntegrationOK with default headers values
func NewApplicationServiceUpdateInfluxDbIntegrationOK() *ApplicationServiceUpdateInfluxDbIntegrationOK {
return &ApplicationServiceUpdateInfluxDbIntegrationOK{}
}
/*
ApplicationServiceUpdateInfluxDbIntegrationOK describes a response with status code 200, with default header values.
A successful response.
*/
type ApplicationServiceUpdateInfluxDbIntegrationOK struct {
Payload interface{}
}
// IsSuccess returns true when this application service update influx db integration o k response has a 2xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this application service update influx db integration o k response has a 3xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this application service update influx db integration o k response has a 4xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsClientError() bool {
return false
}
// IsServerError returns true when this application service update influx db integration o k response has a 5xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsServerError() bool {
return false
}
// IsCode returns true when this application service update influx db integration o k response a status code equal to that given
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the application service update influx db integration o k response
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) Code() int {
return 200
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceUpdateInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceUpdateInfluxDbIntegrationOK %s", 200, payload)
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) GetPayload() interface{} {
return o.Payload
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewApplicationServiceUpdateInfluxDbIntegrationDefault creates a ApplicationServiceUpdateInfluxDbIntegrationDefault with default headers values
func NewApplicationServiceUpdateInfluxDbIntegrationDefault(code int) *ApplicationServiceUpdateInfluxDbIntegrationDefault {
return &ApplicationServiceUpdateInfluxDbIntegrationDefault{
_statusCode: code,
}
}
/*
ApplicationServiceUpdateInfluxDbIntegrationDefault describes a response with status code -1, with default header values.
An unexpected error response.
*/
type ApplicationServiceUpdateInfluxDbIntegrationDefault struct {
_statusCode int
Payload *models.RPCStatus
}
// IsSuccess returns true when this application service update influx db integration default response has a 2xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this application service update influx db integration default response has a 3xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this application service update influx db integration default response has a 4xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this application service update influx db integration default response has a 5xx status code
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this application service update influx db integration default response a status code equal to that given
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the application service update influx db integration default response
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) Code() int {
return o._statusCode
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_UpdateInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_UpdateInfluxDbIntegration default %s", o._statusCode, payload)
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus {
return o.Payload
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RPCStatus)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
ApplicationServiceUpdateInfluxDbIntegrationBody application service update influx db integration body
swagger:model ApplicationServiceUpdateInfluxDbIntegrationBody
*/
type ApplicationServiceUpdateInfluxDbIntegrationBody struct {
// integration
Integration *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration `json:"integration,omitempty"`
}
// Validate validates this application service update influx db integration body
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateIntegration(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) validateIntegration(formats strfmt.Registry) error {
if swag.IsZero(o.Integration) { // not required
return nil
}
if o.Integration != nil {
if err := o.Integration.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update influx db integration body based on the context it is used
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateIntegration(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error {
if o.Integration != nil {
if swag.IsZero(o.Integration) { // not required
return nil
}
if err := o.Integration.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateInfluxDbIntegrationBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration Integration object to update.
swagger:model ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration
*/
type ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration struct {
// Bucket. (InfluxDb v2)
Bucket string `json:"bucket,omitempty"`
// InfluxDb database name. (InfluxDb v1)
Db string `json:"db,omitempty"`
// InfluxDb API write endpoint (e.g. http://localhost:8086/write).
Endpoint string `json:"endpoint,omitempty"`
// Organization. (InfluxDb v2)
Organization string `json:"organization,omitempty"`
// InfluxDb password. (InfluxDb v1)
Password string `json:"password,omitempty"`
// InfluxDb timestamp precision (InfluxDb v1).
Precision *models.APIInfluxDbPrecision `json:"precision,omitempty"`
// InfluxDb retention policy name. (InfluxDb v1)
RetentionPolicyName string `json:"retentionPolicyName,omitempty"`
// Token. (InfluxDb v2)
Token string `json:"token,omitempty"`
// InfluxDb username. (InfluxDb v1)
Username string `json:"username,omitempty"`
// InfluxDb version.
Version *models.APIInfluxDbVersion `json:"version,omitempty"`
}
// Validate validates this application service update influx db integration params body integration
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validatePrecision(formats); err != nil {
res = append(res, err)
}
if err := o.validateVersion(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) validatePrecision(formats strfmt.Registry) error {
if swag.IsZero(o.Precision) { // not required
return nil
}
if o.Precision != nil {
if err := o.Precision.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "precision")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "precision")
}
return err
}
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) validateVersion(formats strfmt.Registry) error {
if swag.IsZero(o.Version) { // not required
return nil
}
if o.Version != nil {
if err := o.Version.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "version")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "version")
}
return err
}
}
return nil
}
// ContextValidate validate this application service update influx db integration params body integration based on the context it is used
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidatePrecision(ctx, formats); err != nil {
res = append(res, err)
}
if err := o.contextValidateVersion(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) contextValidatePrecision(ctx context.Context, formats strfmt.Registry) error {
if o.Precision != nil {
if swag.IsZero(o.Precision) { // not required
return nil
}
if err := o.Precision.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "precision")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "precision")
}
return err
}
}
return nil
}
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) contextValidateVersion(ctx context.Context, formats strfmt.Registry) error {
if o.Version != nil {
if swag.IsZero(o.Version) { // not required
return nil
}
if err := o.Version.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("body" + "." + "integration" + "." + "version")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("body" + "." + "integration" + "." + "version")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error {
var res ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

Some files were not shown because too many files have changed in this diff Show More