Skip to content

Commit

Permalink
Merge branch 'beta-candidate-01' of https://github.com/OctopusDeploy/…
Browse files Browse the repository at this point in the history
  • Loading branch information
AdminTurnedDevOps committed Sep 23, 2020
2 parents 4f174b1 + 3432d44 commit 552d142
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -4,6 +4,7 @@ require (
github.com/Djarvur/go-err113 v0.1.0 // indirect
github.com/OctopusDeploy/go-octopusdeploy v1.6.1-0.20200918004128-e9a9cbc9c0a4
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef
github.com/aws/aws-sdk-go v1.34.13 // indirect
github.com/golangci/golangci-lint v1.31.0 // indirect
github.com/golangci/misspell v0.3.5 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -122,6 +122,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=
github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
Expand Down
7 changes: 7 additions & 0 deletions octopusdeploy/deploy_package.go
@@ -1,6 +1,8 @@
package octopusdeploy

import (
"log"

"github.com/OctopusDeploy/go-octopusdeploy/model"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
Expand All @@ -25,6 +27,11 @@ func buildDeployPackageActionResource(tfAction map[string]interface{}) model.Dep

action := buildDeploymentActionResource(tfAction)
action.ActionType = "Octopus.TentaclePackage"

if tfAction == nil {
log.Println("Deploy Package Resource is nil. Please confirm the package resource")
}

addWindowsServiceFeatureToActionResource(tfAction, action)
return action
}
18 changes: 17 additions & 1 deletion octopusdeploy/package_reference.go
@@ -1,13 +1,29 @@
package octopusdeploy

import (
"fmt"
"log"

"github.com/OctopusDeploy/go-octopusdeploy/model"
"github.com/asaskevich/govalidator"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func addPrimaryPackageSchema(element *schema.Resource, required bool) {
func addPrimaryPackageSchema(element *schema.Resource, required bool) error {
if element == nil {
return createInvalidParameterError("addPrimaryPackageSchema", "element")
}

if govalidator.IsInt("required") {
fmt.Println("")
} else {
log.Println("the required arg is not a bool")
}

element.Schema["primary_package"] = getPackageSchema(required)
element.Schema["primary_package"].MaxItems = 1

return nil
}

func addPackagesSchema(element *schema.Resource, primaryIsRequired bool) {
Expand Down
30 changes: 30 additions & 0 deletions octopusdeploy/resource_certificate.go
Expand Up @@ -3,6 +3,9 @@ package octopusdeploy
import (
"fmt"
"log"
"strconv"

"github.com/asaskevich/govalidator"

"github.com/OctopusDeploy/go-octopusdeploy/client"
"github.com/OctopusDeploy/go-octopusdeploy/enum"
Expand Down Expand Up @@ -65,6 +68,18 @@ func resourceCertificate() *schema.Resource {
func resourceCertificateRead(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)

if apiClient == nil {
log.Println("Client is empty. go-octopusdeploy SDK may be facing issues.")
}

if d == nil {
return createInvalidParameterError("esourceCertificateRead", "d")
}

if m == nil {
return createInvalidParameterError("esourceCertificateRead", "m")
}

certificateID := d.Id()
certificate, err := apiClient.Certificates.Get(certificateID)

Expand All @@ -88,8 +103,23 @@ func resourceCertificateRead(d *schema.ResourceData, m interface{}) error {
}

func buildCertificateResource(d *schema.ResourceData) *model.Certificate {
if d == nil {
log.Println("The schema for certificate resource is nil")
}

certificateName := d.Get("name").(string)

if govalidator.IsNull("name") {
fmt.Println("Please confirm the certificate name is a string and is not null")
}

str, intErr := strconv.Atoi("name")
if intErr != nil {
log.Println(str)
} else {
fmt.Println("Please ensure that the name is of type: string")
}

var notes string
var certificateData string
var password string
Expand Down

0 comments on commit 552d142

Please sign in to comment.