dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts@v1.0.2/dtos/common/ping.go (about)

     1  //
     2  // Copyright (C) 2020 IOTech Ltd
     3  // Copyright (C) 2020 Intel Corporation
     4  //
     5  // SPDX-License-Identifier: Apache-2.0
     6  
     7  package common
     8  
     9  import (
    10  	"time"
    11  )
    12  
    13  // PingResponse defines the content of response content for GET Ping DTO
    14  type PingResponse struct {
    15  	Versionable `json:",inline"`
    16  	Timestamp   string `json:"timestamp"`
    17  	ServiceName string `json:"serviceName"`
    18  }
    19  
    20  // NewPingResponse creates new PingResponse with all fields set appropriately
    21  func NewPingResponse(serviceName string) PingResponse {
    22  	return PingResponse{
    23  		Versionable: NewVersionable(),
    24  		Timestamp:   time.Now().Format(time.UnixDate),
    25  		ServiceName: serviceName,
    26  	}
    27  }