1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-06 09:47:02 +01:00
Files
2024-04-04 21:23:02 +02:00

319 lines
12 KiB
Go

package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// Printer
type Printer struct {
PrinterBase
}
// NewPrinter instantiates a new Printer and sets the default values.
func NewPrinter()(*Printer) {
m := &Printer{
PrinterBase: *NewPrinterBase(),
}
odataTypeValue := "#microsoft.graph.printer"
m.SetOdataType(&odataTypeValue)
return m
}
// CreatePrinterFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
func CreatePrinterFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewPrinter(), nil
}
// GetConnectors gets the connectors property value. The connectors that are associated with the printer.
func (m *Printer) GetConnectors()([]PrintConnectorable) {
val, err := m.GetBackingStore().Get("connectors")
if err != nil {
panic(err)
}
if val != nil {
return val.([]PrintConnectorable)
}
return nil
}
// GetFieldDeserializers the deserialization information for the current model
func (m *Printer) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.PrinterBase.GetFieldDeserializers()
res["connectors"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreatePrintConnectorFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]PrintConnectorable, len(val))
for i, v := range val {
res[i] = v.(PrintConnectorable)
}
m.SetConnectors(res)
}
return nil
}
res["hasPhysicalDevice"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetHasPhysicalDevice(val)
}
return nil
}
res["isShared"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetIsShared(val)
}
return nil
}
res["lastSeenDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetTimeValue()
if err != nil {
return err
}
if val != nil {
m.SetLastSeenDateTime(val)
}
return nil
}
res["registeredDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetTimeValue()
if err != nil {
return err
}
if val != nil {
m.SetRegisteredDateTime(val)
}
return nil
}
res["shares"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreatePrinterShareFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]PrinterShareable, len(val))
for i, v := range val {
res[i] = v.(PrinterShareable)
}
m.SetShares(res)
}
return nil
}
res["taskTriggers"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreatePrintTaskTriggerFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]PrintTaskTriggerable, len(val))
for i, v := range val {
res[i] = v.(PrintTaskTriggerable)
}
m.SetTaskTriggers(res)
}
return nil
}
return res
}
// GetHasPhysicalDevice gets the hasPhysicalDevice property value. True if the printer has a physical device for printing. Read-only.
func (m *Printer) GetHasPhysicalDevice()(*bool) {
val, err := m.GetBackingStore().Get("hasPhysicalDevice")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
}
// GetIsShared gets the isShared property value. True if the printer is shared; false otherwise. Read-only.
func (m *Printer) GetIsShared()(*bool) {
val, err := m.GetBackingStore().Get("isShared")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
}
// GetLastSeenDateTime gets the lastSeenDateTime property value. The most recent dateTimeOffset when a printer interacted with Universal Print. Read-only.
func (m *Printer) GetLastSeenDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
val, err := m.GetBackingStore().Get("lastSeenDateTime")
if err != nil {
panic(err)
}
if val != nil {
return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
}
return nil
}
// GetRegisteredDateTime gets the registeredDateTime property value. The DateTimeOffset when the printer was registered. Read-only.
func (m *Printer) GetRegisteredDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
val, err := m.GetBackingStore().Get("registeredDateTime")
if err != nil {
panic(err)
}
if val != nil {
return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
}
return nil
}
// GetShares gets the shares property value. The list of printerShares that are associated with the printer. Currently, only one printerShare can be associated with the printer. Read-only. Nullable.
func (m *Printer) GetShares()([]PrinterShareable) {
val, err := m.GetBackingStore().Get("shares")
if err != nil {
panic(err)
}
if val != nil {
return val.([]PrinterShareable)
}
return nil
}
// GetTaskTriggers gets the taskTriggers property value. A list of task triggers that are associated with the printer.
func (m *Printer) GetTaskTriggers()([]PrintTaskTriggerable) {
val, err := m.GetBackingStore().Get("taskTriggers")
if err != nil {
panic(err)
}
if val != nil {
return val.([]PrintTaskTriggerable)
}
return nil
}
// Serialize serializes information the current object
func (m *Printer) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.PrinterBase.Serialize(writer)
if err != nil {
return err
}
if m.GetConnectors() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetConnectors()))
for i, v := range m.GetConnectors() {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
err = writer.WriteCollectionOfObjectValues("connectors", cast)
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("hasPhysicalDevice", m.GetHasPhysicalDevice())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("isShared", m.GetIsShared())
if err != nil {
return err
}
}
{
err = writer.WriteTimeValue("lastSeenDateTime", m.GetLastSeenDateTime())
if err != nil {
return err
}
}
{
err = writer.WriteTimeValue("registeredDateTime", m.GetRegisteredDateTime())
if err != nil {
return err
}
}
if m.GetShares() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetShares()))
for i, v := range m.GetShares() {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
err = writer.WriteCollectionOfObjectValues("shares", cast)
if err != nil {
return err
}
}
if m.GetTaskTriggers() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetTaskTriggers()))
for i, v := range m.GetTaskTriggers() {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
err = writer.WriteCollectionOfObjectValues("taskTriggers", cast)
if err != nil {
return err
}
}
return nil
}
// SetConnectors sets the connectors property value. The connectors that are associated with the printer.
func (m *Printer) SetConnectors(value []PrintConnectorable)() {
err := m.GetBackingStore().Set("connectors", value)
if err != nil {
panic(err)
}
}
// SetHasPhysicalDevice sets the hasPhysicalDevice property value. True if the printer has a physical device for printing. Read-only.
func (m *Printer) SetHasPhysicalDevice(value *bool)() {
err := m.GetBackingStore().Set("hasPhysicalDevice", value)
if err != nil {
panic(err)
}
}
// SetIsShared sets the isShared property value. True if the printer is shared; false otherwise. Read-only.
func (m *Printer) SetIsShared(value *bool)() {
err := m.GetBackingStore().Set("isShared", value)
if err != nil {
panic(err)
}
}
// SetLastSeenDateTime sets the lastSeenDateTime property value. The most recent dateTimeOffset when a printer interacted with Universal Print. Read-only.
func (m *Printer) SetLastSeenDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
err := m.GetBackingStore().Set("lastSeenDateTime", value)
if err != nil {
panic(err)
}
}
// SetRegisteredDateTime sets the registeredDateTime property value. The DateTimeOffset when the printer was registered. Read-only.
func (m *Printer) SetRegisteredDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
err := m.GetBackingStore().Set("registeredDateTime", value)
if err != nil {
panic(err)
}
}
// SetShares sets the shares property value. The list of printerShares that are associated with the printer. Currently, only one printerShare can be associated with the printer. Read-only. Nullable.
func (m *Printer) SetShares(value []PrinterShareable)() {
err := m.GetBackingStore().Set("shares", value)
if err != nil {
panic(err)
}
}
// SetTaskTriggers sets the taskTriggers property value. A list of task triggers that are associated with the printer.
func (m *Printer) SetTaskTriggers(value []PrintTaskTriggerable)() {
err := m.GetBackingStore().Set("taskTriggers", value)
if err != nil {
panic(err)
}
}
// Printerable
type Printerable interface {
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
PrinterBaseable
GetConnectors()([]PrintConnectorable)
GetHasPhysicalDevice()(*bool)
GetIsShared()(*bool)
GetLastSeenDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetRegisteredDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetShares()([]PrinterShareable)
GetTaskTriggers()([]PrintTaskTriggerable)
SetConnectors(value []PrintConnectorable)()
SetHasPhysicalDevice(value *bool)()
SetIsShared(value *bool)()
SetLastSeenDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetRegisteredDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetShares(value []PrinterShareable)()
SetTaskTriggers(value []PrintTaskTriggerable)()
}