Hemoglobin is the protein in blood cells. In the course of the blood cell's life, it may sometimes collide with sugar and get stuck.
It is normal at any time for about 5% of your hemoglobin to be glycosolated, or stuck to a sugar. If you average higher blood sugars , more of your hemoglobin will have sugar stuck to it.
If your glycosolated hemoglobin A1c is 5.7% or greater, that is considered very strong evidence that your average blood sugar is too high. If your hbA1c is 6.5% or greater, that is enough to diagnose you with diabetes. If it is below 6.5% it is still possible that you could have diabetes.
If your A1c comes in slightly high (say, 5.9%) then your healthcare provider will hopefully have a discussion with you to figure out if you can reasonably change things in your life like getting more exercise or a different diet to lower it, and might refer you to a dietician, a diabetes educator, or another specialist. You might or might not be put on a medication.
If your A1c comes in higher (say, 7.2%) then you should be put on a medication, probably a metformin, as well as maybe getting lifestyle advice and a referral to another doctor.
If your A1c is sky high (say, 12.5%) then you will probably be put at least temporarily on insulin but you might only be put on an oral medication, and you should get a referral to one or more specialists, like an endocrinologist or diabetologist.