Skip to content

Commit

Permalink
Automated build 'Automated commit 'Merge pull request #1786 from sail…
Browse files Browse the repository at this point in the history
…point/devrel-1732

Change slim/full campaign to any of' by github action: 11666929358' python sdk: 11666939534
  • Loading branch information
developer-relations-sp committed Nov 4, 2024
1 parent be29d66 commit 4cb94f6
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 80 deletions.
7 changes: 6 additions & 1 deletion sailpoint/v2024/models/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Campaign(BaseModel):
""" # noqa: E501
id: Optional[StrictStr] = Field(default=None, description="Id of the campaign")
name: StrictStr = Field(description="The campaign name. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: StrictStr = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: Optional[StrictStr] = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
deadline: Optional[datetime] = Field(default=None, description="The campaign's completion deadline. This date must be in the future in order to activate the campaign. If you try to activate a campaign with a deadline of today or in the past, you will receive a 400 error response.")
type: StrictStr = Field(description="The type of campaign. Could be extended in the future.")
email_notification_enabled: Optional[StrictBool] = Field(default=False, description="Enables email notification for this campaign", alias="emailNotificationEnabled")
Expand Down Expand Up @@ -180,6 +180,11 @@ def to_dict(self) -> Dict[str, Any]:
if _item_sources_with_orphan_entitlements:
_items.append(_item_sources_with_orphan_entitlements.to_dict())
_dict['sourcesWithOrphanEntitlements'] = _items
# set to None if description (nullable) is None
# and model_fields_set contains the field
if self.description is None and "description" in self.model_fields_set:
_dict['description'] = None

return _dict

@classmethod
Expand Down
73 changes: 35 additions & 38 deletions sailpoint/v2024/models/get_active_campaigns200_response_inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,39 @@


from __future__ import annotations
from inspect import getfullargspec
import json
import pprint
import re # noqa: F401
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from typing import Optional
from sailpoint.v2024.models.campaign import Campaign
from sailpoint.v2024.models.slim_campaign import SlimCampaign
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
from typing_extensions import Literal, Self
from pydantic import Field

GETACTIVECAMPAIGNS200RESPONSEINNER_ONE_OF_SCHEMAS = ["Campaign", "SlimCampaign"]
GETACTIVECAMPAIGNS200RESPONSEINNER_ANY_OF_SCHEMAS = ["Campaign", "SlimCampaign"]

class GetActiveCampaigns200ResponseInner(BaseModel):
"""
GetActiveCampaigns200ResponseInner
"""

# data type: SlimCampaign
oneof_schema_1_validator: Optional[SlimCampaign] = None
anyof_schema_1_validator: Optional[SlimCampaign] = None
# data type: Campaign
oneof_schema_2_validator: Optional[Campaign] = None
actual_instance: Optional[Union[Campaign, SlimCampaign]] = None
one_of_schemas: Set[str] = { "Campaign", "SlimCampaign" }

model_config = ConfigDict(
validate_assignment=True,
protected_namespaces=(),
)

anyof_schema_2_validator: Optional[Campaign] = None
if TYPE_CHECKING:
actual_instance: Optional[Union[Campaign, SlimCampaign]] = None
else:
actual_instance: Any = None
any_of_schemas: Set[str] = { "Campaign", "SlimCampaign" }

model_config = {
"validate_assignment": True,
"protected_namespaces": (),
}

def __init__(self, *args, **kwargs) -> None:
if args:
Expand All @@ -53,59 +58,52 @@ def __init__(self, *args, **kwargs) -> None:
super().__init__(**kwargs)

@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
def actual_instance_must_validate_anyof(cls, v):
instance = GetActiveCampaigns200ResponseInner.model_construct()
error_messages = []
match = 0
# validate data type: SlimCampaign
if not isinstance(v, SlimCampaign):
error_messages.append(f"Error! Input type `{type(v)}` is not `SlimCampaign`")
else:
match += 1
return v

# validate data type: Campaign
if not isinstance(v, Campaign):
error_messages.append(f"Error! Input type `{type(v)}` is not `Campaign`")
else:
match += 1
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when setting `actual_instance` in GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
elif match == 0:
return v

if error_messages:
# no match
raise ValueError("No match found when setting `actual_instance` in GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
raise ValueError("No match found when setting the actual_instance in GetActiveCampaigns200ResponseInner with anyOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
else:
return v

@classmethod
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
def from_dict(cls, obj: Dict[str, Any]) -> Self:
return cls.from_json(json.dumps(obj))

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Returns the object represented by the json string"""
instance = cls.model_construct()
error_messages = []
match = 0

# deserialize data into SlimCampaign
# anyof_schema_1_validator: Optional[SlimCampaign] = None
try:
instance.actual_instance = SlimCampaign.from_json(json_str)
match += 1
return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into Campaign
error_messages.append(str(e))
# anyof_schema_2_validator: Optional[Campaign] = None
try:
instance.actual_instance = Campaign.from_json(json_str)
match += 1
return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
error_messages.append(str(e))

if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
elif match == 0:
if error_messages:
# no match
raise ValueError("No match found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
raise ValueError("No match found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with anyOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
else:
return instance

Expand All @@ -127,7 +125,6 @@ def to_dict(self) -> Optional[Union[Dict[str, Any], Campaign, SlimCampaign]]:
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
return self.actual_instance.to_dict()
else:
# primitive type
return self.actual_instance

def to_str(self) -> str:
Expand Down
7 changes: 6 additions & 1 deletion sailpoint/v2024/models/slim_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SlimCampaign(BaseModel):
""" # noqa: E501
id: Optional[StrictStr] = Field(default=None, description="Id of the campaign")
name: StrictStr = Field(description="The campaign name. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: StrictStr = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: Optional[StrictStr] = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
deadline: Optional[datetime] = Field(default=None, description="The campaign's completion deadline. This date must be in the future in order to activate the campaign. If you try to activate a campaign with a deadline of today or in the past, you will receive a 400 error response.")
type: StrictStr = Field(description="The type of campaign. Could be extended in the future.")
email_notification_enabled: Optional[StrictBool] = Field(default=False, description="Enables email notification for this campaign", alias="emailNotificationEnabled")
Expand Down Expand Up @@ -129,6 +129,11 @@ def to_dict(self) -> Dict[str, Any]:
if _item_alerts:
_items.append(_item_alerts.to_dict())
_dict['alerts'] = _items
# set to None if description (nullable) is None
# and model_fields_set contains the field
if self.description is None and "description" in self.model_fields_set:
_dict['description'] = None

return _dict

@classmethod
Expand Down
7 changes: 6 additions & 1 deletion sailpoint/v3/models/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Campaign(BaseModel):
""" # noqa: E501
id: Optional[StrictStr] = Field(default=None, description="Id of the campaign")
name: StrictStr = Field(description="The campaign name. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: StrictStr = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: Optional[StrictStr] = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
deadline: Optional[datetime] = Field(default=None, description="The campaign's completion deadline. This date must be in the future in order to activate the campaign. If you try to activate a campaign with a deadline of today or in the past, you will receive a 400 error response.")
type: StrictStr = Field(description="The type of campaign. Could be extended in the future.")
email_notification_enabled: Optional[StrictBool] = Field(default=False, description="Enables email notification for this campaign", alias="emailNotificationEnabled")
Expand Down Expand Up @@ -180,6 +180,11 @@ def to_dict(self) -> Dict[str, Any]:
if _item_sources_with_orphan_entitlements:
_items.append(_item_sources_with_orphan_entitlements.to_dict())
_dict['sourcesWithOrphanEntitlements'] = _items
# set to None if description (nullable) is None
# and model_fields_set contains the field
if self.description is None and "description" in self.model_fields_set:
_dict['description'] = None

return _dict

@classmethod
Expand Down
73 changes: 35 additions & 38 deletions sailpoint/v3/models/get_active_campaigns200_response_inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,39 @@


from __future__ import annotations
from inspect import getfullargspec
import json
import pprint
import re # noqa: F401
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from typing import Optional
from sailpoint.v3.models.campaign import Campaign
from sailpoint.v3.models.slim_campaign import SlimCampaign
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
from typing_extensions import Literal, Self
from pydantic import Field

GETACTIVECAMPAIGNS200RESPONSEINNER_ONE_OF_SCHEMAS = ["Campaign", "SlimCampaign"]
GETACTIVECAMPAIGNS200RESPONSEINNER_ANY_OF_SCHEMAS = ["Campaign", "SlimCampaign"]

class GetActiveCampaigns200ResponseInner(BaseModel):
"""
GetActiveCampaigns200ResponseInner
"""

# data type: SlimCampaign
oneof_schema_1_validator: Optional[SlimCampaign] = None
anyof_schema_1_validator: Optional[SlimCampaign] = None
# data type: Campaign
oneof_schema_2_validator: Optional[Campaign] = None
actual_instance: Optional[Union[Campaign, SlimCampaign]] = None
one_of_schemas: Set[str] = { "Campaign", "SlimCampaign" }

model_config = ConfigDict(
validate_assignment=True,
protected_namespaces=(),
)

anyof_schema_2_validator: Optional[Campaign] = None
if TYPE_CHECKING:
actual_instance: Optional[Union[Campaign, SlimCampaign]] = None
else:
actual_instance: Any = None
any_of_schemas: Set[str] = { "Campaign", "SlimCampaign" }

model_config = {
"validate_assignment": True,
"protected_namespaces": (),
}

def __init__(self, *args, **kwargs) -> None:
if args:
Expand All @@ -53,59 +58,52 @@ def __init__(self, *args, **kwargs) -> None:
super().__init__(**kwargs)

@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
def actual_instance_must_validate_anyof(cls, v):
instance = GetActiveCampaigns200ResponseInner.model_construct()
error_messages = []
match = 0
# validate data type: SlimCampaign
if not isinstance(v, SlimCampaign):
error_messages.append(f"Error! Input type `{type(v)}` is not `SlimCampaign`")
else:
match += 1
return v

# validate data type: Campaign
if not isinstance(v, Campaign):
error_messages.append(f"Error! Input type `{type(v)}` is not `Campaign`")
else:
match += 1
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when setting `actual_instance` in GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
elif match == 0:
return v

if error_messages:
# no match
raise ValueError("No match found when setting `actual_instance` in GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
raise ValueError("No match found when setting the actual_instance in GetActiveCampaigns200ResponseInner with anyOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
else:
return v

@classmethod
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
def from_dict(cls, obj: Dict[str, Any]) -> Self:
return cls.from_json(json.dumps(obj))

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Returns the object represented by the json string"""
instance = cls.model_construct()
error_messages = []
match = 0

# deserialize data into SlimCampaign
# anyof_schema_1_validator: Optional[SlimCampaign] = None
try:
instance.actual_instance = SlimCampaign.from_json(json_str)
match += 1
return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into Campaign
error_messages.append(str(e))
# anyof_schema_2_validator: Optional[Campaign] = None
try:
instance.actual_instance = Campaign.from_json(json_str)
match += 1
return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
error_messages.append(str(e))

if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
elif match == 0:
if error_messages:
# no match
raise ValueError("No match found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with oneOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
raise ValueError("No match found when deserializing the JSON string into GetActiveCampaigns200ResponseInner with anyOf schemas: Campaign, SlimCampaign. Details: " + ", ".join(error_messages))
else:
return instance

Expand All @@ -127,7 +125,6 @@ def to_dict(self) -> Optional[Union[Dict[str, Any], Campaign, SlimCampaign]]:
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
return self.actual_instance.to_dict()
else:
# primitive type
return self.actual_instance

def to_str(self) -> str:
Expand Down
7 changes: 6 additions & 1 deletion sailpoint/v3/models/slim_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SlimCampaign(BaseModel):
""" # noqa: E501
id: Optional[StrictStr] = Field(default=None, description="Id of the campaign")
name: StrictStr = Field(description="The campaign name. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: StrictStr = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
description: Optional[StrictStr] = Field(description="The campaign description. If this object is part of a template, special formatting applies; see the `/campaign-templates/{id}/generate` endpoint documentation for details.")
deadline: Optional[datetime] = Field(default=None, description="The campaign's completion deadline. This date must be in the future in order to activate the campaign. If you try to activate a campaign with a deadline of today or in the past, you will receive a 400 error response.")
type: StrictStr = Field(description="The type of campaign. Could be extended in the future.")
email_notification_enabled: Optional[StrictBool] = Field(default=False, description="Enables email notification for this campaign", alias="emailNotificationEnabled")
Expand Down Expand Up @@ -129,6 +129,11 @@ def to_dict(self) -> Dict[str, Any]:
if _item_alerts:
_items.append(_item_alerts.to_dict())
_dict['alerts'] = _items
# set to None if description (nullable) is None
# and model_fields_set contains the field
if self.description is None and "description" in self.model_fields_set:
_dict['description'] = None

return _dict

@classmethod
Expand Down

0 comments on commit 4cb94f6

Please sign in to comment.