#159: Added ability to disable certificates
This commit is contained in:
+76
-189
@@ -310,20 +310,12 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
|
|||||||
|
|
||||||
// Specific check for SSL verification
|
// Specific check for SSL verification
|
||||||
// This is critical for onprem stuff.
|
// This is critical for onprem stuff.
|
||||||
verifyParam := ""
|
//verifyParam := ""
|
||||||
verifyWrapper := ""
|
//verifyWrapper := ""
|
||||||
verifyAddin := ""
|
//verifyAddin := ""
|
||||||
if len(swagger.Servers) == 0 {
|
verifyParam = ", verify=False"
|
||||||
verifyParam = ", verify=False"
|
verifyWrapper = `if type(ssl_verify) == str: ssl_verify = False if ssl_verify.lower() == "false" or ssl_verify == "0" else True`
|
||||||
verifyWrapper = `if type(ssl_verify) == str: ssl_verify = False if ssl_verify.lower() == "false" or ssl_verify == "0" else True`
|
verifyAddin = ", verify=ssl_verify"
|
||||||
verifyAddin = ", verify=ssl_verify"
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
verifyParam = ", ssl_verify=False"
|
|
||||||
verifyWrapper = `if type(ssl_verify) == str: ssl_verify = False if ssl_verify.lower() == "false" or ssl_verify == "0" else True`
|
|
||||||
verifyAddin = ", verify=ssl_verify"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(parameters) > 0 {
|
if len(parameters) > 0 {
|
||||||
parameterData = fmt.Sprintf(", %s", strings.Join(parameters, ", "))
|
parameterData = fmt.Sprintf(", %s", strings.Join(parameters, ", "))
|
||||||
@@ -974,31 +966,16 @@ func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Connect.Parameters) > 0 {
|
if len(path.Connect.Parameters) > 0 {
|
||||||
@@ -1123,31 +1100,16 @@ func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
// FIXME - remove this when authentication is properly introduced
|
// FIXME - remove this when authentication is properly introduced
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify the SSL certificate request",
|
||||||
Description: "Check if you want to verify the SSL certificate request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "False - default=True",
|
||||||
Example: "False - default=True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Get.Parameters) > 0 {
|
if len(path.Get.Parameters) > 0 {
|
||||||
@@ -1272,31 +1234,16 @@ func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Head.Parameters) > 0 {
|
if len(path.Head.Parameters) > 0 {
|
||||||
@@ -1421,31 +1368,16 @@ func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Delete.Parameters) > 0 {
|
if len(path.Delete.Parameters) > 0 {
|
||||||
@@ -1569,31 +1501,16 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Post.Parameters) > 0 {
|
if len(path.Post.Parameters) > 0 {
|
||||||
@@ -1717,31 +1634,16 @@ func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []W
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Patch.Parameters) > 0 {
|
if len(path.Patch.Parameters) > 0 {
|
||||||
@@ -1865,31 +1767,16 @@ func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
if len(swagger.Servers) == 0 {
|
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
Name: "ssl_verify",
|
||||||
Name: "ssl_verify",
|
Description: "Check if you want to verify request",
|
||||||
Description: "Check if you want to verify request",
|
Multiline: false,
|
||||||
Multiline: false,
|
Required: false,
|
||||||
Required: false,
|
Example: "True",
|
||||||
Example: "True",
|
Schema: SchemaDefinition{
|
||||||
Schema: SchemaDefinition{
|
Type: "string",
|
||||||
Type: "string",
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if swagger.Servers[0].URL == "" {
|
|
||||||
optionalParameters = append(optionalParameters, WorkflowAppActionParameter{
|
|
||||||
Name: "ssl_verify",
|
|
||||||
Description: "Check if you want to verify request",
|
|
||||||
Multiline: false,
|
|
||||||
Required: false,
|
|
||||||
Example: "True",
|
|
||||||
Schema: SchemaDefinition{
|
|
||||||
Type: "string",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headersFound := []string{}
|
headersFound := []string{}
|
||||||
if len(path.Put.Parameters) > 0 {
|
if len(path.Put.Parameters) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user