|
| 1 | +package routeros |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
| 5 | +) |
| 6 | + |
| 7 | +/* |
| 8 | +{ |
| 9 | + "enabled": "auto", |
| 10 | + "status": "disabled", |
| 11 | + "domain": "MSHOME", |
| 12 | + "comment": "MikrotikSMB", |
| 13 | + "interfaces": "all" |
| 14 | +} |
| 15 | +*/ |
| 16 | + |
| 17 | +// https://help.mikrotik.com/docs/spaces/ROS/pages/117145608/SMB |
| 18 | +func ResourceIpSMB() *schema.Resource { |
| 19 | + resSchema := map[string]*schema.Schema{ |
| 20 | + MetaResourcePath: PropResourcePath("/ip/smb"), |
| 21 | + MetaId: PropId(Id), |
| 22 | + |
| 23 | + KeyEnabled: { |
| 24 | + Type: schema.TypeString, |
| 25 | + Optional: true, |
| 26 | + Description: "The default value is 'auto'. This means that the SMB server will automatically be enabled when the first non-disabled SMB share is configured under '/ip smb share'.", |
| 27 | + DiffSuppressFunc: AlwaysPresentNotUserProvided, |
| 28 | + ValidateFunc: ValidationAutoYesNo, |
| 29 | + }, |
| 30 | + "domain": { |
| 31 | + Type: schema.TypeString, |
| 32 | + Optional: true, |
| 33 | + Description: "Name of Windows Workgroup.", |
| 34 | + DiffSuppressFunc: AlwaysPresentNotUserProvided, |
| 35 | + }, |
| 36 | + KeyComment: { |
| 37 | + Type: schema.TypeString, |
| 38 | + Optional: true, |
| 39 | + Description: "Set comment for the server.", |
| 40 | + DiffSuppressFunc: AlwaysPresentNotUserProvided, |
| 41 | + }, |
| 42 | + "interfaces": { |
| 43 | + Type: schema.TypeSet, |
| 44 | + Elem: &schema.Schema{ |
| 45 | + Type: schema.TypeString, |
| 46 | + }, |
| 47 | + Optional: true, |
| 48 | + Description: "List of interfaces on which SMB service will be running.", |
| 49 | + DiffSuppressFunc: AlwaysPresentNotUserProvided, |
| 50 | + }, |
| 51 | + "status": { |
| 52 | + Type: schema.TypeString, |
| 53 | + Computed: true, |
| 54 | + }, |
| 55 | + } |
| 56 | + |
| 57 | + return &schema.Resource{ |
| 58 | + CreateContext: DefaultSystemCreate(resSchema), |
| 59 | + ReadContext: DefaultSystemRead(resSchema), |
| 60 | + UpdateContext: DefaultSystemUpdate(resSchema), |
| 61 | + DeleteContext: DefaultSystemDelete(resSchema), |
| 62 | + |
| 63 | + Importer: &schema.ResourceImporter{ |
| 64 | + StateContext: schema.ImportStatePassthroughContext, |
| 65 | + }, |
| 66 | + |
| 67 | + Schema: resSchema, |
| 68 | + } |
| 69 | +} |
0 commit comments