<commit_before>#--
# Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
#
# For licensing information see the LICENSE.md file in the project root.
#++

module SoftLayer
  # Server is the base class for VirtualServer and BareMetalServer.
  # It implements some functionality common to both those classes.
  #
  # Server is an abstract class and you should not create them
  # directly.
  #
  # While VirtualServer and BareMetalServer each have analogs
  # in the SoftLayer API, those analogs do not share a direct
  # ancestry.  As a result there is no SoftLayer API analog
  # to this class.
  class Server  < SoftLayer::ModelBase
    include ::SoftLayer::DynamicAttribute

    ##
    # :attr_reader:
    # The host name SoftLayer has stored for the server
    sl_attr :hostname

    ##
    # :attr_reader:
    # The domain name SoftLayer has stored for the server
    sl_attr :domain

    ##
    # :attr_reader:
    # A convenience attribute that combines the hostname and domain name
    sl_attr :fullyQualifiedDomainName

    ##
    # :attr_reader:
    # The data center where the server is located
    sl_attr :datacenter

    ##
    # :attr_reader: primary_public_ip
    # The IP address of the primary public interface for the server
    sl_attr :primary_public_ip, "primaryIpAddress"

    ##
    # :attr_reader: primary_private_ip
    # The IP address of the primary private interface for the server
    sl_attr :primary_private_ip, "primaryBackendIpAddress"

    ##
    # :attr_reader:
    # Notes about these server (for use by the customer)
    sl_attr :notes

    ##
    # A lsst of configured network monitors.
    #
    sl_dynamic_attr :network_monitors do |resource|
      resource.should_update? do
        @network_monitors == nil
      end

      resource.to_update do
        network_monitors_data = self.service.object_mask(NetworkMonitor.default_object_mask).getNetworkMonitors

        network_monitors_data.map! do |network_monitor|
          NetworkMonitor.new(softlayer_client, network_monitor) unless network_monitor.empty?
        end

        network_monitors_data.compact
      end
    end

    ##
    # :attr_reader:
    # The list of user customers notified on monitoring failures
    sl_dynamic_attr :notified_network_monitor_users do |resource|
      resource.should_update? do
        #only retrieved once per instance
        @notified_network_monitor_users == nil<commit_msg>Add network monitor stratum max levels dynamic attribute to Server<commit_after>#--
# Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
#
# For licensing information see the LICENSE.md file in the project root.
#++

module SoftLayer
  # Server is the base class for VirtualServer and BareMetalServer.
  # It implements some functionality common to both those classes.
  #
  # Server is an abstract class and you should not create them
  # directly.
  #
  # While VirtualServer and BareMetalServer each have analogs
  # in the SoftLayer API, those analogs do not share a direct
  # ancestry.  As a result there is no SoftLayer API analog
  # to this class.
  class Server  < SoftLayer::ModelBase
    include ::SoftLayer::DynamicAttribute

    ##
    # :attr_reader:
    # The host name SoftLayer has stored for the server
    sl_attr :hostname

    ##
    # :attr_reader:
    # The domain name SoftLayer has stored for the server
    sl_attr :domain

    ##
    # :attr_reader:
    # A convenience attribute that combines the hostname and domain name
    sl_attr :fullyQualifiedDomainName

    ##
    # :attr_reader:
    # The data center where the server is located
    sl_attr :datacenter

    ##
    # :attr_reader: primary_public_ip
    # The IP address of the primary public interface for the server
    sl_attr :primary_public_ip, "primaryIpAddress"

    ##
    # :attr_reader: primary_private_ip
    # The IP address of the primary private interface for the server
    sl_attr :primary_private_ip, "primaryBackendIpAddress"

    ##
    # :attr_reader:
    # Notes about these server (for use by the customer)
    sl_attr :notes

    ##
    # The maximum network monitor query/response levels currently supported by the server
    #
    sl_dynamic_attr :network_monitor_levels do |resource|
      resource.should_update? do
        @network_monitor_levels == nil
      end

      resource.to_update do
        self.service.getAvailableMonitoring
      end
    end

    ##
    # A lsst of configured network monitors.
    #
    sl_dynamic_attr :network_monitors do |resource|
      resource.should_update? do
        @network_monitors == nil
      end

      resource.to_update do
        network_monitors_data = self.service.object_mask(NetworkMonitor.default_object_mask).getNetworkMonitors

        network_monitors_data.map! do |network_monitor|
          NetworkMonitor.new(softlayer_client, network_monitor) unless network_monitor.empty?
        end

        network_monitors_data.compact
      end
    end

    ##
    # :attr_reader:
    # The list of user customers notified on monitoring failures
    sl_dynamic_attr :notified_network_monitor_users do |resource|
      resource.should_update? do
        #only retrieved once per instance
        @notified_network_monitor_users == nil
{'fraction_non_alphanumeric': 0.05873379099923722, 'fraction_numerical': 0.0015255530129672007, 'mean_word_length': 3.104068857589984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2191025', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1425, 'n_words': 501}