You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

notice_impl.go 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package client
  2. import (
  3. "io/ioutil"
  4. "k8s.io/apimachinery/pkg/util/json"
  5. "log"
  6. "net/http"
  7. "strings"
  8. "sync"
  9. )
  10. type notice struct {
  11. sync.RWMutex
  12. client *client
  13. options *NoticeOptions
  14. log log.Logger
  15. }
  16. func newNotice(client *client, options *NoticeOptions) (*notice, error) {
  17. notice := &notice{
  18. RWMutex: sync.RWMutex{},
  19. client: client,
  20. options: options,
  21. log: log.Logger{},
  22. }
  23. return notice, nil
  24. }
  25. func (n *notice) PushNotice(pushNoticeReq PushNoticeReq) (*PushNoticeResp, error) {
  26. url := n.client.url + "/pcm/v1/core/pushNotice"
  27. method := "GET"
  28. jsonStr, _ := json.Marshal(pushNoticeReq)
  29. payload := strings.NewReader(string(jsonStr))
  30. client := &http.Client{}
  31. req, _ := http.NewRequest(method, url, payload)
  32. req.Header.Add("Content-Type", "application/json")
  33. res, _ := client.Do(req)
  34. defer res.Body.Close()
  35. body, _ := ioutil.ReadAll(res.Body)
  36. var resp PushNoticeResp
  37. json.Unmarshal(body, &resp)
  38. return &resp, nil
  39. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.