Best Python code snippet using autotest_python
log_tail_attachment.py
Source:log_tail_attachment.py
1# coding=utf-82# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***3# *** Do not edit by hand unless you're certain you know what you are doing! ***4import copy5import warnings6import pulumi7import pulumi.runtime8from typing import Any, Mapping, Optional, Sequence, Union, overload9from .. import _utilities10__all__ = ['LogTailAttachmentArgs', 'LogTailAttachment']11@pulumi.input_type12class LogTailAttachmentArgs:13 def __init__(__self__, *,14 logtail_config_name: pulumi.Input[str],15 machine_group_name: pulumi.Input[str],16 project: pulumi.Input[str]):17 """18 The set of arguments for constructing a LogTailAttachment resource.19 :param pulumi.Input[str] logtail_config_name: The Logtail configuration name, which is unique in the same project.20 :param pulumi.Input[str] machine_group_name: The machine group name, which is unique in the same project.21 :param pulumi.Input[str] project: The project name to the log store belongs.22 """23 pulumi.set(__self__, "logtail_config_name", logtail_config_name)24 pulumi.set(__self__, "machine_group_name", machine_group_name)25 pulumi.set(__self__, "project", project)26 @property27 @pulumi.getter(name="logtailConfigName")28 def logtail_config_name(self) -> pulumi.Input[str]:29 """30 The Logtail configuration name, which is unique in the same project.31 """32 return pulumi.get(self, "logtail_config_name")33 @logtail_config_name.setter34 def logtail_config_name(self, value: pulumi.Input[str]):35 pulumi.set(self, "logtail_config_name", value)36 @property37 @pulumi.getter(name="machineGroupName")38 def machine_group_name(self) -> pulumi.Input[str]:39 """40 The machine group name, which is unique in the same project.41 """42 return pulumi.get(self, "machine_group_name")43 @machine_group_name.setter44 def machine_group_name(self, value: pulumi.Input[str]):45 pulumi.set(self, "machine_group_name", value)46 @property47 @pulumi.getter48 def project(self) -> pulumi.Input[str]:49 """50 The project name to the log store belongs.51 """52 return pulumi.get(self, "project")53 @project.setter54 def project(self, value: pulumi.Input[str]):55 pulumi.set(self, "project", value)56@pulumi.input_type57class _LogTailAttachmentState:58 def __init__(__self__, *,59 logtail_config_name: Optional[pulumi.Input[str]] = None,60 machine_group_name: Optional[pulumi.Input[str]] = None,61 project: Optional[pulumi.Input[str]] = None):62 """63 Input properties used for looking up and filtering LogTailAttachment resources.64 :param pulumi.Input[str] logtail_config_name: The Logtail configuration name, which is unique in the same project.65 :param pulumi.Input[str] machine_group_name: The machine group name, which is unique in the same project.66 :param pulumi.Input[str] project: The project name to the log store belongs.67 """68 if logtail_config_name is not None:69 pulumi.set(__self__, "logtail_config_name", logtail_config_name)70 if machine_group_name is not None:71 pulumi.set(__self__, "machine_group_name", machine_group_name)72 if project is not None:73 pulumi.set(__self__, "project", project)74 @property75 @pulumi.getter(name="logtailConfigName")76 def logtail_config_name(self) -> Optional[pulumi.Input[str]]:77 """78 The Logtail configuration name, which is unique in the same project.79 """80 return pulumi.get(self, "logtail_config_name")81 @logtail_config_name.setter82 def logtail_config_name(self, value: Optional[pulumi.Input[str]]):83 pulumi.set(self, "logtail_config_name", value)84 @property85 @pulumi.getter(name="machineGroupName")86 def machine_group_name(self) -> Optional[pulumi.Input[str]]:87 """88 The machine group name, which is unique in the same project.89 """90 return pulumi.get(self, "machine_group_name")91 @machine_group_name.setter92 def machine_group_name(self, value: Optional[pulumi.Input[str]]):93 pulumi.set(self, "machine_group_name", value)94 @property95 @pulumi.getter96 def project(self) -> Optional[pulumi.Input[str]]:97 """98 The project name to the log store belongs.99 """100 return pulumi.get(self, "project")101 @project.setter102 def project(self, value: Optional[pulumi.Input[str]]):103 pulumi.set(self, "project", value)104class LogTailAttachment(pulumi.CustomResource):105 @overload106 def __init__(__self__,107 resource_name: str,108 opts: Optional[pulumi.ResourceOptions] = None,109 logtail_config_name: Optional[pulumi.Input[str]] = None,110 machine_group_name: Optional[pulumi.Input[str]] = None,111 project: Optional[pulumi.Input[str]] = None,112 __props__=None):113 """114 The Logtail access service is a log collection agent provided by Log Service.115 You can use Logtail to collect logs from servers such as Alibaba Cloud Elastic116 Compute Service (ECS) instances in real time in the Log Service console. [Refer to details](https://www.alibabacloud.com/help/doc-detail/29058.htm)117 This resource amis to attach one logtail configure to a machine group.118 > **NOTE:** One logtail configure can be attached to multiple machine groups and one machine group can attach several logtail configures.119 ## Example Usage120 Basic Usage121 ```python122 import pulumi123 import pulumi_alicloud as alicloud124 test_project = alicloud.log.Project("testProject", description="create by terraform")125 test_store = alicloud.log.Store("testStore",126 project=test_project.name,127 retention_period=3650,128 shard_count=3,129 auto_split=True,130 max_split_shard_count=60,131 append_meta=True)132 test_machine_group = alicloud.log.MachineGroup("testMachineGroup",133 project=test_project.name,134 topic="terraform",135 identify_lists=[136 "10.0.0.1",137 "10.0.0.3",138 "10.0.0.2",139 ])140 test_log_tail_config = alicloud.log.LogTailConfig("testLogTailConfig",141 project=test_project.name,142 logstore=test_store.name,143 input_type="file",144 log_sample="test",145 output_type="LogService",146 input_detail=\"\"\" {147 "logPath": "/logPath",148 "filePattern": "access.log",149 "logType": "json_log",150 "topicFormat": "default",151 "discardUnmatch": false,152 "enableRawLog": true,153 "fileEncoding": "gbk",154 "maxDepth": 10155 }156 157 \"\"\")158 test_log_tail_attachment = alicloud.log.LogTailAttachment("testLogTailAttachment",159 project=test_project.name,160 logtail_config_name=test_log_tail_config.name,161 machine_group_name=test_machine_group.name)162 ```163 ## Import164 Logtial to machine group can be imported using the id, e.g.165 ```sh166 $ pulumi import alicloud:log/logTailAttachment:LogTailAttachment example tf-log:tf-log-config:tf-log-machine-group167 ```168 :param str resource_name: The name of the resource.169 :param pulumi.ResourceOptions opts: Options for the resource.170 :param pulumi.Input[str] logtail_config_name: The Logtail configuration name, which is unique in the same project.171 :param pulumi.Input[str] machine_group_name: The machine group name, which is unique in the same project.172 :param pulumi.Input[str] project: The project name to the log store belongs.173 """174 ...175 @overload176 def __init__(__self__,177 resource_name: str,178 args: LogTailAttachmentArgs,179 opts: Optional[pulumi.ResourceOptions] = None):180 """181 The Logtail access service is a log collection agent provided by Log Service.182 You can use Logtail to collect logs from servers such as Alibaba Cloud Elastic183 Compute Service (ECS) instances in real time in the Log Service console. [Refer to details](https://www.alibabacloud.com/help/doc-detail/29058.htm)184 This resource amis to attach one logtail configure to a machine group.185 > **NOTE:** One logtail configure can be attached to multiple machine groups and one machine group can attach several logtail configures.186 ## Example Usage187 Basic Usage188 ```python189 import pulumi190 import pulumi_alicloud as alicloud191 test_project = alicloud.log.Project("testProject", description="create by terraform")192 test_store = alicloud.log.Store("testStore",193 project=test_project.name,194 retention_period=3650,195 shard_count=3,196 auto_split=True,197 max_split_shard_count=60,198 append_meta=True)199 test_machine_group = alicloud.log.MachineGroup("testMachineGroup",200 project=test_project.name,201 topic="terraform",202 identify_lists=[203 "10.0.0.1",204 "10.0.0.3",205 "10.0.0.2",206 ])207 test_log_tail_config = alicloud.log.LogTailConfig("testLogTailConfig",208 project=test_project.name,209 logstore=test_store.name,210 input_type="file",211 log_sample="test",212 output_type="LogService",213 input_detail=\"\"\" {214 "logPath": "/logPath",215 "filePattern": "access.log",216 "logType": "json_log",217 "topicFormat": "default",218 "discardUnmatch": false,219 "enableRawLog": true,220 "fileEncoding": "gbk",221 "maxDepth": 10222 }223 224 \"\"\")225 test_log_tail_attachment = alicloud.log.LogTailAttachment("testLogTailAttachment",226 project=test_project.name,227 logtail_config_name=test_log_tail_config.name,228 machine_group_name=test_machine_group.name)229 ```230 ## Import231 Logtial to machine group can be imported using the id, e.g.232 ```sh233 $ pulumi import alicloud:log/logTailAttachment:LogTailAttachment example tf-log:tf-log-config:tf-log-machine-group234 ```235 :param str resource_name: The name of the resource.236 :param LogTailAttachmentArgs args: The arguments to use to populate this resource's properties.237 :param pulumi.ResourceOptions opts: Options for the resource.238 """239 ...240 def __init__(__self__, resource_name: str, *args, **kwargs):241 resource_args, opts = _utilities.get_resource_args_opts(LogTailAttachmentArgs, pulumi.ResourceOptions, *args, **kwargs)242 if resource_args is not None:243 __self__._internal_init(resource_name, opts, **resource_args.__dict__)244 else:245 __self__._internal_init(resource_name, *args, **kwargs)246 def _internal_init(__self__,247 resource_name: str,248 opts: Optional[pulumi.ResourceOptions] = None,249 logtail_config_name: Optional[pulumi.Input[str]] = None,250 machine_group_name: Optional[pulumi.Input[str]] = None,251 project: Optional[pulumi.Input[str]] = None,252 __props__=None):253 opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)254 if not isinstance(opts, pulumi.ResourceOptions):255 raise TypeError('Expected resource options to be a ResourceOptions instance')256 if opts.id is None:257 if __props__ is not None:258 raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')259 __props__ = LogTailAttachmentArgs.__new__(LogTailAttachmentArgs)260 if logtail_config_name is None and not opts.urn:261 raise TypeError("Missing required property 'logtail_config_name'")262 __props__.__dict__["logtail_config_name"] = logtail_config_name263 if machine_group_name is None and not opts.urn:264 raise TypeError("Missing required property 'machine_group_name'")265 __props__.__dict__["machine_group_name"] = machine_group_name266 if project is None and not opts.urn:267 raise TypeError("Missing required property 'project'")268 __props__.__dict__["project"] = project269 super(LogTailAttachment, __self__).__init__(270 'alicloud:log/logTailAttachment:LogTailAttachment',271 resource_name,272 __props__,273 opts)274 @staticmethod275 def get(resource_name: str,276 id: pulumi.Input[str],277 opts: Optional[pulumi.ResourceOptions] = None,278 logtail_config_name: Optional[pulumi.Input[str]] = None,279 machine_group_name: Optional[pulumi.Input[str]] = None,280 project: Optional[pulumi.Input[str]] = None) -> 'LogTailAttachment':281 """282 Get an existing LogTailAttachment resource's state with the given name, id, and optional extra283 properties used to qualify the lookup.284 :param str resource_name: The unique name of the resulting resource.285 :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.286 :param pulumi.ResourceOptions opts: Options for the resource.287 :param pulumi.Input[str] logtail_config_name: The Logtail configuration name, which is unique in the same project.288 :param pulumi.Input[str] machine_group_name: The machine group name, which is unique in the same project.289 :param pulumi.Input[str] project: The project name to the log store belongs.290 """291 opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))292 __props__ = _LogTailAttachmentState.__new__(_LogTailAttachmentState)293 __props__.__dict__["logtail_config_name"] = logtail_config_name294 __props__.__dict__["machine_group_name"] = machine_group_name295 __props__.__dict__["project"] = project296 return LogTailAttachment(resource_name, opts=opts, __props__=__props__)297 @property298 @pulumi.getter(name="logtailConfigName")299 def logtail_config_name(self) -> pulumi.Output[str]:300 """301 The Logtail configuration name, which is unique in the same project.302 """303 return pulumi.get(self, "logtail_config_name")304 @property305 @pulumi.getter(name="machineGroupName")306 def machine_group_name(self) -> pulumi.Output[str]:307 """308 The machine group name, which is unique in the same project.309 """310 return pulumi.get(self, "machine_group_name")311 @property312 @pulumi.getter313 def project(self) -> pulumi.Output[str]:314 """315 The project name to the log store belongs.316 """...
job_serializer_unittest.py
Source:job_serializer_unittest.py
...84 """Check if the machine owners are the same.85 """86 self.assertEqual(self.tko_job.machine_owner,87 self.pb_job.machine_owner)88 def test_machine_group(self):89 """Check if the machine groups are the same.90 """91 self.assertEqual(self.tko_job.machine_group,92 self.pb_job.machine_group)93 def test_aborted_by(self):94 """Check if the jobs are aborted by the same person.95 """96 self.assertEqual(self.tko_job.aborted_by,97 self.pb_job.aborted_by)98 def test_aborted_on(self):99 self.check_time(self.tko_job.aborted_on,100 self.pb_job.aborted_on)101 def test_keyval_dict(self):102 """Check if the contents of the dictionary are the same....
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!