Skip to content

Commit

Permalink
Merge pull request #120 from mxmorin/master
Browse files Browse the repository at this point in the history
Correction mismatchs fields + robot_token_expiration + gc schedule type
  • Loading branch information
wrighbr authored Apr 27, 2021
2 parents 09be6f6 + 52c2007 commit 64ac5c3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func GetConfigSystem(d *schema.ResourceData) models.ConfigBodyPost {
return models.ConfigBodyPost{
ProjectCreationRestriction: d.Get("project_creation_restriction").(string),
ReadOnly: d.Get("read_only").(bool),
RobotTokenDuration: days2mins(d.Get("robot_token_expiration").(int)),
RobotTokenDuration: d.Get("robot_token_expiration").(int),
QuotaPerProjectEnable: true,
RobotNamePrefix: d.Get("robot_name_prefix").(string),
}
Expand Down Expand Up @@ -49,9 +49,9 @@ func GetConfigAuth(d *schema.ResourceData) models.ConfigBodyPost {

LdapGroupBaseDn: d.Get("ldap_group_base_dn").(string),
LdapGroupSearchFilter: d.Get("ldap_group_filter").(string),
LdapGroupGID: d.Get("ldap_group_gid").(string),
LdapGroupAttributeName: d.Get("ldap_group_gid").(string),
LdapGroupAdminDn: d.Get("ldap_group_admin_dn").(string),
LdapGroupAttributeName: d.Get("ldap_group_membership").(string),
LdapGroupMembershipAttribute: d.Get("ldap_group_membership").(string),

LdapVerifyCert: d.Get("ldap_verify_cert").(bool),
}
Expand Down
87 changes: 44 additions & 43 deletions models/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,55 @@ package models
var PathConfig = "/configurations"

type ConfigBodyPost struct {
OidcVerifyCert bool `json:"oidc_verify_cert"`
OidcAutoOnboard bool `json:"oidc_auto_onboard"`
OidcUserClaim string `json:"oidc_user_claim,omitempty"`
EmailIdentity string `json:"email_identity,omitempty"`
LdapGroupSearchFilter string `json:"ldap_group_search_filter,omitempty"`
AuthMode string `json:"auth_mode,omitempty"`
SelfRegistration bool `json:"self_registration"`
OidcScope string `json:"oidc_scope,omitempty"`
LdapSearchDn string `json:"ldap_search_dn,omitempty"`
StoragePerProject string `json:"storage_per_project,omitempty"`
ScanAllPolicy struct {
OidcVerifyCert bool `json:"oidc_verify_cert"`
OidcAutoOnboard bool `json:"oidc_auto_onboard"`
OidcUserClaim string `json:"oidc_user_claim,omitempty"`
EmailIdentity string `json:"email_identity,omitempty"`
LdapGroupSearchFilter string `json:"ldap_group_search_filter,omitempty"`
AuthMode string `json:"auth_mode,omitempty"`
SelfRegistration bool `json:"self_registration"`
OidcScope string `json:"oidc_scope,omitempty"`
LdapSearchDn string `json:"ldap_search_dn,omitempty"`
StoragePerProject string `json:"storage_per_project,omitempty"`
ScanAllPolicy struct {
Type string `json:"type,omitempty"`
Parameter struct {
DailyTime int `json:"daily_time,omitempty"`
} `json:"parameter,omitempty"`
} `json:"scan_all_policy,omitempty"`
LdapTimeout int `json:"ldap_timeout,omitempty"`
LdapBaseDn string `json:"ldap_base_dn,omitempty"`
LdapFilter string `json:"ldap_filter,omitempty"`
ReadOnly bool `json:"read_only"`
QuotaPerProjectEnable bool `json:"quota_per_project_enable"`
LdapURL string `json:"ldap_url,omitempty"`
OidcName string `json:"oidc_name,omitempty"`
ProjectCreationRestriction string `json:"project_creation_restriction,omitempty"`
LdapUID string `json:"ldap_uid,omitempty"`
OidcClientID string `json:"oidc_client_id,omitempty"`
LdapGroupBaseDn string `json:"ldap_group_base_dn,omitempty"`
LdapGroupAttributeName string `json:"ldap_group_attribute_name,omitempty"`
EmailInsecure bool `json:"email_insecure"`
LdapGroupAdminDn string `json:"ldap_group_admin_dn,omitempty"`
EmailUsername string `json:"email_username,omitempty"`
EmailPassword string `json:"email_password,omitempty"`
OidcEndpoint string `json:"oidc_endpoint,omitempty"`
OidcClientSecret string `json:"oidc_client_secret,omitempty"`
OidcGroupsClaim string `json:"oidc_groups_claim,omitempty"`
LdapScope int `json:"ldap_scope,omitempty"`
CountPerProject string `json:"count_per_project,omitempty"`
TokenExpiration int `json:"token_expiration,omitempty"`
LdapGroupSearchScope int `json:"ldap_group_search_scope,omitempty"`
EmailSsl bool `json:"email_ssl"`
EmailPort int `json:"email_port,omitempty"`
EmailHost string `json:"email_host,omitempty"`
EmailFrom string `json:"email_from,omitempty"`
RobotTokenDuration int `json:"robot_token_duration,omitempty"`
LdapVerifyCert bool `json:"ldap_verify_cert,omitempty"`
LdapGroupGID string `json:"ldap_group_gid,omitempty"`
OidcAdminGroup string `json:"oidc_admin_group,omitempty"`
RobotNamePrefix string `json:"robot_name_prefix,omitempty"`
LdapTimeout int `json:"ldap_timeout,omitempty"`
LdapBaseDn string `json:"ldap_base_dn,omitempty"`
LdapFilter string `json:"ldap_filter,omitempty"`
ReadOnly bool `json:"read_only"`
QuotaPerProjectEnable bool `json:"quota_per_project_enable"`
LdapURL string `json:"ldap_url,omitempty"`
OidcName string `json:"oidc_name,omitempty"`
ProjectCreationRestriction string `json:"project_creation_restriction,omitempty"`
LdapUID string `json:"ldap_uid,omitempty"`
OidcClientID string `json:"oidc_client_id,omitempty"`
LdapGroupBaseDn string `json:"ldap_group_base_dn,omitempty"`
LdapGroupAttributeName string `json:"ldap_group_attribute_name,omitempty"`
LdapGroupMembershipAttribute string `json:"ldap_group_membership_attribute,omitempty"`
EmailInsecure bool `json:"email_insecure"`
LdapGroupAdminDn string `json:"ldap_group_admin_dn,omitempty"`
EmailUsername string `json:"email_username,omitempty"`
EmailPassword string `json:"email_password,omitempty"`
OidcEndpoint string `json:"oidc_endpoint,omitempty"`
OidcClientSecret string `json:"oidc_client_secret,omitempty"`
OidcGroupsClaim string `json:"oidc_groups_claim,omitempty"`
LdapScope int `json:"ldap_scope,omitempty"`
CountPerProject string `json:"count_per_project,omitempty"`
TokenExpiration int `json:"token_expiration,omitempty"`
LdapGroupSearchScope int `json:"ldap_group_search_scope,omitempty"`
EmailSsl bool `json:"email_ssl"`
EmailPort int `json:"email_port,omitempty"`
EmailHost string `json:"email_host,omitempty"`
EmailFrom string `json:"email_from,omitempty"`
RobotTokenDuration int `json:"robot_token_duration,omitempty"`
LdapVerifyCert bool `json:"ldap_verify_cert,omitempty"`
LdapGroupGID string `json:"ldap_group_gid,omitempty"`
OidcAdminGroup string `json:"oidc_admin_group,omitempty"`
RobotNamePrefix string `json:"robot_name_prefix,omitempty"`
}

type ConfigBodyResponse struct {
Expand Down
3 changes: 1 addition & 2 deletions provider/resource_garbage_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"encoding/json"
"fmt"
"strings"

"github.com/BESTSELLER/terraform-provider-harbor/client"
"github.com/BESTSELLER/terraform-provider-harbor/models"
Expand Down Expand Up @@ -66,7 +65,7 @@ func resourceGCRead(d *schema.ResourceData, m interface{}) error {
if jsonData.Schedule.Type == "Custom" {
d.Set("schedule", jsonData.Schedule.Cron)
} else {
d.Set("schedule", strings.ToLower(jsonData.Schedule.Type))
d.Set("schedule", jsonData.Schedule.Type)
}
d.Set("delete_untagged", jsonJobParameters.DeleteUntagged)
return nil
Expand Down

0 comments on commit 64ac5c3

Please sign in to comment.