// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Routeros.Ip
{
    /// <summary>
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using System.Linq;
    /// using Pulumi;
    /// using Routeros = Pulumi.Routeros;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var tlsService = 
    ///     {
    ///         { "api-ssl", 8729 },
    ///         { "www-ssl", 443 },
    ///     };
    /// 
    ///     var disableService = 
    ///     {
    ///         { "api", 8728 },
    ///         { "ftp", 21 },
    ///         { "telnet", 23 },
    ///         { "www", 80 },
    ///     };
    /// 
    ///     var enableService = 
    ///     {
    ///         { "ssh", 22 },
    ///         { "winbox", 8291 },
    ///     };
    /// 
    ///     var tlsCert = new Routeros.System.Certificate("tlsCert", new()
    ///     {
    ///         CommonName = "Mikrotik Router",
    ///         DaysValid = 3650,
    ///         KeyUsages = new[]
    ///         {
    ///             "key-cert-sign",
    ///             "crl-sign",
    ///             "digital-signature",
    ///             "key-agreement",
    ///             "tls-server",
    ///         },
    ///         KeySize = "prime256v1",
    ///         Signs = new[]
    ///         {
    ///             null,
    ///         },
    ///     });
    /// 
    ///     // terraform state rm 'routeros_ip_service.tls["www-ssl"]'
    ///     // terraform import 'routeros_ip_service.tls["www-ssl"]' www-ssl
    ///     var tls = new List&lt;Routeros.Ip.Service&gt;();
    ///     foreach (var range in tlsService.Select(pair =&gt; new { pair.Key, pair.Value }))
    ///     {
    ///         tls.Add(new Routeros.Ip.Service($"tls-{range.Key}", new()
    ///         {
    ///             Numbers = range.Key,
    ///             Port = range.Value,
    ///             Certificate = tlsCert.Name,
    ///             TlsVersion = "only-1.2",
    ///             Disabled = false,
    ///         }));
    ///     }
    ///     var disabled = new List&lt;Routeros.Ip.Service&gt;();
    ///     foreach (var range in disableService.Select(pair =&gt; new { pair.Key, pair.Value }))
    ///     {
    ///         disabled.Add(new Routeros.Ip.Service($"disabled-{range.Key}", new()
    ///         {
    ///             Numbers = range.Key,
    ///             Port = range.Value,
    ///             Disabled = true,
    ///         }));
    ///     }
    ///     var enabled = new List&lt;Routeros.Ip.Service&gt;();
    ///     foreach (var range in enableService.Select(pair =&gt; new { pair.Key, pair.Value }))
    ///     {
    ///         enabled.Add(new Routeros.Ip.Service($"enabled-{range.Key}", new()
    ///         {
    ///             Numbers = range.Key,
    ///             Port = range.Value,
    ///             Disabled = false,
    ///         }));
    ///     }
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Import with the name of the ip service in case of the example use www-ssl
    /// 
    /// ```sh
    ///  $ pulumi import routeros:Ip/service:Service www_ssl www-ssl
    /// ```
    /// </summary>
    [RouterosResourceType("routeros:Ip/service:Service")]
    public partial class Service : global::Pulumi.CustomResource
    {
        /// <summary>
        /// &lt;em&gt;Resource ID type (.id / name). This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Output("___id_")]
        public Output<int?> ___id_ { get; private set; } = null!;

        /// <summary>
        /// &lt;em&gt;Resource path for CRUD operations. This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Output("___path_")]
        public Output<string?> ___path_ { get; private set; } = null!;

        /// <summary>
        /// List of IP/IPv6 prefixes from which the service is accessible.
        /// </summary>
        [Output("address")]
        public Output<string?> Address { get; private set; } = null!;

        /// <summary>
        /// The name of the certificate used by a particular service. Applicable only for services that depend on certificates ( www-ssl, api-ssl ).
        /// </summary>
        [Output("certificate")]
        public Output<string?> Certificate { get; private set; } = null!;

        [Output("disabled")]
        public Output<bool?> Disabled { get; private set; } = null!;

        [Output("invalid")]
        public Output<bool> Invalid { get; private set; } = null!;

        /// <summary>
        /// Service name.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// The name of the service whose settings will be changed ( api, api-ssl, ftp, ssh, telnet, winbox, www, www-ssl ).
        /// </summary>
        [Output("numbers")]
        public Output<string> Numbers { get; private set; } = null!;

        /// <summary>
        /// The port particular service listens on.
        /// </summary>
        [Output("port")]
        public Output<int> Port { get; private set; } = null!;

        /// <summary>
        /// Specifies which TLS versions to allow by a particular service.
        /// </summary>
        [Output("tlsVersion")]
        public Output<string?> TlsVersion { get; private set; } = null!;

        /// <summary>
        /// Specify which VRF instance to use by a particular service.
        /// </summary>
        [Output("vrf")]
        public Output<string?> Vrf { get; private set; } = null!;


        /// <summary>
        /// Create a Service resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public Service(string name, ServiceArgs args, CustomResourceOptions? options = null)
            : base("routeros:Ip/service:Service", name, args ?? new ServiceArgs(), MakeResourceOptions(options, ""))
        {
        }

        private Service(string name, Input<string> id, ServiceState? state = null, CustomResourceOptions? options = null)
            : base("routeros:Ip/service:Service", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing Service resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static Service Get(string name, Input<string> id, ServiceState? state = null, CustomResourceOptions? options = null)
        {
            return new Service(name, id, state, options);
        }
    }

    public sealed class ServiceArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// &lt;em&gt;Resource ID type (.id / name). This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Input("___id_")]
        public Input<int>? ___id_ { get; set; }

        /// <summary>
        /// &lt;em&gt;Resource path for CRUD operations. This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Input("___path_")]
        public Input<string>? ___path_ { get; set; }

        /// <summary>
        /// List of IP/IPv6 prefixes from which the service is accessible.
        /// </summary>
        [Input("address")]
        public Input<string>? Address { get; set; }

        /// <summary>
        /// The name of the certificate used by a particular service. Applicable only for services that depend on certificates ( www-ssl, api-ssl ).
        /// </summary>
        [Input("certificate")]
        public Input<string>? Certificate { get; set; }

        [Input("disabled")]
        public Input<bool>? Disabled { get; set; }

        /// <summary>
        /// The name of the service whose settings will be changed ( api, api-ssl, ftp, ssh, telnet, winbox, www, www-ssl ).
        /// </summary>
        [Input("numbers", required: true)]
        public Input<string> Numbers { get; set; } = null!;

        /// <summary>
        /// The port particular service listens on.
        /// </summary>
        [Input("port", required: true)]
        public Input<int> Port { get; set; } = null!;

        /// <summary>
        /// Specifies which TLS versions to allow by a particular service.
        /// </summary>
        [Input("tlsVersion")]
        public Input<string>? TlsVersion { get; set; }

        /// <summary>
        /// Specify which VRF instance to use by a particular service.
        /// </summary>
        [Input("vrf")]
        public Input<string>? Vrf { get; set; }

        public ServiceArgs()
        {
        }
        public static new ServiceArgs Empty => new ServiceArgs();
    }

    public sealed class ServiceState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// &lt;em&gt;Resource ID type (.id / name). This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Input("___id_")]
        public Input<int>? ___id_ { get; set; }

        /// <summary>
        /// &lt;em&gt;Resource path for CRUD operations. This is an internal service field, setting a value is not required.&lt;/em&gt;
        /// </summary>
        [Input("___path_")]
        public Input<string>? ___path_ { get; set; }

        /// <summary>
        /// List of IP/IPv6 prefixes from which the service is accessible.
        /// </summary>
        [Input("address")]
        public Input<string>? Address { get; set; }

        /// <summary>
        /// The name of the certificate used by a particular service. Applicable only for services that depend on certificates ( www-ssl, api-ssl ).
        /// </summary>
        [Input("certificate")]
        public Input<string>? Certificate { get; set; }

        [Input("disabled")]
        public Input<bool>? Disabled { get; set; }

        [Input("invalid")]
        public Input<bool>? Invalid { get; set; }

        /// <summary>
        /// Service name.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// The name of the service whose settings will be changed ( api, api-ssl, ftp, ssh, telnet, winbox, www, www-ssl ).
        /// </summary>
        [Input("numbers")]
        public Input<string>? Numbers { get; set; }

        /// <summary>
        /// The port particular service listens on.
        /// </summary>
        [Input("port")]
        public Input<int>? Port { get; set; }

        /// <summary>
        /// Specifies which TLS versions to allow by a particular service.
        /// </summary>
        [Input("tlsVersion")]
        public Input<string>? TlsVersion { get; set; }

        /// <summary>
        /// Specify which VRF instance to use by a particular service.
        /// </summary>
        [Input("vrf")]
        public Input<string>? Vrf { get; set; }

        public ServiceState()
        {
        }
        public static new ServiceState Empty => new ServiceState();
    }
}
