# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::ServiceFabric::V7_0_0_42
  module Models
    #
    # Describes a stateless service.
    #
    class StatelessServiceDescription < ServiceDescription

      include MsRestAzure


      def initialize
        @ServiceKind = "Stateless"
      end

      attr_accessor :ServiceKind

      # @return [Integer] The instance count.
      attr_accessor :instance_count

      # @return [Integer] MinInstanceCount is the minimum number of instances
      # that must be up to meet the EnsureAvailability safety check during
      # operations like upgrade or deactivate node.
      # The actual number that is used is max( MinInstanceCount, ceil(
      # MinInstancePercentage/100.0 * InstanceCount) ).
      # Note, if InstanceCount is set to -1, during MinInstanceCount
      # computation -1 is first converted into the number of nodes on which the
      # instances are allowed to be placed according to the placement
      # constraints on the service.
      attr_accessor :min_instance_count

      # @return [Integer] MinInstancePercentage is the minimum percentage of
      # InstanceCount that must be up to meet the EnsureAvailability safety
      # check during operations like upgrade or deactivate node.
      # The actual number that is used is max( MinInstanceCount, ceil(
      # MinInstancePercentage/100.0 * InstanceCount) ).
      # Note, if InstanceCount is set to -1, during MinInstancePercentage
      # computation, -1 is first converted into the number of nodes on which
      # the instances are allowed to be placed according to the placement
      # constraints on the service.
      attr_accessor :min_instance_percentage

      # @return [Integer] Flags indicating whether other properties are set.
      # Each of the associated properties corresponds to a flag, specified
      # below, which, if set, indicate that the property is specified.
      # This property can be a combination of those flags obtained using
      # bitwise 'OR' operator.
      # For example, if the provided value is 1 then the flags for
      # InstanceCloseDelayDuration is set.
      #
      # - None - Does not indicate any other properties are set. The value is
      # zero.
      # - InstanceCloseDelayDuration - Indicates the InstanceCloseDelayDuration
      # property is set. The value is 1.
      attr_accessor :flags

      # @return [Integer] Duration in seconds, to wait before a stateless
      # instance is closed, to allow the active requests to drain gracefully.
      # This would be effective when the instance is closing during the
      # application/cluster upgrade and disabling node.
      # The endpoint exposed on this instance is removed prior to starting the
      # delay, which prevents new connections to this instance.
      # In addition, clients that have subscribed to service endpoint change
      # events(https://docs.microsoft.com/en-us/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync),
      # can do
      # the following upon receiving the endpoint removal notification:
      # - Stop sending new requests to this instance.
      # - Close existing connections after in-flight requests have completed.
      # - Connect to a different instance of the service partition for future
      # requests.
      # Note, the default value of InstanceCloseDelayDuration is 0, which
      # indicates that there won't be any delay or removal of the endpoint
      # prior to closing the instance.
      attr_accessor :instance_close_delay_duration_seconds


      #
      # Mapper for StatelessServiceDescription class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'Stateless',
          type: {
            name: 'Composite',
            class_name: 'StatelessServiceDescription',
            model_properties: {
              application_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ApplicationName',
                type: {
                  name: 'String'
                }
              },
              service_name: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceName',
                type: {
                  name: 'String'
                }
              },
              service_type_name: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceTypeName',
                type: {
                  name: 'String'
                }
              },
              initialization_data: {
                client_side_validation: true,
                required: false,
                serialized_name: 'InitializationData',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'NumberElementType',
                      type: {
                        name: 'Number'
                      }
                  }
                }
              },
              partition_description: {
                client_side_validation: true,
                required: true,
                serialized_name: 'PartitionDescription',
                type: {
                  name: 'Composite',
                  polymorphic_discriminator: 'PartitionScheme',
                  uber_parent: 'PartitionSchemeDescription',
                  class_name: 'PartitionSchemeDescription'
                }
              },
              placement_constraints: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PlacementConstraints',
                type: {
                  name: 'String'
                }
              },
              correlation_scheme: {
                client_side_validation: true,
                required: false,
                serialized_name: 'CorrelationScheme',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServiceCorrelationDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ServiceCorrelationDescription'
                      }
                  }
                }
              },
              service_load_metrics: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceLoadMetrics',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServiceLoadMetricDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ServiceLoadMetricDescription'
                      }
                  }
                }
              },
              service_placement_policies: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServicePlacementPolicies',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServicePlacementPolicyDescriptionElementType',
                      type: {
                        name: 'Composite',
                        polymorphic_discriminator: 'Type',
                        uber_parent: 'ServicePlacementPolicyDescription',
                        class_name: 'ServicePlacementPolicyDescription'
                      }
                  }
                }
              },
              default_move_cost: {
                client_side_validation: true,
                required: false,
                serialized_name: 'DefaultMoveCost',
                type: {
                  name: 'String'
                }
              },
              is_default_move_cost_specified: {
                client_side_validation: true,
                required: false,
                serialized_name: 'IsDefaultMoveCostSpecified',
                type: {
                  name: 'Boolean'
                }
              },
              service_package_activation_mode: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServicePackageActivationMode',
                type: {
                  name: 'String'
                }
              },
              service_dns_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceDnsName',
                type: {
                  name: 'String'
                }
              },
              scaling_policies: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ScalingPolicies',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ScalingPolicyDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ScalingPolicyDescription'
                      }
                  }
                }
              },
              ServiceKind: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceKind',
                type: {
                  name: 'String'
                }
              },
              instance_count: {
                client_side_validation: true,
                required: true,
                serialized_name: 'InstanceCount',
                constraints: {
                  InclusiveMinimum: -1
                },
                type: {
                  name: 'Number'
                }
              },
              min_instance_count: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MinInstanceCount',
                type: {
                  name: 'Number'
                }
              },
              min_instance_percentage: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MinInstancePercentage',
                type: {
                  name: 'Number'
                }
              },
              flags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'Flags',
                type: {
                  name: 'Number'
                }
              },
              instance_close_delay_duration_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'InstanceCloseDelayDurationSeconds',
                constraints: {
                  InclusiveMaximum: 4294967295,
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end
