Reference documentation and code samples for the Google API Common Protos Client class Violation.
A message type used to describe a single precondition failure.
Generated from protobuf message google.rpc.PreconditionFailure.Violation
Namespace
Google \ Rpc \ PreconditionFailure
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ type
string
The type of PreconditionFailure. We recommend using a service-specific enum type to define the supported precondition violation subjects. For example, "TOS" for "Terms of Service violation".
↳ subject
string
The subject, relative to the type, that failed. For example, "google.com/cloud" relative to the "TOS" type would indicate which terms of service is being referenced.
↳ description
string
A description of how the precondition failed. Developers can use this description to understand how to fix the failure. For example: "Terms of service not accepted".
getType
The type of PreconditionFailure. We recommend using a service-specific
enum type to define the supported precondition violation subjects. For
example, "TOS" for "Terms of Service violation".
Returns
Type
Description
string
setType
The type of PreconditionFailure. We recommend using a service-specific
enum type to define the supported precondition violation subjects. For
example, "TOS" for "Terms of Service violation".
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getSubject
The subject, relative to the type, that failed.
For example, "google.com/cloud" relative to the "TOS" type would indicate
which terms of service is being referenced.
Returns
Type
Description
string
setSubject
The subject, relative to the type, that failed.
For example, "google.com/cloud" relative to the "TOS" type would indicate
which terms of service is being referenced.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDescription
A description of how the precondition failed. Developers can use this
description to understand how to fix the failure.
For example: "Terms of service not accepted".
Returns
Type
Description
string
setDescription
A description of how the precondition failed. Developers can use this
description to understand how to fix the failure.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Google API Common Protos Client - Class Violation (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Rpc.PreconditionFailure.Violation)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Rpc.PreconditionFailure.Violation)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Rpc.PreconditionFailure.Violation)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Rpc.PreconditionFailure.Violation)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Rpc.PreconditionFailure.Violation)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Rpc.PreconditionFailure.Violation) \nReference documentation and code samples for the Google API Common Protos Client class Violation.\n\nA message type used to describe a single precondition failure.\n\nGenerated from protobuf message `google.rpc.PreconditionFailure.Violation`\n\nNamespace\n---------\n\nGoogle \\\\ Rpc \\\\ PreconditionFailure\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getType\n\nThe type of PreconditionFailure. We recommend using a service-specific\nenum type to define the supported precondition violation subjects. For\nexample, \"TOS\" for \"Terms of Service violation\".\n\n### setType\n\nThe type of PreconditionFailure. We recommend using a service-specific\nenum type to define the supported precondition violation subjects. For\nexample, \"TOS\" for \"Terms of Service violation\".\n\n### getSubject\n\nThe subject, relative to the type, that failed.\n\nFor example, \"google.com/cloud\" relative to the \"TOS\" type would indicate\nwhich terms of service is being referenced.\n\n### setSubject\n\nThe subject, relative to the type, that failed.\n\nFor example, \"google.com/cloud\" relative to the \"TOS\" type would indicate\nwhich terms of service is being referenced.\n\n### getDescription\n\nA description of how the precondition failed. Developers can use this\ndescription to understand how to fix the failure.\n\nFor example: \"Terms of service not accepted\".\n\n### setDescription\n\nA description of how the precondition failed. Developers can use this\ndescription to understand how to fix the failure.\n\nFor example: \"Terms of service not accepted\"."]]